changeset 1141:f030acb8d999

dummy merge for repo head
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:15:18 +0200
parents f576fc74ee80 (diff) 465e70422e66 (current diff)
children 12abbf15f18a
files geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionParams.java geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Datasource.java geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/DatasourceConnection.java geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java gnv/src/main/webapp/WEB-INF/config/log4j.properties gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_adons_inc.jsp gnv/src/main/webapp/images/bg_fieldset.gif gnv/src/main/webapp/images/bg_fieldset_ie6.gif gnv/src/main/webapp/images/img.gif gnv/src/main/webapp/images/list-item.gif gnv/src/main/webapp/images/stock_data-save.png gnv/src/main/webapp/scripts/calendar-de.js gnv/src/main/webapp/scripts/calendar-en.js gnv/src/main/webapp/scripts/calendar-setup.js gnv/src/main/webapp/scripts/calendar-setup_stripped.js gnv/src/main/webapp/scripts/calendar.js gnv/src/main/webapp/scripts/calendar_stripped.js gnv/src/main/webapp/styles/calendar-blue.css
diffstat 679 files changed, 74746 insertions(+), 12639 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/ChangeLog	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,546 @@
+2012-07-05 Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* README: New file with minimal instructions how to build the
+	  documentation.
+
+2010-08-13 Tim Englich <tim@intevation.de>
+
+	* admin-manual/installation-artifact-server.tex,
+	  admin-manual/operating-the-system.tex,
+	  admin-manual/installation-base.tex,
+	  admin-manual/installation-webclient.tex:
+	  Added corrections and wishes of the training on the installation
+	  which was given to the BSH.
+
+2010-06-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* admin-manual/installation-base.tex: Some refactoring of the proxy
+	  installation.
+
+2010-06-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* config-manual/general_settings.tex: Removed section 'Adding new
+	  Languages'. This section should be placed in an own file.
+
+	* config-manual/adding_new_languages.tex: New file for section 'Adding new
+	  Languages'.
+
+	* config-manual/config-manual.tex: Include section 'Adding new Languages'.
+
+2010-06-29  Tim Englich <tim@intevation.de>
+
+	* admin-manual/installation-base.tex:
+	Added Section which explains how to install the proxy-script
+	which is required for the OpenLayers-Client which is integrated in the
+	GNV-Web-Client.
+
+2010-06-29  Tim Englich <tim@intevation.de>
+
+	* config-manual/general_settings.tex:
+	Added section with the description how to add a new
+	language to the system into the config-manual.
+
+2010-06-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* licenses/overview.txt: Overview of external libs and its licenses.
+
+2010-05-12  Hans Plum <hans@intevation.de>
+
+	Tagging as Version 1.0
+
+2010-05-12  Hans Plum <hans@intevation.de>
+
+	* config-manual/config-manual.tex,
+	config-manual/model_of_transitions.tex,
+	config-manual/title.tex,
+	config-manual/generating_maps.tex,
+	config-manual/general_settings.tex,
+	config-manual/miscellanea.tex,
+	config-manual/Makefile,
+	config-manual/administering_artifact-server.tex:
+	Adapted titlepage to admin manual. Replaced with public Makefile
+	according to admin manual. (XXX) Added some workaround linebreaks with
+	typewriter sections 
+
+2010-05-12  Hans Plum <hans@intevation.de>
+
+
+	* config-manual/config-manual.tex,
+	config-manual/model_of_transitions.tex,
+	config-manual/generating_maps.tex,
+	config-manual/overview.tex,
+	config-manual/generating_charts.tex,
+	config-manual/general_settings.tex,
+	config-manual/administering_artifact-server.tex:
+	Final QS of all chapters. Cleanup FIXMEs and typos mainly.
+
+2010-05-10  Hans Plum <hans@intevation.de>
+
+	* config-manual/generating_maps.tex:
+	Added content about generating maps with extensive background
+	information about the interaction between artifact-server and
+	mapserver.
+
+2010-05-10  Hans Plum <hans@intevation.de>
+
+	* config-manual/model_of_transitions.tex,
+	config-manual/generating_charts.tex, 
+	config-manual/general_settings.tex:
+	Added content about generating charts.
+
+2010-05-10  Tim Englich  <tim@intevation.de>
+
+	* config-manual/general_settings.tex,
+	  config-manual/config-manual.txt:
+	Added short documentation for the file timegap_definition.xml. The
+	usage and the definition of the values stored in the file are
+	explained in the file itself.
+
+2010-05-10  Tim Englich  <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Done some litte changes in the introduction of the
+	Section Model of Transitions.
+
+2010-05-10  Tim Englich  <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex,
+	  config-manual/general_settings.tex:
+	Moved section Query-configuration to Section Model of Transitions.
+
+2010-05-10  Tim Englich  <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Do some Documentstyling. Added Typewriter-Style
+	to mark XML-Elements and other technical Items.
+
+2010-05-10  Tim Englich  <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Fixed some mistakes.
+
+2010-05-09  Hans Plum <hans@intevation.de>
+
+	* config-manual/config-manual.txt:
+	fragment missed in last commit
+
+	* admin-manual/overview.tex:
+	fix some copy&paste mistakes
+
+2010-05-09  Hans Plum <hans@intevation.de>
+
+	* config-manual/config-manual.tex:
+	referenced new documents
+
+	* config-manual/overview.tex (added):
+	introduction/overview of the GNV-server consisting of
+	artifact- and mapserver
+
+	* config-manual/general_settings.tex:
+	overview of the entire configuration
+
+	* config-manual/generating_maps.tex (added),
+	config-manual/generating_charts.tex (added),
+	config-manual/administering_artifact-server.tex (added):
+	split up in typical tasks:
+	    - administration and installation
+	    - generating charts (TODO: Fill me)
+	    - generating maps (TODO: Fill me)
+	    - configuring fis, products, etc. (TODO: Integrate me)
+
+	* config-manual/config-manual.txt:
+	Added some hints
+
+2010-05-07  Tim Englich  <tim@intevation.de>
+
+	* general_settings.tex:
+	Document following Sections:
+	artifact-factories, artifacts, mapserver, velocity, ehcache,
+	geo-backend
+	Description of geo-backend/Backend-Configuration is missing.
+
+2010-05-07  Tim Englich  <tim@intevation.de>
+
+	* general_settings.tex:
+	Added first Structure and XML-Structure for the documentation
+	of the File conf.xml.
+	Added the Documentation for the System-Properties.
+
+2010-05-07  Tim Englich  <tim@intevation.de>
+
+	* general_settings.tex:
+	Added separat LaTex-File for the Documentation of the general
+	settings.
+	* config-manual.tex:
+	Include the File general_settings.tex into the main Document.
+
+2010-05-07  Tim Englich  <tim@intevation.de>
+
+	* model_of_transitions.tex:
+	Answerd Questions and increase some Sections of the Documentation.
+
+2010-05-07  Hans Plum <hans@intevation.de>
+
+	* config-manual/config-manual.txt: Added some more FIXMEs for internal
+	DB interface
+
+2010-05-07  Hans Plum <hans@intevation.de>
+
+	* config-manual/config-manual.txt,
+	config-manual/model_of_transitions.tex:
+	Commit before and now: Added some FIXMEs for getting a better
+	understanding
+
+2010-05-06  Hans Plum <hans@intevation.de>
+
+	* admin-manual/figures/bsh_logo.gif:
+	converted to .png because of compile error
+
+2010-05-06  Hans Plum <hans@intevation.de>
+
+	* tex/*, src/*, README:
+	Deleted stubs of documentation.
+
+	* test-guideline/README: Added a README to give user more orientation.
+
+2010-05-06  Hans Plum <hans@intevation.de>
+
+	* admin-manual/installation-artifact-server.tex,
+	admin-manual/installation-base.tex:
+	Renamed gnv-wrapper to gnv-wms to clearify function
+
+2010-05-06  Hans Plum <hans@intevation.de>
+
+	* admin-manual/installation-admin-manual.txt:
+	Clean up; all content moved tp *.tex
+
+	* admin-manual/installation-admin-manual.tex:
+	Adapted a file name after renaming
+
+2010-05-06  Hans Plum <hans@intevation.de>
+
+	* admin-manual/installation-artifact-server.tex: renamed from
+	admin-manual/installation-artefact-server.tex in order to unify use of
+	naming
+
+2010-05-06  Hans Plum <hans@intevation.de>
+	
+	* admin-manual/overview.tex,
+	admin-manual/operating-the-system.tex,
+	admin-manual/installation-artefact-server.tex:
+	Unified naming of artefact to artifact
+
+2010-05-06  Hans Plum <hans@intevation.de>
+	
+	* admin-manual/title.tex,
+	admin-manual/installation-admin-manual.tex,
+	admin-manual/figures/bsh_logo.gif,
+	admin-manual/operating-the-system.tex,
+	admin-manual/installation-base.tex,
+	admin-manual/installation-webclient.tex,
+	admin-manual/installation-artefact-server.tex:
+	Finalized documentation with references, unifying tools, adding logos.
+	TODO: Unify the use of artifact. Checking against implementation.
+
+2010-05-06  Hans Plum <hans@intevation.de>
+
+	* admin-manual/Makefile:
+	Replaced selfmade Makefile through a specialized one from
+	http://www.bouncingchairs.net/oss (GPL)
+
+2010-05-05  Hans Plum <hans@intevation.de>
+
+	* admin-manual/overview.tex,
+	admin-manual/operating-the-system.tex,
+	admin-manual/installation-base.tex,
+	admin-manual/installation-webclient.tex,
+	admin-manual/installation-artefact-server.tex:
+	Removed sections about deinstallation and monitoring because they were
+	not tested.
+
+2010-05-05  Hans Plum <hans@intevation.de>
+
+	* admin-manual/installation-admin-manual.tex,
+	admin-manual/overview.tex,
+	admin-manual/operating-the-system.tex,
+	admin-manual/installation-base.tex,
+	admin-manual/installation-webclient.tex,
+	admin-manual/installation-artefact-server.tex:
+	Improving artifact, webclient and operation section. Added hyperref
+	package.
+
+2010-05-04  Tim Englich <tim@intevation.de>
+	* config-manual/model_of_transitions.tex:
+	Fixed some typos. Do some document-styling.
+
+2010-05-04  Tim Englich <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added Sample calls for creating an FIS and also getting
+	the Products which it contains.
+	* config-manual/sample-documents/create-artifact.xml:
+	Added XMl-Document which contains the XML-Request-Body for
+	the http-post call for creating an Artifact.
+
+2010-05-04  Tim Englich <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added Example for adding a new Product to a FIS.
+
+2010-05-04  Tim Englich <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added Example for adding a new Artifact for the FIS with no
+	Products to the REST-Server.
+
+2010-05-04  Tim Englich <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added Example for adding a new FIS to the REST-Server. 
+
+2010-05-04  Tim Englich <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added listing of all supported OutputStates.
+
+2010-05-04  Tim Englich <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added MarineFeatures as Subtype of ESRI ArcMarineBSH
+
+2010-05-04  Tim Englich <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added description for Configuration of InputValue of states and short
+	examples of the usage in SQL-statements to the Documentation.
+
+2010-05-04  Hans Plum <hans@intevation.de>
+
+	* config-manual/config-manual.tex,
+	config-manual/model_of_transitions.tex:
+	Fixed compilation error and revert temporary change for graphix
+	package
+
+2010-05-04  Hans Plum <hans@intevation.de>
+
+	* config-manual/config-manual.tex,
+	config-manual/model_of_transitions.tex:
+	Added an overview of the subject-specific part of the configuration
+	introducing the dependencies of the relevant files
+
+2010-05-03  Tim Englich <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added Mapping between the Configuration an the shown Objects in the
+	System into the Documentation.
+
+2010-05-03  Tim Englich <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added Description of Configuration for OutputStates and OutputModes.
+	
+2010-05-03  Tim Englich <tim@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added description of Configuration of States and Transitions.
+	Also added description for the Configuration of an product.
+	Added enumerations.
+
+2010-04-30  Tim Englich  <tim.englich@intevation.de>
+
+	* config-manual/model_of_transitions.tex:
+	Added the first descriptions of the Configuration of
+	Artifact-Factories, Artifacts representing a FIS and the Products
+	which can be configured to the different FIS.
+
+2010-04-30  Tim Englich  <tim.englich@intevation.de>
+
+	* config-manual/config-manual.tex:
+	Added Include for File model_of_transitions.tex into the main
+	Document.
+	* config-manual/model_of_transitions.tex:
+	Added File for the Documentation of the FIS, Products and the
+	required Transitionmodels of a Product.
+	Added Howto for configuring a new FIS, configuring a new product and
+	adding a additional Product to a FIS.
+
+2010-04-30  Tim Englich  <tim.englich@intevation.de>
+
+	* config-manual/config-manual.tex:
+	Added the main LaTex-Document.
+	* config-manual/title.tex:
+	Added the LaTex-IncludeDocument which will include
+	the Title-Page of this document 
+	* config-manual/figures:
+	Added folder for figures which should be integrated in this Document.
+	* config-manual/Makefile:
+	Adding Makefile for generating e.g. an PDF-Document
+	* config-manual/figures/intevation-logo.eps:
+	Added Intevation Logo.
+
+2010-04-30  Hans Plum  <hans@intevation.de>
+
+	* config-manual/config-manual.txt:
+	Added a first draft for a configuration manual for the 
+	artifact server
+
+2010-04-28  Hans Plum  <hans@intevation.de>
+
+	* test-guideline/gnv-horizontalprofile.txt,
+	test-guideline/gnv-verticalprofile.txt,
+	test-guideline/gnv-timerseries.txt, test-guideline/gnv-layer.txt,
+	test-guideline/gnv-framework.txt,
+	test-guideline/gnv-horizontal-cross-section.txt,
+	test-guideline/gnv-vertical-cross-section.txt,
+	test-guideline/gnv-test-guideline.txt,
+	test-guideline/gnv-horizontales-schnittprofil.txt:
+	Added a test-guideline for the matrix of products to database
+	schemata. Look into test-guideline/gnv-test-guideline.txt for further
+	information.
+
+2010-04-28  Hans Plum  <hans@intevation.de>
+
+	* Renamed admin-manual/abbildungen in admin-manual/figures
+
+	* admin-manual/title.tex: Adapted file path after renaming
+
+	* admin-manual/installation-artefact-server.tex:
+	Added 2 FIXMEs
+
+2010-04-28  Hans Plum  <hans@intevation.de>
+
+	* admin-manual, admin-manual/installation-admin-manual.txt,
+	admin-manual/title.tex, admin-manual/installation-admin-manual.tex,
+	admin-manual/overview.tex, admin-manual/operating-the-system.tex,
+	admin-manual/installation-base.tex,
+	admin-manual/installation-webclient.tex, admin-manual/abbildungen,
+	admin-manual/installation-artefact-server.tex, admin-manual/Makefile:
+	Moved all admin-manual specific files in new directory admin-manual
+
+2010-04-28  Hans Plum  <hans@intevation.de>
+
+	* installation-admin-manual.txt, title.tex,
+	tex/*, 	installation-admin-manual.tex, overview.tex, ChangeLog,
+	operating-the-system.tex, src/*, installation-base.tex, abbildungen,
+	installation-webclient.tex, installation-artefact-server.tex,
+	Makefile, README:
+	Moved content to trunk.
+
+2010-04-28  Hans Plum  <hans@intevation.de>
+
+	* trunk/, tags/, branches/:
+	Added standard SVN structure for this module
+
+2010-04-28  Hans Plum  <hans@intevation.de>
+
+	* installation-admin-manual.txt:
+	Moved content into LaTeX documents
+	
+	* New: title.tex
+	installation-admin-manual.tex
+	overview.tex
+	operating-the-system.tex
+	installation-base.tex
+	installation-webclient.tex
+	installation-artefact-server.tex:
+	Formatting of content and updating content.
+
+2010-04-27  Tim Englich  <tim.englich@intevation.de>
+
+	* installation-admin-manual.tex:
+	First Documentstructure for LaTex-Document
+	* abbildungen:
+	Added Folder for images. 
+	* MakeFile:
+	File to generate PDF.
+
+2010-04-27  Tim Englich  <tim.englich@intevation.de>
+
+	* installation-admin-manual.txt:
+	Added description which Version of Operatin System has
+	to be installed.
+
+2010-04-27  Tim Englich  <tim.englich@intevation.de>
+
+	* installation-admin-manual.txt:
+	Added description howto install, configure and uninstall the
+	GNV-Client into the Tomcat Application Server.
+
+2010-04-27  Tim Englich  <tim.englich@intevation.de>
+
+	* installation-admin-manual.txt:
+	Added description howto install, configure and uninstall the 
+	UMN-Mapserver Version 5.6.3 using Gispatcher-Resources on 
+	the Operation System.
+
+2010-04-27  Tim Englich  <tim.englich@intevation.de>
+
+	* installation-admin-manual.txt:
+	Added description howto install, configure and uninstall Apache
+	Webserver Version 2.2 including Mod-JK on the Operation System.
+
+2010-04-27  Hans Plum  <hans@eulimene>
+
+	* installation-admin-manual.txt:
+	Added overview of the system, installation of 
+	artefact-server and operation of the GNV system.
+
+2010-04-26  Tim Englich  <tim.englich@intevation.de>
+
+	* installation-admin-manual.txt:
+	  Added description howto install, configure and uninstall Apache 
+	  Tomcat Applicationserver Version 5.5 on the Operation System.
+	  Added all relevant commands which have to be executed
+	  from the Systemadministrator. Also put Snippets of the Configuration
+	  Files to the Content of this File.
+
+
+2010-04-26  Tim Englich  <tim.englich@intevation.de>
+
+	* installation-admin-manual.txt:
+	Added description howto install, configure and uninstall Java 1.6 on
+	the Operation System.
+	Added all relevant commands which have to be executed from the
+	Systemadministrator.
+
+2010-04-20  Hans Plum <hans@intevation.de>
+
+	* installation-admin-manual.txt:
+	Added relevant installation notices of an installation of a vanilla
+	Debian Lenny System with Tomcat 5.5 and UMN MapServer (Debian Package)
+	preinstalled
+
+2010-04-20  Hans Plum <hans@intevation.de>
+
+	* installation-admin-manual.txt:
+	Added UMN Mapserver as component; added responsibility for chapters;
+	removed extensive numbering in order to avoid manual updating. A word
+	processor can do this later on.
+
+2010-04-20  Hans Plum <hans@intevation.de>
+
+	* installation-admin-manual.txt:
+	Renamed handbook.txt to installation-admin-manual.txt to make the task
+	clearer.
+
+2010-04-20  Hans Plum <hans@intevation.de>
+
+	* handbook.txt:
+	Restructered the draft a bit and added Integration of Apache WebServer
+	and Apache Tomcat explicitly.
+
+2010-04-19  Tim Englich  <tim.englich@intevation.de>
+
+	* handbook.txt:
+	  Initial Checkin of installation and administration manual. 
+	  This document contains a first draft of an outline of the contents.
+
+2010-04-11	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* tex/Makefile, tex/tech-doku.tex: Initialer Checkin der
+	technischen Dokumentarion.
+
+2010-02-16	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src: Quellen der Dokumentation
+	* ChangeLog, README: Angelegt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/README	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,11 @@
+To build pdf documentation, call `make` with the documents name without the
+".tex" extension, e.g.
+
+  cd admin-manual
+  make installation-admin-manual
+
+will result in
+
+  installation-admin-manual.pdf
+
+.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/admin-manual/Makefile	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,3492 @@
+# Copyright 2004 Chris Monson (shiblon@gmail.com)
+# Latest version available at http://www.bouncingchairs.net/oss
+#
+#    This file is part of ``Chris Monson's Free Software''.
+#
+#    ``Chris Monson's Free Software'' is free software; you can redistribute it
+#    and/or modify it under the terms of the GNU General Public License as
+#    published by the Free Software Foundation, Version 2.
+#
+#    ``Chris Monson's Free Software'' is distributed in the hope that it will
+#    be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+#    Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with ``Chris Monson's Free Software''; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#    It is also available on the web at http://www.gnu.org/copyleft/gpl.html
+#
+#    Note that using this makefile to build your documents does NOT place them
+#    under the GPL unless you, the author, specifically do so.  In other words,
+#    I, Chris Monson, the copyright holder and author of this makefile,
+#    consider it impossible to ``link'' to this makefile in any way covered by
+#    the GPL.
+#
+# TO OBTAIN INSTRUCTIONS FOR USING THIS FILE, RUN:
+#    make help
+#
+fileinfo	:= LaTeX Makefile
+author		:= Chris Monson
+version		:= 2.2.0-rc1
+#
+# Note that the user-global version is imported *after* the source directory,
+# so that you can use stuff like ?= to get proper override behavior.
+.PHONY: Makefile GNUmakefile Makefile.ini $(HOME)/.latex-makefile/Makefile.ini
+-include Makefile.ini
+-include $(HOME)/.latex-makefile/Makefile.ini
+#
+# This can be pdflatex or latex - you can change this by adding the following line to your Makefile.ini:
+# BUILD_STRATEGY := latex
+BUILD_STRATEGY		?= pdflatex
+#
+# Sets LC_ALL=C, by default, so that the locale-aware tools, like sort, be
+# # immune to changes to the locale in the user environment.
+export LC_ALL		?= C
+#
+#
+# If you specify sources here, all other files with the same suffix
+# will be treated as if they were _include_ files.
+#onlysources.tex	?= main.tex
+#onlysources.tex.sh	?=
+#onlysources.tex.pl	?=
+#onlysources.tex.py	?=
+#onlysources.rst	?=
+#onlysources.fig	?=
+#onlysources.gpi	?=
+#onlysources.dot	?=
+#onlysources.xvg	?=
+#onlysources.svg	?=
+#onlysources.eps.gz	?=
+#onlysources.eps	?=
+#
+# If you list files here, they will be treated as _include_ files
+#includes.tex		?= file1.tex file2.tex
+#includes.tex.sh	?=
+#includes.tex.pl	?=
+#includes.tex.py	?=
+#includes.rst		?=
+#includes.fig		?=
+#includes.gpi		?=
+#includes.dot		?=
+#includes.xvg		?=
+#includes.svg		?=
+#includes.eps.gz	?=
+#includes.eps		?=
+#
+# If you list files or wildcards here, they will *not* be cleaned - default is
+# to allow everything to be cleaned.
+#neverclean		?= *.pdf
+#
+# Alternatively (recommended), you can add those lines to a Makefile.ini file
+# and it will get picked up automatically without your having to edit this
+# Makefile.
+#
+# KNOWN ISSUES:
+#	* The following occurs:
+#		file with: \usepackage{named}\bibliographystyle{named}
+#		Compile
+#		change to: \usepackage{apalike}\bibliographystyle{apalike}
+#		Compile again -- BARF!
+#
+#		The workaround: make clean-nographics; make
+#
+#		Note that we may not be able to fix this.  LaTeX itself barfs
+#		on this, not the makefile.  The very first invocation of LaTeX
+#		(when something like this has happened) reads the existing .aux
+#		file and discovers invalid commands like \citeauthoryear that
+#		are only valid in the package that was just removed.  It then
+#		tries to parse them and explodes.  It's not at all clear to me
+#		how to fix this.  I tried removing the .aux files on the first
+#		run of LaTeX, but that necessarily requires more subsequent
+#		rebuilds on common edits.  There does not appear to be a
+#		graceful solution to this issue.
+#
+# CHANGES:
+# Chris Monson (2010-04-08):
+# 	* Bumped version to 2.2.0-rc1
+# 	* Added back in the rst_style_file stuff that got broken when switching
+# 		rst -> tex to use the script mechanism
+# Chris Monson (2010-03-23):
+#	* Bumped version to 2.2.0-beta8
+#	* Work on issue 76: bad backtick escape for some sed versions, failure
+#		to clear out the hold buffer when outputting MISSING comment.
+#		- Backed out 2>&1 to &> (doesn't work in sh)
+#		- Backed out using . to source variables
+# Chris Monson (2010-03-22):
+# 	* Bumped version to 2.2.0-beta7
+# 	* Issue 72: Fix latex/bibtex invocation order for annotated bib styles
+# 	* Fixed informational output to reflect which LaTeX run we're on
+# 	* Fixed graphic detection to include graphics that are already there in
+# 		.d files
+# 	* Tightened up the .d file output to only make .d depend on graphic
+# 		*source* files.  This means that building foo.d no longer
+# 		builds all of the graphics files on which foo.tex depends.
+# 		Had to use .SECONDEXPANSION trickery to make it work.
+# 	* Changed get-graphics to only accept a stem.
+# 	* Fixed build-once logic for scripted .tex to work better
+# 	* Made get-inputs sed script more maintainable.
+# 	* Moved Makefile.ini import up higher.
+# 	* Changed bare stems to not recursively invoke make
+# 	* Updated diff output to be more silent everywhere
+# 	* Added a MISSING comment to the .d file if stuff isn't found - forces
+# 		removal of .1st.make file, which often forces it to try again.
+# 	* Fixed broken graphics-target function
+# 	* Added sleep to .d file generation when stuff is missing - if it
+# 		builds too fast, make doesn't realize it needs to be reloaded,
+# 		and thus never discovers some deeper dependencies (especially
+# 		evident when graphics are included from scripted include
+# 		files).
+# Chris Monson (2010-03-17):
+# 	* Bumped version to 2.2.0-beta6
+# 	* Fixed bareword builds to actually work (requires static patterns)
+# 	* Fixed colorization to work with new paragraph stuff
+# Chris Monson (2010-03-17):
+# 	* Bumped version to 2.2.0-beta5
+# 	* Fixed graphic detection to be much more focused - splits log file
+# 		into paragraphs before doing pattern matching.
+# 	* Fixed make foo to work properly (recursively calls make foo.pdf)
+# 	* Fixed gpi -> pdf generation to not waste time building .eps *after*
+# 		the pdf already exists.
+# 	* Changed log copies to include MAKE_RESTARTS as part of the name.
+# 	* Fixed missing include file detection (also makes use of the paragraph
+# 		stuff) to detect missing scripted include files.
+# Chris Monson (2010-03-16):
+# 	* Bumped version to 2.2.0-beta4
+# 	* issue 70: .pdf not moved out of the way properly on first
+# 		compilation, resulting in early error detection failure.
+# 	* issue 74: fixed broken error on missing .aux files: the
+# 		implementation was masking real errors.
+# Chris Monson (2010-03-15):
+# 	* Bumped version to 2.2.0-beta3
+# 	* issue 71: Made the tput dependency optional
+# 	* issue 73: Made .tex targets not pull in .d files (building them from
+# 		scripts should not require a .d)
+# 	* issue 74: Output a much saner error when a .aux file is not produced
+# 		(e.g., when you are typing "make" without arguments in a
+# 		directory with included .tex files that are not named with
+# 		._include_.)
+# Chris Monson (2010-03-11):
+# 	* Bumped version to 2.2.0-beta2
+# 	* Fixed clean-graphics to get rid of intermediate .eps files that may
+# 		be hanging around
+# 	* Added an automatic setting to use eps terminals in pdflatex mode for
+# 		gnuplot if it doesn't understand pdf.
+# 	* issue 66: Removed grayscale generation via magic suffix.  Grayscale
+# 		generation is now only available via GRAY=1
+# 	* issue 68: Added explicit handling of LC_ALL for locale-aware tools
+# 		like "sort"
+# Chris Monson (2010-03-10):
+# 	* Bumped version to 2.2.0-beta1
+# 	* Fixed success message to handle output message in different places
+# 	* Added name of produced file to success message
+# Chris Monson (2010-03-10):
+# 	* Bumped version to 2.2.0-alpha3
+# 	* Added meaningful error message for wrong hyperref options
+# 	* Added meaningful error message for incorrect graphics extensions
+# Chris Monson (2010-03-09):
+# 	* Bumped version to 2.2.0-alpha2
+# 	* Updated graphics handling (gnuplot and fig generate pdf natively)
+# 	* Changed xmgrace to output monochrome natively
+# Chris Monson (2010-03-09):
+# 	* Bumped version to 2.2.0-alpha1 - major change!
+# 	* Support pdflatex natively and by default (issue 6 - a long time coming)
+# 	* Add ability to have a single $HOME/.latex-makefile/Makefile.ini for
+# 		all invocations
+# 	* Reworked graphic inclusion detection so that extensions need not be
+# 		specified for either build strategy (e.g.,
+# 		\includegraphics{test1.eps} -> \includegrahpics{test1})
+# 	* Changed log format to include filenames and line numbers
+# Chris Monson (2010-02-04):
+# 	* Bumped version to 2.1.43
+# 	* All of the following are for issue 63 (thanks to mojoh81):
+# 	* Added documentation about fixing Makefile.ini default target
+# 	* Added perl and python script targets
+# 	* Fixed run logic to allow included .tex files to be scripted (the
+# 		run-again logic now detects missing .tex files, and the MV
+# 		command has been switched out for a command that only invokes
+# 		MV if the files exist)
+# 	* Changed scripted generation to only run once per make invocation
+# 	* Added dependency on expr
+# Chris Monson (2010-01-19):
+# 	* Bumped version to 2.1.42
+# 	* issue 62: Added .brf extension to cleanable files (backrefs)
+# Chris Monson (2010-01-07):
+# 	* Bumped version to 2.1.41
+# 	* issue 60: bad makeindex runs now error out on subsequent tries
+# Chris Monson (2009-12-01):
+# 	* Bumped version to 2.1.40
+# 	* issue 36: build all indices (for e.g., splitidx usage)
+# 	* issue 59: clean up all generated files (including indices)
+# Chris Monson (2009-11-23):
+# 	* Bumped version to 2.1.39
+# 	* issue 57: change ps2pdf invocations to just use gs directly
+# Chris Monson (2009-11-19):
+# 	* Bumped version to 2.1.38
+# 	* issue 57: Added some limited support for Cygwin (spaces in filenames)
+# Chris Monson (2009-11-15):
+# 	* Bumped version to 2.1.37
+# 	* Removed svninfo, since this is now managed by mercurial
+# 	* Fixed typo in changelist
+# 	* Issue 52: added jpg->eps conversion (thanks to brubakee)
+# 	* Issue 54: fix missing Overfull colorization due to lack of a blank
+# 		line preceding the first error.
+#	* Issue 51: remove head.tmp and body.tmp in make clean invocation
+#	* Issue 56: maintain multiple versions of log files (for debugging)
+# Chris Monson (2009-11-14):
+# 	* Bumped version to 2.1.36
+# 	* Issues 53 and 49: added .brf, .mtc, and .maf to the cleanables
+# Chris Monson (2009-11-05):
+# 	* Bumped version to 2.1.35
+# 	* Added nomenclature support (see issue 48)
+# Chris Monson (2009-10-29):
+# 	* Bumped version to 2.1.34
+# 	* Fixed _out_ creation bug introduced in 2.1.33 (it was always created)
+# 	* Fixed erroneous help output for $HOME in BINARY_TARGET_DIR
+# 	* Changed contact email address - bring on the spam!
+# Chris Monson (2009-10-21):
+# 	* Bumped version to 2.1.33
+# 	* Fixed issue 46, adding support for dot2tex (thanks to fdemesmay)
+# 	* Made all_files.* settable in Makefile.ini (using ?= instead of :=)
+# 	* Fixed issue 47, thanks to fdemesmay: add binary copy directory, copy
+# 		dvi, pdf, and ps if it exists
+# Chris Monson (2009-09-25):
+# 	* Bumped version to 2.1.32
+# 	* Fixed so that a changed lol file will cause a rebuild
+# 	* Added .lol files to the cleanable list
+# Chris Monson (2009-09-08):
+# 	* Bumped version to 2.1.31
+# 	* Closed issue 43: evince doesn't notice pdf change w/out touch
+# Chris Monson (2009-08-28):
+# 	* Bumped version to 2.1.30
+# 	* Closed issue 39: Capture multi-line log warnings/errors to output
+# Chris Monson (2009-08-26):
+# 	* Bumped version to 2.1.29
+# 	* Closed issue 42: add svg support using inkscape
+# Chris Monson (2009-08-17):
+# 	* Bumped version to 2.1.28
+# 	* Patch from paul.biggar for issue 38: package warnings are overlooked
+# Chris Monson (2009-08-07):
+# 	* Bumped version to 2.1.27
+# 	* Included patch for issue 37 - removes pdf/ps files before copying,
+# 		allowing some broken viewers to see changes properly.
+# Chris Monson (2009-05-15):
+# 	* Bumped version to 2.1.26
+# 	* Included patch for issue 9 from favonia - detects .fig changes for
+# 		pstex files during regular compilation, so long as the pstex
+# 		has been built at least once with make all-pstex.
+# Chris Monson (2009-03-27):
+# 	* Bumped version to 2.1.25
+# 	* Cleaned up a bunch of variable setting stuff - more stuff is now
+# 		settable from Makefile.ini
+# 	* Cleaned up documentation for various features, especially settable
+# 		variables.
+# 	* issue 28: support for png -> eps conversion (it even looks good!)
+# 	* issue 29: support for "neverclean" files in Makefile.ini
+# 	* issue 30: make ps2pdf14 the default - fall back when not there
+# Chris Monson (2009-03-09):
+# 	* Bumped version to 2.1.24
+# 	* issue 27: xmgrace support (thanks to rolandschulzhd)
+# Chris Monson (2008-10-23):
+# 	* Bumped version to 2.1.23
+# 	* issue 23: fixed _check_programs to not use bash string subs
+# Chris Monson (2008-09-02):
+# 	* Bumped version to 2.1.22
+# 	* Appled patch from Holger <yllohy@googlemail.com> to add include
+# 		sources and some documentation updates.
+# 	* Updated backup_patterns to be a bit more aggressive (also thanks to
+# 		Holger)
+# Chris Monson (2008-08-30):
+# 	* Bumped version to 2.1.21
+# 	* Added ability to specify onlysources.* variables to indicate the only
+# 		files that should *not* be considered includes.  Thanks to Holger
+# 		<yllohy@googlemail.com> for this patch.
+# 	* Added an automatic include of Makefile.ini if it exists.  Allows
+# 		settings to be made outside of this makefile.
+# Chris Monson (2008-05-21):
+# 	* Bumped version to 2.1.20
+# 	* Added manual pstex compilation support (run make all-pstex first)
+# 	* Removed all automatic pstex support.  It was totally breaking
+# 		everything and is very hard to incorporate into the makefile
+# 		concept because it requires LaTeX to *fail* before it can
+# 		determine that it needs the files.
+# Chris Monson (2008-04-17):
+# 	* Bumped version to 2.1.19
+# 	* Changed the pstex build hack to be on by default
+# Chris Monson (2008-04-09):
+# 	* Bumped version to 2.1.18
+# 	* issue 16: fixed pstex build problems, seems nondeterministic.  Added
+# 		gratuitious hack for testing: set PSTEX_BUILD_ALL_HACK=1.
+# Chris Monson (2008-04-09):
+# 	* Bumped version to 2.1.17
+# 	* issue 20: fixed accumulation of <pid>*.make files - wildcard was
+#		refusing to work on files that are very recently created.
+# Chris Monson (2008-04-02):
+# 	* Bumped version to 2.1.16
+# 	* issue 19: Removed the use of "type" to fix broken "echo" settings
+# Chris Monson (2008-03-27):
+# 	* Bumped version to 2.1.15
+# 	* issue 18: Favors binary echo over builtin, as binary understands -n
+# 	* issue 16: Fixed handling of missing pstex_t files in the log
+# 	* issue 9: Added .SECONDARY target for .pstex files
+# Chris Monson (2008-03-21):
+# 	* Bumped version to 2.1.14
+# 	* Fixed broken aux file flattening, which caused included bibs to be
+# 		missed.
+# Chris Monson (2008-03-20):
+# 	* Bumped version to 2.1.13
+# 	* Changed error output colorization to show errors for missing files
+# 		that are not graphics files.
+# Chris Monson (2008-03-20):
+# 	* Bumped version to 2.1.12
+# 	* Fixed a regression introduced in r28 that makes bibtex fail when
+# 		there is no index file present
+# Chris Monson (2008-03-03):
+# 	* Bumped version to 2.1.11
+# 	* Fixed issue 11 (handle index files, reported by abachn)
+# 	* Cleaned up some comments and help text
+# Chris Monson (2008-01-24):
+# 	* Bumped version to 2.1.10
+#	* Fixed to work when 'sh' is a POSIX shell like 'dash'
+# Chris Monson (2007-12-12):
+# 	* Bumped version to 2.1.9
+# 	* Fixed documentation and dependency graph for pstex files
+# Chris Monson (2007-12-12):
+# 	* Bumped version to 2.1.8
+# 	* Added basic pstex_t support for fig files (Issue 9 by favonia)
+# 		I still suggest that psfrag be used instead.
+# Chris Monson (2007-10-16):
+# 	* Bumped version to 2.1.7
+# 	* Removed todo item: allow other comment directives for rst conversion
+# 	* Added ability to use global rst style file _rststyle_._include_.tex
+# 	* Added help text to that effect
+# Chris Monson (2007-05-20):
+# 	* Bumped version to 2.1.6
+# 	* Changed default paper size for rst files
+# 	* Added todo item: fix paper size for rst files
+# 	* Added todo item: allow other comment directives for rst conversion
+# Chris Monson (2007-04-02):
+# 	* Bumped version to 2.1.5
+# 	* Addressed Issue 7, incorrect .gpi.d generation in subdirectories
+# Chris Monson (2007-03-28):
+# 	* Bumped version to 2.1.4
+# 	* Fixed syntax error in dot output
+# Chris Monson (2007-03-01):
+# 	* Bumped version to 2.1.3
+# 	* Added reST to the included documentation
+# 	* Fixed graphics and script generation to be settable in the
+# 		environment.
+# Chris Monson (2007-02-23):
+# 	* Bumped version to 2.1.2
+# 	* Added the ability to generate .tex files from .rst files
+# Chris Monson (2006-10-17):
+# 	* Bumped version to 2.1.1
+# 	* Fixed includes from subdirectories (sed-to-sed slash escape problem)
+# Chris Monson (2006-10-05):
+# 	* Bumped version to 2.1.0 (pretty serious new feature added)
+# 	* New feature: bib files can now be anywhere on the BIBINPUTS path
+# 	* New programs: kpsewhich (with tetex) and xargs (BSD)
+# Chris Monson (2006-09-28):
+# 	* Bumped version to 2.0.9
+# 	* Added ability to parse more than one bibliography
+# Chris Monson (2006-06-01):
+# 	* Bumped version to 2.0.8
+# 	* Added .vrb to the list of cleaned files
+# Chris Monson (2006-04-26):
+# 	* Bumped version to 2.0.7
+# 	* Fixed so that clean-nographics does not remove .gpi.d files
+# 	* Removed jpg -> eps hack (not working properly -- just pre-convert)
+# 	* Fixed so that postscript grayscale can be done with BSD sed
+# Chris Monson (2006-04-25):
+# 	* Bumped version to 2.0.6
+# 	* Fixed so that changed toc, lot, lof, or out causes a rebuild
+# Chris Monson (2006-04-17):
+# 	* Bumped version to 2.0.5
+# 	* Added jpg -> eps conversion target
+# Chris Monson (2006-04-12):
+# 	* Bumped version to 2.0.4
+# 	* Fixed BSD sed invocation to not use \| as a branch delimiter
+# 	* Added a comment section on what is and is not allowed in BSD sed
+# 	* Made paper size handling more robust while I was at it
+# 	* Fixed postscript RGB grayscale to use a weighted average
+# 	* Fixed postscript HSB grayscale to convert to RGB first
+# 	* Fixed a problem with rebuilding .bbl files
+# Chris Monson (2006-04-11):
+# 	* Bumped version to 2.0.3
+# 	* Fixed some BSD sed problems: can't use \n in substitutions
+# Chris Monson (2006-04-10):
+# 	* Bumped version to 2.0.2
+# 	* Once again removed ability to create .tex files from scripts
+# 	* \includeonly works again
+# Chris Monson (2006-04-09):
+# 	* Bumped version to 2.0.1
+# 	* Fixed grayscale postscript handling to be more robust
+# 	* Added ability to generate ._gray_. files from eps and eps.gz
+# 	* Added ability to clean ._gray_.eps files created from .eps files
+# Chris Monson (2006-04-07):
+# 	* Bumped version to 2.0.0
+# 	* Removed clunky ability to create included .tex files from scripts
+# 	* Added note in the help about included tex scripting not working
+# 	* Fixed the .eps generation to delete %.gpihead.make when finished
+# 	* Abandoned designs to use shell variables to create sed scripts
+# 	* Abandoned __default__.tex.sh idea: it causes recursion with %: .
+# 	* Removed web page to-do.  All items are now complete.
+# 	* Added better grayscale conversion for dot figures (direct ps fixup).
+# 	* Include files can now be scripted (at the expense of \includeonly).
+# 	* Updated dependency graph to contain better node names.
+# Chris Monson (2006-04-06):
+# 	* Bumped version to 2.0b3
+# 	* Top level includes now fail if there is no rule to build them
+# 	* A helpful message is printed when they do fail
+# 	* Grayscale has been changed to be ._gray_, other phonies use _ now, too
+# 	* Grayscale handling has been completed
+# 	* Changed _include_stems target to _includes target.
+# 	* Fixed _includes target to be useful by itself.
+# 	* Removed the ability to specify clean and build targets at once
+# 	* Verified that epsfig works fine with current code
+# 	* Fixed included scripts so that they are added to the dep files
+# 	* Fixed so that graphics includes don't happen if they aren't for gpi
+# 	* Fixed dot output to allow grayscale.
+# Chris Monson (2006-04-05):
+#	* Bumped version to 2.0b2
+#	* Removed automatic -gray output.  It needs fixing in a bad way.
+#	* Revamped dependency creation completely.
+#	* Fixed conditional inclusion to actually work (test.nobuild.d, test.d).
+#	* Fixed clean target to remove log targets
+#	* Added the 'monochrome' word for gray gpi output
+#	* Added a _check_gpi_files target that checks for common problems
+#	* Changed the _version target into the version target (no _)
+#	* Added better handling of grayscale files.  Use the .gray.pdf target.
+#	* Fixed testing for rebuilds
+# Chris Monson (2006-04-04):
+#	* Bumped version to 2.0b1
+#	* Changed colorization of output
+#	* Made .auxbbl and .auxtex .make files secondary targets
+#	* Shortened and simplified the final latex invocation loop
+#	* Added version-specific output ($$i vs. $$$$i) in latex loop
+#	* Added a build message for the first .dvi run (Building .dvi (0))
+#	* Removed some build messages that most people don't care about.
+#	* Simplified procedure for user-set colors -- simple text specification
+#	* Fixed diff output to...not output.
+#	* Fixed rerun bug -- detect not only when preceded with LaTeX Warning
+#	* Sped up gpi plotting
+#	* Added error handling and colorized output for gpi failure
+#	* Documented color changing stuff.
+#	* Now sort the flattened aux file to avoid false recompilation needs
+#	* Added clean-nographics target
+#	* Don't remove self.dvi file if self.aux is missing in the log
+#	* Clarified some code.  Did some very minor adjusting.
+# Chris Monson (2006-04-03):
+#	* Bumped version to 2.0a7
+#	* Added .dvi and .ps files as secondary files.
+#	* Fixed handling of multiple run detection when includeonly is in use.
+#	* Added code to flatten .aux files.
+#	* Added more files as .SECONDARY prerequisites to avoid recompilation.
+#	* Fixed the inputs generation to be much simpler and to use pipes.
+#	* Added the dependency graph directly into the makefile.
+#	* Changed flatten-aux to remove \@writefile \relax \newlabel, etc.
+#	* Undid pipe changes with sed usage (BSD sed doesn't know -f-).
+#	* Added a _check_programs target that tells you what your system has.
+#	* Fixed an error in colorization that made unnecessary errors appear
+#	* Added view targets.
+#	* Updated help text.
+#	* Augmented cookies so that .aux can trigger .bbl and .dvi rebuilds
+#	* Added more informative error handling for dvips and ps2pdf
+# Chris Monson (2006-04-02):
+#	* Bumped version to 2.0a6
+#	* Added indirection to .bbl dependencies to avoid rebuilding .bbl files
+#	* Streamlined the diff invocation to eliminate an existence test
+#	* Removed special shell quote escape variables
+#	* Moved includes to a more prominent location
+#	* Fixed .inputs.make to not contain .aux files
+#	* Fixed embedding to use a file instead of always grepping.
+#	* Added *.make.temp to the list of cleanable files
+#	* Fixed Ruby.  It should now be supported properly.
+#	* Now differentiate between all, default, and buildable files.
+#	* Fixed to bail out on serious errors.
+#	* Revised the handling of includable files.  Still working on it.
+# Chris Monson (2006-03-31):
+#	* Bumped version to 2.0a5
+#	* Fixed a bug with LaTeX error detection (there can be spaces)
+#	* Added .bbl support, simplifying everything and making it more correct
+#	* Refactored some tests that muddy the code
+#	* Did a little cleanup of some shell loops that can safely be make loops
+#	* Added support for graphviz .dot files
+#	* Made _all_programs output easier to read
+#	* Added the ruby support that has long been advertised
+#	* Font embedding was screwed up for PostScript -- now implicit
+#	* Changed the generation of -gray.gpi files to a single command
+#	* Changed any make-generated file that is not included from .d to .make
+# Chris Monson (2006-03-30):
+#	* Bumped version to 2.0a4
+#	* Fixed a bug with very long graphics file names
+#	* Added a todo entry for epsfig support
+#	* Fixed a bug paper size bug: sometimes more than one entry appears
+#	* Fixed DVI build echoing to display the number instead of process ID
+#	* DVI files are now removed on first invocation if ANY file is missing
+#	* Added a simple grayscale approach: if a file ends with -gray.gpi, it
+#		is created from the corresponding .gpi file with a special
+#		comment ##GRAY in its header, which causes coloring to be
+#		turned off.
+#	* Fixed a bug in the handling of .tex.sh files.  For some reason I had
+#		neglected to define file stems for scripted output.
+#	* Removed a trailing ; from the %.graphics dependencies
+#	* Added dvips embedding (I think it works, anyway)
+# Chris Monson (2006-03-29):
+#	* Bumped version to 2.0a3
+#	* Fixed error in make 3.79 with MAKEFILE_LIST usage
+#	* Added the presumed filename to the _version output
+#	* Added a vim macro for converting sed scripts to make commands
+#	* Added gpi dependency support (plotting external files and loading gpi)
+#	* Allow .gpi files to be ignored if called .include.gpi or .nobuild.gpi
+#	* Fixed sed invocations where \+ was used.  BSD sed uses \{1,\}.
+# Chris Monson (2006-03-28):
+#	* Bumped version to 2.0a2
+#	* Added SHELL_DEBUG and VERBOSE options
+#	* Changed the default shell back to /bin/sh (unset, in other words)
+#	* Moved .PHONY declarations closer to their targets
+#	* Moved help text into its own define block to obtain better formatting
+#	* Removed need for double-entry when adding a new program invocation
+#	* Moved .SECONDARY declaration closer to its relevant occurrence
+#	* Commented things more heavily
+#	* Added help text about setting terminal and output in gnuplot
+#	* Created more fine-grained clean targets
+#	* Added a %.graphics target that generates all of %'s graphics
+#	* Killed backward-compatible graphics generation (e.g., eps.gpi=gpi.eps)
+#	* For now, we're just GPL 2, not 3.  Maybe it will change later
+#	* Made the version and svninfo into variables
+# Chris Monson (2006-03-27):
+#	* Bumped version to 2.0a1
+#	* Huge, sweeping changes -- automatic dependencies
+
+# IMPORTANT!
+#
+# When adding to the following list, do not introduce any blank lines.  The
+# list is extracted for documentation using sed and is terminated by a blank
+# line.
+#
+# EXTERNAL PROGRAMS:
+# = ESSENTIAL PROGRAMS =
+# == Basic Shell Utilities ==
+CAT		?= cat
+CP		?= cp -f
+DIFF		?= diff
+ECHO		?= echo
+EGREP		?= egrep
+ENV		?= env
+EXPR		?= expr
+MV		?= mv -f
+SED		?= sed
+SORT		?= sort
+TOUCH		?= touch
+UNIQ		?= uniq
+WHICH		?= which
+XARGS		?= xargs
+SLEEP		?= sleep
+# == LaTeX (tetex-provided) ==
+BIBTEX		?= bibtex
+DVIPS		?= dvips
+LATEX		?= latex
+PDFLATEX	?= pdflatex
+EPSTOPDF	?= epstopdf
+MAKEINDEX	?= makeindex
+KPSEWHICH	?= kpsewhich
+GS		?= gs
+# = OPTIONAL PROGRAMS =
+# == Makefile Color Output ==
+TPUT		?= tput
+# == TeX Generation ==
+PERL		?= perl
+PYTHON		?= python
+RST2LATEX	?= rst2latex.py
+# == EPS Generation ==
+CONVERT		?= convert	# ImageMagick
+DOT		?= dot		# GraphViz
+DOT2TEX		?= dot2tex	# dot2tex - add options (not -o) as needed
+FIG2DEV		?= fig2dev	# XFig
+GNUPLOT		?= gnuplot	# GNUplot
+INKSCAPE	?= inkscape	# Inkscape (svg support)
+XMGRACE		?= xmgrace	# XMgrace
+PNGTOPNM	?= pngtopnm	# From NetPBM - step 1 for png -> eps
+PPMTOPGM	?= ppmtopgm	# From NetPBM - (gray) step 2 for png -> eps
+PNMTOPS		?= pnmtops	# From NetPBM - step 3 for png -> eps
+GUNZIP		?= gunzip	# GZipped EPS
+# == Beamer Enlarged Output ==
+PSNUP		?= psnup
+# == Viewing Stuff ==
+VIEW_POSTSCRIPT	?= gv
+VIEW_PDF	?= xpdf
+VIEW_GRAPHICS	?= display
+
+# Command options for embedding fonts and postscript->pdf conversion
+PS_EMBED_OPTIONS	?= -dPDFSETTINGS=/printer -dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100
+PS_COMPATIBILITY	?= 1.4
+
+# Defaults for GPI
+DEFAULT_GPI_EPS_FONTSIZE	?= 22
+DEFAULT_GPI_PDF_FONTSIZE	?= 12
+
+# Style file for ReST
+RST_STYLE_FILE			?= $(wildcard _rststyle_._include_.tex)
+
+# This ensures that even when echo is a shell builtin, we still use the binary
+# (the builtin doesn't always understand -n)
+FIXED_ECHO	:= $(if $(findstring -n,$(shell $(ECHO) -n)),$(shell which echo),$(ECHO))
+ECHO		:= $(if $(FIXED_ECHO),$(FIXED_ECHO),$(ECHO))
+
+define determine-gnuplot-output-extension
+$(if $(shell $(WHICH) $(GNUPLOT)),
+     $(if $(findstring unknown or ambiguous, $(shell $(GNUPLOT) -e "set terminal pdf" 2>&1)),
+	  eps, pdf),
+     none)
+endef
+
+GNUPLOT_OUTPUT_EXTENSION	?= $(strip $(call determine-gnuplot-output-extension))
+
+# Directory into which we place "binaries" if it exists.
+# Note that this can be changed on the commandline or in Makefile.ini:
+#
+# Command line:
+#   make BINARY_TARGET_DIR=$HOME/pdfs myfile.pdf
+#
+# Also, you can specify a relative directory (relative to the Makefile):
+#   make BINARY_TARGET_DIR=pdfs myfile.pdf
+#
+# Or, you can use Makefile.ini:
+#
+#   BINARY_TARGET_DIR := $(HOME)/bin_out
+#
+BINARY_TARGET_DIR	?= _out_
+
+RESTARTS		:= $(if $(MAKE_RESTARTS),$(MAKE_RESTARTS),0)
+# SH NOTES
+#
+# On some systems, /bin/sh, which is the default shell, is not linked to
+# /bin/bash.  While bash is supposed to be sh-compatible when invoked as sh, it
+# just isn't.  This section details some of the things you have to stay away
+# from to remain sh-compatible.
+#
+#	* File pattern expansion does not work for {}
+#	* [ "$x" = "$y" ] has to be [ x"$x" x"$y" ]
+#	* &> for stderr redirection doesn't work, use 2>&1 instead
+#
+# BSD SED NOTES
+#
+# BSD SED is not very nice compared to GNU sed, but it is the most
+# commonly-invoked sed on Macs (being based on BSD), so we have to cater to
+# it or require people to install GNU sed.  It seems like the GNU
+# requirement isn't too bad since this makefile is really a GNU makefile,
+# but apparently GNU sed is much less common than GNU make in general, so
+# I'm supporting it here.
+#
+# Sad experience has taught me the following about BSD sed:
+#
+# 	* \+ is not understood to mean \{1,\}
+# 	* \| is meaningless (does not branch)
+# 	* \n cannot be used as a substitution character
+# 	* ? does not mean \{0,1\}, but is literal
+# 	* a\ works, but only reliably for a single line if subsequent lines
+# 		have forward slashes in them (as is the case in postscript)
+#
+# For more info (on the Mac) you can consult
+#
+# man -M /usr/share/man re_format
+#
+# And look for the word "Obsolete" near the bottom.
+
+#
+# EXTERNAL PROGRAM DOCUMENTATION SCRIPT
+#
+
+# $(call output-all-programs,[<output file>])
+define output-all-programs
+	[ -f '$(this_file)' ] && \
+	$(SED) \
+		-e '/^[[:space:]]*#[[:space:]]*EXTERNAL PROGRAMS:/,/^$$/!d' \
+		-e '/EXTERNAL PROGRAMS/d' \
+		-e '/^$$/d' \
+		-e '/^[[:space:]]*#/i\ '\
+		-e 's/^[[:space:]]*#[[:space:]][^=]*//' \
+		$(this_file) $(if $1,> '$1',) || \
+	$(ECHO) "Cannot determine the name of this makefile."
+endef
+
+# If they misspell gray, it should still work.
+GRAY	?= $(call get-default,$(GREY),)
+
+#
+# Utility Functions and Definitions
+#
+
+# While not exactly a make function, this vim macro is useful.  It takes a
+# verbatim sed script and converts each line to something suitable in a command
+# context.  Just paste the script's contents into the editor, yank this into a
+# register (starting at '0') and run the macro once for each line of the
+# original script:
+#
+# 0i	-e :s/\$/$$/eg
:s/'/'"'"'/eg
^Ela'A' \:noh
j
+
+# don't call this directly - it is here to avoid calling wildcard more than
+# once in remove-files.
+remove-files-helper	= $(if $1,$(RM) $1,$(sh_true))
+
+# $(call remove-files,file1 file2)
+remove-files		= $(call remove-files-helper,$(wildcard $1))
+
+# Removes all cleanable files in the given list
+# $(call clean-files,file1 file2 file3 ...)
+# Works exactly like remove-files, but filters out files in $(neverclean)
+clean-files		= \
+	$(call remove-files-helper,$(call cleanable-files,$(wildcard $1)))
+
+# Outputs all generated files to STDOUT, along with some others that are
+# created by these (e.g., .idx files end up producing .ilg and .ind files).
+# Discovered by reading *.fls OUTPUT lines and producing corresponding .ind
+# filenames as needed.
+#
+# $(call get-generated-names,<source recorder file (*.fls)>)
+define get-generated-names
+[ -f '$1' ] && \
+$(SED) \
+	-e '/^OUTPUT /{' \
+	-e '  s///' \
+	-e '  p' \
+	-e '  s/\.idx/\.ind/p' \
+	-e '  s/\.ind/\.ilg/p' \
+	-e '}' \
+	-e 'd' \
+	'$1' \
+| $(SORT) | $(UNIQ)
+endef
+
+# This removes files without checking whether they are there or not.  This
+# sometimes has to be used when the file is created by a series of shell
+# commands, but there ends up being a race condition: make doesn't know about
+# the file generation as quickly as the system does, so $(wildcard ...) doesn't
+# work right.  Blech.
+# $(call remove-temporary-files,filenames)
+remove-temporary-files	= $(if $1,$(RM) $1,:)
+
+# Create an identifier from a file name
+# $(call cleanse-filename,filename)
+cleanse-filename	= $(subst .,_,$(subst /,__,$1))
+
+# Escape dots
+# $(call escape-dots,str)
+escape-dots		= $(subst .,\\.,$1)
+
+# Test that a file exists
+# $(call test-exists,file)
+test-exists		= [ -e '$1' ]
+
+# $(call move-files,source,destination)
+move-if-exists		= $(call test-exists,$1) && $(MV) '$1' '$2'
+
+# Copy file1 to file2 only if file2 doesn't exist or they are different
+# $(call copy-if-different,sfile,dfile)
+copy-if-different	= $(call test-different,$1,$2) && $(CP) '$1' '$2'
+copy-if-exists		= $(call test-exists,$1) && $(CP) '$1' '$2'
+move-if-different	= $(call test-different,$1,$2) && $(MV) '$1' '$2'
+replace-if-different-and-remove	= \
+	$(call test-different,$1,$2) \
+	&& $(MV) '$1' '$2' \
+	|| $(call remove-files,'$1')
+
+# Note that $(DIFF) returns success when the files are the SAME....
+# $(call test-different,sfile,dfile)
+test-different		= ! $(DIFF) -q '$1' '$2' >/dev/null 2>&1
+test-exists-and-different	= \
+	$(call test-exists,$2) && $(call test-different,$1,$2)
+
+# Return value 1, or value 2 if value 1 is empty
+# $(call get-default,<possibly empty arg>,<default value if empty>)
+get-default	= $(if $1,$1,$2)
+
+# Copy a file and log what's going on
+# $(call copy-with-logging,<source>,<target>)
+define copy-with-logging
+if [ -d '$2/' ]; then \
+	if $(CP) '$1' '$2/'; then \
+		$(ECHO) "$(C_INFO)Copied '$1' to '$2/'$(C_RESET)"; \
+	else \
+		$(ECHO) "$(C_ERROR)Failed to copy '$1' to '$2/'$(C_RESET)"; \
+	fi; \
+fi
+endef
+
+# Gives a reassuring message about the failure to find include files
+# $(call include-message,<list of include files>)
+define include-message
+$(strip \
+$(if $(filter-out $(wildcard $1),$1),\
+	$(shell $(ECHO) \
+	"$(C_INFO)NOTE: You may ignore warnings about the"\
+	"following files:" >&2;\
+	$(ECHO) >&2; \
+	$(foreach s,$(filter-out $(wildcard $1),$1),$(ECHO) '     $s' >&2;)\
+	$(ECHO) "$(C_RESET)" >&2)
+))
+endef
+# Characters that are hard to specify in certain places
+space		:= $(empty) $(empty)
+colon		:= \:
+comma		:= ,
+
+# Useful shell definitions
+sh_true		:= :
+sh_false	:= ! :
+
+# Clear out the standard interfering make suffixes
+.SUFFIXES:
+
+# Turn off forceful rm (RM is usually mapped to rm -f)
+ifdef SAFE_RM
+RM	:= rm
+endif
+
+# Turn command echoing back on with VERBOSE=1
+ifndef VERBOSE
+QUIET	:= @
+endif
+
+# Turn on shell debugging with SHELL_DEBUG=1
+# (EVERYTHING is echoed, even $(shell ...) invocations)
+ifdef SHELL_DEBUG
+SHELL	+= -x
+endif
+
+# Get the name of this makefile (always right in 3.80, often right in 3.79)
+# This is only really used for documentation, so it isn't too serious.
+ifdef MAKEFILE_LIST
+this_file	:= $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
+else
+this_file	:= $(wildcard GNUmakefile makefile Makefile)
+endif
+
+# Terminal color definitions
+
+REAL_TPUT 	:= $(if $(NO_COLOR),,$(shell $(WHICH) $(TPUT)))
+
+# $(call get-term-code,codeinfo)
+# e.g.,
+# $(call get-term-code,setaf 0)
+get-term-code = $(if $(REAL_TPUT),$(shell $(REAL_TPUT) $1),)
+
+black	:= $(call get-term-code,setaf 0)
+red	:= $(call get-term-code,setaf 1)
+green	:= $(call get-term-code,setaf 2)
+yellow	:= $(call get-term-code,setaf 3)
+blue	:= $(call get-term-code,setaf 4)
+magenta	:= $(call get-term-code,setaf 5)
+cyan	:= $(call get-term-code,setaf 6)
+white	:= $(call get-term-code,setaf 7)
+bold	:= $(call get-term-code,bold)
+uline	:= $(call get-term-code,smul)
+reset	:= $(call get-term-code,sgr0)
+
+#
+# User-settable definitions
+#
+LATEX_COLOR_WARNING	?= magenta
+LATEX_COLOR_ERROR	?= red
+LATEX_COLOR_INFO	?= green
+LATEX_COLOR_UNDERFULL	?= magenta
+LATEX_COLOR_OVERFULL	?= red bold
+LATEX_COLOR_PAGES	?= bold
+LATEX_COLOR_BUILD	?= cyan
+LATEX_COLOR_GRAPHIC	?= yellow
+LATEX_COLOR_DEP		?= green
+LATEX_COLOR_SUCCESS	?= green bold
+LATEX_COLOR_FAILURE	?= red bold
+
+# Gets the real color from a simple textual definition like those above
+# $(call get-color,ALL_CAPS_COLOR_NAME)
+# e.g., $(call get-color,WARNING)
+get-color	= $(subst $(space),,$(foreach c,$(LATEX_COLOR_$1),$($c)))
+
+#
+# STANDARD COLORS
+#
+C_WARNING	:= $(call get-color,WARNING)
+C_ERROR		:= $(call get-color,ERROR)
+C_INFO		:= $(call get-color,INFO)
+C_UNDERFULL	:= $(call get-color,UNDERFULL)
+C_OVERFULL	:= $(call get-color,OVERFULL)
+C_PAGES		:= $(call get-color,PAGES)
+C_BUILD		:= $(call get-color,BUILD)
+C_GRAPHIC	:= $(call get-color,GRAPHIC)
+C_DEP		:= $(call get-color,DEP)
+C_SUCCESS	:= $(call get-color,SUCCESS)
+C_FAILURE	:= $(call get-color,FAILURE)
+C_RESET		:= $(reset)
+
+#
+# PRE-BUILD TESTS
+#
+
+# Check that clean targets are not combined with other targets (weird things
+# happen, and it's not easy to fix them)
+hascleangoals	:= $(if $(sort $(filter clean clean-%,$(MAKECMDGOALS))),1)
+hasbuildgoals	:= $(if $(sort $(filter-out clean clean-%,$(MAKECMDGOALS))),1)
+ifneq "$(hasbuildgoals)" ""
+ifneq "$(hascleangoals)" ""
+$(error $(C_ERROR)Clean and build targets specified together$(C_RESET)))
+endif
+endif
+
+#
+# VARIABLE DECLARATIONS
+#
+
+# Names of sed scripts that morph gnuplot files -- only the first found is used
+GNUPLOT_SED	:= global-gpi.sed gnuplot.sed
+GNUPLOT_GLOBAL	:= global._include_.gpi gnuplot.global
+
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+default_graphic_extension	?= eps
+latex_build_program		?= $(LATEX)
+build_target_extension		?= dvi
+hyperref_driver_pattern		?= hdvips
+hyperref_driver_error		?= Using dvips: specify ps2pdf in the hyperref options.
+else
+default_graphic_extension	?= pdf
+latex_build_program		?= $(PDFLATEX)
+build_target_extension		?= pdf
+hyperref_driver_pattern		?= hpdf.*
+hyperref_driver_error		?= Using pdflatex: specify pdftex in the hyperref options (or leave it blank).
+endif
+
+# Files of interest
+all_files.tex		?= $(wildcard *.tex)
+all_files.tex.sh	?= $(wildcard *.tex.sh)
+all_files.tex.pl	?= $(wildcard *.tex.pl)
+all_files.tex.py	?= $(wildcard *.tex.py)
+all_files.rst		?= $(wildcard *.rst)
+all_files.fig		?= $(wildcard *.fig)
+all_files.gpi		?= $(wildcard *.gpi)
+all_files.dot		?= $(wildcard *.dot)
+all_files.xvg		?= $(wildcard *.xvg)
+all_files.svg		?= $(wildcard *.svg)
+all_files.png		?= $(wildcard *.png)
+all_files.jpg		?= $(wildcard *.jpg)
+all_files.eps.gz	?= $(wildcard *.eps.gz)
+all_files.eps		?= $(wildcard *.eps)
+
+# Utility function for obtaining all files not specified in $(neverclean)
+# $(call cleanable-files,file1 file2 file3 ...)
+# Returns the list of files that is not in $(wildcard $(neverclean))
+cleanable-files = $(filter-out $(wildcard $(neverclean)), $1)
+
+# Utility function for getting all .$1 files that are to be ignored
+#  * files listed in $(includes.$1)
+#  * files not listed in $(onlysources.$1) if it is defined
+ignore_files = \
+  $(includes.$1) \
+  $(if $(onlysources.$1),$(filter-out $(onlysources.$1), $(all_files.$1)))
+
+# Patterns to never be allowed as source targets
+ignore_patterns	:= %._include_
+
+# Patterns allowed as source targets but not included in 'all' builds
+nodefault_patterns := %._nobuild_ $(ignore_patterns)
+
+# Utility function for getting targets suitable building
+# $(call filter-buildable,suffix)
+filter-buildable	= \
+	$(filter-out $(call ignore_files,$1) \
+		$(addsuffix .$1,$(ignore_patterns)),$(all_files.$1))
+
+# Utility function for getting targets suitable for 'all' builds
+# $(call filter-default,suffix)
+filter-default		= \
+	$(filter-out $(call ignore_files,$1) \
+		$(addsuffix .$1,$(nodefault_patterns)),$(all_files.$1))
+
+# Top level sources that can be built even when they are not by default
+files.tex	:= $(call filter-buildable,tex)
+files.tex.sh	:= $(call filter-buildable,tex.sh)
+files.tex.pl	:= $(call filter-buildable,tex.pl)
+files.tex.py	:= $(call filter-buildable,tex.py)
+files.rst	:= $(call filter-buildable,rst)
+files.gpi	:= $(call filter-buildable,gpi)
+files.dot	:= $(call filter-buildable,dot)
+files.fig	:= $(call filter-buildable,fig)
+files.xvg	:= $(call filter-buildable,xvg)
+files.svg	:= $(call filter-buildable,svg)
+files.png	:= $(call filter-buildable,png)
+files.jpg	:= $(call filter-buildable,jpg)
+files.eps.gz	:= $(call filter-buildable,eps.gz)
+
+# Make all pstex targets secondary.  The pstex_t target requires the pstex
+# target, and nothing else really depends on it, so it often gets deleted.
+# This avoids that by allowing *all* fig files to be pstex targets, which is
+# perfectly valid and causes no problems even if they're going to become eps
+# files in the end.
+.SECONDARY:	$(patsubst %.fig,%.pstex,$(files.fig))
+
+# Top level sources that are built by default targets
+default_files.tex	:= $(call filter-default,tex)
+default_files.tex.sh	:= $(call filter-default,tex.sh)
+default_files.tex.pl	:= $(call filter-default,tex.pl)
+default_files.tex.py	:= $(call filter-default,tex.py)
+default_files.rst	:= $(call filter-default,rst)
+default_files.gpi	:= $(call filter-default,gpi)
+default_files.dot	:= $(call filter-default,dot)
+default_files.fig	:= $(call filter-default,fig)
+default_files.xvg	:= $(call filter-default,xvg)
+default_files.svg	:= $(call filter-default,svg)
+default_files.png	:= $(call filter-default,png)
+default_files.jpg	:= $(call filter-default,jpg)
+default_files.eps.gz	:= $(call filter-default,eps.gz)
+
+# Utility function for creating larger lists of files
+# $(call concat-files,suffixes,[prefix])
+concat-files	= $(foreach s,$1,$($(if $2,$2_,)files.$s))
+
+# Useful file groupings
+all_files_source	:= $(call concat-files,tex,all)
+all_files_scripts	:= $(call concat-files,tex.sh tex.pl tex.py rst,all)
+
+.PHONY: $(all_files_scripts)
+
+default_files_source	:= $(call concat-files,tex,default)
+default_files_scripts	:= $(call concat-files,tex.sh tex.pl tex.py rst,default)
+
+files_source	:= $(call concat-files,tex)
+files_scripts	:= $(call concat-files,tex.sh tex.pl tex.py rst)
+
+# Utility function for obtaining stems
+# $(call get-stems,suffix,[prefix])
+get-stems	= $(sort $($(if $2,$2_,)files.$1:%.$1=%))
+
+# List of all stems (including ._include_ and ._nobuild_ file stems)
+all_stems.tex		:= $(call get-stems,tex,all)
+all_stems.tex.sh	:= $(call get-stems,tex.sh,all)
+all_stems.tex.pl	:= $(call get-stems,tex.pl,all)
+all_stems.tex.py	:= $(call get-stems,tex.py,all)
+all_stems.rst		:= $(call get-stems,rst,all)
+all_stems.fig		:= $(call get-stems,fig,all)
+all_stems.gpi		:= $(call get-stems,gpi,all)
+all_stems.dot		:= $(call get-stems,dot,all)
+all_stems.xvg		:= $(call get-stems,xvg,all)
+all_stems.svg		:= $(call get-stems,svg,all)
+all_stems.png		:= $(call get-stems,png,all)
+all_stems.jpg		:= $(call get-stems,jpg,all)
+all_stems.eps.gz	:= $(call get-stems,eps.gz,all)
+all_stems.eps		:= $(call get-stems,eps,all)
+
+# List of all default stems (all default PDF targets):
+default_stems.tex		:= $(call get-stems,tex,default)
+default_stems.tex.sh		:= $(call get-stems,tex.sh,default)
+default_stems.tex.pl		:= $(call get-stems,tex.pl,default)
+default_stems.tex.py		:= $(call get-stems,tex.py,default)
+default_stems.rst		:= $(call get-stems,rst,default)
+default_stems.fig		:= $(call get-stems,fig,default)
+default_stems.gpi		:= $(call get-stems,gpi,default)
+default_stems.dot		:= $(call get-stems,dot,default)
+default_stems.xvg		:= $(call get-stems,xvg,default)
+default_stems.svg		:= $(call get-stems,svg,default)
+default_stems.png		:= $(call get-stems,png,default)
+default_stems.jpg		:= $(call get-stems,jpg,default)
+default_stems.eps.gz		:= $(call get-stems,eps.gz,default)
+
+# List of all stems (all possible bare PDF targets created here):
+stems.tex		:= $(call get-stems,tex)
+stems.tex.sh		:= $(call get-stems,tex.sh)
+stems.tex.pl		:= $(call get-stems,tex.pl)
+stems.tex.py		:= $(call get-stems,tex.py)
+stems.rst		:= $(call get-stems,rst)
+stems.fig		:= $(call get-stems,fig)
+stems.gpi		:= $(call get-stems,gpi)
+stems.dot		:= $(call get-stems,dot)
+stems.xvg		:= $(call get-stems,xvg)
+stems.svg		:= $(call get-stems,svg)
+stems.png		:= $(call get-stems,png)
+stems.jpg		:= $(call get-stems,jpg)
+stems.eps.gz		:= $(call get-stems,eps.gz)
+
+# Utility function for creating larger lists of stems
+# $(call concat-stems,suffixes,[prefix])
+concat-stems	= $(sort $(foreach s,$1,$($(if $2,$2_,)stems.$s)))
+
+# The most likely to be source but not finished product go first
+graphic_source_extensions	:= fig \
+				   gpi \
+				   xvg \
+				   svg \
+				   dot \
+				   eps.gz
+
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+graphic_source_extensions	+= png jpg
+graphic_target_extensions	:= eps ps
+else
+graphic_source_extensions	+= eps
+graphic_target_extensions	:= pdf png jpg mps tif
+endif
+
+all_stems_source	:= $(call concat-stems,tex,all)
+all_stems_script	:= $(call concat-stems,tex.sh tex.pl tex.py rst,all)
+all_stems_graphic	:= $(call concat-stems,$(graphic_source_extensions),all)
+all_stems_ss		:= $(sort $(all_stems_source) $(all_stems_script))
+all_stems_sg		:= $(sort $(all_stems_script))
+all_stems_ssg		:= $(sort $(all_stems_ss))
+
+default_stems_source	:= $(call concat-stems,tex,default)
+default_stems_script	:= $(call concat-stems,tex.sh tex.pl tex.py rst,default)
+default_stems_ss	:= $(sort $(default_stems_source) $(default_stems_script))
+default_stems_sg	:= $(sort $(default_stems_script))
+default_stems_ssg	:= $(sort $(default_stems_ss))
+
+stems_source		:= $(call concat-stems,tex)
+stems_script		:= $(call concat-stems,tex.sh tex.pl tex.py rst)
+stems_graphic		:= $(call concat-stems,$(graphic_source_extensions))
+stems_gg		:= $(sort $(stems_graphic))
+stems_ss		:= $(sort $(stems_source) $(stems_script))
+stems_sg		:= $(sort $(stems_script))
+stems_ssg		:= $(sort $(stems_ss))
+
+# Calculate names that can generate the need for an include file.  We can't
+# really do this with patterns because it's too easy to screw up, so we create
+# an exhaustive list.
+allowed_source_suffixes	:= \
+	pdf \
+	ps \
+	dvi \
+	ind \
+	nls \
+	bbl \
+	aux \
+	aux.make \
+	d \
+	auxbbl.make \
+	_graphics \
+	_show
+allowed_source_patterns		:= $(addprefix %.,$(allowed_source_suffixes))
+
+allowed_graphic_suffixes	:= \
+	pdf \
+	eps \
+	gpihead.make \
+	gpi.d
+allowed_graphic_patterns	:= $(addprefix %.,$(allowed_graphic_suffixes))
+
+# All targets allowed to build documents
+allowed_source_targets	:= \
+	$(foreach suff,$(allowed_source_suffixes),\
+	$(addsuffix .$(suff),$(stems_ssg)))
+
+# All targets allowed to build graphics
+allowed_graphic_targets	:= \
+	$(foreach suff,$(allowed_graphic_suffixes),\
+	$(addsuffix .$(suff),$(stems_gg)))
+
+# All targets that build multiple documents (like 'all')
+allowed_batch_source_targets	:= \
+	all \
+	all-pdf \
+	all-ps \
+	all-dvi \
+	all-bbl \
+	all-ind \
+	all-gls \
+	all-nls \
+	show
+
+# All targets that build multiple graphics (independent of document)
+allowed_batch_graphic_targets	:= \
+	all-graphics \
+	all-pstex \
+	all-dot2tex \
+	show-graphics
+
+# Now we figure out which stuff is available as a make target for THIS RUN.
+real_goals	:= $(call get-default,$(filter-out _includes,$(MAKECMDGOALS)),\
+			all)
+
+specified_source_targets	:= $(strip \
+	$(filter $(allowed_source_targets) $(stems_ssg),$(real_goals)) \
+	)
+
+specified_batch_source_targets	:= $(strip \
+	$(filter $(allowed_batch_source_targets),$(real_goals)) \
+	)
+
+specified_graphic_targets	:= $(strip \
+	$(filter $(allowed_graphic_targets),$(real_goals)) \
+	)
+
+specified_batch_graphic_targets	:= $(strip \
+	$(filter $(allowed_batch_graphic_targets),$(real_goals)) \
+	)
+
+specified_gpi_targets	:= $(patsubst %.gpi,%.$(default_graphic_extension),\
+	$(filter $(patsubst %.$(default_graphic_extension),%.gpi,$(specified_graphic_targets)),\
+		$(all_files.gpi)) \
+	)
+
+# Determine which .d files need including from the information gained above.
+# This is done by first checking whether a batch target exists.  If it does,
+# then all *default* stems are used to create possible includes (nobuild need
+# not apply for batch status).  If no batch targets exist, then the individual
+# targets are considered and appropriate includes are taken from them.
+source_stems_to_include	:= \
+	$(sort\
+	$(if $(specified_batch_source_targets),\
+		$(default_stems_ss),\
+		$(foreach t,$(specified_source_targets),\
+		$(foreach p,$(allowed_source_patterns),\
+			$(patsubst $p,%,$(filter $p $(stems_ssg),$t)) \
+		)) \
+	))
+
+# Determine which .gpi.d files are needed using the above information.  We
+# first check whether a batch target is specified, then check individual
+# graphics that may have been specified.
+graphic_stems_to_include	:= \
+	$(sort\
+	$(if $(specified_batch_graphic_targets),\
+		$(default_stems.gpi),\
+		$(foreach t,$(specified_gpi_targets),\
+		$(foreach p,$(allowed_graphic_patterns),\
+			$(patsubst $p,%,$(filter $p,$t)) \
+		)) \
+	))
+
+# All dependencies for the 'all' targets
+all_pdf_targets		:= $(addsuffix .pdf,$(stems_ssg))
+all_ps_targets		:= $(addsuffix .ps,$(stems_ssg))
+all_dvi_targets		:= $(addsuffix .dvi,$(stems_ssg))
+all_tex_targets		:= $(addsuffix .tex,$(stems_sg))
+all_d_targets		:= $(addsuffix .d,$(stems_ssg))
+all_graphics_targets	:= $(addsuffix .$(default_graphic_extension),$(stems_gg))
+intermediate_graphics_targets	:= $(if $(filter pdf,$(default_graphic_extension)),$(addsuffix .eps,$(stems_gg)),)
+all_pstex_targets	:= $(addsuffix .pstex_t,$(stems.fig))
+all_dot2tex_targets	:= $(addsuffix .dot_t,$(stems.dot))
+
+all_known_graphics	:= $(sort $(all_graphics_targets) $(wildcard *.$(default_graphic_extension)))
+
+default_pdf_targets	:= $(addsuffix .pdf,$(default_stems_ss))
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+default_ps_targets	:= $(addsuffix .ps,$(default_stems_ss))
+default_dvi_targets	:= $(addsuffix .dvi,$(default_stems_ss))
+pre_pdf_extensions	:= dvi ps
+endif
+
+# Extensions generated by LaTeX invocation that can be removed when complete
+rm_ext		:= \
+	log *.log aux $(pre_pdf_extensions) pdf blg bbl out nav snm toc lof lot lol pfg \
+	fls vrb idx ind ilg glg glo gls lox nls nlo nlg brf mtc maf brf
+backup_patterns	:= *~ *.bak *.backup body.tmp head.tmp
+
+graph_stem	:= _graph
+
+# All LaTeX-generated files that can be safely removed
+
+rm_tex := \
+	$(foreach e,$(rm_ext),$(addsuffix .$e,$(all_stems_source))) \
+	$(foreach e,$(rm_ext) tex,$(addsuffix .$e,$(all_stems_sg))) \
+	$(addsuffix .log,$(all_ps_targets) $(all_pdf_targets)) \
+	$(addsuffix .*.log,$(stems_graphic))
+
+# These are the files that will affect .gpi transformation for all .gpi files.
+#
+# Use only the first one found.  Backward compatible values are at the end.
+# Note that we use foreach, even though wildcard also returns a list, to ensure
+# that the order in the uppercase variables is preserved.  Directory listings
+# provide no such guarantee, so we avoid relying on them.
+gpi_sed		:= $(strip \
+	$(firstword $(foreach f,$(GNUPLOT_SED),$(wildcard $f))))
+gpi_global	:= $(strip \
+	$(firstword $(foreach f,$(GNUPLOT_GLOBAL),$(wildcard $f))))
+
+#
+# Functions used in generating output
+#
+
+# Outputs all source dependencies to stdout.  The first argument is the file to
+# be parsed, the second is a list of files that will show up as dependencies in
+# the new .d file created here.
+#
+# NOTE: BSD sed does not understand \|, so we have to do something more
+# clunky to extract suitable extensions.
+#
+# Also, we do a little bit of funny rewriting up front (TARGETS=) to make sure
+# that we can properly backslash-escape spaces in file names (e.g, on Cygwin
+# for tex distributions that have "Program Files" in their name).
+#
+# $(call get-inputs,<parsed file>,<target files>)
+define get-inputs
+$(SED) \
+-e '/^INPUT/!d' \
+-e 's!^INPUT \(\./\)\{0,1\}!!' \
+-e 's/[[:space:]]/\\ /g' \
+-e 's/\(.*\)\.aux$$/\1.tex/' \
+-e '/\.tex$$/b addtargets' \
+-e '/\.cls$$/b addtargets' \
+-e '/\.sty$$/b addtargets' \
+-e '/\.pstex_t$$/b addtargets' \
+-e '/\.dot_t$$/b addtargets' \
+-e 'd' \
+-e ':addtargets' \
+-e 's/^/$2: /' \
+$1 | $(SORT) | $(UNIQ)
+endef
+
+# $(call get-missing-inputs,<log file>,<target files>)
+define get-missing-inputs
+$(SED) \
+-e '$$ b para' \
+-e '/^$$/b para' \
+-e 'H' \
+-e 'd' \
+-e ':para' \
+-e 'x' \
+-e '/^$$/d' \
+-e 's/^\n*//' \
+-e '/^! LaTeX Error: File /{' \
+-e '  s/^/::DOUBLE_PARAGRAPH::/' \
+-e '  h' \
+-e '  d' \
+-e '}' \
+-e 's/^::DOUBLE_PARAGRAPH:://' \
+-e '/Default extension: /!d' \
+-e 's/[[:space:]]\{1,\}/ /g' \
+-e 's/\n\{1,\}/ /g' \
+-e 's/^.*File `//' \
+-e 's/'"'"' not found\..*//' \
+-e '/\.tex/!s/$$/.tex/' \
+-e 's/[[:space:]]/\\ /g' \
+-e 'h' \
+-e 's/.*/# MISSING input "&" - (presence of comment affects build)/' \
+-e 'p' \
+-e 's/.*//' \
+-e 'x' \
+-e 's/^/$2: /' \
+$1 | $(SORT) | $(UNIQ)
+endef
+
+# Get source file for specified graphics stem.
+#
+# $(call graphics-source,<stem>)
+define graphics-source
+$(strip $(firstword \
+	$(wildcard \
+		$(addprefix $1.,\
+			$(graphic_source_extensions))) \
+	$1 \
+))
+endef
+
+# Get the target file for the specified graphics file/stem
+#
+# $(call graphics-target,<stem>)
+define graphics-target
+$(strip $(if 	$(filter $(addprefix %.,$(graphic_target_extensions)),$1), $1,
+	$(firstword $(patsubst $(addprefix %.,$(graphic_source_extensions) $(graphic_target_extensions)), %, $1).$(default_graphic_extension) $1.$(default_graphic_extension))))
+endef
+
+# Outputs all of the graphical dependencies to stdout.  The first argument is
+# the stem of the source file being built, the second is a list of suffixes
+# that will show up as dependencies in the generated .d file.
+#
+# Note that we try to escape spaces in filenames where possible.  We have to do
+# it with three backslashes so that as the name percolates through the makefile
+# it eventually ends up with the proper escaping when the build rule is found.
+# Ugly, but it appears to work.  Note that graphicx doesn't allow filenames
+# with spaces, so this could in many ways be moot unless you're using something
+# like grffile.
+#
+# For pdflatex, we really need the missing file to be specified without an
+# extension, otherwise compilation barfs on the first missing file.  Truly
+# annoying, but there you have it.
+#
+# It turns out that the graphics errors, although they have lines with empty
+# space, are only made of two paragraphs.  So, we just use some sed magic to
+# get everything into paragraphs, detect when it's a paragraph that interests
+# us, and double it up.  Then we get the filename only if we're missing
+# extensions (a sign that it's graphicx complaining).
+#
+# $(call get-graphics,<target file stem>)
+#.log,$(addprefix $*.,d $(build_target_extension) _graphics)
+define get-graphics
+$(SED) \
+-e '$$ b para' \
+-e '/^$$/b para' \
+-e 'H' \
+-e 'd' \
+-e ':para' \
+-e 'x' \
+-e '/^$$/d' \
+-e 's/^\n*//' \
+-e '/^! LaTeX Error: File `/{' \
+-e '  s/^/::DOUBLE_PARAGRAPH::/' \
+-e '  h' \
+-e '  d' \
+-e '}' \
+-e 's/^::DOUBLE_PARAGRAPH:://' \
+-e '/could not locate the file with any of these extensions:/{' \
+-e '  s/\n\{1,\}/ /g' \
+-e '  s/[[:space:]]\{1,\}/ /g' \
+-e '  s/^.*File `//' \
+-e '  s/'"'"' not found\..*//' \
+-e '  h' \
+-e '  s/.*/# MISSING stem "&" - (presence of comment affects build)/' \
+-e '  p' \
+-e '  g' \
+-e '  b addtargets' \
+-e '}' \
+-e '/.*File: \(.*\) Graphic file (type [^)]*).*/{' \
+-e '  s//\1/' \
+-e '  b addtargets' \
+-e '}' \
+-e 'd' \
+-e ':addtargets' \
+-e 's/[[:space:]]/\\\\\\&/g' \
+-e 'h' \
+-e 's/.*/-include &.gpi.d/' \
+-e 'p' \
+-e 'g' \
+-e 's/.*/$(addprefix $1,.d): $$$$(call graphics-source,&)/' \
+-e 'p' \
+-e 's/.*//' \
+-e 'x' \
+-e 's/.*/$(addprefix $1.,$(build_target_extension) _graphics): $$$$(call graphics-target,&)/' \
+-e 'p' \
+-e 'd' \
+$*.log
+endef
+
+# Checks for build failure due to pstex inclusion, and gives instructions.
+#
+# $(call die-on-pstexs,<parsed file>)
+define die-on-pstexs
+if $(EGREP) -q '^! LaTeX Error: File .*\.pstex.* not found' $1; then \
+	$(ECHO) "$(C_ERROR)Missing pstex_t file(s)$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)  make all-pstex$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \
+	exit 1; \
+fi
+endef
+
+# Checks for build failure due to dot2tex, and gives instructions.
+#
+# $(call die-on-dot2tex,<parsed file>)
+define die-on-dot2tex
+if $(EGREP) -q ' LaTeX Error: File .*\.dot_t.* not found' $1; then \
+	$(ECHO) "$(C_ERROR)Missing dot_t file(s)$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)  make all-dot2tex$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \
+	exit 1; \
+fi
+endef
+
+# Checks for the existence of a .aux file, and dies with an error message if it
+# isn't there.  Note that we pass the file stem in, not the full filename,
+# e.g., to check for foo.aux, we call it thus: $(call die-on-no-aux,foo)
+#
+# $(call die-on-no-aux,<aux stem>)
+define die-on-no-aux
+if [ ! -e '$1.aux' ]; then \
+	$(call colorize-latex-errors,$1.log); \
+	exit 1; \
+fi
+endef
+
+# Outputs all index files to stdout.  Arg 1 is the source file stem, arg 2 is
+# the list of targets for the discovered dependency.
+#
+# $(call get-log-index,<log file stem>,<target files>)
+define get-log-index
+$(SED) \
+-e 's/^No file \(.*\.ind\)\.$$/TARGETS=\1/' \
+-e 's/^No file \(.*\.[gn]ls\)\.$$/TARGETS=\1/' \
+-e 's/[[:space:]]/\\&/g' \
+-e '/^TARGETS=/{' \
+-e '  h' \
+-e '  s/^TARGETS=/$2: /p' \
+-e '  g' \
+-e '  s/^TARGETS=\(.*\)/\1: $1.tex/p' \
+-e '}' \
+-e 'd' \
+'$1.log' | $(SORT) | $(UNIQ)
+endef
+
+
+# Outputs all bibliography files to stdout.  Arg 1 is the source stem, arg 2 is
+# a list of targets for each dependency found.
+#
+# The script kills all lines that do not contain bibdata.  Remaining lines have
+# the \bibdata macro and delimiters removed to create a dependency list.  A
+# trailing comma is added, then all adjacent commas are collapsed into a single
+# comma.  Then commas are replaced with the string .bib[space], and the
+# trailing space is killed off.  Finally, all filename spaces are escaped.
+# This produces a list of space-delimited .bib filenames, which is what the
+# make dep file expects to see.
+#
+# Note that we give kpsewhich a bogus argument so that a failure of sed to
+# produce output will not cause an error.
+#
+# $(call get-bibs,<aux file>,<targets>)
+define get-bibs
+$(SED) \
+-e '/^\\bibdata/!d' \
+-e 's/\\bibdata{\([^}]*\)}/\1,/' \
+-e 's/,\{2,\}/,/g' \
+-e 's/[[:space:]]/\\&/g' \
+-e 's/,/.bib /g' \
+-e 's/ \{1,\}$$//' \
+$1 | $(XARGS) $(KPSEWHICH) '#######' | \
+$(SED) \
+-e 's/^/$2: /' | \
+\$(SORT) | $(UNIQ)
+endef
+
+# Makes a an aux file that only has stuff relevant to the target in it
+# $(call make-auxtarget-file,<flattened-aux>,<new-aux>)
+define make-auxtarget-file
+$(SED) \
+-e '/^\\newlabel/!d' \
+$1 > $2
+endef
+
+# Makes an aux file that only has stuff relevant to the bbl in it
+# $(call make-auxbbl-file,<flattened-aux>,<new-aux>)
+define make-auxbbl-file
+$(SED) \
+-e '/^\\newlabel/d' \
+$1 > $2
+endef
+
+# Makes a .gpi.d file from a .gpi file
+# $(call make-gpi-d,<.gpi>,<.gpi.d>)
+define make-gpi-d
+$(ECHO) '# vim: ft=make' > $2; \
+$(ECHO) 'ifndef INCLUDED_$(call cleanse-filename,$2)' >> $2; \
+$(ECHO) 'INCLUDED_$(call cleanse-filename,$2) := 1' >> $2; \
+$(call get-gpi-deps,$1,$(addprefix $(2:%.gpi.d=%).,$(GNUPLOT_OUTPUT_EXTENSION) gpi.d)) >> $2; \
+$(ECHO) 'endif' >> $2;
+endef
+
+# Parse .gpi files for data and loaded dependencies, output to stdout
+#
+# The sed script here tries to be clever about obtaining valid
+# filenames from the gpi file.  It assumes that the plot command starts its own
+# line, which is not too difficult a constraint to satisfy.
+#
+# This command script also generates 'include' directives for every 'load'
+# command in the .gpi file.  The load command must appear on a line by itself
+# and the file it loads must have the suffix .gpi.  If you don't want it to be
+# compiled when running make graphics, then give it a suffix of ._include_.gpi.
+#
+# $(call get-gpi-deps,<gpi file>,<targets>)
+define get-gpi-deps
+$(SED) \
+-e '/^[[:space:]]*s\{0,1\}plot/,/[^\\]$$/{' \
+-e ' H' \
+-e ' /[^\\]$$/{' \
+-e '  s/.*//' \
+-e '  x' \
+-e '  s/\\\{0,1\}\n//g' \
+-e '  s/^[[:space:]]*s\{0,1\}plot[[:space:]]*\(\[[^]]*\][[:space:]]*\)*/,/' \
+-e '  s/[[:space:]]*\(['\''"][^'\''"]*['\''"]\)\{0,1\}[^,]*/\1/g' \
+-e '  s/,['\''"]-\{0,1\}['\''"]//g' \
+-e '  s/[,'\''"]\{1,\}/ /g' \
+-e '  s!.*!$2: &!' \
+-e '  p' \
+-e ' }' \
+-e ' d' \
+-e '}' \
+-e 's/^[[:space:]]*load[[:space:]]*['\''"]\([^'\''"]*\.gpi\)['\''"].*$$/-include \1.d/p' \
+-e 'd' \
+$1
+endef
+
+# Colorizes real, honest-to-goodness LaTeX errors that can't be overcome with
+# recompilation.
+#
+# Note that we only ignore file not found errors for things that we know how to
+# build, like graphics files.
+#
+# $(call colorize-latex-errors,<log file>)
+define colorize-latex-errors
+$(SED) \
+-e '$$ b para' \
+-e '/^$$/b para' \
+-e 'H' \
+-e 'd' \
+-e ':para' \
+-e 'x' \
+-e '/^$$/d' \
+-e 's/^\n*//' \
+-e '/^! LaTeX Error: File /{' \
+-e '  s/^/::DOUBLE_PARAGRAPH::/' \
+-e '  h' \
+-e '  d' \
+-e '}' \
+-e 's/^::DOUBLE_PARAGRAPH:://' \
+-e '/could not locate the file with any of these extensions:/d' \
+-e '/Missing .begin.document/{' \
+-e '  h' \
+-e '  s/.*/Are you trying to build an include file?/' \
+-e '  x' \
+-e '  G' \
+-e '}' \
+-e '/ LaTeX Error: Cannot determine size/d' \
+-e 's/.* LaTeX Error .*/$(C_ERROR)&$(C_RESET)/p' \
+-e 's/Error: pdflatex (file .*/$(C_ERROR)& - try specifying it without an extension$(C_RESET)/p' \
+-e '/.*\*hyperref using.*driver \(.*\)\*.*/{' \
+-e '  s//\1/' \
+-e '  /^$(hyperref_driver_pattern)$$/!{' \
+-e '    s/.*//' \
+-e '    p' \
+-e '    s/.*/$(C_ERROR)--- Using incorrect driver for hyperref! ---$(C_RESET)/' \
+-e '    p' \
+-e '    s/.*/$(C_ERROR)$(hyperref_driver_error)$(C_RESET)/' \
+-e '    p' \
+-e '  }' \
+-e '  d' \
+-e '}' \
+-e '/ LaTeX Error: Unknown graphics extension/{' \
+-e '  s/^/     /' \
+-e '  h' \
+-e '  s/.*/--- Graphics extension error:/' \
+-e '  G' \
+-e '  h' \
+-e '  s/.*/--- If you specified the extension explicitly in your .tex file, try removing it./' \
+-e '  H' \
+-e '  g' \
+-e '  s/.*/$(C_ERROR)&$(C_RESET)/' \
+-e '  p' \
+-e '  s/.*//' \
+-e '  h' \
+-e '  b' \
+-e '}' \
+-e 's/.*\(\n\{0,\}! .*\)/$(C_ERROR)\1$(C_RESET)/p' \
+-e 'd' \
+$1
+endef
+
+# Colorize Makeindex errors
+define colorize-makeindex-errors
+$(SED) \
+-e '/^!! /{' \
+-e '  N' \
+-e '  s/^.*$$/$(C_ERROR)&$(C_RESET)/' \
+-e '  p' \
+-e '}' \
+-e 'd' \
+$1
+endef
+
+# Colorize epstopdf errors
+#
+# $(call colorize-epstopdf-errors,<log file>)
+define colorize-epstopdf-errors
+$(SED) \
+-e '/^Error:/,/^Execution stack:/{' \
+-e '  /^Execution stack:/d' \
+-e '  s/.*/$(C_ERROR)&$(C_RESET)/' \
+-e '  p' \
+-e '}' \
+-e 'd' \
+$1
+endef
+
+# Colorize GNUplot errors
+#
+# $(call colorize-gnuplot-errors,<log file>)
+define colorize-gnuplot-errors
+$(SED) \
+-e '/, line [0-9]*:/!{' \
+-e '  H' \
+-e '  x' \
+-e '  s/.*\n\(.*\n.*\)$$/\1/' \
+-e '  x' \
+-e '}' \
+-e '/, line [0-9]*:/{' \
+-e '  H' \
+-e '  /unknown.*terminal type/{' \
+-e '    s/.*/--- Try changing the GNUPLOT_OUTPUT_EXTENSION variable to 'eps'./' \
+-e '	H' \
+-e '  }' \
+-e '  /gpihead/{' \
+-e '    s/.*/--- This could be a Makefile bug - contact the maintainer./' \
+-e '    H' \
+-e '  }' \
+-e '  g' \
+-e '  s/.*/$(C_ERROR)&$(C_RESET)/' \
+-e '  p' \
+-e '}' \
+-e '/^gnuplot>/,/^$$/{' \
+-e '  s/^gnuplot.*/$(C_ERROR)&/' \
+-e '  s/^$$/$(C_RESET)/' \
+-e '  p' \
+-e '}' \
+-e 'd' \
+$1
+endef
+
+# Colorize GraphViz errors
+#
+# $(call colorize-dot-errors,<log file>)
+define colorize-dot-errors
+$(SED) \
+-e '/^Error:/,/context:/s/.*/$(C_ERROR)&$(C_RESET)/p' \
+-e 's/^Warning:.*/$(C_WARNING)&$(C_RESET)/p' \
+-e 'd' \
+'$1'
+endef
+
+# Get all important .aux files from the top-level .aux file and merges them all
+# into a single file, which it outputs to stdout.
+#
+# $(call flatten-aux,<toplevel aux>,<output file>)
+define flatten-aux
+$(SED) \
+-e '/\\@input{\(.*\)}/{' \
+-e     's//\1/' \
+-e     's![.:]!\\&!g' \
+-e     'h' \
+-e     's!.*!\\:\\\\@input{&}:{!' \
+-e     'p' \
+-e     'x' \
+-e     's/\\././g' \
+-e     's/.*/r &/p' \
+-e     's/.*/d/p' \
+-e     's/.*/}/p' \
+-e     'd' \
+-e '}' \
+-e 'd' \
+'$1' > "$1.$$$$.sed.make"; \
+$(SED) -f "$1.$$$$.sed.make" '$1' > "$1.$$$$.make"; \
+$(SED) \
+-e '/^\\relax/d' \
+-e '/^\\bibcite/d' \
+-e 's/^\(\\newlabel{[^}]\{1,\}}\).*/\1/' \
+"$1.$$$$.make" | $(SORT) > '$2'; \
+$(call remove-temporary-files,$1.$$$$.make $1.$$$$.sed.make)
+endef
+
+# Generate pdf from postscript
+#
+# Note that we don't just call ps2pdf, since there are so many versions of that
+# script on various systems.  Instead, we call the postscript interpreter
+# directly.
+#
+# $(call ps2pdf,infile,outfile,[embed fonts])
+define ps2pdf
+	$(GS) \
+		-dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \
+		$(if $3,$(PS_EMBED_OPTIONS)) \
+		-q -dNOPAUSE -dBATCH \
+		-sDEVICE=pdfwrite -sstdout=%stderr \
+		'-sOutputFile=$2' \
+		-dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \
+		$(if $3,$(PS_EMBED_OPTIONS)) \
+		-c .setpdfwrite \
+		-f '$1'
+endef
+
+# Colorize LaTeX output.
+# This uses a neat trick from the Sed & Awk Book from O'Reilly:
+# 1) If a line has a single ending paren, delete it to make a blank line (so
+#	that we catch the first error, which is not always preceded by a blank
+#	line).
+# 2) Ensure that the last line of the file gets appended to the hold buffer,
+# 	and blank it out to trigger end-of-paragraph logic below.
+# 3) When encountering a blank line (LaTeX output helpfully breaks output on
+# 	newlines)
+# 	a) swap the hold buffer (containing the paragraph) into the pattern buffer (putting a blank line into the hold buffer),
+# 	b) remove the newline at the beginning (don't ask),
+# 	c) apply any colorizing substitutions necessary to ensure happiness.
+# 	d) get the newline out of the hold buffer and append it
+# 	e) profit! (print)
+# 4) Anything not colorized is deleted, unless in verbose mode.
+color_tex	:= \
+	$(SED) \
+	-e '$${' \
+	-e '  /^$$/!{' \
+	-e '    H' \
+	-e '    s/.*//' \
+	-e '  }' \
+	-e '}' \
+	-e '/^$$/!{' \
+	-e '  H' \
+	-e '  d' \
+	-e '}' \
+	-e '/^$$/{' \
+	-e '  x' \
+	-e '  s/^\n//' \
+	-e '  /Output written on /{' \
+	-e '    s/.*Output written on \([^(]*\) (\([^)]\{1,\}\)).*/Success!  Wrote \2 to \1/' \
+	-e '    s/[[:digit:]]\{1,\}/$(C_PAGES)&$(C_RESET)/g' \
+	-e '    s/Success!/$(C_SUCCESS)&$(C_RESET)/g' \
+	-e '    s/to \(.*\)$$/to $(C_SUCCESS)\1$(C_RESET)/' \
+	-e '    b end' \
+	-e '  }' \
+	-e '  / *LaTeX Error:.*/{' \
+	-e '    s/.*\( *LaTeX Error:.*\)/$(C_ERROR)\1$(C_RESET)/' \
+	-e '    b end' \
+	-e '  }' \
+	-e '  /.*Warning:.*/{' \
+	-e '    s//$(C_WARNING)&$(C_RESET)/' \
+	-e '    b end' \
+	-e '  }' \
+	-e '  /Underfull.*/{' \
+	-e '    s/.*\(Underfull.*\)/$(C_UNDERFULL)\1$(C_RESET)/' \
+	-e '    b end' \
+	-e '  }' \
+	-e '  /Overfull.*/{' \
+	-e '    s/.*\(Overfull.*\)/$(C_OVERFULL)\1$(C_RESET)/' \
+	-e '    b end' \
+	-e '  }' \
+	$(if $(VERBOSE),,-e '  d') \
+	-e '  :end' \
+	-e '  G' \
+	-e '}' \
+
+# Colorize BibTeX output.
+color_bib	:= \
+	$(SED) \
+	-e 's/^Warning--.*/$(C_WARNING)&$(C_RESET)/' -e 't' \
+	-e '/---/,/^.[^:]/{' \
+	-e '  H' \
+	-e '  /^.[^:]/{' \
+	-e '    x' \
+	-e '    s/\n\(.*\)/$(C_ERROR)\1$(C_RESET)/' \
+	-e '	p' \
+	-e '    s/.*//' \
+	-e '    h' \
+	-e '    d' \
+	-e '  }' \
+	-e '  d' \
+	-e '}' \
+	-e '/(.*error.*)/s//$(C_ERROR)&$(C_RESET)/' \
+	$(if $(VERBOSE),,-e 'd')
+
+
+# Make beamer output big enough to print on a full page.  Landscape doesn't
+# seem to work correctly.
+enlarge_beamer	= $(PSNUP) -l -1 -W128mm -H96mm -pletter
+
+# $(call test-run-again,<source stem>)
+test-run-again	= $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.)$$' $1.log
+
+# This tests whether the build target commands should be run at all, from
+# viewing the log file.
+# $(call test-log-for-need-to-run,<source stem>)
+define test-log-for-need-to-run
+$(SED) \
+-e '/^No file $(call escape-dots,$1)\.aux\./d' \
+$1.log \
+| $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.|No file .+\.tex\.|LaTeX Warning: File.*)$$'
+endef
+
+# LaTeX invocations
+#
+# $(call latex,<tex file>,[<extra LaTeX args>])
+run-latex	= $(latex_build_program) --interaction=batchmode $(if $2,$2,) $1 > /dev/null
+
+# $(call latex-color-log,<LaTeX stem>)
+latex-color-log	= $(color_tex) $1.log
+
+# $(call run-makeindex,<input>,<output>,<log>,<extra flags>)
+define run-makeindex
+success=1; \
+if ! $(MAKEINDEX) -q $1 -t $3 -o $2 $4 > /dev/null || $(EGREP) -q '^!!' $3; then \
+	$(call colorize-makeindex-errors,$3); \
+	$(RM) -f '$2'; \
+	success=0; \
+fi; \
+[ "$$success" = "1" ] && $(sh_true) || $(sh_false);
+endef
+
+# This runs the given script to generate output, and it uses MAKE_RESTARTS to
+# ensure that it never runs it more than once for a particular root make
+# invocation.
+#
+# $(call run-script,<interpreter>,<input>,<output>)
+define run-script
+[ ! -e '$2.cookie' ] && $(ECHO) "restarts=$(RESTARTS)" > $2.cookie && $(ECHO) "level=$(MAKELEVEL)" >> $2.cookie; \
+restarts=`$(SED) -n -e 's/^restarts=//p' $2.cookie`; \
+level=`$(SED) -n -e 's/^level=//p' $2.cookie`; \
+if $(EXPR) $(MAKELEVEL) '<=' $$level '&' $(RESTARTS) '<=' $$restarts >/dev/null; then \
+	$(call echo-build,$2,$3,$(RESTARTS)-$(MAKELEVEL)); \
+	$1 '$2' '$3'; \
+	$(ECHO) "restarts=$(RESTARTS)" > '$2.cookie'; \
+	$(ECHO) "level=$(MAKELEVEL)" >> '$2.cookie'; \
+fi
+endef
+
+# BibTeX invocations
+#
+# $(call run-bibtex,<tex stem>)
+run-bibtex	= $(BIBTEX) $1 | $(color_bib)
+
+
+# $(call convert-eps-to-pdf,<eps file>,<pdf file>,[gray])
+# Note that we don't use the --filter flag because it has trouble with bounding boxes that way.
+define convert-eps-to-pdf
+$(if $3,$(CAT) '$1' | $(call kill-ps-color) > '$1.cookie',$(CP) '$1' '$1.cookie'); \
+$(EPSTOPDF) '$1.cookie' --outfile='$2' > $1.log; \
+$(call colorize-epstopdf-errors,$1.log);
+endef
+
+# $(call convert-gpi,<gpi file>,<output file>,[gray])
+#
+define convert-gpi
+$(ECHO) 'set terminal $(if $(filter %.pdf,$2),pdf enhanced,postscript enhanced eps)' \
+$(if $(filter %.pdf,$2),fsize ,)$(call get-default,$(strip \
+$(firstword \
+	$(shell \
+		$(SED) \
+			-e 's/^\#\#FONTSIZE=\([[:digit:]]\{1,\}\)/\1/p' \
+			-e 'd' \
+			$1 $(strip $(gpi_global)) \
+	) \
+) \
+),$(if $(filter %.pdf,$2),$(DEFAULT_GPI_PDF_FONTSIZE),$(DEFAULT_GPI_EPS_FONTSIZE))) \
+$(strip $(if $3,monochrome,$(if \
+$(shell $(EGREP) '^\#\#[[:space:]]*GRAY[[:space:]]*$$' $< $(gpi_global)),\
+,color))) > $1head.make; \
+$(ECHO) 'set output "$2"' >> $1head.make; \
+$(if $(gpi_global),$(CAT) $(gpi_global) >> $1head.make;,) \
+fnames='$1head.make $1';\
+$(if $(gpi_sed),\
+	$(SED) -f '$(gpi_sed)' $$fnames > $1.temp.make; \
+	fnames=$1.temp.make;,\
+) \
+success=1; \
+if ! $(GNUPLOT) $$fnames 2>$1.log; then \
+	$(call colorize-gnuplot-errors,$1.log); \
+	success=0; \
+fi; \
+$(if $(gpi_sed),$(call remove-temporary-files,$1.temp.make);,) \
+$(call remove-temporary-files,$1head.make); \
+[ "$$success" = "1" ] && $(sh_true) || $(sh_false);
+endef
+
+# Creation of .eps files from .png files
+#
+# The intermediate step of PNM (using NetPBM) produces much nicer output than
+# ImageMagick's "convert" binary.  I couldn't get the right combination of
+# flags to make it look nice, anyway.
+#
+# To handle gray scale conversion, we pipe things through ppmtopgm in the
+# middle.
+#
+# $(call convert-png,<png file>,<eps file>)
+define convert-png
+$(PNGTOPNM) "$1" \
+	$(if $3,| $(PPMTOPGM),) \
+	| $(PNMTOPS) -noturn \
+	> "$2"
+endef
+
+# Creation of .eps files from .jpg files
+#
+# Thanks to brubakee for this solution.
+#
+# Uses Postscript level 2 to avoid file size bloat
+# $(call convert-jpg,<jpg file>,<eps file>)
+define convert-jpg
+$(CONVERT) $(if $3,-type Grayscale,) '$1' eps2:'$2'
+endef
+
+# Creation of .eps files from .fig files
+# $(call convert-fig,<fig file>,<output file>,[gray])
+convert-fig	= $(FIG2DEV) -L $(if $(filter %.pdf,$2),pdf,eps) $(if $3,-N,) $1 $2
+
+# Creation of .pstex files from .fig files
+# $(call convert-fig-pstex,<fig file>,<pstex file>)
+convert-fig-pstex	= $(FIG2DEV) -L pstex $1 $2 > /dev/null 2>&1
+
+# Creation of .pstex_t files from .fig files
+# $(call convert-fig-pstex-t,<fig file>,<pstex file>,<pstex_t file>)
+convert-fig-pstex-t	= $(FIG2DEV) -L pstex_t -p $3 $1 $2 > /dev/null 2>&1
+
+# Creation of .dot_t files from .dot files
+# #(call convert-dot-tex,<dot file>,<dot_t file>)
+convert-dot-tex		= $(DOT2TEX) '$1' > '$2'
+
+# Converts svg files into .eps files
+#
+# $(call convert-svg,<svg file>,<eps file>,[gray])
+convert-svg	= $(INKSCAPE) --export-eps='$2' '$1'
+
+# Converts xvg files into .eps files
+#
+# $(call convert-xvg,<xvg file>,<eps file>,[gray])
+convert-xvg	= $(XMGRACE) '$1' -printfile - -hardcopy -hdevice $(if $3,-mono,) EPS > '$2'
+
+# Converts .eps.gz files into .eps files
+#
+# $(call convert-epsgz,<eps.gz file>,<eps file>,[gray])
+convert-epsgz	= $(GUNZIP) -c '$1' $(if $3,| $(call kill-ps-color)) > '$2'
+
+# Converts .eps files into .eps files (usually a no-op, but can make grayscale)
+#
+# $(call convert-eps,<in file>,<out file>,[gray])
+convert-eps	= $(if $3,$(call kill-ps-color) $1 > $2)
+
+# The name of the file containing special postscript commands for grayscale
+gray_eps_file	:= gray.eps.make
+
+# Changes sethsbcolor and setrgbcolor calls in postscript to always produce
+# grayscale.  In general, this is accomplished by writing new versions of those
+# functions into the user dictionary space, which is looked up before the
+# global or system dictionaries (userdict is one of the permanent dictionaries
+# in postscript and is not read-only like systemdict).
+#
+# For setrgbcolor, the weighted average of the triple is computed and the
+# triple is replaced with three copies of that average before the original
+# procedure is called: .299R + .587G + .114B
+#
+# For sethsbcolor, the color is first converted to RGB, then to grayscale by
+# the new setrgbcolor operator as described above.  Why is this done?
+# Because simply using the value component will tend to make pure colors
+# white, a very undesirable thing.  Pure blue should not translate to white,
+# but to some level of gray.  Conversion to RGB does the right thing.  It's
+# messy, but it works.
+#
+# From
+# http://en.wikipedia.org/wiki/HSV_color_space#Transformation_from_HSV_to_RGB,
+# HSB = HSV (Value = Brightness), and the formula used to convert to RGB is
+# as follows:
+#
+# Hi = int(floor(6 * H)) mod 6
+# f = 6 * H - Hi
+# p = V(1-S)
+# q = V(1-fS)
+# t = V(1-(1-f)S)
+# if Hi = 0: R G B <-- V t p
+# if Hi = 1: R G B <-- q V p
+# if Hi = 2: R G B <-- p V t
+# if Hi = 3: R G B <-- p q V
+# if Hi = 4: R G B <-- t p V
+# if Hi = 5: R G B <-- V p q
+#
+# The messy stack-based implementation is below
+# $(call create-gray-eps-file,filename)
+define create-gray-eps-file
+$(ECHO) -n -e '\
+/OLDRGB /setrgbcolor load def\n\
+/setrgbcolor {\n\
+    .114 mul exch\n\
+    .587 mul add exch\n\
+    .299 mul add\n\
+    dup dup\n\
+    OLDRGB\n\
+} bind def\n\
+/OLDHSB /sethsbcolor load def\n\
+/sethsbcolor {\n\
+    2 index                     % H V S H\n\
+    6 mul floor cvi 6 mod       % Hi V S H\n\
+    3 index                     % H Hi V S H\n\
+    6 mul                       % 6H Hi V S H\n\
+    1 index                     % Hi 6H Hi V S H\n\
+    sub                         % f Hi V S H\n\
+    2 index 1                   % 1 V f Hi V S H\n\
+    4 index                     % S 1 V f Hi V S H\n\
+    sub mul                     % p f Hi V S H\n\
+    3 index 1                   % 1 V p f Hi V S H\n\
+    6 index                     % S 1 V p f Hi V S H\n\
+    4 index                     % f S 1 V p f Hi V S H\n\
+    mul sub mul                 % q p f Hi V S H\n\
+    4 index 1 1                 % 1 1 V q p f Hi V S H\n\
+    5 index                     % f 1 1 V q p f Hi V S H\n\
+    sub                         % (1-f) 1 V q p f Hi V S H\n\
+    8 index                     % S (1-f) 1 V q p f Hi V S H\n\
+    mul sub mul                 % t q p f Hi V S H\n\
+    4 -1 roll pop               % t q p Hi V S H\n\
+    7 -2 roll pop pop           % t q p Hi V\n\
+    5 -2 roll                   % Hi V t q p\n\
+    dup 0 eq\n\
+    {1 index 3 index 6 index}\n\
+    {\n\
+        dup 1 eq\n\
+        {3 index 2 index 6 index}\n\
+        {\n\
+            dup 2 eq\n\
+            {4 index 2 index 4 index}\n\
+            {\n\
+                dup 3 eq\n\
+                {4 index 4 index 3 index}\n\
+                {\n\
+                    dup 4 eq\n\
+                    {2 index 5 index 3 index}\n\
+                    {\n\
+                        dup 5 eq\n\
+                        {1 index 5 index 5 index}\n\
+                        {0 0 0}\n\
+                        ifelse\n\
+                    }\n\
+                    ifelse\n\
+                }\n\
+                ifelse\n\
+            }\n\
+            ifelse\n\
+        }\n\
+        ifelse\n\
+    }\n\
+    ifelse                      % B G R Hi V t q p\n\
+    setrgbcolor\n\
+    5 {pop} repeat\n\
+} bind def\n'\
+> $1
+endef
+
+# This actually inserts the color-killing code into a postscript file
+# $(call kill-ps-color)
+define kill-ps-color
+$(SED) -e '/%%EndComments/r $(gray_eps_file)'
+endef
+
+# Converts graphviz .dot files into .eps files
+# Grayscale is not directly supported by dot, so we pipe it through fig2dev in
+# that case.
+# $(call convert-dot,<dot file>,<eps file>,<log file>,[gray])
+define convert-dot
+$(DOT) -Tps '$1' 2>'$3' $(if $4,| $(call kill-ps-color)) > $2; \
+$(call colorize-dot-errors,$3)
+endef
+
+# Convert DVI to Postscript
+# $(call make-ps,<dvi file>,<ps file>,<log file>,[<paper size>])
+make-ps		= \
+	$(DVIPS) -o '$2' $(if $(filter-out BEAMER,$4),-t$(firstword $4),) '$1' \
+		$(if $(filter BEAMER,$4),| $(enlarge_beamer)) > $3 2>&1
+
+# Convert Postscript to PDF
+# $(call make-pdf,<ps file>,<pdf file>,<log file>,<embed file>)
+make-pdf	= \
+	$(call ps2pdf,$1,$2,$(filter 1,$(shell $(CAT) '$4'))) > '$3' 2>&1
+
+# Display information about what is being done
+# $(call echo-build,<input file>,<output file>,[<run number>])
+echo-build	= $(ECHO) "$(C_BUILD)= $1 --> $2$(if $3, ($3),) =$(C_RESET)"
+echo-graphic	= $(ECHO) "$(C_GRAPHIC)= $1 --> $2 =$(C_RESET)"
+echo-dep	= $(ECHO) "$(C_DEP)= $1 --> $2 =$(C_RESET)"
+
+# Display a list of something
+# $(call echo-list,<values>)
+echo-list	= for x in $1; do $(ECHO) "$$x"; done
+
+#
+# DEFAULT TARGET
+#
+
+.PHONY: all
+all: $(default_pdf_targets) ;
+
+.PHONY: all-pdf
+all-pdf: $(default_pdf_targets) ;
+
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+.PHONY: all-ps
+all-ps: $(default_ps_targets) ;
+
+.PHONY: all-dvi
+all-dvi: $(default_dvi_targets) ;
+endif
+
+#
+# VIEWING TARGET
+#
+.PHONY: show
+show: all
+	$(QUIET)for x in $(default_pdf_targets); do \
+		[ -e "$$x" ] && $(VIEW_PDF) $$x & \
+	done
+
+#
+# INCLUDES
+#
+source_includes	:= $(addsuffix .d,$(source_stems_to_include))
+graphic_includes := $(addsuffix .gpi.d,$(graphic_stems_to_include))
+
+# Include only the dependencies used
+ifneq "" "$(source_includes)"
+include $(source_includes)$(call include-message,$(source_includes))
+endif
+ifneq "" "$(graphic_includes)"
+include $(graphic_includes)$(call include-message,$(graphic_includes))
+endif
+
+#
+# MAIN TARGETS
+#
+
+# Note that we don't just say %: %.pdf here - this can tend to mess up our
+# includes, which detect what kind of file we are asking for.  For example,
+# asking to build foo.pdf is much different than asking to build foo when
+# foo.gpi exists, because we look through all of the goals for *.pdf that
+# matches *.gpi, then use that to determine which include files we need to
+# build.
+#
+# Thus, we invoke make recursively with better arugments instead, restarting
+# all of the appropriate machinery.
+.PHONY: $(default_stems_ss)
+$(default_stems_ss): %: %.pdf ;
+
+# This builds and displays the wanted file.
+.PHONY: $(addsuffix ._show,$(stems_ssg))
+%._show: %.pdf
+	$(QUIET)$(VIEW_PDF) $< &
+
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+.SECONDARY: $(all_pdf_targets)
+%.pdf: %.ps %.embed.make
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call make-pdf,$<,$@.temp,$@.log,$*.embed.make); \
+	if [ x"$$?" = x"0" ]; then \
+	    $(if $(VERBOSE),$(CAT) $@.log,:); \
+	    $(RM) -f '$@'; \
+	    $(MV) '$@.temp' '$@'; \
+	    $(TOUCH) '$@'; \
+	    $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \
+	else \
+	    $(CAT) $@.log; \
+	    $(call remove-temporary-files,'$@.temp'); \
+	    $(sh_false); \
+	fi
+
+.SECONDARY: $(all_ps_targets)
+%.ps: %.dvi %.paper.make
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call make-ps,$<,$@.temp,$@.log,\
+			$(firstword $(shell $(CAT) $*.paper.make))); \
+	if [ x"$$?" = x"0" ]; then \
+	    $(if $(VERBOSE),$(CAT) $@.log,:); \
+	    $(RM) -f '$@'; \
+	    $(MV) '$@.temp' '$@'; \
+	    $(TOUCH) '$@'; \
+	    $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \
+	else \
+	    $(CAT) $@.log; \
+	    $(call remove-temporary-files,'$@.temp'); \
+	    $(sh_false); \
+	fi
+endif
+
+# Build the final target (dvi or pdf) file.  This is a very tricky rule because
+# of the way that latex runs multiple times, needs graphics after the first run
+# (or maybe already has them), and relies on bibliographies or indices that may
+# not exist.
+#
+#	Check the log for fatal errors.  If they exist, colorize and bail.
+#
+#	Create the .auxtarget.cookie file.  (Needed for next time if not present)
+#
+#	If any of the following are true, we must rebuild at least one time:
+#
+#	* the .bbl was recently rebuilt
+#
+#		check a cookie, then delete it
+#
+#	* any of several output files was created or changed:
+#
+#		check $*.run.cookie, then delete it
+#
+#	* the .aux file changed in a way that necessitates attention
+#
+#		Note that if the .auxtarget.make file doesn't exist, this means
+#		that we are doing a clean build, so it doesn't figure into the
+#		test for running again.
+#
+#		compare against .auxtarget.make
+#
+#		move if different, remove if not
+#
+#	* the .log file has errors or warnings requiring at least one more run
+#
+#	We use a loop over a single item to simplify the process of breaking
+#	out when we find one of the conditions to be true.
+#
+#	If we do NOT need to run latex here, then we move the $@.1st.make file
+#	over to $@ because the target file has already been built by the first
+#	dependency run and is valid.
+#
+#	If we do, we delete that cookie file and do the normal multiple-runs
+#	routine.
+#
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+.SECONDARY: $(all_dvi_targets)
+endif
+%.$(build_target_extension): %.bbl %.aux %.$(build_target_extension).1st.make
+	$(QUIET)\
+	fatal=`$(call colorize-latex-errors,$*.log)`; \
+	if [ x"$$fatal" != x"" ]; then \
+		$(ECHO) "$$fatal"; \
+		exit 1; \
+	fi; \
+	$(call make-auxtarget-file,$*.aux.make,$*.auxtarget.cookie); \
+	run=0; \
+	for i in 1; do \
+		if $(call test-exists,$*.bbl.cookie); then \
+			run=1; \
+			break; \
+		fi; \
+		if $(call test-exists,$*.run.cookie); then \
+			run=1; \
+		    	break; \
+		fi; \
+		if $(call \
+		test-exists-and-different,$*.auxtarget.cookie,$*.auxtarget.make);\
+		then \
+			run=1; \
+			break; \
+		fi; \
+		if $(call test-log-for-need-to-run,$*); then \
+			run=1; \
+			break; \
+		fi; \
+	done; \
+	$(call remove-temporary-files,$*.bbl.cookie $*.run.cookie); \
+	$(MV) $*.auxtarget.cookie $*.auxtarget.make; \
+	if [ x"$$run" = x"1" ]; then \
+		$(call remove-files,$@.1st.make); \
+		for i in 2 3 4 5; do \
+			$(if $(findstring 3.79,$(MAKE_VERSION)),\
+				$(call echo-build,$*.tex,$@,$(RESTARTS)-$$$$i),\
+				$(call echo-build,$*.tex,$@,$(RESTARTS)-$$i)\
+			); \
+			$(call run-latex,$*); \
+			$(CP) '$*.log' '$*.'$(RESTARTS)-$$i'.log'; \
+			$(call test-run-again,$*) || break; \
+		done; \
+	else \
+		$(MV) '$@.1st.make' '$@'; \
+	fi; \
+	$(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \
+	$(call latex-color-log,$*)
+
+# Build the .bbl file.  When dependencies are included, this will (or will
+# not!) depend on something.bib, which we detect, acting accordingly.  The
+# dependency creation also produces the %.auxbbl.make file.  BibTeX is a bit
+# finicky about what you call the actual files, but we can rest assured that if
+# a .auxbbl.make file exists, then the .aux file does, as well.  The
+# .auxbbl.make file is a cookie indicating whether the .bbl needs to be
+# rewritten.  It only changes if the .aux file changes in ways relevant to .bbl
+# creation.
+#
+# Note that we do NOT touch the .bbl file if there is no need to
+# create/recreate it.  We would like to leave existing files alone if they
+# don't need to be changed, thus possibly avoiding a rebuild trigger.
+%.bbl: %.auxbbl.make
+	$(QUIET)\
+	$(if $(filter %.bib,$^),\
+		$(call echo-build,$(filter %.bib,$?) $*.aux,$@); \
+		$(call run-bibtex,$*); \
+		$(TOUCH) $@.cookie; \
+	) \
+	if $(EGREP) -q 'bibstyle.(apacann|chcagoa|[^}]*annot)' '$*.aux'; then \
+		$(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-1); \
+		$(call run-latex,$*); \
+		$(CP) '$*.log' '$*.$(RESTARTS)-annotated.log'; \
+		$(if $(filter %.bib,$^),\
+			$(call echo-build,** annotated extra bibtex ** $(filter %.bib,$?) $*.aux,$@); \
+			$(call run-bibtex,$*); \
+			$(TOUCH) $@.cookie; \
+		) \
+		$(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-2); \
+		$(call run-latex,$*); \
+	fi
+
+# Create the index file - note that we do *not* depend on %.tex here, since
+# that unnecessarily restricts the kinds of indices that we can build to those
+# with exactly the same stem as the source file.  Things like splitidx create
+# idx files with other names.
+#
+# Therefore, we add the .tex dependency in the sourcestem.d file in the call to
+# get index file dependencies from the logs.
+%.ind:	%.idx
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call run-makeindex,$<,$@,$*.ilg)
+
+# Create the glossary file
+%.gls:	%.glo %.tex
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call run-makeindex,$<,$@,$*.glg,-s nomencl.ist)
+
+# Create the nomenclature file
+%.nls:	%.nlo %.tex
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call run-makeindex,$<,$@,$*.nlg,-s nomencl.ist)
+
+# SCRIPTED LaTeX TARGETS
+#
+# Keep the generated .tex files around for debugging if needed.
+.SECONDARY: $(all_tex_targets)
+
+%.tex::	%.tex.sh
+	$(QUIET)$(call run-script,$(SHELL),$<,$@)
+
+%.tex::	%.tex.py
+	$(QUIET)$(call run-script,$(PYTHON),$<,$@)
+
+%.tex::	%.tex.pl
+	$(QUIET)$(call run-script,$(PERL),$<,$@)
+
+%.tex::	%.rst $(RST_STYLE_FILE)
+	$(QUIET)\
+	$(call run-script,$(RST2LATEX)\
+		--documentoptions=letterpaper\
+		$(if $(RST_STYLE_FILE),--stylesheet=$(RST_STYLE_FILE),),$<,$@)
+
+#
+# GRAPHICS TARGETS
+#
+.PHONY: all-graphics
+all-graphics:	$(all_graphics_targets);
+
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+.PHONY: all-pstex
+all-pstex:	$(all_pstex_targets);
+endif
+
+.PHONY: all-dot2tex
+all-dot2tex:	$(all_dot2tex_targets);
+
+.PHONY: show-graphics
+show-graphics: all-graphics
+	$(VIEW_GRAPHICS) $(all_known_graphics)
+
+$(gray_eps_file):
+	$(QUIET)$(call echo-build,$^,$@)
+	$(QUIET)$(call create-gray-eps-file,$@)
+
+ifeq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+%.pdf: %.eps $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-eps-to-pdf,$<,$@,$(GRAY))
+
+ifeq "$(strip $(GNUPLOT_OUTPUT_EXTENSION))" "pdf"
+%.pdf:	%.gpi %.gpi.d $(gpi_sed)
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-gpi,$<,$@,$(GRAY))
+endif
+
+%.pdf:	%.fig
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-fig,$<,$@,$(GRAY))
+
+endif
+
+%.eps:	%.gpi %.gpi.d $(gpi_sed)
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-gpi,$<,$@,$(GRAY))
+
+%.eps: %.fig
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-fig,$<,$@,$(GRAY))
+
+%.eps: %.dot $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-dot,$<,$@,$<.log,$(GRAY))
+
+%.eps: %.xvg $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-xvg,$<,$@,$(GRAY))
+
+%.eps: %.svg $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-svg,$<,$@,$(GRAY))
+
+%.eps: %.jpg $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-jpg,$<,$@,$(GRAY))
+
+%.eps: %.png $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-png,$<,$@,$(GRAY))
+
+%.eps: %.eps.gz $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-epsgz,$<,$@,$(GRAY))
+
+%.pstex: %.fig
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-fig-pstex,$<,$@,$(GRAY))
+
+%.pstex_t: %.fig %.pstex
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-fig-pstex-t,$<,$@,$*.pstex,$(GRAY))
+
+%.dot_t: %.dot
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-dot-tex,$<,$@)
+
+#
+# DEPENDENCY-RELATED TARGETS.
+#
+
+# Generate all of the information needed to get dependencies
+# As a side effect, this creates a .dvi or .pdf file (depending on the build
+# strategy).  We need to be sure to remove it if there are errors.  Errors can
+# take several forms and all of them are found within the log file:
+#	* There was a LaTeX error
+#	* A needed file was not found
+#	* Cross references need adjustment
+#
+# Behavior:
+#	This rule is responsible for generating the following:
+#	%.aux
+#	%.d
+#	%.aux.make
+#	%.(pdf|dvi).1st.make (the .pdf or .dvi output file, moved)
+#
+#	Steps:
+#
+#	Run latex
+#	Move .pdf or .dvi somewhere else (make no judgements about success)
+#	Flatten the .aux file into another file
+#	Add source dependencies
+#	Add graphic dependencies
+#	Add bib dependencies
+#
+#	Create cookies for various suffixes that may represent files that
+#	need to be read by LaTeX in order for it to function properly.
+#
+#	Note that if some of the dependencies are discovered because they turn
+#	up missing in the log file, we really need the .d file to be reloaded.
+#	Adding a sleep command helps with this.  Otherwise make is extremely
+#	nondeterministic, sometimes working, sometimes not.
+#
+#	Usually we can force this by simply removing the generated pdf file and
+#	not creating a .1st.make file..
+#
+%.$(build_target_extension).1st.make %.d %.aux %.aux.make %.fls: %.tex
+	$(QUIET)$(call echo-build,$<,$*.d $*.$(build_target_extension).1st.make,$(RESTARTS)-1)
+	$(QUIET)\
+	$(call run-latex,$<,--recorder) || $(sh_true); \
+	$(CP) '$*.log' '$*.$(RESTARTS)-1.log'; \
+	$(call die-on-dot2tex,$*.log); \
+	$(call die-on-no-aux,$*); \
+	$(call flatten-aux,$*.aux,$*.aux.make); \
+	$(ECHO) "# vim: ft=make" > $*.d; \
+	$(ECHO) ".PHONY: $*._graphics" >> $*.d; \
+	$(call get-inputs,$*.fls,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \
+	$(call get-missing-inputs,$*.log,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \
+	$(ECHO) ".SECONDEXPANSION:" >> $*.d; \
+	$(call get-graphics,$*) >> $*.d; \
+	$(call get-log-index,$*,$(addprefix $*.,d aux aux.make)) >> $*.d; \
+	$(call get-bibs,$*.aux.make,$(addprefix $*.,bbl aux aux.make)) >> $*.d; \
+	$(EGREP) -q "# MISSING" $*.d && $(SLEEP) 1 && $(RM) $*.pdf; \
+	$(call move-if-exists,$*.$(build_target_extension),$*.$(build_target_extension).1st.make); \
+	for s in toc out lot lof lol nav; do \
+		if [ -e "$*.$$s" ]; then \
+			if ! $(DIFF) -q $*.$$s $*.$$s.make >/dev/null 2>&1; then \
+				$(TOUCH) $*.run.cookie; \
+			fi; \
+			$(CP) $*.$$s $*.$$s.make; \
+		fi; \
+	done
+
+# This is a cookie that is updated if the flattened aux file has changed in a
+# way that affects the bibliography generation.
+.SECONDARY: $(addsuffix .auxbbl.make,$(stems_ssg))
+%.auxbbl.make: %.aux.make
+	$(QUIET)\
+	$(call make-auxbbl-file,$<,$@.temp); \
+	$(call replace-if-different-and-remove,$@.temp,$@)
+
+# Build a dependency file for .gpi files.  These often plot data files that
+# also reside in the directory, so if a data file changes, it's nice to know
+# about it.  This also handles loaded .gpi files, whose filename should have
+# _include_. in it.
+%.gpi.d: %.gpi
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call make-gpi-d,$<,$@)
+
+# Store the paper size for this document -- note that if beamer is used we set
+# it to the special BEAMER paper size.  We only do this, however, if the
+# special comment exists, in which case we enlarge the output with psnup.
+#
+#	The paper size is extracted from a documentclass attribute.
+%.paper.make: %.tex
+	$(QUIET)$(SED) \
+	-e '/\\documentclass/,/}/{' \
+	-e '  s/%.*//' \
+	-e '  H' \
+	-e '  /}/{' \
+	-e '    s/.*//' \
+	-e '    x' \
+	-e '    /\\documentclass/!d' \
+	-e '    s/[\n[:space:]]*//g' \
+	-e '    s/\([,{[]\)\([[:alnum:]]\{1,\}\)paper\([],}]\)/\1%-\2-%\3/g' \
+	-e '    s/\([,{[]\)\(landscape\)\([],}]\)/\1%-\2-%\3/g' \
+	-e '    s/^[^%]*%-//' \
+	-e '    s/-%[^%]*$$//' \
+	-e '    s/-%[^%]%-/ /g' \
+	-e '    p' \
+	-e '  }' \
+	-e '  d' \
+	-e '}' \
+	-e 'd' \
+	$< > $@; \
+	$(EGREP) -q '^[^%]*\\documentclass[^{]*{beamer}' $< && \
+	(\
+		$(EGREP) -q '^%%[[:space:]]*BEAMER[[:space:]]*LARGE$$' $< && \
+		$(ECHO) "BEAMER" > $@ || \
+		: > $@ \
+	) || $(sh_true)
+
+# Store embedding instructions for this document using a special comment
+%.embed.make: %.tex
+	$(QUIET)$(EGREP) '^%%[[:space:]]*NO[[:space:]]*EMBED[[:space:]]*$$' $< \
+		&& $(ECHO) '' > $@ \
+		|| $(ECHO) '1' > $@;
+
+#
+# HELPFUL PHONY TARGETS
+#
+
+.PHONY: _all_programs
+_all_programs:
+	$(QUIET)$(ECHO) "== All External Programs Used =="
+	$(QUIET)$(call output-all-programs)
+
+.PHONY: _check_programs
+_check_programs:
+	$(QUIET)$(ECHO) "== Checking Makefile Dependencies =="; $(ECHO)
+	$(QUIET) \
+	$(ECHO) hi; \
+	allprogs=`\
+	 ($(call output-all-programs)) | \
+	 $(SED) \
+	 -e 's/^[[:space:]]*//' \
+	 -e '/^#/d' \
+	 -e 's/[[:space:]]*#.*//' \
+	 -e '/^=/s/[[:space:]]/_/g' \
+	 -e '/^[[:space:]]*$$/d' \
+	 -e 's/^[^=].*=[[:space:]]*\([^[:space:]]\{1,\}\).*$$/\\1/' \
+	 `; \
+	spaces='                             '; \
+	for p in $${allprogs}; do \
+	case $$p in \
+		=*) $(ECHO); $(ECHO) "$$p";; \
+		*) \
+			$(ECHO) -n "$$p:$$spaces" | $(SED) -e 's/^\(.\{0,20\}\).*$$/\1/'; \
+			loc=`$(WHICH) $$p`; \
+			if [ x"$$?" = x"0" ]; then \
+				$(ECHO) "$(C_SUCCESS)Found:$(C_RESET) $$loc"; \
+			else \
+				$(ECHO) "$(C_FAILURE)Not Found$(C_RESET)"; \
+			fi; \
+			;; \
+	esac; \
+	done
+
+.PHONY: _check_gpi_files
+_check_gpi_files:
+	$(QUIET)$(ECHO) "== Checking all .gpi files for common errors =="; \
+	$(ECHO); \
+	for f in $(files.gpi); do \
+	result=`$(EGREP) '^([^#]*set terminal |set output )' $$f`; \
+	$(ECHO) -n "$$f: "; \
+	if [ x"$$result" = x"" ]; then \
+		$(ECHO) "$(C_SUCCESS)Okay$(C_RESET)"; \
+	else \
+		$(ECHO) "$(C_FAILURE)Warning: Problematic commands:$(C_RESET)";\
+		$(ECHO) "$(C_ERROR)$$result$(C_RESET)"; \
+	fi; \
+	done; \
+	$(ECHO)
+
+.PHONY: _all_stems
+_all_stems:
+	$(QUIET)$(ECHO) "== All Stems =="
+	$(QUIET)$(call echo-list,$(sort $(default_stems_ss)))
+
+.PHONY: _includes
+_includes:
+	$(QUIET)$(ECHO) "== Include Stems =="
+	$(QUIET)$(ECHO) "=== Sources ==="
+	$(QUIET)$(call echo-list,$(sort $(source_includes)))
+	$(QUIET)$(ECHO) "=== Graphics ==="
+	$(QUIET)$(call echo-list,$(sort $(graphic_includes)))
+
+.PHONY: _all_sources
+_all_sources:
+	$(QUIET)$(ECHO) "== All Sources =="
+	$(QUIET)$(call echo-list,$(sort $(all_files.tex)))
+
+.PHONY: _dependency_graph
+_dependency_graph:
+	$(QUIET)$(ECHO) "/* LaTeX Dependency Graph */"
+	$(QUIET)$(call output-dependency-graph)
+
+.PHONY: _show_dependency_graph
+_show_dependency_graph:
+	$(QUIET)$(call output-dependency-graph,$(graph_stem).dot)
+	$(QUIET)$(DOT) -Tps -o $(graph_stem).eps $(graph_stem).dot
+	$(QUIET)$(VIEW_POSTSCRIPT) $(graph_stem).eps
+	$(QUIET)$(call remove-temporary-files,$(graph_stem).*)
+
+.PHONY: _sources
+_sources:
+	$(QUIET)$(ECHO) "== Sources =="
+	$(QUIET)$(call echo-list,$(sort $(files.tex)))
+
+.PHONY: _scripts
+_scripts:
+	$(QUIET)$(ECHO) "== Scripts =="
+	$(QUIET)$(call echo-list,$(sort $(files_scripts)))
+
+.PHONY: _graphic_outputs
+_graphic_outputs:
+	$(QUIET)$(ECHO) "== Graphic Outputs =="
+	$(QUIET)$(call echo-list,$(sort $(all_graphics_targets)))
+
+.PHONY: _env
+_env:
+ifdef .VARIABLES
+	$(QUIET)$(ECHO) "== MAKE VARIABLES =="
+	$(QUIET)$(call echo-list,$(foreach var,$(sort $(.VARIABLES)),'$(var)'))
+endif
+	$(QUIET)$(ECHO) "== ENVIRONMENT =="
+	$(QUIET)$(ENV)
+
+#
+# CLEAN TARGETS
+#
+# clean-generated is somewhat unique - it relies on the .fls file being
+# properly built so that it can determine which of the files was generated, and
+# which was not.  Expect it to silently fail if the .fls file is missing.
+#
+# This is used to, e.g., clean up index files that are generated by the LaTeX.
+.PHONY: clean-generated
+clean-generated:
+	$(QUIET)$(call clean-files,$(foreach e,$(addsuffix .fls,$(all_stems_source)),\
+						$(shell $(call get-generated-names,$e))))
+
+.PHONY: clean-deps
+clean-deps:
+	$(QUIET)$(call clean-files,$(all_d_targets) *.make *.make.temp *.cookie)
+
+.PHONY: clean-tex
+clean-tex: clean-deps
+	$(QUIET)$(call clean-files,$(rm_tex))
+
+.PHONY: clean-graphics
+# TODO: This *always* deletes pstex files, even if they were not generated by
+# anything....  In other words, if you create a pstex and pstex_t pair by hand
+# an drop them in here without the generating fig file, they will be deleted
+# and you won't get them back.  It's a hack put in here because I'm not sure we
+# even want to keep pstex functionality, so my motivation is not terribly high
+# for doing it right.
+clean-graphics:
+	$(QUIET)$(call clean-files,$(all_graphics_targets) $(intermediate_graphics_targets) *.gpi.d *.pstex *.pstex_t *.dot_t)
+
+.PHONY: clean-backups
+clean-backups:
+	$(QUIET)$(call clean-files,$(backup_patterns) *.temp)
+
+.PHONY: clean-auxiliary
+clean-auxiliary:
+	$(QUIET)$(call clean-files,$(graph_stem).*)
+
+.PHONY: clean-nographics
+clean-nographics: clean-tex clean-deps clean-backups clean-auxiliary ;
+
+.PHONY: clean
+clean:	clean-generated clean-tex clean-graphics clean-deps clean-backups clean-auxiliary
+
+#
+# HELP TARGETS
+#
+
+.PHONY: help
+help:
+	$(help_text)
+
+.PHONY: version
+version:
+	$(QUIET)\
+	$(ECHO) "$(fileinfo) Version $(version)"; \
+	$(ECHO) "by $(author)"; \
+
+#
+# HELP TEXT
+#
+
+define help_text
+# $(fileinfo) Version $(version)
+#
+# by $(author)
+#
+# Generates a number of possible output files from a LaTeX document and its
+# various dependencies.  Handles .bib files, \include and \input, and .eps
+# graphics.  All dependencies are handled automatically by running LaTeX over
+# the source.
+#
+# USAGE:
+#
+#    make [GRAY=1] [VERBOSE=1] [SHELL_DEBUG=1] <target(s)>
+#
+# STANDARD OPTIONS:
+#    GRAY:
+#        Setting this variable forces all recompiled graphics to be grayscale.
+#        It is useful when creating a document for printing.  The default is
+#        to allow colors.  Note that it only changes graphics that need to be
+#        rebuilt!  It is usually a good idea to do a 'make clean' first.
+#
+#    VERBOSE:
+#        This turns off all @ prefixes for commands invoked by make.  Thus,
+#        you get to see all of the gory details of what is going on.
+#
+#    SHELL_DEBUG:
+#        This enables the -x option for sh, meaning that everything it does is
+#        echoed to stderr.  This is particularly useful for debugging
+#        what is going on in $$(shell ...) invocations.  One of my favorite
+#        debugging tricks is to do this:
+#
+#        make -d SHELL_DEBUG=1 VERBOSE=1 2>&1 | less
+#
+# STANDARD AUXILIARY FILES:
+#
+#      Makefile.ini
+#
+#          This file can contain variable declarations that override various
+#          aspects of the makefile.  For example, one might specify
+#
+#          neverclean := *.pdf *.ps
+#          onlysources.tex := main.tex
+#          LATEX_COLOR_WARNING := 'bold red uline'
+#
+#          And this would override the neverclean setting to ensure that pdf
+#          and ps files always remain behind, set the makefile to treat all
+#          .tex files that are not "main.tex" as includes (and therefore not
+#          default targets).  It also changes the LaTeX warning output to be
+#          red, bold, and underlined.
+#
+#          There are numerous variables in this file that can be overridden in
+#          this way.  Search for '?=' to find them all.
+#
+#          Also, you can put arbitrary targets into it if, for example, you
+#          want your source built from something else, e.g.:
+#
+#          generated.tex: generating_script.weird_lang depA depB
+#          	./generating_script.weird_lang > $$@
+#
+#          Note that if you are not careful, you can override the default
+#          target (what happens when you type "make" without arguments), so if
+#          you do use Makefile.ini, you probably want to start it with
+#          something like the following line:
+#
+#          default: all
+#
+#          Since the first target in any makefile is automatically the default,
+#          and the makefile already has a sensible "all" target, this will do
+#          what you want.
+#
+#          The Makefile.ini is imported before *anything else* is done, so go
+#          wild with your ideas for changes to this makefile in there.  It
+#          makes it easy to test them before submitting patches.
+#
+# STANDARD ENVIRONMENT VARIABLES:
+#
+#      LATEX_COLOR_WARNING		'$(LATEX_COLOR_WARNING)'
+#      LATEX_COLOR_ERROR		'$(LATEX_COLOR_ERROR)'
+#      LATEX_COLOR_UNDERFULL		'$(LATEX_COLOR_UNDERFULL)'
+#      LATEX_COLOR_OVERFULL		'$(LATEX_COLOR_OVERFULL)'
+#      LATEX_COLOR_PAGES		'$(LATEX_COLOR_PAGES)'
+#      LATEX_COLOR_BUILD		'$(LATEX_COLOR_BUILD)'
+#      LATEX_COLOR_GRAPHIC		'$(LATEX_COLOR_GRAPHIC)'
+#      LATEX_COLOR_DEP			'$(LATEX_COLOR_DEP)'
+#      LATEX_COLOR_SUCCESS		'$(LATEX_COLOR_SUCCESS)'
+#      LATEX_COLOR_FAILURE		'$(LATEX_COLOR_FAILURE)'
+#
+#   These may be redefined in your environment to be any of the following:
+#
+#      black
+#      red
+#      green
+#      yellow
+#      blue
+#      magenta
+#      cyan
+#      white
+#
+#   Bold or underline may be used, as well, either alone or in combination
+#   with colors:
+#
+#      bold
+#      uline
+#
+#   Order is not important.  You may want, for example, to specify:
+#
+#   export LATEX_COLOR_SUCCESS='bold blue uline'
+#
+#   in your .bashrc file.  I don't know why, but you may want to.
+#
+# STANDARD TARGETS:
+#
+#    all:
+#        Make all possible documents in this directory.  The documents are
+#        determined by scanning for .tex and .tex.sh (described in more detail
+#        later) and omitting any file that ends in ._include_.tex or
+#        ._nobuild_.tex.  The output is a set of .pdf files.
+#
+#        If you wish to omit files without naming them with the special
+#        underscore names, set the following near the top of the Makefile,
+#        or (this is recommended) within a Makefile.ini in the same directory:
+#
+#        	includes.tex := file1.tex file2.tex
+#
+#        This will cause the files listed to be considered as include files.
+#
+#        If you have only few source files, you can set
+#
+#        	onlysources.tex := main.tex
+#
+#        This will cause only the source files listed to be considered in
+#        dependency detection.  All other .tex files will be considered as
+#        include files.  Note that these options work for *any* source type,
+#        so you could do something similar with includes.gpi, for example.
+#        Note that this works for *any valid source* target.  All of the
+#        onlysources.* variables are commented out in the shipping version of
+#        this file, so it does the right thing when they simply don't exist.
+#        The comments are purely documentation.  If you know, for example, that
+#        file.mycoolformat is supported by this Makefile, but don't see the
+#        "onlysources.mycoolformat" declared in the comments, that doesn't mean
+#        you can't use it.  Go ahead and set "onlysources.mycoolformat" and it
+#        should do the right thing.
+#
+#    show:
+#        Builds and displays all documents in this directory.  It uses the
+#        environment-overridable value of VIEW_PDF (currently $(VIEW_PDF)) to
+#        do its work.
+#
+#    all-graphics:
+#        Make all of the graphics in this directory.
+#
+#    all-pstex (only for BUILD_STRATEGY=latex):
+#        Build all fig files into pstex and pstex_t files.  Gray DOES NOT WORK.
+#
+#    all-gray-pstex (only for BUILD_STRATEGY=latex):
+#    	 Build all fig files into grayscale pstex and pstex_t files.
+#
+#    all-dot2tex:
+#    	 Build all dot files into tex files.
+#
+#    show-graphics:
+#        Builds and displays all graphics in this directory.  Uses the
+#        environment-overridable value of VIEW_GRAPHICS (currently
+#        $(VIEW_GRAPHICS)) to do its work.
+#
+#    clean:
+#        Remove ALL generated files, leaving only source intact.
+#        This will *always* skip files mentioned in the "neverclean" variable,
+#        either in this file or specified in Makefile.ini:
+#
+#        	neverclean := *.pdf *.ps
+#
+#       The neverclean variable works on all "clean" targets below, as well.
+#
+#    clean-graphics:
+#        Remove all generated graphics files.
+#
+#    clean-backups:
+#        Remove all backup files: $(backup_patterns)
+#        (XFig and other editors have a nasty habit of leaving them around)
+#        Also removes Makefile-generated .temp files
+#
+#    clean-tex:
+#        Remove all files generated from LaTeX invocations except dependency
+#        information.  Leaves graphics alone.
+#
+#    clean-deps:
+#        Removes all auto-generated dependency information.
+#
+#    clean-auxiliary:
+#        Removes extra files created by various targets (like the dependency
+#        graph output).
+#
+#    clean-nographics:
+#        Cleans everything *except* the graphics files.
+#
+#    help:
+#        This help text.
+#
+#    version:
+#        Version information about this LaTeX makefile.
+#
+# DEBUG TARGETS:
+#
+#    _all_programs:
+#        A list of the programs used by this makefile.
+#
+#    _check_programs:
+#        Checks your system for the needed software and reports what it finds.
+#
+#    _check_gpi_files:
+#        Checks the .gpi files in the current directory for common errors, such
+#        as specification of the terminal or output file inside of the gpi file
+#        itself.
+#
+#    _dependency_graph:
+#        Outputs a .dot file to stdout that represents a graph of LaTeX
+#        dependencies.  To see it, use the _show_dependency_graph target or
+#        direct the output to a file, run dot on it, and view the output, e.g.:
+#
+#        make _dependency_graph > graph.dot
+#        dot -T ps -o graph.eps graph.dot
+#        gv graph.eps
+#
+#    _show_dependency_graph:
+#        Makes viewing the graph simple: extracts, builds and displays the
+#        dependency graph given in the _dependency_graph target using the value
+#        of the environment-overridable VIEW_POSTSCRIPT variable (currently set
+#        to $(VIEW_POSTSCRIPT)).  The postscript viewer is used because it
+#        makes it easier to zoom in on the graph, a critical ability for
+#        something so dense and mysterious.
+#
+#    _all_sources:
+#        List all .tex files in this directory.
+#
+#    _sources:
+#        Print out a list of all compilable sources in this directory.  This is
+#        useful for determining what make thinks it will be using as the
+#        primary source for 'make all'.
+#
+#    _scripts:
+#        Print out a list of scripts that make knows can be used to generate
+#        .tex files (described later).
+#
+#    _all_stems:
+#        Print a list of stems.  These represent bare targets that can be
+#        executed.  Listing <stem> as a bare target will produce <stem>.pdf.
+#
+#    _includes:
+#        A list of .d files that would be included in this run if _includes
+#        weren't specified.  This target may be used alone or in conjunction
+#        with other targets.
+#
+#    _graphic_outputs:
+#        A list of all generated .eps files
+#
+#    _env:
+#        A list of environment variables and their values.  If supported by
+#        your version of make, also a list of variables known to make.
+#
+# FILE TARGETS:
+#
+#    %, %.pdf:
+#        Build a PDF file from the corresponding %.tex file.
+#
+#        If BUILD_STRATEGY=pdflatex, then this builds the pdf directly.
+#        Otherwise, it uses this old-school but effective approach:
+#
+#            latex -> dvips -> ps2pdf
+#
+#        The BUILD_STRATEGY can be overridden in Makefile.ini in the same
+#        directory.  The default is pdflatex.
+#
+#        Reasons for using latex -> dvips include the "psfrag" package, and the
+#        generation of postscript instead of PDF.  Arguments for using pdflatex
+#        include "new and shiny" and "better supported."  I can't argue with
+#        either of those, and supporting them both didn't turn out to be that
+#        difficult, so there you have it.  Choices.
+#
+#    %._show:
+#        A phony target that builds the pdf file and then displays it using the
+#        environment-overridable value of VIEW_PDF ($(VIEW_PDF)).
+#
+#    %._graphics:
+#        A phony target that generates all graphics on which %.pdf (or %.dvi)
+#        depends.
+#
+#    %.ps (only for BUILD_STRATEGY=latex):
+#        Build a Postscript file from the corresponding %.tex file.
+#        This is done using dvips.  Paper size is automatically
+#        extracted from the declaration
+#
+#        \documentclass[<something>paper]
+#
+#        or it is the system default.
+#
+#        If using beamer (an excellent presentation class), the paper
+#        size is ignored.  More on this later.
+#
+#    %.dvi (only for BUILD_STRATEGY=latex):
+#        Build the DVI file from the corresponding %.tex file.
+#
+#    %.ind:
+#        Build the index for this %.tex file.
+#
+#    %.gls:
+#        Build the nomenclature glossary for this %.tex file.
+#
+#    %.nls:
+#        Build the (newer) nomenclature file for this %.tex file.
+#
+#    %.eps:
+#        Build an eps file from one of the following file types:
+#
+#       .dot    : graphviz
+#       .gpi    : gnuplot
+#       .fig    : xfig
+#       .xvg    : xmgrace
+#       .svg    : scalable vector graphics (goes through inkscape)
+#       .png    : png (goes through NetPBM)
+#       .jpg	: jpeg (goes through ImageMagick)
+#       .eps.gz : gzipped eps
+#
+#       The behavior of this makefile with each type is described in
+#       its own section below.
+#
+#    %.pstex{,_t} (only for BUILD_STRATEGY=latex):
+#       Build a .pstex_t file from a .fig file.
+#
+# FEATURES:
+#
+#    Optional Binary Directory:
+#        If you create the _out_ directory in the same place as the makefile,
+#        it will automatically be used as a dumping ground for .pdf (or .dvi,
+#        .ps, and .pdf) output files.
+#
+#        Alternatively, you can set the BINARY_TARGET_DIR variable, either as a
+#        make argument or in Makefile.ini, to point to your directory of
+#        choice.  Note that no pathname wildcard expansion is done in the
+#        makefile, so make sure that the path is complete before going in
+#        there.  E.g., if you want to specify something in your home directory,
+#        use $$HOME/ instead of ~/ so that the shell expands it before it gets
+#        to the makefile.
+#
+#    External Program Dependencies:
+#        Every external program used by the makefile is represented by an
+#        ALLCAPS variable at the top of this file.  This should allow you to
+#        make judgments about whether your system supports the use of this
+#        makefile.  The list is available in the ALL_PROGRAMS variable and,
+#        provided that you are using GNU make 3.80 or later (or you haven't
+#        renamed this file to something weird like "mylatexmakefile" and like
+#        invoking it with make -f) can be viewed using
+#
+#        make _all_programs
+#
+#        Additionally, the availability of these programs can be checked
+#        automatically for you by running
+#
+#        make _check_programs
+#
+#        The programs are categorized according to how important they are and
+#        what function they perform to help you decide which ones you really
+#        need.
+#
+#    Colorized Output:
+#        The output of commands is colorized to highlight things that are often
+#        important to developers.  This includes {underfull,overfull}
+#        {h,v}boxes, general LaTeX Errors, each stage of document building, and
+#        the number of pages in the final document.  The colors are obtained
+#        using 'tput', so colorization should work pretty well on any terminal.
+#
+#        The colors can be customized very simply by setting any of the
+#        LATEX_COLOR_<CONTEXT> variables in your environment (see above).
+#
+#    Predecessors to TeX Files:
+#        Given a target <target>, if no <target>.tex file exists but a
+#        corresponding script or predecessor file exists, then appropriate
+#        action will be taken to generate the tex file.
+#
+#        Currently supported script or predecessor languages are:
+#
+#        sh:     %.tex.sh
+#        perl:   %.tex.pl
+#        python: %.tex.py
+#
+#           Calls the script using the appropriate interpreter, assuming that
+#           its output is a .tex file.
+#
+#           The script is called thus:
+#
+#              <interpreter> <script file name> <target tex file>
+#
+#           and therefore sees exactly one parameter: the name of the .tex
+#           file that it is to create.
+#
+#           Why does this feature exist?  I ran into this while working on
+#           my paper dissertation.  I wrote a huge bash script that used a
+#           lot of sed to bring together existing papers in LaTeX.  It
+#           would have been nice had I had something like this to make my
+#           life easier, since as it stands I have to run the script and
+#           then build the document with make.  This feature provides hooks
+#           for complicated stuff that you may want to do, but that I have
+#           not considered.  It should work fine with included dependencies,
+#           too.
+#
+#           Scripts are run every time make is invoked.  Some trickery is
+#           employed to make sure that multiple restarts of make don't cause
+#           them to be run again.
+#
+#        reST: %.rst
+#
+#           Runs the reST to LaTeX converter to generate a .tex file
+#           If it finds a file names _rststyle_._include_.tex, uses it as
+#           the "stylesheet" option to rst2latex.
+#
+#           Note that this does not track sub-dependencies in rst files.  It
+#           assumes that the top-level rst file will change if you want a
+#           rebuild.
+#
+#    Dependencies:
+#
+#        In general, dependencies are extracted directly from LaTeX output on
+#        your document.  This includes
+#
+#        *    Bibliography information
+#        *    \include or \input files (honoring \includeonly, too)
+#        *    Graphics files inserted by the graphicx package
+#
+#        Where possible, all of these are built correctly and automatically.
+#        In the case of graphics files, these are generated from the following
+#        file types:
+#
+#        GraphViz:      .dot
+#        GNUPlot:       .gpi
+#        XFig:          .fig
+#        XMgrace:       .xvg
+#        SVG:           .svg
+#        PNG:           .png
+#        JPEG:          .jpg
+#        GZipped EPS:   .eps.gz
+#
+#        If the file exists as a .eps already, it is merely used (and will not
+#        be deleted by 'clean'!).
+#
+#        LaTeX and BibTeX are invoked correctly and the "Rerun to get
+#        cross-references right" warning is heeded a reasonable number of
+#        times.  In my experience this is enough for even the most troublesome
+#        documents, but it can be easily changed (if LaTeX has to be run after
+#        BibTeX more than three times, it is likely that something is moving
+#        back and forth between pages, and no amount of LaTeXing will fix
+#        that).
+#
+#        \includeonly is honored by this system, so files that are not
+#        specified there will not trigger a rebuild when changed.
+#
+#    Beamer:
+#        A special TeX source comment is recognized by this makefile (only when
+#        BUILD_STRATEGY=latex, since this invokes psnup):
+#
+#        %%[[:space:]]*BEAMER[[:space:]]*LARGE
+#
+#        The presence of this comment forces the output of dvips through psnup
+#        to enlarge beamer slides to take up an entire letter-sized page.  This
+#        is particularly useful when printing transparencies or paper versions
+#        of the slides.  For some reason landscape orientation doesn't appear
+#        to work, though.
+#
+#        If you want to put multiple slides on a page, use this option and then
+#        print using mpage, a2ps, or psnup to consolidate slides.  My personal
+#        favorite is a2ps, but your mileage may vary.
+#
+#        When beamer is the document class, dvips does NOT receive a paper size
+#        command line attribute, since beamer does special things with sizes.
+#
+#    GNUPlot Graphics:
+#        When creating a .gpi file, DO NOT INCLUDE the "set terminal" or "set
+#        output" commands!  The makefile will include terminal information for
+#        you.  Besides being unnecessary and potentially harmful, including the
+#        terminal definition in the .gpi file makes it harder for you, the one
+#        writing the document, to preview your graphics, e.g., with
+#
+#           gnuplot -persist myfile.gpi
+#
+#        so don't do specify a terminal or an output file in your .gpi files.
+#
+#        When building a gpi file into an eps file, there are several features
+#        available to the document designer:
+#
+#        Global Header:
+#            The makefile searches for the files in the variable GNUPLOT_GLOBAL
+#            in order:
+#
+#            ($(GNUPLOT_GLOBAL))
+#
+#            Only the first found is used.  All .gpi files in the directory are
+#            treated as though the contents of GNUPLOT_GLOBAL were directly
+#            included at the top of the file.
+#
+#            NOTE: This includes special comments! (see below)
+#
+#        Font Size:
+#            A special comment in a .gpi file (or a globally included file) of
+#            the form
+#
+#            ## FONTSIZE=<number>
+#
+#            will change the font size of the GPI output.  If font size is
+#            specified in both the global file and the GPI file, the
+#            specification in the individual GPI file is used.
+#
+#        Grayscale Output:
+#            GNUplot files also support a special comment to force them to be
+#            output in grayscale *no matter what*:
+#
+#            ## GRAY
+#
+#            This is not generally advisable, since you can always create a
+#            grayscale document using the forms mentioned above.  But, if your
+#            plot simply must be grayscale even in a document that allows
+#            colors, this is how you do it.
+#
+#    XFig Graphics:
+#            No special handling is done with XFig, except when a global
+#            grayscale method is used, e.g.
+#
+#                make GRAY=1 document
+#
+#            In these cases the .eps files is created using the -N switch to
+#            fig2dev to turn off color output.  (Only works with eps, not pstex
+#            output)
+#
+#    GraphVis Graphics:
+#            Color settings are simply ignored here.  The 'dot' program is used
+#            to transform a .dot file into a .eps file.
+#
+#            If you want, you can use the dot2tex program to convert dot files
+#            to tex graphics.  The default is to just call dot2tex with no
+#            arguments, but you can change the DOT2TEX definition to include
+#            options as needed (in your Makefile.ini).
+#
+#            Note that, as with pstex, the makefile cannot use latex's own
+#            output to discover all missing dot_t (output) files, since anytime
+#            TeX includes TeX, it has to bail when it can't find the include
+#            file.  It can therefore only stop on the first missing file it
+#            discovers, and we can't get a large list of them out easily.
+#
+#            So, the makefile errors out if it's missing an included dot_t
+#            file, then prompts the user to run this command manually:
+#
+#                make all-dot2tex
+#
+#    GZipped EPS Graphics:
+#
+#        A .eps.gz file is sometimes a nice thing to have.  EPS files can get
+#        very large, especially when created from bitmaps (don't do this if you
+#        don't have to).  This makefile will unzip them (not in place) to
+#        create the appropriate EPS file.
+#
+endef
+
+#
+# DEPENDENCY CHART:
+#
+#digraph "g" {
+#    rankdir=TB
+#    size="9,9"
+#    edge [fontsize=12 weight=10]
+#    node [shape=box fontsize=14 style=rounded]
+#
+#    eps [
+#        shape=Mrecord
+#        label="{{<gpi> GNUplot|<epsgz> GZip|<dot> Dot|<fig> XFig}|<eps> eps}"
+#        ]
+#    pstex [label="%.pstex"]
+#    pstex_t [label="%.pstex_t"]
+#    tex_outputs [shape=point]
+#    extra_tex_files [shape=point]
+#    gpi_data [label="<data>"]
+#    gpi_includes [label="_include_.gpi"]
+#    aux [label="%.aux"]
+#    fls [label="%.fls"]
+#    idx [label="%.idx"]
+#    glo [label="%.glo"]
+#    ind [label="%.ind"]
+#    log [label="%.log"]
+#    tex_sh [label="%.tex.sh"]
+#    rst [label="%.rst"]
+#    tex [
+#        shape=record
+#        label="<tex> %.tex|<include> _include_.tex"
+#        ]
+#    include_aux [label="_include_.aux"]
+#    file_bib [label=".bib"]
+#    bbl [label="%.bbl"]
+#    dvi [label="%.dvi"]
+#    ps [label="%.ps"]
+#    pdf [label="%.pdf"]
+#    fig [label=".fig"]
+#    dot [label=".dot"]
+#    gpi [label=".gpi"]
+#    eps_gz [label=".eps.gz"]
+#
+#    gpi_files [shape=point]
+#
+#    rst -> tex:tex [label="reST"]
+#    tex_sh -> tex:tex [label="sh"]
+#    tex_pl -> tex:tex [label="perl"]
+#    tex_py -> tex:tex [label="python"]
+#    tex -> tex_outputs [label="latex"]
+#    tex_outputs -> dvi
+#    tex_outputs -> aux
+#    tex_outputs -> log
+#    tex_outputs -> fls
+#    tex_outputs -> idx
+#    tex_outputs -> include_aux
+#    aux -> bbl [label="bibtex"]
+#    file_bib -> bbl [label="bibtex"]
+#    idx -> ind [label="makeindex"]
+#    glo -> gls [label="makeindex"]
+#    nlo -> nls [label="makeindex"]
+#    gls -> extra_tex_files
+#    nls -> extra_tex_files
+#    ind -> extra_tex_files
+#    bbl -> extra_tex_files
+#    eps -> extra_tex_files
+#    extra_tex_files -> dvi [label="latex"]
+#    gpi_files -> eps:gpi [label="gnuplot"]
+#    gpi -> gpi_files
+#    gpi_data -> gpi_files
+#    gpi_includes -> gpi_files
+#    eps_gz -> eps:epsgz [label="gunzip"]
+#    fig -> eps:fig [label="fig2dev"]
+#    fig -> pstex [label="fig2dev"]
+#    fig -> pstex_t [label="fig2dev"]
+#    pstex -> pstex_t [label="fig2dev"]
+#    dot -> eps:dot [label="dot"]
+#    dvi -> ps [label="dvips"]
+#    include_aux -> bbl [label="bibtex"]
+#    ps -> pdf [label="ps2pdf"]
+#
+#    edge [ color=blue label="" style=dotted weight=1 fontcolor=blue]
+#    fls -> tex:include [label="INPUT: *.tex"]
+#    fls -> file_bib [label="INPUT: *.aux"]
+#    aux -> file_bib [label="\\bibdata{...}"]
+#    include_aux -> file_bib [label="\\bibdata{...}"]
+#    log -> gpi [label="Graphic file"]
+#    log -> fig [label="Graphic file"]
+#    log -> eps_gz [label="Graphic file"]
+#    log -> dot [label="Graphic file"]
+#    log -> idx [label="No file *.ind"]
+#    log -> glo [label="No file *.gls"]
+#    log -> nlo [label="No file *.nls"]
+#    gpi -> gpi_data [label="plot '...'"]
+#    gpi -> gpi_includes [label="load '...'"]
+#    tex:tex -> ps [label="paper"]
+#    tex:tex -> pdf [label="embedding"]
+#}
+
+#
+# DEPENDENCY CHART SCRIPT
+#
+# $(call output_dependency_graph,[<output file>])
+define output-dependency-graph
+	if [ -f '$(this_file)' ]; then \
+	$(SED) \
+		-e '/^[[:space:]]*#[[:space:]]*DEPENDENCY CHART:/,/^$$/!d' \
+		-e '/DEPENDENCY CHART/d' \
+		-e '/^$$/d' \
+		-e 's/^[[:space:]]*#//' \
+		$(this_file) $(if $1,> '$1',); \
+	else \
+		$(ECHO) "Cannot determine the name of this makefile."; \
+	fi
+endef
+# vim: noet sts=0 sw=8 ts=8
Binary file doc/admin-manual/figures/bsh_logo.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/admin-manual/figures/intevation-logo.eps	Fri Sep 28 12:15:18 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/admin-manual/installation-admin-manual.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,204 @@
+\documentclass[12pt]{scrartcl}
+
+%----------------------------------------------
+% Load packages
+
+\usepackage{a4}
+\usepackage{times}
+\usepackage[latin1]{inputenc}
+\usepackage{fancyhdr}
+%\usepackage{german}
+%\usepackage[marvosym]{eurofont}
+%\usepackage[all, light]{draftcopy}
+%\usepackage{supertabular}
+%\usepackage{colortbl}
+%\usepackage{epsf}
+\usepackage{graphicx}
+\usepackage{lastpage}
+%\usepackage{proposal}
+\usepackage{listings}
+\usepackage[hyperindex=true, bookmarks=true, breaklinks=true,
+colorlinks=true, linkcolor=red,bookmarksopen]{hyperref}
+
+%----------------------------------------------
+% Document DATE and VERSION
+% set these values when releasing a new version
+
+\newcommand{\documentdate}{April 27th, 2010}
+\newcommand{\documentversion}{1.0}
+\newcommand{\documentrevision}{FIXME SVN REV}
+\newcommand{\documentID}{installation-admin-manual.tex}
+%----------------------------------------------
+
+%----------------------------------------------
+% Document TITLE
+\newcommand{\documenttitle}{Generic Viewer -- Installation and Operations}
+
+
+%----------------------------------------------
+% Some parameters for layouting
+
+\paperwidth=21cm
+\hoffset=-0.54cm
+\textwidth=17cm
+
+\paperheight=29.7cm
+\voffset=-1.5cm
+\topmargin=0cm
+\headheight=1cm
+\textheight=24cm
+
+\setcounter{secnumdepth}{4}
+\setcounter{tocdepth}{4}
+
+%----------------------------------------------
+
+\begin{document}
+
+\lstset{ %
+language=sh,
+basicstyle=\ttfamily,       % the size of the fonts that are used for the code
+numbers=left,                   % where to put the line-numbers
+numberstyle=\footnotesize,      % the size of the fonts that are used for the line-numbers
+numbersep=5pt,                  % how far the line-numbers are from the code
+% backgroundcolor=\color{white},  % choose the background color. You must add \usepackage{color}
+showspaces=false,               % show spaces adding particular underscores
+showstringspaces=false,         % underline spaces within strings
+showtabs=false,                 % show tabs within strings adding particular underscores
+frame=single,                   % adds a frame around the code
+tabsize=2,                      % sets default tabsize to 2 spaces
+captionpos=b,                   % sets the caption-position to bottom
+breaklines=true,                % sets automatic line breaking
+breakatwhitespace=false,        % sets if automatic breaks should only happen at whitespace
+title=\lstname,                 % show the filename of files included with \lstinputlisting; also try caption instead of title
+escapeinside={\%*}{*)}          % if you want to add a comment within your code
+% morekeywords={*,...}            % if you want to add more keywords to the set
+}
+
+%-----------------------------------
+% HEADER/FOOTER DEFINITION
+
+% for some pages latex switches back to pagestyle plain :-(
+\fancypagestyle{plain}{%
+	\fancyhf{} % clear all header and footer fields
+	\fancyhead[LO,RE]{\footnotesize \documenttitle\\ \leftmark}
+	\fancyfoot[RO,LE]{\footnotesize Intevation GmbH} % Author
+	\fancyfoot[CO,CE]{\footnotesize \thepage/\pageref{LastPage}}
+	\fancyfoot[LO,RE]{\footnotesize \documentdate
+	\\\documentID}
+	\renewcommand{\footrulewidth}{0.4pt}
+}
+
+% and now define pagestyle fancy
+\fancyhead{} % clear all fields
+\fancyhead[LO]{\footnotesize \documenttitle\\ \leftmark}
+
+\fancyfoot{}% clear all fields
+\fancyfoot[RO]{\footnotesize Intevation GmbH} % Author
+\fancyfoot[CO]{\footnotesize \thepage/\pageref{LastPage}}
+\fancyfoot[LO]{\footnotesize \documentdate
+\\\documentID}
+
+\renewcommand{\footrulewidth}{0.4pt}
+
+%
+% END Header/Footer Definition
+%-----------------------------------
+
+%----------------------------------------------
+% MACRO DEFINITION
+%
+%   \Fig{figure}{lof text}{caption} :
+%			places 'figure' and
+%                       writes 'caption' at the bottom with leading
+%                       'Abbildung figno:'. 'lof text' is added to the list of
+%                       figures.
+%                       Example:
+%                       \Fig{\epsfxsize30mm \epsffile{x.eps}}{the x}{the x}
+%
+%   \FigNoEntry{}{} :
+%			same as above, no entry in figures list
+%
+%   \FigCaption{} :
+%			line with figure caption, setting figure
+%                       counter and figures list
+%
+%   \Tab{table}{lot text}{caption} :
+%			places 'table' and writes caption on top of the table
+%			with leading 'Tabelle tabno:'. 'lot text' is added to
+%			the list of tables.
+%****************************************************************************
+%       Figure makro for graphics continously enumerated.
+%
+
+\newcounter{FigCnt}
+\newcounter{TabCnt}
+
+\newcommand{\Fig}[3]%
+{
+        \refstepcounter{FigCnt}
+        \addcontentsline{lof}{figure}%
+                {\protect\numberline{\arabic{FigCnt}}{#2}}
+        \mbox{#1}
+
+\nopagebreak
+        {Abbildung \arabic{FigCnt}: #3}
+
+}
+
+\newcommand{\FigNoEntry}[2]%
+{
+        \refstepcounter{FigCnt}
+        \mbox{#1}
+
+\nopagebreak
+        {Abbildung \arabic{FigCnt}: #2}
+
+}
+
+\newcommand{\FigCaption}[1]%
+{
+        \refstepcounter{FigCnt}
+        \addcontentsline{lof}{figure}%
+                {\protect\numberline{\arabic{FigCnt}}{#1}}
+
+        %{Figure \thesection.\arabic{FigCnt}: #1}
+}
+
+\newcommand{\Tab}[3]%
+{
+        \refstepcounter{TabCnt}
+        \addcontentsline{lot}{figure}%
+                {\protect\numberline{\arabic{TabCnt}}{#2}}
+        {Tabelle \arabic{TabCnt}: #3}
+\nopagebreak
+        #1
+
+}
+
+\hyphenation{Intevation}
+% end macro definition
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcounter{schritt}
+\renewcommand{\theschritt}{\Roman{schritt}}
+%\makeatletter\renewcommand{\p@schritt}{Abschnitt~\thesubsubsection~}\makeatother
+
+%-----------------------------------
+% DOCUMENT SETTINGS
+\pagestyle{fancy}
+\setlength{\parindent}{0cm}
+\setlength{\parskip}{5pt plus 2pt minus 1pt}
+
+% Start actual content here
+\include{title}
+\newpage
+\tableofcontents
+\include{overview}
+\include{installation-base}
+\include{installation-artifact-server}
+\include{installation-webclient}
+\include{operating-the-system}
+
+\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/admin-manual/installation-artifact-server.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,139 @@
+\subsection{Artifact-Server}
+The Artifact-Server contains the entire business logic of the system.
+The server provides a RESTful interface with a XML-based protocol to the
+webclient. Technically the server is a standalone java process serving the
+REST interface.
+
+\subsubsection*{Installation}
+\label{ref:artifact-server-install}
+
+Running the server with its own user\footnote{Remark: A group with the
+same name is created automatically.}: 
+\begin{lstlisting}
+  adduser artifacts
+\end{lstlisting}
+
+Setup and configuring logging:
+\begin{lstlisting}
+  cd /var/log
+  mkdir artifacts
+  chown -r root:artifacts artifacts
+  chmod 770 artifacts
+  chmod g+s artifacts
+\end{lstlisting}
+
+The log level can be adjusted in the file \verb+ conf/log4j.properties+.
+Further information can be found there.
+
+Integrate software of artifact-server into filesystem:
+\begin{lstlisting}
+  cd /opt
+  tar xfvj /root/artifact-server-$VERSION.tar.bz2
+  ln -s artifact-server-$VERSION artifact-server
+  cd artifact-server
+\end{lstlisting}
+
+Setting the access rights:
+\begin{lstlisting}
+   bin/setup.sh
+\end{lstlisting}
+
+Configure connection to database:
+\begin{lstlisting}
+  cd /opt/artifact-server
+  vim conf/arcsdeconnectionpool.properties
+  
+  # in conf/arcsdeconnectionpool.properties do:
+  server=xyz.server.com
+  username=guest
+  credentials=XYZ
+  port=5151
+  database=esri_sde
+\end{lstlisting}
+
+Configure address for finding the WMS-Server:
+\begin{lstlisting}
+  cd /opt/artifact-server/
+  vim conf/conf.xml
+  # adapt the address in the element
+  # artifact-database/gnv/mapserver/server. This is
+  # the string the server uses to provide an address of the mapserver to enduser.
+  e.g. http://SERVER/cgi-bin/gnv-wms
+\end{lstlisting}
+
+The artifact server can export and import projects of the user's
+parameterizations. In order to protect the server against invalid files,
+configure a secret for signing artifacts.
+
+{\em Hint: If the secret is changed, all files that were created before
+are not valid anymore.}
+
+\begin{lstlisting}
+  # generate a randomized string, e.g.
+  cd /opt/artifact-server/
+  pwgen -s 30
+  # populate the tag artifact-database/export-secret
+\end{lstlisting}
+
+Adapt TCP-port of artifact-server, if the default has to be changed
+(default:8181):
+\begin{lstlisting}
+  cd /opt/artifact-server
+  vim conf/conf.xml
+  
+  # in conf/conf.xml edit the element artifact-database/rest-server/port
+\end{lstlisting}
+
+Integrate artifact-server in startup-process of operating system:
+\begin{lstlisting}
+  cp -i /opt/artifact-server/install/debian/artifact-server/artifact-server-init-scipt 
+        /etc/init.d/artifact-server
+  chmod +x /etc/init.d/artifact-server
+  update-rc.d artifact-server defaults
+\end{lstlisting}
+
+The server can be started and stopped via
+\begin{lstlisting}
+  /etc/init.d/artifact-server {start | stop}
+\end{lstlisting}
+
+The installation of the artifact-server is finished. It can be tested
+now.
+
+\subsubsection*{Test of the Installation}
+\label{ref:artifact-server-testing}
+  Start the server:
+  \begin{lstlisting}
+  /etc/init.d/artifact-server start
+  \end{lstlisting}
+  
+  1. Operating System: Check if the process of the server called "App"
+  is running:
+  \begin{lstlisting}
+  jps
+  
+  # Example with list of java processes:
+  19252
+  19509 Jps
+  19441 App
+
+  cat /var/run/artifact-server.pid
+  \end{lstlisting}
+
+  Task: Compare the running process numbers.
+
+  2. Network: Check if the artifact-server opens a TCP-port (default: 8181)
+  \begin{lstlisting}
+  netstat -nltp | grep 8181
+  
+  # Check for an entry like:
+  tcp        0      0 127.0.0.1:8181          0.0.0.0:*  LISTEN 18648/java
+  \end{lstlisting}
+
+  3. Artifact-Server ready for communication with client?
+  \begin{lstlisting}
+  curl "http://localhost:8181/factories" | xmllint --format -
+  \end{lstlisting}
+  
+  Task: Check for a XML-document describing possible expert information
+  systems (FIS)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/admin-manual/installation-base.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,414 @@
+\section{Installation and Configuration}
+
+This section describes preconditions for the entire system and an installation
+on a Debian 5.0.x (Lenny) for the GNV-System without an running X-Environment.
+Mostly, the debian package management\footnote{Further information at
+\url{http://www.debian.org/doc/manuals/debian-reference/ch02.en.html}}
+using \verb+ aptitude+ is used in this manual.
+
+If existing configurations have to be changed, the following notation will be
+used: \verb|+| for adding a line replacing the marked by \verb|-|.
+
+\subsection{Preconditions}
+
+\subsubsection*{System}
+
+\begin{itemize}
+  \item Storage for the delivered software: 100 MB
+  \item Current processor on a 32-bit Architecture (Beginning
+    2010)\footnote{Running on a 64-bit system should work out of the box
+    and improve scalibility issues (not tested yet).}
+  \item RAM: 1 GB for production as minimum.\footnote{This value depends
+    mainly on the amount of connected users.}
+  \item Network access to Database Backend
+  \item RW-Access to the filesystem for logging, shapefile-export,
+    caching
+\end{itemize}
+
+\subsubsection*{Database: Software and Data}
+
+The software has been developed for the following system:
+
+\begin{itemize}
+  \item ESRI ArcSDE 9.3.1 on Oracle 10.2\footnote{The development
+    started in ESRI ArcSDE 9.2. There are known
+    problems with this version.}
+  \item ArcMarineBSH, model package "Time Series and Measurements"
+  \item ArcMarineBSH, model package " MeshFeature"
+  \item ArcMarineBSH, model package "Marine Feature"
+  \item ArcS57 -- International Hydrographic Organization (IHO) S-57 for
+    ENC Data Model. - ESRI Data Models. http://support.esri.com/datamodels
+  \item CONTIS -- Federal Maritime and Hydrographic Agency (BSH). Continental 
+    Shelf Information System -- \\
+    \url{http://www.bsh.de/en/Marine\_uses/Industry/CONTIS\_maps/index.jsp}
+  \item GNV specific schema MapViewer interface -- Schema for integrating with MapViewer and
+    their WMS services
+  \item GNV specific schema for managing the cache -- The central
+    dataware house is updated regulary. To keep the cache up-to-date,
+    needs to cleaned after database updates.
+\end{itemize}
+
+
+\subsection{Operating System}
+
+{\em Hint}: Configuring of partitions, firewalls, etc. for the system is out of
+the scope of this documentation.
+
+\subsection{Preparations}
+
+In some steps it is required to use templates wich are packed in
+\verb+ artifact-server-$VERSION.tar.bz2+ to get access to those files.
+
+Please extract the tar.bz2 file as explained in 
+Chapter~\ref{ref:artifact-server-install},
+ p.~\pageref{ref:artifact-server-install}.
+
+The complete document use the system-variable \verb+$ARTIFACT_SERVER_HOME+
+to refer the root-directory of the Artifac-Server.
+It might be helpful to export this variable using the following command:
+
+\verb+ export ARTIFACT_SERVER_HOME=/opt/artifact-server+ 
+
+\subsection{Java Environment}
+
+\subsubsection*{Installation Sun Java 6}
+
+This GNV-system is developed for Sun Java 6. 
+
+Add non-free packages of the Debian distribution to the system in
+\verb+/etc/apt/sources.list+:
+
+\begin{lstlisting}
+  [...]
+  deb http://ftp.de.debian.org/debian/ lenny main non-free
+  deb-src http://ftp.de.debian.org/debian/ lenny main
+
+  deb http://security.debian.org/ lenny/updates main
+  deb-src http://security.debian.org/ lenny/updates main
+  [...]
+\end{lstlisting}
+
+
+Install Sun Java 6 and its dependencies by executing the following:
+
+\begin{lstlisting}
+   apt-get update
+   apt-get install sun-java6-jdk
+\end{lstlisting}
+
+\subsubsection*{Install Native Components for Java6 (optional)}
+
+This step is optional but recommended\footnote{For background
+information, c.f. \url{http://tomcat.apache.org/tomcat-5.5-doc/apr.html}}.
+
+For a better support of the native server technologies, the package
+\verb+libtcnative+ can be installed.
+
+\begin{lstlisting}
+  apt-get install libtcnative-1
+  cd /usr/lib/jvm/java-6-sun/jre/lib/i386/client
+  ln -s /usr/lib/libtcnative-1.so
+\end{lstlisting}
+
+\subsubsection*{Configuration}
+
+To ensure that the Apache Tomcat and the GNV Artifact-Server will use
+Sun Java 6 exclusively, switch to the default Java version
+globally\footnote{This manual assumes that there are no other packages
+depending to another Java version.}.
+
+Use  \verb+update-alternatives+ mechanism of the Debian
+system\footnote{Background information: {\tt man update-alternatives}}, execute:
+
+\verb+ update-alternatives --list java+
+
+Lists all installed Java-Environments. E.g.:
+ 
+\begin{lstlisting}
+  Auswahl      Alternative
+  -----------------------------------------------
+            1    /usr/bin/gij-4.3
+   +        2    /usr/lib/jvm/java-gcj/jre/bin/java
+            3    /usr/lib/jvm/java-1.5.0-sun/jre/bin/java
+   *        4    /usr/lib/jvm/java-6-sun/jre/bin/java
+\end{lstlisting}
+
+
+\verb+update-alternatives --config java+
+
+Opens a dialog to reconfigure the java version which should be used as default.
+Type the Number of the the java which should be used.
+For the example above, type "4".
+
+\subsubsection*{Test of the Installation}
+
+Execute \verb+ java -version+
+
+Check if a version of 1.6.0* has been set. Check:
+
+\begin{lstlisting}
+  java version  "1.6.0_20-b02"
+  Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
+  Java HotSpot(TM) Server VM (build 11.2-b01, mixed mode)
+\end{lstlisting}
+
+
+\subsection{Tomcat Application Server}
+To run the GNV-System a Apache Tomcat Server Version 5.5 is required.
+This section describes the steps for installing and configuring
+Apache Tomcat.
+
+\subsubsection*{Installation}
+
+To install the Tomcat Application-Server and its dependencies, execute:
+
+\verb+ apt-get install tomcat5.5+
+
+\subsubsection*{Configuration}
+
+Adapt some run-time specific properties in
+\verb+/etc/default/tomcat5.5+:
+
+\begin{lstlisting}
+   - #JAVA_HOME="/usr/lib/jvm/java-6-sun/"
+   + JAVA_HOME="/usr/lib/jvm/java-6-sun/"
+   
+   - #JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"
+   + JAVA_OPTS="-Djava.awt.headless=true -Xmx1024m -server"
+
+   - #TOMCAT5_SECURITY=yes
+   + TOMCAT5_SECURITY=no
+\end{lstlisting}
+
+{\bf Hint: As there is no Java security policy for the GNV WebClient,
+Java Security Management is switched off.}
+
+The Apache Tomcat is integrate with Apache WebServer just via the Apache
+JServ Protocoll (AJP). To secure the connection, just local connections
+are allowed for AJP on Tomcat\footnote{For background information, c.f.
+\url{http://tomcat.apache.org/tomcat-5.5-doc/connectors.html}}.
+
+Modify the \verb+ /etc/tomcat5.5/server.xml+:
+\begin{lstlisting}
+
+    # Deactivate Standard HTTP Connector:
+
+    +<!--
+     <Connector port="8180" maxHttpHeaderSize="8192" address="127.0.0.1"
+                maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
+                enableLookups="false" redirectPort="8443" acceptCount="100"
+                connectionTimeout="20000" disableUploadTimeout="true" />
+    +-->
+ 
+     - <Connector port="8009" 
+     -           enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
+ 
+     + <Connector port="8009" 
+     +           enableLookups="false" redirectPort="8443" protocol="AJP/1.3" address="127.0.0.1"/>
+\end{lstlisting}
+ 
+To activate these changes, restart  Apache Tomcat:
+ 
+\verb+ /etc/init.d/tomcat5.5 restart+
+
+ \subsubsection*{Test of the Installation}
+
+Check if the port 8009 is opened via:
+\verb+ netstat -nltp | grep 8009+
+
+A possible listing looks like this:
+\begin{lstlisting}
+  tcp        0      0 127.0.0.1:8009          0.0.0.0:*  LISTEN      19252/jsvc
+\end{lstlisting}
+ 
+So fare, there is no commandline client for AJP to test the connection.
+If there are problems, setup \verb+ mod_jk+ module in Apache WebServer
+and check its according log files.
+
+\subsection{Apache Webserver}
+This section describes the required steps for the installation and configuration 
+of the Apache Webserver Version 2.2. Apache WebServer controls all
+HTTP-Connections to the outside of the system. Apache Tomcat is
+integrated via mod\_jk.
+
+\subsubsection*{Installation}
+
+To install the Apache Webserver you have to execute the following command:
+
+\verb+ apt-get install apache2+
+
+To establish the connection between the Tomcat application server and
+Apache Webserver an additional Module "mod\_jk" has to be installed.
+
+\verb+ apt-get install libapache2-mod-jk+
+
+\subsubsection*{Configuring mod\_jk}
+
+Edit the settings for mod\_jk in
+file \verb+ /etc/libapache2-mod-jk/workers.properties+. For further
+information, there are comments in the configuration file\footnote{Background
+information can be found at \\
+\url{http://tomcat.apache.org/connectors-doc/generic\_howto/workers.html}}.
+
+
+\begin{lstlisting}
+  - workers.java_home= /usr/lib/jvm/java-gcj/
+  + workers.java_home=/usr/lib/jvm/java-6-sun
+\end{lstlisting}
+
+In file \verb+ /etc/apache2/httpd.conf+:
+
+\begin{lstlisting}
+  + JkWorkersFile "/etc/libapache2-mod-jk/workers.properties"
+  + JkLogFile "/var/log/mod_jk.log"
+\end{lstlisting}
+
+After finishing the configuration, enable the module in Apache
+WebServer: \verb+ a2enmod jk+ and restart the server 
+\verb+ /etc/init.d/apache2 restart+.
+
+
+\subsubsection*{Publish the site in Apache WebServer}
+
+Depending of the existing configuration of Apache WebServer, the
+following steps can differ. In this case, a vanilla configuration is
+assumed\footnote{Background information about Apache WebServer can
+be found at \url{http://httpd.apache.org/docs/2.2/}}.
+
+Disable default configuration
+\verb+ a2dissite default+
+
+Adapt eMail-address for configuration in 
+\verb+ $ARTIFACT_SERVER_HOME/install/debian/apache2/gnv+.
+
+Enable the specific site (VirtualHost) in Apache WebServer:
+\begin{lstlisting}
+  cp -i $ARTIFACT_SERVER_HOME/install/debian/apache2/gnv to /etc/apache2/sites-available
+  # Activate site for GNV
+  a2ensite gnv
+  /etc/init.d/apache reload
+\end{lstlisting}
+
+
+\subsubsection*{Test of the Installation}
+
+You can test the installation by executing the following url:
+
+\verb+ curl "http://localhost/gnv/" -o test+
+
+After a successful installation, the file {test} will contain HTML describing
+the startpage of the GNV WebClient.
+
+
+\subsection{UMN MapServer: Installation and configuration}
+The UMN MapServer is part of the artifact server. It is responsible for
+rendering shapefiles produced by the artifact-server and publish them as
+OGC Web Map Service.
+
+\subsubsection*{Installation}
+It is recommended to use a more recent version than the one in Debian
+Lenny. In the installation package, there is a debian package of
+MapServer that should be installed.
+
+In order to verify the integrity of the installation package, it is necessary to import 
+a GPG-Key which was used to sign the packages:
+
+\begin{lstlisting}
+gpg --keyserver hkp://keys.gnupg.net --recv-keys EC70B1B8
+gpg --export EC70B1B8 | apt-key add -
+\end{lstlisting}
+
+Installing the mapserver-gp and its dependencies, executing the following command:
+
+\begin{lstlisting}
+cd $ARTIFACT_SERVER_HOME/install/debian/umn-mapserver
+dpkg -i cgi-mapserver-gp_5.6.3-1~gp+1_i386.deb
+\end{lstlisting}
+
+If there are libraries which are required by the Mapserver but not
+installed yet run the following command:
+\begin{lstlisting}
+apt-get -f install
+\end{lstlisting}
+
+
+Provide a possibility to integrate Mapserver properly and transfer
+configurations to MapServer during runtime:
+
+\begin{lstlisting}
+cd /usr/lib/cgi-bin
+cp -i $ARTIFACT_SERVER_HOME/install/debian/umn-mapserver/gnv-wms .
+chmod +x gnv-wms
+\end{lstlisting}
+
+For setting proper contact details in the WMS Capabilities response,
+edit the file \verb+ $ARTIFACT_SERVER_HOME/conf/maptemplates/mapfile.vm+
+in the section WEB $\rightarrow$ METADATA.
+
+The Mapserver will need fonts for rendering lables in the map.
+To provide this it is required to install the freefonts.
+\begin{lstlisting}
+apt-get install ttf-freefont
+\end{lstlisting}
+
+
+\subsubsection*{Test of installation}
+Check for a sucessful installation via:
+
+\begin{lstlisting}
+cd root
+curl \
+"http://localhost/cgi-bin/gnv-wms" \
+-o mapserver
+\end{lstlisting}
+
+For a sucessful configuration, the response document \verb+ mapserver+
+contains a Value which contains the following message of the mapserver.
+
+TODO: QUERYSTRING WAS EMPTY HINZUFUEGEN
+
+\subsection{Proxy-Script: Installation and Configuration}
+The Proxy-Script is required to allow the Map-Client to request external
+services. Security policies forbit and prevent requesting those services - like
+a GetFeatureInfo request - directly.
+
+\subsubsection{Installation}
+
+First make sure that python is installed on the operating system.
+Otherwise install python using the following command:
+
+\verb+ apt-get install python+
+
+Then the script itself must be published on the server by executing the
+following steps:
+
+\begin{lstlisting}
+cd /usr/lib/cgi-bin
+cp -i $ARTIFACT_SERVER_HOME/install/debian/ol-proxy/proxy.cgi .
+\end{lstlisting}
+
+\subsubsection{Configuration}
+The Proxy-Script can only communicate with servers it is allowed to.
+To enable the communication to the server where the UMN-Mapserver is hosted
+or to other Server it is necessary to edit {\tt allowedHosts} in the
+Proxy-Script at line 18.
+
+There you have to replace the placeholder THISHOSTNAME with the name which
+will be used to reach the GNV-Web-Client.
+
+You can add further servers using the syntax which is given in the script.
+
+\subsubsection{Test of installation}
+
+It is possible to test the installation using the following command:
+
+\begin{lstlisting}
+curl http://localhost/cgi-bin/proxy.cgi?url=http%3A%2F%2Flocalhost/cgi-bin/mapserv-gp
+\end{lstlisting}
+
+If localhost is allowed in the proxy-script the result might be this:
+
+\begin{lstlisting}
+TODO: QUERYSTRING WAS EMPTY HINZUFUEGEN
+\end{lstlisting}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/admin-manual/installation-webclient.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,52 @@
+\subsection{GNV-WebClient}
+The last step of the installationprcess is to install the WebClient called
+GNV-Client. The GNV-Client is a web Application ARchive (WAR) which has to be published
+via Apache Tomcat.
+
+
+\subsubsection*{Installation}
+
+Make sure, the Apache Tomcat is stopped. Deploying the
+WAR-file\footnote{There are several ways of deployment in Apache Tomcat.
+Background information can be found at
+\url{http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html}}:
+\begin{lstlisting}
+  cp -i gnv-\$VERSION.war /usr/share/tomcat5.5/webapps/gnv.war
+  # Start Tomcat:
+  /etc/init.d/tomcat5.5 start
+\end{lstlisting}
+
+
+\subsubsection*{Configuration}
+\label{ref:webclient-config}
+
+As default, the GNV-Client looks for an artifact-server running on
+\verb+ http://localhost:8181/+. If this address needs not to be changed,
+there is nothing to do to considering the execution environment.
+
+If the address of the artifact-server has been changed (c.f.
+chapter~\ref{ref:artifact-server-install},
+p.\pageref{ref:artifact-server-install}), it can be adapted in the file {\tt
+WEB-INF/web.xml} for the parameter name 
+\verb+de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.url.1+.
+
+As default log information is written into the file
+\verb+/usr/share/tomcat5.5/logs/gnv.log+. The log level can be adjusted
+in the file \verb+WEB-INF/classes/log4j.properties+. For further
+instructions look into the file.
+
+{\em Hint: The changes need to be done within the compressed
+war-file because of the deployment mechanism of Apache Tomcat in case of
+a restart. Keep in mind to repackage the war-file for a solution
+surveiving a restart of Tomcat.}
+
+
+\subsubsection*{Test of the Installation}
+
+Testing the installation via Apache WebServer, mod\_jk and Apache Tomcat:
+\begin{lstlisting}
+  curl "http://localhost/gnv/start.do" -o gnv
+\end{lstlisting}
+
+The file \verb+gnv+ includes HTML describing the startpage of the
+GNV-WebClient.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/admin-manual/operating-the-system.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,135 @@
+\section{Management of operational processes}
+
+For running the entire GNV-system the following components have to be
+available in the described sequence:
+\begin{enumerate}
+  \item Database server 
+  \item Artifact-server
+  \item Apache Tomcat running the WebClient
+  \item Apache WebServer
+\end{enumerate}
+
+During a server startup the installed components get started
+automatically.
+
+\subsection{Managing the Artifact Server}
+
+\subsubsection*{Starting and Stopping}
+
+The artifact-server can be restarted without stopping the WebClient.
+During the restart-process client accessing the server get an approriate
+message. Their session data will not be lost if the artifact database
+will remain untouched.
+
+  Stopping artifact-server:
+  \begin{lstlisting}
+  /etc/init.d/artifact-server stop
+  \end{lstlisting}
+
+  Starting artifact server
+  \begin{lstlisting}
+  /etc/init.d/artifact-server start
+  \end{lstlisting}
+  
+  Restarting artifact server
+  \begin{lstlisting}
+  /etc/init.d/artifact-server restart
+  \end{lstlisting}
+
+\subsubsection*{Troubleshooting}
+
+\paragraph*{Database problems}
+For checking problems with the connection to the database server, check
+the logfile of the artifact-server (c.f.
+Chapter~\ref{ref:artifact-server-install}, 
+p.~\pageref{ref:artifact-server-install}).
+
+In most cases, a restart of the artifact-server will help to solve
+problems in the artifact-server. If you still encounter problems, check
+for the network connection to the database server and the maturity of
+the database server.
+
+\paragraph*{Caching problems}
+Inconsistencies between original data and cached data:
+The artifact-server stores result sets of the database in a cache and
+provides maps via configuration files for MapServer based on shapefiles.
+In case of inconsistencies showing up for longer than twice the
+maximum of the update cycle of internal ETL processes, do the following
+as user \verb+root+:
+
+\begin{lstlisting}
+  cd /opt/artifact-server
+  /etc/init.d/artifact-server stop
+  rm -ri cache/*
+  /etc/init.d/artifact-server start
+\end{lstlisting}
+
+\subsection{Managing the GNV-Client}
+\subsubsection*{Start Stop Restart}
+
+The GNV-WebClient can be managed by controlling Apache Tomcat instance:
+
+ Status GNV-WebClient
+ \begin{lstlisting}
+   /etc/init.d/tomcat5.5 status
+ \end{lstlisting}
+
+ Stopping GNV-WebClient
+ \begin{lstlisting}
+   /etc/init.d/tomcat5.5 stop
+ \end{lstlisting}
+
+ Starting GNV-WebClient
+ \begin{lstlisting}
+   /etc/init.d/tomcat5.5 start
+ \end{lstlisting}
+
+ Restarting GNV-WebClient
+ \begin{lstlisting}
+   /etc/init.d/tomcat5.5 restart
+ \end{lstlisting}
+
+\subsubsection*{Troubleshooting}
+
+If the GNV-WebClient can not be accessed through the Apache WebServer, do the
+following:
+\begin{lstlisting}
+  1. /etc/init.d/apache2 restart
+  2. Check in your browser at http://$SERVERNAME/gnv
+\end{lstlisting}
+
+If you still encounter problems, follow the next these steps:
+
+{\bf Caution: The entire application will be down until the WebServer is
+back up.}
+\begin{lstlisting}
+  /etc/init.d/apache2 stop
+  /etc/init.d/tomcat5.5 stop
+  rm -r /usr/share/tomcat5.5/work/Catalina/localhost/gnv/*
+  /etc/init.d/tomcat5.5 start # wait until tomcat is up
+  /etc/init.d/apache2 start
+\end{lstlisting}
+
+For further information, you look into the log information during the use of the
+GNV WebClient
+\begin{lstlisting}
+  tail -f -n 50 /usr/share/tomcat5.5/logs/gnv.log
+\end{lstlisting}
+
+To get even more logging, do the following:
+
+{\bf Caution: The entire application will be down until the Apache Tomcat
+has been started properly; the higher log-level can affect the
+runtime-behaviour of the client. For further instructions, c.f.
+Chapter~\ref{ref:webclient-config}, p.~\pageref{ref:webclient-config}.}
+
+\begin{lstlisting}
+  /etc/init.d/tomcat5.5 stop
+  Set logging to DEBUG 
+  vim /usr/share/tomcat5.5/webapps/gnv/WEB-INF/classes/log4j.properties
+  /etc/init.d/tomcat5.5 start # wait until tomcat is up
+  tail -f -n 50 /usr/share/tomcat5.5/logs/gnv.log
+\end{lstlisting}
+
+It is recommended to undo the logging configuration, after the relevant
+part has been found.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/admin-manual/overview.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,72 @@
+\section{Overview of the GNV-System}
+
+The GNV systems consists of the mainly 4 components, serving the
+following tasks:
+
+% TODO: Add architecture of the system in english
+
+\begin{enumerate}
+\item Artifact-Server \\
+The Artifact-Server is a middleware component, managing the core tasks:
+\begin{itemize}
+   \item Access to the database backend
+   \item Providing a RESTful-Interface with a XML-based protocol to serve
+   the expert information systems (FIS) with their products
+   \item (diagrams like timeseries, verticalprofile, map layers) to make
+   them accessable for the GNV-WebClient
+   \item Processing of data for interpolation, classification and vectorisation
+   \item Configuration capabilities for FIS and products
+   \item Caching database result sets
+   \item Managing the WMS-Server for creating maps dynamically
+\end{itemize}
+
+\item Database Backend \\
+Database schemata like ESRI ArcMarineBSH, ArcS57 and CONTIS can be
+served out of a ESRI ArcSDE 9.3.1 database.
+
+\item WMS-Server \\
+The WMS-Server provides maps via the standardized interface of the OGC
+Web Map Service. The configuration is managed through the
+artifact-server depending on the parameterization done be the user in
+the GNV-WebClient
+
+\item GNV-WebClient \\
+The GNV-WebClient is a thin webbased client providing a HTML-based user
+interface for the user to parameterize the FIS and products via the
+XML-based protocol provided by the artifact-server through its
+RESTful-interface. Within the client the user can manage these tasks:
+\begin{itemize}
+  \item Select FIS, producs and their parameterisation
+  \item Visualize different diagrams like timeseries, vertical- and
+horizontalprofiles, vertical and horizontal cross-sections and map
+layers
+  \item Calculate and visualize (histograms) statistics
+  \item Export diagrams for printing in PNG, SVG, vectorized PDFs
+  \item Export data as in raw formats like CSV, Ocean Data View (ODV) and
+ESRI Shapefiles
+\end{itemize}
+
+The GNV-WebClient can be integrated with different MapViewers. The
+GNV-WebClients supports a XML-based interface to the MapViewers
+describung geometrical data and information about
+used layers in order to adapt the selection of FIS and areas of interest
+for the parameterization.
+\end{enumerate}
+
+The systems has been designed as a distributed system. This manual
+descibes the installation of a centralized system on one server for the
+middleware and an existing database server.
+
+\section{Deliverables}
+\begin{enumerate}
+  \item \verb+ artifact-server-$VERSION.tar.bz2+ -- Artifact-Server of the 
+    GNV-System as package for installation
+  \item \verb+ gnv-$VERSION.war+ -- Web Application Archive for
+    deploying in Apache Tomcat
+  \item \verb| cgi-mapserver-gp_5.6.3-1~gp+1_i386| -- UMN MapServer
+    5.6.3 (in Debian Lenny, UMN MapServer 5.0.3)
+  \item \verb+ installation-admin-manual.pdf+ -- this document
+  \item \verb+ configuration-manual.pdf+ -- Explaining the configuration
+    possibilities for the GNV-System in order to adapt FIS and products
+    (diagrams and maps) according to the database schema
+\end{enumerate}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/admin-manual/title.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,51 @@
+%-----------------------------------
+% TITLE PAGE
+
+\begin{figure}[ht]
+  \begin{minipage}[b]{0.5\linewidth}
+    \centering
+    \includegraphics[scale=0.75]{figures/bsh_logo} \\
+     {\tt http://www.bsh.de/en}\\[4.0cm]
+  \end{minipage}
+  \begin{minipage}[b]{0.5\linewidth}
+    \centering
+    \includegraphics[width=0.75\textwidth]{figures/intevation-logo}
+     {\tt http://intevation.de/geospatial}\\[2.0cm]
+  \end{minipage}
+\end{figure}
+
+ \vspace{4cm}
+ 
+ {
+ 	\sffamily\large
+ 	Documentation Generic  Viewer
+ 
+ 	\vspace{1cm}
+ 	{
+ 		\bfseries\huge
+ 		Installation and Operations
+ 	}
+ 
+ 	\vspace{1cm}
+ 	Version \documentversion~-~Date: \documentdate
+ 
+ 	%% Revision \documentrevision
+ }
+ 
+ \vspace{4cm}
+ 
+ \thispagestyle{empty}
+ 
+ \vfill
+ 
+ \begin{flushleft}
+ {\bf Authors}:\\
+ Tim Englich$<$tim.englich@intevation.de$>$\\
+ Hans Plum $<$hans.plum@intevation.de$>$\\
+ Sascha Teichmann $<$sascha.teichmann@intevation.de$>$\\
+ {\bf Intevation GmbH},\\
+ Neuer Graben 17, 49074 Osnabrück, Germany\\
+ Tel: ++49 541 33 50 83 - 0 \\
+ \url{http://www.intevation.net/geospatial}
+ 
+ \end{flushleft}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/Makefile	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,3492 @@
+# Copyright 2004 Chris Monson (shiblon@gmail.com)
+# Latest version available at http://www.bouncingchairs.net/oss
+#
+#    This file is part of ``Chris Monson's Free Software''.
+#
+#    ``Chris Monson's Free Software'' is free software; you can redistribute it
+#    and/or modify it under the terms of the GNU General Public License as
+#    published by the Free Software Foundation, Version 2.
+#
+#    ``Chris Monson's Free Software'' is distributed in the hope that it will
+#    be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
+#    Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with ``Chris Monson's Free Software''; if not, write to the Free Software
+#    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#    It is also available on the web at http://www.gnu.org/copyleft/gpl.html
+#
+#    Note that using this makefile to build your documents does NOT place them
+#    under the GPL unless you, the author, specifically do so.  In other words,
+#    I, Chris Monson, the copyright holder and author of this makefile,
+#    consider it impossible to ``link'' to this makefile in any way covered by
+#    the GPL.
+#
+# TO OBTAIN INSTRUCTIONS FOR USING THIS FILE, RUN:
+#    make help
+#
+fileinfo	:= LaTeX Makefile
+author		:= Chris Monson
+version		:= 2.2.0-rc1
+#
+# Note that the user-global version is imported *after* the source directory,
+# so that you can use stuff like ?= to get proper override behavior.
+.PHONY: Makefile GNUmakefile Makefile.ini $(HOME)/.latex-makefile/Makefile.ini
+-include Makefile.ini
+-include $(HOME)/.latex-makefile/Makefile.ini
+#
+# This can be pdflatex or latex - you can change this by adding the following line to your Makefile.ini:
+# BUILD_STRATEGY := latex
+BUILD_STRATEGY		?= pdflatex
+#
+# Sets LC_ALL=C, by default, so that the locale-aware tools, like sort, be
+# # immune to changes to the locale in the user environment.
+export LC_ALL		?= C
+#
+#
+# If you specify sources here, all other files with the same suffix
+# will be treated as if they were _include_ files.
+#onlysources.tex	?= main.tex
+#onlysources.tex.sh	?=
+#onlysources.tex.pl	?=
+#onlysources.tex.py	?=
+#onlysources.rst	?=
+#onlysources.fig	?=
+#onlysources.gpi	?=
+#onlysources.dot	?=
+#onlysources.xvg	?=
+#onlysources.svg	?=
+#onlysources.eps.gz	?=
+#onlysources.eps	?=
+#
+# If you list files here, they will be treated as _include_ files
+#includes.tex		?= file1.tex file2.tex
+#includes.tex.sh	?=
+#includes.tex.pl	?=
+#includes.tex.py	?=
+#includes.rst		?=
+#includes.fig		?=
+#includes.gpi		?=
+#includes.dot		?=
+#includes.xvg		?=
+#includes.svg		?=
+#includes.eps.gz	?=
+#includes.eps		?=
+#
+# If you list files or wildcards here, they will *not* be cleaned - default is
+# to allow everything to be cleaned.
+#neverclean		?= *.pdf
+#
+# Alternatively (recommended), you can add those lines to a Makefile.ini file
+# and it will get picked up automatically without your having to edit this
+# Makefile.
+#
+# KNOWN ISSUES:
+#	* The following occurs:
+#		file with: \usepackage{named}\bibliographystyle{named}
+#		Compile
+#		change to: \usepackage{apalike}\bibliographystyle{apalike}
+#		Compile again -- BARF!
+#
+#		The workaround: make clean-nographics; make
+#
+#		Note that we may not be able to fix this.  LaTeX itself barfs
+#		on this, not the makefile.  The very first invocation of LaTeX
+#		(when something like this has happened) reads the existing .aux
+#		file and discovers invalid commands like \citeauthoryear that
+#		are only valid in the package that was just removed.  It then
+#		tries to parse them and explodes.  It's not at all clear to me
+#		how to fix this.  I tried removing the .aux files on the first
+#		run of LaTeX, but that necessarily requires more subsequent
+#		rebuilds on common edits.  There does not appear to be a
+#		graceful solution to this issue.
+#
+# CHANGES:
+# Chris Monson (2010-04-08):
+# 	* Bumped version to 2.2.0-rc1
+# 	* Added back in the rst_style_file stuff that got broken when switching
+# 		rst -> tex to use the script mechanism
+# Chris Monson (2010-03-23):
+#	* Bumped version to 2.2.0-beta8
+#	* Work on issue 76: bad backtick escape for some sed versions, failure
+#		to clear out the hold buffer when outputting MISSING comment.
+#		- Backed out 2>&1 to &> (doesn't work in sh)
+#		- Backed out using . to source variables
+# Chris Monson (2010-03-22):
+# 	* Bumped version to 2.2.0-beta7
+# 	* Issue 72: Fix latex/bibtex invocation order for annotated bib styles
+# 	* Fixed informational output to reflect which LaTeX run we're on
+# 	* Fixed graphic detection to include graphics that are already there in
+# 		.d files
+# 	* Tightened up the .d file output to only make .d depend on graphic
+# 		*source* files.  This means that building foo.d no longer
+# 		builds all of the graphics files on which foo.tex depends.
+# 		Had to use .SECONDEXPANSION trickery to make it work.
+# 	* Changed get-graphics to only accept a stem.
+# 	* Fixed build-once logic for scripted .tex to work better
+# 	* Made get-inputs sed script more maintainable.
+# 	* Moved Makefile.ini import up higher.
+# 	* Changed bare stems to not recursively invoke make
+# 	* Updated diff output to be more silent everywhere
+# 	* Added a MISSING comment to the .d file if stuff isn't found - forces
+# 		removal of .1st.make file, which often forces it to try again.
+# 	* Fixed broken graphics-target function
+# 	* Added sleep to .d file generation when stuff is missing - if it
+# 		builds too fast, make doesn't realize it needs to be reloaded,
+# 		and thus never discovers some deeper dependencies (especially
+# 		evident when graphics are included from scripted include
+# 		files).
+# Chris Monson (2010-03-17):
+# 	* Bumped version to 2.2.0-beta6
+# 	* Fixed bareword builds to actually work (requires static patterns)
+# 	* Fixed colorization to work with new paragraph stuff
+# Chris Monson (2010-03-17):
+# 	* Bumped version to 2.2.0-beta5
+# 	* Fixed graphic detection to be much more focused - splits log file
+# 		into paragraphs before doing pattern matching.
+# 	* Fixed make foo to work properly (recursively calls make foo.pdf)
+# 	* Fixed gpi -> pdf generation to not waste time building .eps *after*
+# 		the pdf already exists.
+# 	* Changed log copies to include MAKE_RESTARTS as part of the name.
+# 	* Fixed missing include file detection (also makes use of the paragraph
+# 		stuff) to detect missing scripted include files.
+# Chris Monson (2010-03-16):
+# 	* Bumped version to 2.2.0-beta4
+# 	* issue 70: .pdf not moved out of the way properly on first
+# 		compilation, resulting in early error detection failure.
+# 	* issue 74: fixed broken error on missing .aux files: the
+# 		implementation was masking real errors.
+# Chris Monson (2010-03-15):
+# 	* Bumped version to 2.2.0-beta3
+# 	* issue 71: Made the tput dependency optional
+# 	* issue 73: Made .tex targets not pull in .d files (building them from
+# 		scripts should not require a .d)
+# 	* issue 74: Output a much saner error when a .aux file is not produced
+# 		(e.g., when you are typing "make" without arguments in a
+# 		directory with included .tex files that are not named with
+# 		._include_.)
+# Chris Monson (2010-03-11):
+# 	* Bumped version to 2.2.0-beta2
+# 	* Fixed clean-graphics to get rid of intermediate .eps files that may
+# 		be hanging around
+# 	* Added an automatic setting to use eps terminals in pdflatex mode for
+# 		gnuplot if it doesn't understand pdf.
+# 	* issue 66: Removed grayscale generation via magic suffix.  Grayscale
+# 		generation is now only available via GRAY=1
+# 	* issue 68: Added explicit handling of LC_ALL for locale-aware tools
+# 		like "sort"
+# Chris Monson (2010-03-10):
+# 	* Bumped version to 2.2.0-beta1
+# 	* Fixed success message to handle output message in different places
+# 	* Added name of produced file to success message
+# Chris Monson (2010-03-10):
+# 	* Bumped version to 2.2.0-alpha3
+# 	* Added meaningful error message for wrong hyperref options
+# 	* Added meaningful error message for incorrect graphics extensions
+# Chris Monson (2010-03-09):
+# 	* Bumped version to 2.2.0-alpha2
+# 	* Updated graphics handling (gnuplot and fig generate pdf natively)
+# 	* Changed xmgrace to output monochrome natively
+# Chris Monson (2010-03-09):
+# 	* Bumped version to 2.2.0-alpha1 - major change!
+# 	* Support pdflatex natively and by default (issue 6 - a long time coming)
+# 	* Add ability to have a single $HOME/.latex-makefile/Makefile.ini for
+# 		all invocations
+# 	* Reworked graphic inclusion detection so that extensions need not be
+# 		specified for either build strategy (e.g.,
+# 		\includegraphics{test1.eps} -> \includegrahpics{test1})
+# 	* Changed log format to include filenames and line numbers
+# Chris Monson (2010-02-04):
+# 	* Bumped version to 2.1.43
+# 	* All of the following are for issue 63 (thanks to mojoh81):
+# 	* Added documentation about fixing Makefile.ini default target
+# 	* Added perl and python script targets
+# 	* Fixed run logic to allow included .tex files to be scripted (the
+# 		run-again logic now detects missing .tex files, and the MV
+# 		command has been switched out for a command that only invokes
+# 		MV if the files exist)
+# 	* Changed scripted generation to only run once per make invocation
+# 	* Added dependency on expr
+# Chris Monson (2010-01-19):
+# 	* Bumped version to 2.1.42
+# 	* issue 62: Added .brf extension to cleanable files (backrefs)
+# Chris Monson (2010-01-07):
+# 	* Bumped version to 2.1.41
+# 	* issue 60: bad makeindex runs now error out on subsequent tries
+# Chris Monson (2009-12-01):
+# 	* Bumped version to 2.1.40
+# 	* issue 36: build all indices (for e.g., splitidx usage)
+# 	* issue 59: clean up all generated files (including indices)
+# Chris Monson (2009-11-23):
+# 	* Bumped version to 2.1.39
+# 	* issue 57: change ps2pdf invocations to just use gs directly
+# Chris Monson (2009-11-19):
+# 	* Bumped version to 2.1.38
+# 	* issue 57: Added some limited support for Cygwin (spaces in filenames)
+# Chris Monson (2009-11-15):
+# 	* Bumped version to 2.1.37
+# 	* Removed svninfo, since this is now managed by mercurial
+# 	* Fixed typo in changelist
+# 	* Issue 52: added jpg->eps conversion (thanks to brubakee)
+# 	* Issue 54: fix missing Overfull colorization due to lack of a blank
+# 		line preceding the first error.
+#	* Issue 51: remove head.tmp and body.tmp in make clean invocation
+#	* Issue 56: maintain multiple versions of log files (for debugging)
+# Chris Monson (2009-11-14):
+# 	* Bumped version to 2.1.36
+# 	* Issues 53 and 49: added .brf, .mtc, and .maf to the cleanables
+# Chris Monson (2009-11-05):
+# 	* Bumped version to 2.1.35
+# 	* Added nomenclature support (see issue 48)
+# Chris Monson (2009-10-29):
+# 	* Bumped version to 2.1.34
+# 	* Fixed _out_ creation bug introduced in 2.1.33 (it was always created)
+# 	* Fixed erroneous help output for $HOME in BINARY_TARGET_DIR
+# 	* Changed contact email address - bring on the spam!
+# Chris Monson (2009-10-21):
+# 	* Bumped version to 2.1.33
+# 	* Fixed issue 46, adding support for dot2tex (thanks to fdemesmay)
+# 	* Made all_files.* settable in Makefile.ini (using ?= instead of :=)
+# 	* Fixed issue 47, thanks to fdemesmay: add binary copy directory, copy
+# 		dvi, pdf, and ps if it exists
+# Chris Monson (2009-09-25):
+# 	* Bumped version to 2.1.32
+# 	* Fixed so that a changed lol file will cause a rebuild
+# 	* Added .lol files to the cleanable list
+# Chris Monson (2009-09-08):
+# 	* Bumped version to 2.1.31
+# 	* Closed issue 43: evince doesn't notice pdf change w/out touch
+# Chris Monson (2009-08-28):
+# 	* Bumped version to 2.1.30
+# 	* Closed issue 39: Capture multi-line log warnings/errors to output
+# Chris Monson (2009-08-26):
+# 	* Bumped version to 2.1.29
+# 	* Closed issue 42: add svg support using inkscape
+# Chris Monson (2009-08-17):
+# 	* Bumped version to 2.1.28
+# 	* Patch from paul.biggar for issue 38: package warnings are overlooked
+# Chris Monson (2009-08-07):
+# 	* Bumped version to 2.1.27
+# 	* Included patch for issue 37 - removes pdf/ps files before copying,
+# 		allowing some broken viewers to see changes properly.
+# Chris Monson (2009-05-15):
+# 	* Bumped version to 2.1.26
+# 	* Included patch for issue 9 from favonia - detects .fig changes for
+# 		pstex files during regular compilation, so long as the pstex
+# 		has been built at least once with make all-pstex.
+# Chris Monson (2009-03-27):
+# 	* Bumped version to 2.1.25
+# 	* Cleaned up a bunch of variable setting stuff - more stuff is now
+# 		settable from Makefile.ini
+# 	* Cleaned up documentation for various features, especially settable
+# 		variables.
+# 	* issue 28: support for png -> eps conversion (it even looks good!)
+# 	* issue 29: support for "neverclean" files in Makefile.ini
+# 	* issue 30: make ps2pdf14 the default - fall back when not there
+# Chris Monson (2009-03-09):
+# 	* Bumped version to 2.1.24
+# 	* issue 27: xmgrace support (thanks to rolandschulzhd)
+# Chris Monson (2008-10-23):
+# 	* Bumped version to 2.1.23
+# 	* issue 23: fixed _check_programs to not use bash string subs
+# Chris Monson (2008-09-02):
+# 	* Bumped version to 2.1.22
+# 	* Appled patch from Holger <yllohy@googlemail.com> to add include
+# 		sources and some documentation updates.
+# 	* Updated backup_patterns to be a bit more aggressive (also thanks to
+# 		Holger)
+# Chris Monson (2008-08-30):
+# 	* Bumped version to 2.1.21
+# 	* Added ability to specify onlysources.* variables to indicate the only
+# 		files that should *not* be considered includes.  Thanks to Holger
+# 		<yllohy@googlemail.com> for this patch.
+# 	* Added an automatic include of Makefile.ini if it exists.  Allows
+# 		settings to be made outside of this makefile.
+# Chris Monson (2008-05-21):
+# 	* Bumped version to 2.1.20
+# 	* Added manual pstex compilation support (run make all-pstex first)
+# 	* Removed all automatic pstex support.  It was totally breaking
+# 		everything and is very hard to incorporate into the makefile
+# 		concept because it requires LaTeX to *fail* before it can
+# 		determine that it needs the files.
+# Chris Monson (2008-04-17):
+# 	* Bumped version to 2.1.19
+# 	* Changed the pstex build hack to be on by default
+# Chris Monson (2008-04-09):
+# 	* Bumped version to 2.1.18
+# 	* issue 16: fixed pstex build problems, seems nondeterministic.  Added
+# 		gratuitious hack for testing: set PSTEX_BUILD_ALL_HACK=1.
+# Chris Monson (2008-04-09):
+# 	* Bumped version to 2.1.17
+# 	* issue 20: fixed accumulation of <pid>*.make files - wildcard was
+#		refusing to work on files that are very recently created.
+# Chris Monson (2008-04-02):
+# 	* Bumped version to 2.1.16
+# 	* issue 19: Removed the use of "type" to fix broken "echo" settings
+# Chris Monson (2008-03-27):
+# 	* Bumped version to 2.1.15
+# 	* issue 18: Favors binary echo over builtin, as binary understands -n
+# 	* issue 16: Fixed handling of missing pstex_t files in the log
+# 	* issue 9: Added .SECONDARY target for .pstex files
+# Chris Monson (2008-03-21):
+# 	* Bumped version to 2.1.14
+# 	* Fixed broken aux file flattening, which caused included bibs to be
+# 		missed.
+# Chris Monson (2008-03-20):
+# 	* Bumped version to 2.1.13
+# 	* Changed error output colorization to show errors for missing files
+# 		that are not graphics files.
+# Chris Monson (2008-03-20):
+# 	* Bumped version to 2.1.12
+# 	* Fixed a regression introduced in r28 that makes bibtex fail when
+# 		there is no index file present
+# Chris Monson (2008-03-03):
+# 	* Bumped version to 2.1.11
+# 	* Fixed issue 11 (handle index files, reported by abachn)
+# 	* Cleaned up some comments and help text
+# Chris Monson (2008-01-24):
+# 	* Bumped version to 2.1.10
+#	* Fixed to work when 'sh' is a POSIX shell like 'dash'
+# Chris Monson (2007-12-12):
+# 	* Bumped version to 2.1.9
+# 	* Fixed documentation and dependency graph for pstex files
+# Chris Monson (2007-12-12):
+# 	* Bumped version to 2.1.8
+# 	* Added basic pstex_t support for fig files (Issue 9 by favonia)
+# 		I still suggest that psfrag be used instead.
+# Chris Monson (2007-10-16):
+# 	* Bumped version to 2.1.7
+# 	* Removed todo item: allow other comment directives for rst conversion
+# 	* Added ability to use global rst style file _rststyle_._include_.tex
+# 	* Added help text to that effect
+# Chris Monson (2007-05-20):
+# 	* Bumped version to 2.1.6
+# 	* Changed default paper size for rst files
+# 	* Added todo item: fix paper size for rst files
+# 	* Added todo item: allow other comment directives for rst conversion
+# Chris Monson (2007-04-02):
+# 	* Bumped version to 2.1.5
+# 	* Addressed Issue 7, incorrect .gpi.d generation in subdirectories
+# Chris Monson (2007-03-28):
+# 	* Bumped version to 2.1.4
+# 	* Fixed syntax error in dot output
+# Chris Monson (2007-03-01):
+# 	* Bumped version to 2.1.3
+# 	* Added reST to the included documentation
+# 	* Fixed graphics and script generation to be settable in the
+# 		environment.
+# Chris Monson (2007-02-23):
+# 	* Bumped version to 2.1.2
+# 	* Added the ability to generate .tex files from .rst files
+# Chris Monson (2006-10-17):
+# 	* Bumped version to 2.1.1
+# 	* Fixed includes from subdirectories (sed-to-sed slash escape problem)
+# Chris Monson (2006-10-05):
+# 	* Bumped version to 2.1.0 (pretty serious new feature added)
+# 	* New feature: bib files can now be anywhere on the BIBINPUTS path
+# 	* New programs: kpsewhich (with tetex) and xargs (BSD)
+# Chris Monson (2006-09-28):
+# 	* Bumped version to 2.0.9
+# 	* Added ability to parse more than one bibliography
+# Chris Monson (2006-06-01):
+# 	* Bumped version to 2.0.8
+# 	* Added .vrb to the list of cleaned files
+# Chris Monson (2006-04-26):
+# 	* Bumped version to 2.0.7
+# 	* Fixed so that clean-nographics does not remove .gpi.d files
+# 	* Removed jpg -> eps hack (not working properly -- just pre-convert)
+# 	* Fixed so that postscript grayscale can be done with BSD sed
+# Chris Monson (2006-04-25):
+# 	* Bumped version to 2.0.6
+# 	* Fixed so that changed toc, lot, lof, or out causes a rebuild
+# Chris Monson (2006-04-17):
+# 	* Bumped version to 2.0.5
+# 	* Added jpg -> eps conversion target
+# Chris Monson (2006-04-12):
+# 	* Bumped version to 2.0.4
+# 	* Fixed BSD sed invocation to not use \| as a branch delimiter
+# 	* Added a comment section on what is and is not allowed in BSD sed
+# 	* Made paper size handling more robust while I was at it
+# 	* Fixed postscript RGB grayscale to use a weighted average
+# 	* Fixed postscript HSB grayscale to convert to RGB first
+# 	* Fixed a problem with rebuilding .bbl files
+# Chris Monson (2006-04-11):
+# 	* Bumped version to 2.0.3
+# 	* Fixed some BSD sed problems: can't use \n in substitutions
+# Chris Monson (2006-04-10):
+# 	* Bumped version to 2.0.2
+# 	* Once again removed ability to create .tex files from scripts
+# 	* \includeonly works again
+# Chris Monson (2006-04-09):
+# 	* Bumped version to 2.0.1
+# 	* Fixed grayscale postscript handling to be more robust
+# 	* Added ability to generate ._gray_. files from eps and eps.gz
+# 	* Added ability to clean ._gray_.eps files created from .eps files
+# Chris Monson (2006-04-07):
+# 	* Bumped version to 2.0.0
+# 	* Removed clunky ability to create included .tex files from scripts
+# 	* Added note in the help about included tex scripting not working
+# 	* Fixed the .eps generation to delete %.gpihead.make when finished
+# 	* Abandoned designs to use shell variables to create sed scripts
+# 	* Abandoned __default__.tex.sh idea: it causes recursion with %: .
+# 	* Removed web page to-do.  All items are now complete.
+# 	* Added better grayscale conversion for dot figures (direct ps fixup).
+# 	* Include files can now be scripted (at the expense of \includeonly).
+# 	* Updated dependency graph to contain better node names.
+# Chris Monson (2006-04-06):
+# 	* Bumped version to 2.0b3
+# 	* Top level includes now fail if there is no rule to build them
+# 	* A helpful message is printed when they do fail
+# 	* Grayscale has been changed to be ._gray_, other phonies use _ now, too
+# 	* Grayscale handling has been completed
+# 	* Changed _include_stems target to _includes target.
+# 	* Fixed _includes target to be useful by itself.
+# 	* Removed the ability to specify clean and build targets at once
+# 	* Verified that epsfig works fine with current code
+# 	* Fixed included scripts so that they are added to the dep files
+# 	* Fixed so that graphics includes don't happen if they aren't for gpi
+# 	* Fixed dot output to allow grayscale.
+# Chris Monson (2006-04-05):
+#	* Bumped version to 2.0b2
+#	* Removed automatic -gray output.  It needs fixing in a bad way.
+#	* Revamped dependency creation completely.
+#	* Fixed conditional inclusion to actually work (test.nobuild.d, test.d).
+#	* Fixed clean target to remove log targets
+#	* Added the 'monochrome' word for gray gpi output
+#	* Added a _check_gpi_files target that checks for common problems
+#	* Changed the _version target into the version target (no _)
+#	* Added better handling of grayscale files.  Use the .gray.pdf target.
+#	* Fixed testing for rebuilds
+# Chris Monson (2006-04-04):
+#	* Bumped version to 2.0b1
+#	* Changed colorization of output
+#	* Made .auxbbl and .auxtex .make files secondary targets
+#	* Shortened and simplified the final latex invocation loop
+#	* Added version-specific output ($$i vs. $$$$i) in latex loop
+#	* Added a build message for the first .dvi run (Building .dvi (0))
+#	* Removed some build messages that most people don't care about.
+#	* Simplified procedure for user-set colors -- simple text specification
+#	* Fixed diff output to...not output.
+#	* Fixed rerun bug -- detect not only when preceded with LaTeX Warning
+#	* Sped up gpi plotting
+#	* Added error handling and colorized output for gpi failure
+#	* Documented color changing stuff.
+#	* Now sort the flattened aux file to avoid false recompilation needs
+#	* Added clean-nographics target
+#	* Don't remove self.dvi file if self.aux is missing in the log
+#	* Clarified some code.  Did some very minor adjusting.
+# Chris Monson (2006-04-03):
+#	* Bumped version to 2.0a7
+#	* Added .dvi and .ps files as secondary files.
+#	* Fixed handling of multiple run detection when includeonly is in use.
+#	* Added code to flatten .aux files.
+#	* Added more files as .SECONDARY prerequisites to avoid recompilation.
+#	* Fixed the inputs generation to be much simpler and to use pipes.
+#	* Added the dependency graph directly into the makefile.
+#	* Changed flatten-aux to remove \@writefile \relax \newlabel, etc.
+#	* Undid pipe changes with sed usage (BSD sed doesn't know -f-).
+#	* Added a _check_programs target that tells you what your system has.
+#	* Fixed an error in colorization that made unnecessary errors appear
+#	* Added view targets.
+#	* Updated help text.
+#	* Augmented cookies so that .aux can trigger .bbl and .dvi rebuilds
+#	* Added more informative error handling for dvips and ps2pdf
+# Chris Monson (2006-04-02):
+#	* Bumped version to 2.0a6
+#	* Added indirection to .bbl dependencies to avoid rebuilding .bbl files
+#	* Streamlined the diff invocation to eliminate an existence test
+#	* Removed special shell quote escape variables
+#	* Moved includes to a more prominent location
+#	* Fixed .inputs.make to not contain .aux files
+#	* Fixed embedding to use a file instead of always grepping.
+#	* Added *.make.temp to the list of cleanable files
+#	* Fixed Ruby.  It should now be supported properly.
+#	* Now differentiate between all, default, and buildable files.
+#	* Fixed to bail out on serious errors.
+#	* Revised the handling of includable files.  Still working on it.
+# Chris Monson (2006-03-31):
+#	* Bumped version to 2.0a5
+#	* Fixed a bug with LaTeX error detection (there can be spaces)
+#	* Added .bbl support, simplifying everything and making it more correct
+#	* Refactored some tests that muddy the code
+#	* Did a little cleanup of some shell loops that can safely be make loops
+#	* Added support for graphviz .dot files
+#	* Made _all_programs output easier to read
+#	* Added the ruby support that has long been advertised
+#	* Font embedding was screwed up for PostScript -- now implicit
+#	* Changed the generation of -gray.gpi files to a single command
+#	* Changed any make-generated file that is not included from .d to .make
+# Chris Monson (2006-03-30):
+#	* Bumped version to 2.0a4
+#	* Fixed a bug with very long graphics file names
+#	* Added a todo entry for epsfig support
+#	* Fixed a bug paper size bug: sometimes more than one entry appears
+#	* Fixed DVI build echoing to display the number instead of process ID
+#	* DVI files are now removed on first invocation if ANY file is missing
+#	* Added a simple grayscale approach: if a file ends with -gray.gpi, it
+#		is created from the corresponding .gpi file with a special
+#		comment ##GRAY in its header, which causes coloring to be
+#		turned off.
+#	* Fixed a bug in the handling of .tex.sh files.  For some reason I had
+#		neglected to define file stems for scripted output.
+#	* Removed a trailing ; from the %.graphics dependencies
+#	* Added dvips embedding (I think it works, anyway)
+# Chris Monson (2006-03-29):
+#	* Bumped version to 2.0a3
+#	* Fixed error in make 3.79 with MAKEFILE_LIST usage
+#	* Added the presumed filename to the _version output
+#	* Added a vim macro for converting sed scripts to make commands
+#	* Added gpi dependency support (plotting external files and loading gpi)
+#	* Allow .gpi files to be ignored if called .include.gpi or .nobuild.gpi
+#	* Fixed sed invocations where \+ was used.  BSD sed uses \{1,\}.
+# Chris Monson (2006-03-28):
+#	* Bumped version to 2.0a2
+#	* Added SHELL_DEBUG and VERBOSE options
+#	* Changed the default shell back to /bin/sh (unset, in other words)
+#	* Moved .PHONY declarations closer to their targets
+#	* Moved help text into its own define block to obtain better formatting
+#	* Removed need for double-entry when adding a new program invocation
+#	* Moved .SECONDARY declaration closer to its relevant occurrence
+#	* Commented things more heavily
+#	* Added help text about setting terminal and output in gnuplot
+#	* Created more fine-grained clean targets
+#	* Added a %.graphics target that generates all of %'s graphics
+#	* Killed backward-compatible graphics generation (e.g., eps.gpi=gpi.eps)
+#	* For now, we're just GPL 2, not 3.  Maybe it will change later
+#	* Made the version and svninfo into variables
+# Chris Monson (2006-03-27):
+#	* Bumped version to 2.0a1
+#	* Huge, sweeping changes -- automatic dependencies
+
+# IMPORTANT!
+#
+# When adding to the following list, do not introduce any blank lines.  The
+# list is extracted for documentation using sed and is terminated by a blank
+# line.
+#
+# EXTERNAL PROGRAMS:
+# = ESSENTIAL PROGRAMS =
+# == Basic Shell Utilities ==
+CAT		?= cat
+CP		?= cp -f
+DIFF		?= diff
+ECHO		?= echo
+EGREP		?= egrep
+ENV		?= env
+EXPR		?= expr
+MV		?= mv -f
+SED		?= sed
+SORT		?= sort
+TOUCH		?= touch
+UNIQ		?= uniq
+WHICH		?= which
+XARGS		?= xargs
+SLEEP		?= sleep
+# == LaTeX (tetex-provided) ==
+BIBTEX		?= bibtex
+DVIPS		?= dvips
+LATEX		?= latex
+PDFLATEX	?= pdflatex
+EPSTOPDF	?= epstopdf
+MAKEINDEX	?= makeindex
+KPSEWHICH	?= kpsewhich
+GS		?= gs
+# = OPTIONAL PROGRAMS =
+# == Makefile Color Output ==
+TPUT		?= tput
+# == TeX Generation ==
+PERL		?= perl
+PYTHON		?= python
+RST2LATEX	?= rst2latex.py
+# == EPS Generation ==
+CONVERT		?= convert	# ImageMagick
+DOT		?= dot		# GraphViz
+DOT2TEX		?= dot2tex	# dot2tex - add options (not -o) as needed
+FIG2DEV		?= fig2dev	# XFig
+GNUPLOT		?= gnuplot	# GNUplot
+INKSCAPE	?= inkscape	# Inkscape (svg support)
+XMGRACE		?= xmgrace	# XMgrace
+PNGTOPNM	?= pngtopnm	# From NetPBM - step 1 for png -> eps
+PPMTOPGM	?= ppmtopgm	# From NetPBM - (gray) step 2 for png -> eps
+PNMTOPS		?= pnmtops	# From NetPBM - step 3 for png -> eps
+GUNZIP		?= gunzip	# GZipped EPS
+# == Beamer Enlarged Output ==
+PSNUP		?= psnup
+# == Viewing Stuff ==
+VIEW_POSTSCRIPT	?= gv
+VIEW_PDF	?= xpdf
+VIEW_GRAPHICS	?= display
+
+# Command options for embedding fonts and postscript->pdf conversion
+PS_EMBED_OPTIONS	?= -dPDFSETTINGS=/printer -dEmbedAllFonts=true -dSubsetFonts=true -dMaxSubsetPct=100
+PS_COMPATIBILITY	?= 1.4
+
+# Defaults for GPI
+DEFAULT_GPI_EPS_FONTSIZE	?= 22
+DEFAULT_GPI_PDF_FONTSIZE	?= 12
+
+# Style file for ReST
+RST_STYLE_FILE			?= $(wildcard _rststyle_._include_.tex)
+
+# This ensures that even when echo is a shell builtin, we still use the binary
+# (the builtin doesn't always understand -n)
+FIXED_ECHO	:= $(if $(findstring -n,$(shell $(ECHO) -n)),$(shell which echo),$(ECHO))
+ECHO		:= $(if $(FIXED_ECHO),$(FIXED_ECHO),$(ECHO))
+
+define determine-gnuplot-output-extension
+$(if $(shell $(WHICH) $(GNUPLOT)),
+     $(if $(findstring unknown or ambiguous, $(shell $(GNUPLOT) -e "set terminal pdf" 2>&1)),
+	  eps, pdf),
+     none)
+endef
+
+GNUPLOT_OUTPUT_EXTENSION	?= $(strip $(call determine-gnuplot-output-extension))
+
+# Directory into which we place "binaries" if it exists.
+# Note that this can be changed on the commandline or in Makefile.ini:
+#
+# Command line:
+#   make BINARY_TARGET_DIR=$HOME/pdfs myfile.pdf
+#
+# Also, you can specify a relative directory (relative to the Makefile):
+#   make BINARY_TARGET_DIR=pdfs myfile.pdf
+#
+# Or, you can use Makefile.ini:
+#
+#   BINARY_TARGET_DIR := $(HOME)/bin_out
+#
+BINARY_TARGET_DIR	?= _out_
+
+RESTARTS		:= $(if $(MAKE_RESTARTS),$(MAKE_RESTARTS),0)
+# SH NOTES
+#
+# On some systems, /bin/sh, which is the default shell, is not linked to
+# /bin/bash.  While bash is supposed to be sh-compatible when invoked as sh, it
+# just isn't.  This section details some of the things you have to stay away
+# from to remain sh-compatible.
+#
+#	* File pattern expansion does not work for {}
+#	* [ "$x" = "$y" ] has to be [ x"$x" x"$y" ]
+#	* &> for stderr redirection doesn't work, use 2>&1 instead
+#
+# BSD SED NOTES
+#
+# BSD SED is not very nice compared to GNU sed, but it is the most
+# commonly-invoked sed on Macs (being based on BSD), so we have to cater to
+# it or require people to install GNU sed.  It seems like the GNU
+# requirement isn't too bad since this makefile is really a GNU makefile,
+# but apparently GNU sed is much less common than GNU make in general, so
+# I'm supporting it here.
+#
+# Sad experience has taught me the following about BSD sed:
+#
+# 	* \+ is not understood to mean \{1,\}
+# 	* \| is meaningless (does not branch)
+# 	* \n cannot be used as a substitution character
+# 	* ? does not mean \{0,1\}, but is literal
+# 	* a\ works, but only reliably for a single line if subsequent lines
+# 		have forward slashes in them (as is the case in postscript)
+#
+# For more info (on the Mac) you can consult
+#
+# man -M /usr/share/man re_format
+#
+# And look for the word "Obsolete" near the bottom.
+
+#
+# EXTERNAL PROGRAM DOCUMENTATION SCRIPT
+#
+
+# $(call output-all-programs,[<output file>])
+define output-all-programs
+	[ -f '$(this_file)' ] && \
+	$(SED) \
+		-e '/^[[:space:]]*#[[:space:]]*EXTERNAL PROGRAMS:/,/^$$/!d' \
+		-e '/EXTERNAL PROGRAMS/d' \
+		-e '/^$$/d' \
+		-e '/^[[:space:]]*#/i\ '\
+		-e 's/^[[:space:]]*#[[:space:]][^=]*//' \
+		$(this_file) $(if $1,> '$1',) || \
+	$(ECHO) "Cannot determine the name of this makefile."
+endef
+
+# If they misspell gray, it should still work.
+GRAY	?= $(call get-default,$(GREY),)
+
+#
+# Utility Functions and Definitions
+#
+
+# While not exactly a make function, this vim macro is useful.  It takes a
+# verbatim sed script and converts each line to something suitable in a command
+# context.  Just paste the script's contents into the editor, yank this into a
+# register (starting at '0') and run the macro once for each line of the
+# original script:
+#
+# 0i	-e :s/\$/$$/eg
:s/'/'"'"'/eg
^Ela'A' \:noh
j
+
+# don't call this directly - it is here to avoid calling wildcard more than
+# once in remove-files.
+remove-files-helper	= $(if $1,$(RM) $1,$(sh_true))
+
+# $(call remove-files,file1 file2)
+remove-files		= $(call remove-files-helper,$(wildcard $1))
+
+# Removes all cleanable files in the given list
+# $(call clean-files,file1 file2 file3 ...)
+# Works exactly like remove-files, but filters out files in $(neverclean)
+clean-files		= \
+	$(call remove-files-helper,$(call cleanable-files,$(wildcard $1)))
+
+# Outputs all generated files to STDOUT, along with some others that are
+# created by these (e.g., .idx files end up producing .ilg and .ind files).
+# Discovered by reading *.fls OUTPUT lines and producing corresponding .ind
+# filenames as needed.
+#
+# $(call get-generated-names,<source recorder file (*.fls)>)
+define get-generated-names
+[ -f '$1' ] && \
+$(SED) \
+	-e '/^OUTPUT /{' \
+	-e '  s///' \
+	-e '  p' \
+	-e '  s/\.idx/\.ind/p' \
+	-e '  s/\.ind/\.ilg/p' \
+	-e '}' \
+	-e 'd' \
+	'$1' \
+| $(SORT) | $(UNIQ)
+endef
+
+# This removes files without checking whether they are there or not.  This
+# sometimes has to be used when the file is created by a series of shell
+# commands, but there ends up being a race condition: make doesn't know about
+# the file generation as quickly as the system does, so $(wildcard ...) doesn't
+# work right.  Blech.
+# $(call remove-temporary-files,filenames)
+remove-temporary-files	= $(if $1,$(RM) $1,:)
+
+# Create an identifier from a file name
+# $(call cleanse-filename,filename)
+cleanse-filename	= $(subst .,_,$(subst /,__,$1))
+
+# Escape dots
+# $(call escape-dots,str)
+escape-dots		= $(subst .,\\.,$1)
+
+# Test that a file exists
+# $(call test-exists,file)
+test-exists		= [ -e '$1' ]
+
+# $(call move-files,source,destination)
+move-if-exists		= $(call test-exists,$1) && $(MV) '$1' '$2'
+
+# Copy file1 to file2 only if file2 doesn't exist or they are different
+# $(call copy-if-different,sfile,dfile)
+copy-if-different	= $(call test-different,$1,$2) && $(CP) '$1' '$2'
+copy-if-exists		= $(call test-exists,$1) && $(CP) '$1' '$2'
+move-if-different	= $(call test-different,$1,$2) && $(MV) '$1' '$2'
+replace-if-different-and-remove	= \
+	$(call test-different,$1,$2) \
+	&& $(MV) '$1' '$2' \
+	|| $(call remove-files,'$1')
+
+# Note that $(DIFF) returns success when the files are the SAME....
+# $(call test-different,sfile,dfile)
+test-different		= ! $(DIFF) -q '$1' '$2' >/dev/null 2>&1
+test-exists-and-different	= \
+	$(call test-exists,$2) && $(call test-different,$1,$2)
+
+# Return value 1, or value 2 if value 1 is empty
+# $(call get-default,<possibly empty arg>,<default value if empty>)
+get-default	= $(if $1,$1,$2)
+
+# Copy a file and log what's going on
+# $(call copy-with-logging,<source>,<target>)
+define copy-with-logging
+if [ -d '$2/' ]; then \
+	if $(CP) '$1' '$2/'; then \
+		$(ECHO) "$(C_INFO)Copied '$1' to '$2/'$(C_RESET)"; \
+	else \
+		$(ECHO) "$(C_ERROR)Failed to copy '$1' to '$2/'$(C_RESET)"; \
+	fi; \
+fi
+endef
+
+# Gives a reassuring message about the failure to find include files
+# $(call include-message,<list of include files>)
+define include-message
+$(strip \
+$(if $(filter-out $(wildcard $1),$1),\
+	$(shell $(ECHO) \
+	"$(C_INFO)NOTE: You may ignore warnings about the"\
+	"following files:" >&2;\
+	$(ECHO) >&2; \
+	$(foreach s,$(filter-out $(wildcard $1),$1),$(ECHO) '     $s' >&2;)\
+	$(ECHO) "$(C_RESET)" >&2)
+))
+endef
+# Characters that are hard to specify in certain places
+space		:= $(empty) $(empty)
+colon		:= \:
+comma		:= ,
+
+# Useful shell definitions
+sh_true		:= :
+sh_false	:= ! :
+
+# Clear out the standard interfering make suffixes
+.SUFFIXES:
+
+# Turn off forceful rm (RM is usually mapped to rm -f)
+ifdef SAFE_RM
+RM	:= rm
+endif
+
+# Turn command echoing back on with VERBOSE=1
+ifndef VERBOSE
+QUIET	:= @
+endif
+
+# Turn on shell debugging with SHELL_DEBUG=1
+# (EVERYTHING is echoed, even $(shell ...) invocations)
+ifdef SHELL_DEBUG
+SHELL	+= -x
+endif
+
+# Get the name of this makefile (always right in 3.80, often right in 3.79)
+# This is only really used for documentation, so it isn't too serious.
+ifdef MAKEFILE_LIST
+this_file	:= $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
+else
+this_file	:= $(wildcard GNUmakefile makefile Makefile)
+endif
+
+# Terminal color definitions
+
+REAL_TPUT 	:= $(if $(NO_COLOR),,$(shell $(WHICH) $(TPUT)))
+
+# $(call get-term-code,codeinfo)
+# e.g.,
+# $(call get-term-code,setaf 0)
+get-term-code = $(if $(REAL_TPUT),$(shell $(REAL_TPUT) $1),)
+
+black	:= $(call get-term-code,setaf 0)
+red	:= $(call get-term-code,setaf 1)
+green	:= $(call get-term-code,setaf 2)
+yellow	:= $(call get-term-code,setaf 3)
+blue	:= $(call get-term-code,setaf 4)
+magenta	:= $(call get-term-code,setaf 5)
+cyan	:= $(call get-term-code,setaf 6)
+white	:= $(call get-term-code,setaf 7)
+bold	:= $(call get-term-code,bold)
+uline	:= $(call get-term-code,smul)
+reset	:= $(call get-term-code,sgr0)
+
+#
+# User-settable definitions
+#
+LATEX_COLOR_WARNING	?= magenta
+LATEX_COLOR_ERROR	?= red
+LATEX_COLOR_INFO	?= green
+LATEX_COLOR_UNDERFULL	?= magenta
+LATEX_COLOR_OVERFULL	?= red bold
+LATEX_COLOR_PAGES	?= bold
+LATEX_COLOR_BUILD	?= cyan
+LATEX_COLOR_GRAPHIC	?= yellow
+LATEX_COLOR_DEP		?= green
+LATEX_COLOR_SUCCESS	?= green bold
+LATEX_COLOR_FAILURE	?= red bold
+
+# Gets the real color from a simple textual definition like those above
+# $(call get-color,ALL_CAPS_COLOR_NAME)
+# e.g., $(call get-color,WARNING)
+get-color	= $(subst $(space),,$(foreach c,$(LATEX_COLOR_$1),$($c)))
+
+#
+# STANDARD COLORS
+#
+C_WARNING	:= $(call get-color,WARNING)
+C_ERROR		:= $(call get-color,ERROR)
+C_INFO		:= $(call get-color,INFO)
+C_UNDERFULL	:= $(call get-color,UNDERFULL)
+C_OVERFULL	:= $(call get-color,OVERFULL)
+C_PAGES		:= $(call get-color,PAGES)
+C_BUILD		:= $(call get-color,BUILD)
+C_GRAPHIC	:= $(call get-color,GRAPHIC)
+C_DEP		:= $(call get-color,DEP)
+C_SUCCESS	:= $(call get-color,SUCCESS)
+C_FAILURE	:= $(call get-color,FAILURE)
+C_RESET		:= $(reset)
+
+#
+# PRE-BUILD TESTS
+#
+
+# Check that clean targets are not combined with other targets (weird things
+# happen, and it's not easy to fix them)
+hascleangoals	:= $(if $(sort $(filter clean clean-%,$(MAKECMDGOALS))),1)
+hasbuildgoals	:= $(if $(sort $(filter-out clean clean-%,$(MAKECMDGOALS))),1)
+ifneq "$(hasbuildgoals)" ""
+ifneq "$(hascleangoals)" ""
+$(error $(C_ERROR)Clean and build targets specified together$(C_RESET)))
+endif
+endif
+
+#
+# VARIABLE DECLARATIONS
+#
+
+# Names of sed scripts that morph gnuplot files -- only the first found is used
+GNUPLOT_SED	:= global-gpi.sed gnuplot.sed
+GNUPLOT_GLOBAL	:= global._include_.gpi gnuplot.global
+
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+default_graphic_extension	?= eps
+latex_build_program		?= $(LATEX)
+build_target_extension		?= dvi
+hyperref_driver_pattern		?= hdvips
+hyperref_driver_error		?= Using dvips: specify ps2pdf in the hyperref options.
+else
+default_graphic_extension	?= pdf
+latex_build_program		?= $(PDFLATEX)
+build_target_extension		?= pdf
+hyperref_driver_pattern		?= hpdf.*
+hyperref_driver_error		?= Using pdflatex: specify pdftex in the hyperref options (or leave it blank).
+endif
+
+# Files of interest
+all_files.tex		?= $(wildcard *.tex)
+all_files.tex.sh	?= $(wildcard *.tex.sh)
+all_files.tex.pl	?= $(wildcard *.tex.pl)
+all_files.tex.py	?= $(wildcard *.tex.py)
+all_files.rst		?= $(wildcard *.rst)
+all_files.fig		?= $(wildcard *.fig)
+all_files.gpi		?= $(wildcard *.gpi)
+all_files.dot		?= $(wildcard *.dot)
+all_files.xvg		?= $(wildcard *.xvg)
+all_files.svg		?= $(wildcard *.svg)
+all_files.png		?= $(wildcard *.png)
+all_files.jpg		?= $(wildcard *.jpg)
+all_files.eps.gz	?= $(wildcard *.eps.gz)
+all_files.eps		?= $(wildcard *.eps)
+
+# Utility function for obtaining all files not specified in $(neverclean)
+# $(call cleanable-files,file1 file2 file3 ...)
+# Returns the list of files that is not in $(wildcard $(neverclean))
+cleanable-files = $(filter-out $(wildcard $(neverclean)), $1)
+
+# Utility function for getting all .$1 files that are to be ignored
+#  * files listed in $(includes.$1)
+#  * files not listed in $(onlysources.$1) if it is defined
+ignore_files = \
+  $(includes.$1) \
+  $(if $(onlysources.$1),$(filter-out $(onlysources.$1), $(all_files.$1)))
+
+# Patterns to never be allowed as source targets
+ignore_patterns	:= %._include_
+
+# Patterns allowed as source targets but not included in 'all' builds
+nodefault_patterns := %._nobuild_ $(ignore_patterns)
+
+# Utility function for getting targets suitable building
+# $(call filter-buildable,suffix)
+filter-buildable	= \
+	$(filter-out $(call ignore_files,$1) \
+		$(addsuffix .$1,$(ignore_patterns)),$(all_files.$1))
+
+# Utility function for getting targets suitable for 'all' builds
+# $(call filter-default,suffix)
+filter-default		= \
+	$(filter-out $(call ignore_files,$1) \
+		$(addsuffix .$1,$(nodefault_patterns)),$(all_files.$1))
+
+# Top level sources that can be built even when they are not by default
+files.tex	:= $(call filter-buildable,tex)
+files.tex.sh	:= $(call filter-buildable,tex.sh)
+files.tex.pl	:= $(call filter-buildable,tex.pl)
+files.tex.py	:= $(call filter-buildable,tex.py)
+files.rst	:= $(call filter-buildable,rst)
+files.gpi	:= $(call filter-buildable,gpi)
+files.dot	:= $(call filter-buildable,dot)
+files.fig	:= $(call filter-buildable,fig)
+files.xvg	:= $(call filter-buildable,xvg)
+files.svg	:= $(call filter-buildable,svg)
+files.png	:= $(call filter-buildable,png)
+files.jpg	:= $(call filter-buildable,jpg)
+files.eps.gz	:= $(call filter-buildable,eps.gz)
+
+# Make all pstex targets secondary.  The pstex_t target requires the pstex
+# target, and nothing else really depends on it, so it often gets deleted.
+# This avoids that by allowing *all* fig files to be pstex targets, which is
+# perfectly valid and causes no problems even if they're going to become eps
+# files in the end.
+.SECONDARY:	$(patsubst %.fig,%.pstex,$(files.fig))
+
+# Top level sources that are built by default targets
+default_files.tex	:= $(call filter-default,tex)
+default_files.tex.sh	:= $(call filter-default,tex.sh)
+default_files.tex.pl	:= $(call filter-default,tex.pl)
+default_files.tex.py	:= $(call filter-default,tex.py)
+default_files.rst	:= $(call filter-default,rst)
+default_files.gpi	:= $(call filter-default,gpi)
+default_files.dot	:= $(call filter-default,dot)
+default_files.fig	:= $(call filter-default,fig)
+default_files.xvg	:= $(call filter-default,xvg)
+default_files.svg	:= $(call filter-default,svg)
+default_files.png	:= $(call filter-default,png)
+default_files.jpg	:= $(call filter-default,jpg)
+default_files.eps.gz	:= $(call filter-default,eps.gz)
+
+# Utility function for creating larger lists of files
+# $(call concat-files,suffixes,[prefix])
+concat-files	= $(foreach s,$1,$($(if $2,$2_,)files.$s))
+
+# Useful file groupings
+all_files_source	:= $(call concat-files,tex,all)
+all_files_scripts	:= $(call concat-files,tex.sh tex.pl tex.py rst,all)
+
+.PHONY: $(all_files_scripts)
+
+default_files_source	:= $(call concat-files,tex,default)
+default_files_scripts	:= $(call concat-files,tex.sh tex.pl tex.py rst,default)
+
+files_source	:= $(call concat-files,tex)
+files_scripts	:= $(call concat-files,tex.sh tex.pl tex.py rst)
+
+# Utility function for obtaining stems
+# $(call get-stems,suffix,[prefix])
+get-stems	= $(sort $($(if $2,$2_,)files.$1:%.$1=%))
+
+# List of all stems (including ._include_ and ._nobuild_ file stems)
+all_stems.tex		:= $(call get-stems,tex,all)
+all_stems.tex.sh	:= $(call get-stems,tex.sh,all)
+all_stems.tex.pl	:= $(call get-stems,tex.pl,all)
+all_stems.tex.py	:= $(call get-stems,tex.py,all)
+all_stems.rst		:= $(call get-stems,rst,all)
+all_stems.fig		:= $(call get-stems,fig,all)
+all_stems.gpi		:= $(call get-stems,gpi,all)
+all_stems.dot		:= $(call get-stems,dot,all)
+all_stems.xvg		:= $(call get-stems,xvg,all)
+all_stems.svg		:= $(call get-stems,svg,all)
+all_stems.png		:= $(call get-stems,png,all)
+all_stems.jpg		:= $(call get-stems,jpg,all)
+all_stems.eps.gz	:= $(call get-stems,eps.gz,all)
+all_stems.eps		:= $(call get-stems,eps,all)
+
+# List of all default stems (all default PDF targets):
+default_stems.tex		:= $(call get-stems,tex,default)
+default_stems.tex.sh		:= $(call get-stems,tex.sh,default)
+default_stems.tex.pl		:= $(call get-stems,tex.pl,default)
+default_stems.tex.py		:= $(call get-stems,tex.py,default)
+default_stems.rst		:= $(call get-stems,rst,default)
+default_stems.fig		:= $(call get-stems,fig,default)
+default_stems.gpi		:= $(call get-stems,gpi,default)
+default_stems.dot		:= $(call get-stems,dot,default)
+default_stems.xvg		:= $(call get-stems,xvg,default)
+default_stems.svg		:= $(call get-stems,svg,default)
+default_stems.png		:= $(call get-stems,png,default)
+default_stems.jpg		:= $(call get-stems,jpg,default)
+default_stems.eps.gz		:= $(call get-stems,eps.gz,default)
+
+# List of all stems (all possible bare PDF targets created here):
+stems.tex		:= $(call get-stems,tex)
+stems.tex.sh		:= $(call get-stems,tex.sh)
+stems.tex.pl		:= $(call get-stems,tex.pl)
+stems.tex.py		:= $(call get-stems,tex.py)
+stems.rst		:= $(call get-stems,rst)
+stems.fig		:= $(call get-stems,fig)
+stems.gpi		:= $(call get-stems,gpi)
+stems.dot		:= $(call get-stems,dot)
+stems.xvg		:= $(call get-stems,xvg)
+stems.svg		:= $(call get-stems,svg)
+stems.png		:= $(call get-stems,png)
+stems.jpg		:= $(call get-stems,jpg)
+stems.eps.gz		:= $(call get-stems,eps.gz)
+
+# Utility function for creating larger lists of stems
+# $(call concat-stems,suffixes,[prefix])
+concat-stems	= $(sort $(foreach s,$1,$($(if $2,$2_,)stems.$s)))
+
+# The most likely to be source but not finished product go first
+graphic_source_extensions	:= fig \
+				   gpi \
+				   xvg \
+				   svg \
+				   dot \
+				   eps.gz
+
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+graphic_source_extensions	+= png jpg
+graphic_target_extensions	:= eps ps
+else
+graphic_source_extensions	+= eps
+graphic_target_extensions	:= pdf png jpg mps tif
+endif
+
+all_stems_source	:= $(call concat-stems,tex,all)
+all_stems_script	:= $(call concat-stems,tex.sh tex.pl tex.py rst,all)
+all_stems_graphic	:= $(call concat-stems,$(graphic_source_extensions),all)
+all_stems_ss		:= $(sort $(all_stems_source) $(all_stems_script))
+all_stems_sg		:= $(sort $(all_stems_script))
+all_stems_ssg		:= $(sort $(all_stems_ss))
+
+default_stems_source	:= $(call concat-stems,tex,default)
+default_stems_script	:= $(call concat-stems,tex.sh tex.pl tex.py rst,default)
+default_stems_ss	:= $(sort $(default_stems_source) $(default_stems_script))
+default_stems_sg	:= $(sort $(default_stems_script))
+default_stems_ssg	:= $(sort $(default_stems_ss))
+
+stems_source		:= $(call concat-stems,tex)
+stems_script		:= $(call concat-stems,tex.sh tex.pl tex.py rst)
+stems_graphic		:= $(call concat-stems,$(graphic_source_extensions))
+stems_gg		:= $(sort $(stems_graphic))
+stems_ss		:= $(sort $(stems_source) $(stems_script))
+stems_sg		:= $(sort $(stems_script))
+stems_ssg		:= $(sort $(stems_ss))
+
+# Calculate names that can generate the need for an include file.  We can't
+# really do this with patterns because it's too easy to screw up, so we create
+# an exhaustive list.
+allowed_source_suffixes	:= \
+	pdf \
+	ps \
+	dvi \
+	ind \
+	nls \
+	bbl \
+	aux \
+	aux.make \
+	d \
+	auxbbl.make \
+	_graphics \
+	_show
+allowed_source_patterns		:= $(addprefix %.,$(allowed_source_suffixes))
+
+allowed_graphic_suffixes	:= \
+	pdf \
+	eps \
+	gpihead.make \
+	gpi.d
+allowed_graphic_patterns	:= $(addprefix %.,$(allowed_graphic_suffixes))
+
+# All targets allowed to build documents
+allowed_source_targets	:= \
+	$(foreach suff,$(allowed_source_suffixes),\
+	$(addsuffix .$(suff),$(stems_ssg)))
+
+# All targets allowed to build graphics
+allowed_graphic_targets	:= \
+	$(foreach suff,$(allowed_graphic_suffixes),\
+	$(addsuffix .$(suff),$(stems_gg)))
+
+# All targets that build multiple documents (like 'all')
+allowed_batch_source_targets	:= \
+	all \
+	all-pdf \
+	all-ps \
+	all-dvi \
+	all-bbl \
+	all-ind \
+	all-gls \
+	all-nls \
+	show
+
+# All targets that build multiple graphics (independent of document)
+allowed_batch_graphic_targets	:= \
+	all-graphics \
+	all-pstex \
+	all-dot2tex \
+	show-graphics
+
+# Now we figure out which stuff is available as a make target for THIS RUN.
+real_goals	:= $(call get-default,$(filter-out _includes,$(MAKECMDGOALS)),\
+			all)
+
+specified_source_targets	:= $(strip \
+	$(filter $(allowed_source_targets) $(stems_ssg),$(real_goals)) \
+	)
+
+specified_batch_source_targets	:= $(strip \
+	$(filter $(allowed_batch_source_targets),$(real_goals)) \
+	)
+
+specified_graphic_targets	:= $(strip \
+	$(filter $(allowed_graphic_targets),$(real_goals)) \
+	)
+
+specified_batch_graphic_targets	:= $(strip \
+	$(filter $(allowed_batch_graphic_targets),$(real_goals)) \
+	)
+
+specified_gpi_targets	:= $(patsubst %.gpi,%.$(default_graphic_extension),\
+	$(filter $(patsubst %.$(default_graphic_extension),%.gpi,$(specified_graphic_targets)),\
+		$(all_files.gpi)) \
+	)
+
+# Determine which .d files need including from the information gained above.
+# This is done by first checking whether a batch target exists.  If it does,
+# then all *default* stems are used to create possible includes (nobuild need
+# not apply for batch status).  If no batch targets exist, then the individual
+# targets are considered and appropriate includes are taken from them.
+source_stems_to_include	:= \
+	$(sort\
+	$(if $(specified_batch_source_targets),\
+		$(default_stems_ss),\
+		$(foreach t,$(specified_source_targets),\
+		$(foreach p,$(allowed_source_patterns),\
+			$(patsubst $p,%,$(filter $p $(stems_ssg),$t)) \
+		)) \
+	))
+
+# Determine which .gpi.d files are needed using the above information.  We
+# first check whether a batch target is specified, then check individual
+# graphics that may have been specified.
+graphic_stems_to_include	:= \
+	$(sort\
+	$(if $(specified_batch_graphic_targets),\
+		$(default_stems.gpi),\
+		$(foreach t,$(specified_gpi_targets),\
+		$(foreach p,$(allowed_graphic_patterns),\
+			$(patsubst $p,%,$(filter $p,$t)) \
+		)) \
+	))
+
+# All dependencies for the 'all' targets
+all_pdf_targets		:= $(addsuffix .pdf,$(stems_ssg))
+all_ps_targets		:= $(addsuffix .ps,$(stems_ssg))
+all_dvi_targets		:= $(addsuffix .dvi,$(stems_ssg))
+all_tex_targets		:= $(addsuffix .tex,$(stems_sg))
+all_d_targets		:= $(addsuffix .d,$(stems_ssg))
+all_graphics_targets	:= $(addsuffix .$(default_graphic_extension),$(stems_gg))
+intermediate_graphics_targets	:= $(if $(filter pdf,$(default_graphic_extension)),$(addsuffix .eps,$(stems_gg)),)
+all_pstex_targets	:= $(addsuffix .pstex_t,$(stems.fig))
+all_dot2tex_targets	:= $(addsuffix .dot_t,$(stems.dot))
+
+all_known_graphics	:= $(sort $(all_graphics_targets) $(wildcard *.$(default_graphic_extension)))
+
+default_pdf_targets	:= $(addsuffix .pdf,$(default_stems_ss))
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+default_ps_targets	:= $(addsuffix .ps,$(default_stems_ss))
+default_dvi_targets	:= $(addsuffix .dvi,$(default_stems_ss))
+pre_pdf_extensions	:= dvi ps
+endif
+
+# Extensions generated by LaTeX invocation that can be removed when complete
+rm_ext		:= \
+	log *.log aux $(pre_pdf_extensions) pdf blg bbl out nav snm toc lof lot lol pfg \
+	fls vrb idx ind ilg glg glo gls lox nls nlo nlg brf mtc maf brf
+backup_patterns	:= *~ *.bak *.backup body.tmp head.tmp
+
+graph_stem	:= _graph
+
+# All LaTeX-generated files that can be safely removed
+
+rm_tex := \
+	$(foreach e,$(rm_ext),$(addsuffix .$e,$(all_stems_source))) \
+	$(foreach e,$(rm_ext) tex,$(addsuffix .$e,$(all_stems_sg))) \
+	$(addsuffix .log,$(all_ps_targets) $(all_pdf_targets)) \
+	$(addsuffix .*.log,$(stems_graphic))
+
+# These are the files that will affect .gpi transformation for all .gpi files.
+#
+# Use only the first one found.  Backward compatible values are at the end.
+# Note that we use foreach, even though wildcard also returns a list, to ensure
+# that the order in the uppercase variables is preserved.  Directory listings
+# provide no such guarantee, so we avoid relying on them.
+gpi_sed		:= $(strip \
+	$(firstword $(foreach f,$(GNUPLOT_SED),$(wildcard $f))))
+gpi_global	:= $(strip \
+	$(firstword $(foreach f,$(GNUPLOT_GLOBAL),$(wildcard $f))))
+
+#
+# Functions used in generating output
+#
+
+# Outputs all source dependencies to stdout.  The first argument is the file to
+# be parsed, the second is a list of files that will show up as dependencies in
+# the new .d file created here.
+#
+# NOTE: BSD sed does not understand \|, so we have to do something more
+# clunky to extract suitable extensions.
+#
+# Also, we do a little bit of funny rewriting up front (TARGETS=) to make sure
+# that we can properly backslash-escape spaces in file names (e.g, on Cygwin
+# for tex distributions that have "Program Files" in their name).
+#
+# $(call get-inputs,<parsed file>,<target files>)
+define get-inputs
+$(SED) \
+-e '/^INPUT/!d' \
+-e 's!^INPUT \(\./\)\{0,1\}!!' \
+-e 's/[[:space:]]/\\ /g' \
+-e 's/\(.*\)\.aux$$/\1.tex/' \
+-e '/\.tex$$/b addtargets' \
+-e '/\.cls$$/b addtargets' \
+-e '/\.sty$$/b addtargets' \
+-e '/\.pstex_t$$/b addtargets' \
+-e '/\.dot_t$$/b addtargets' \
+-e 'd' \
+-e ':addtargets' \
+-e 's/^/$2: /' \
+$1 | $(SORT) | $(UNIQ)
+endef
+
+# $(call get-missing-inputs,<log file>,<target files>)
+define get-missing-inputs
+$(SED) \
+-e '$$ b para' \
+-e '/^$$/b para' \
+-e 'H' \
+-e 'd' \
+-e ':para' \
+-e 'x' \
+-e '/^$$/d' \
+-e 's/^\n*//' \
+-e '/^! LaTeX Error: File /{' \
+-e '  s/^/::DOUBLE_PARAGRAPH::/' \
+-e '  h' \
+-e '  d' \
+-e '}' \
+-e 's/^::DOUBLE_PARAGRAPH:://' \
+-e '/Default extension: /!d' \
+-e 's/[[:space:]]\{1,\}/ /g' \
+-e 's/\n\{1,\}/ /g' \
+-e 's/^.*File `//' \
+-e 's/'"'"' not found\..*//' \
+-e '/\.tex/!s/$$/.tex/' \
+-e 's/[[:space:]]/\\ /g' \
+-e 'h' \
+-e 's/.*/# MISSING input "&" - (presence of comment affects build)/' \
+-e 'p' \
+-e 's/.*//' \
+-e 'x' \
+-e 's/^/$2: /' \
+$1 | $(SORT) | $(UNIQ)
+endef
+
+# Get source file for specified graphics stem.
+#
+# $(call graphics-source,<stem>)
+define graphics-source
+$(strip $(firstword \
+	$(wildcard \
+		$(addprefix $1.,\
+			$(graphic_source_extensions))) \
+	$1 \
+))
+endef
+
+# Get the target file for the specified graphics file/stem
+#
+# $(call graphics-target,<stem>)
+define graphics-target
+$(strip $(if 	$(filter $(addprefix %.,$(graphic_target_extensions)),$1), $1,
+	$(firstword $(patsubst $(addprefix %.,$(graphic_source_extensions) $(graphic_target_extensions)), %, $1).$(default_graphic_extension) $1.$(default_graphic_extension))))
+endef
+
+# Outputs all of the graphical dependencies to stdout.  The first argument is
+# the stem of the source file being built, the second is a list of suffixes
+# that will show up as dependencies in the generated .d file.
+#
+# Note that we try to escape spaces in filenames where possible.  We have to do
+# it with three backslashes so that as the name percolates through the makefile
+# it eventually ends up with the proper escaping when the build rule is found.
+# Ugly, but it appears to work.  Note that graphicx doesn't allow filenames
+# with spaces, so this could in many ways be moot unless you're using something
+# like grffile.
+#
+# For pdflatex, we really need the missing file to be specified without an
+# extension, otherwise compilation barfs on the first missing file.  Truly
+# annoying, but there you have it.
+#
+# It turns out that the graphics errors, although they have lines with empty
+# space, are only made of two paragraphs.  So, we just use some sed magic to
+# get everything into paragraphs, detect when it's a paragraph that interests
+# us, and double it up.  Then we get the filename only if we're missing
+# extensions (a sign that it's graphicx complaining).
+#
+# $(call get-graphics,<target file stem>)
+#.log,$(addprefix $*.,d $(build_target_extension) _graphics)
+define get-graphics
+$(SED) \
+-e '$$ b para' \
+-e '/^$$/b para' \
+-e 'H' \
+-e 'd' \
+-e ':para' \
+-e 'x' \
+-e '/^$$/d' \
+-e 's/^\n*//' \
+-e '/^! LaTeX Error: File `/{' \
+-e '  s/^/::DOUBLE_PARAGRAPH::/' \
+-e '  h' \
+-e '  d' \
+-e '}' \
+-e 's/^::DOUBLE_PARAGRAPH:://' \
+-e '/could not locate the file with any of these extensions:/{' \
+-e '  s/\n\{1,\}/ /g' \
+-e '  s/[[:space:]]\{1,\}/ /g' \
+-e '  s/^.*File `//' \
+-e '  s/'"'"' not found\..*//' \
+-e '  h' \
+-e '  s/.*/# MISSING stem "&" - (presence of comment affects build)/' \
+-e '  p' \
+-e '  g' \
+-e '  b addtargets' \
+-e '}' \
+-e '/.*File: \(.*\) Graphic file (type [^)]*).*/{' \
+-e '  s//\1/' \
+-e '  b addtargets' \
+-e '}' \
+-e 'd' \
+-e ':addtargets' \
+-e 's/[[:space:]]/\\\\\\&/g' \
+-e 'h' \
+-e 's/.*/-include &.gpi.d/' \
+-e 'p' \
+-e 'g' \
+-e 's/.*/$(addprefix $1,.d): $$$$(call graphics-source,&)/' \
+-e 'p' \
+-e 's/.*//' \
+-e 'x' \
+-e 's/.*/$(addprefix $1.,$(build_target_extension) _graphics): $$$$(call graphics-target,&)/' \
+-e 'p' \
+-e 'd' \
+$*.log
+endef
+
+# Checks for build failure due to pstex inclusion, and gives instructions.
+#
+# $(call die-on-pstexs,<parsed file>)
+define die-on-pstexs
+if $(EGREP) -q '^! LaTeX Error: File .*\.pstex.* not found' $1; then \
+	$(ECHO) "$(C_ERROR)Missing pstex_t file(s)$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)  make all-pstex$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \
+	exit 1; \
+fi
+endef
+
+# Checks for build failure due to dot2tex, and gives instructions.
+#
+# $(call die-on-dot2tex,<parsed file>)
+define die-on-dot2tex
+if $(EGREP) -q ' LaTeX Error: File .*\.dot_t.* not found' $1; then \
+	$(ECHO) "$(C_ERROR)Missing dot_t file(s)$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)Please run$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)  make all-dot2tex$(C_RESET)"; \
+	$(ECHO) "$(C_ERROR)before proceeding.$(C_RESET)"; \
+	exit 1; \
+fi
+endef
+
+# Checks for the existence of a .aux file, and dies with an error message if it
+# isn't there.  Note that we pass the file stem in, not the full filename,
+# e.g., to check for foo.aux, we call it thus: $(call die-on-no-aux,foo)
+#
+# $(call die-on-no-aux,<aux stem>)
+define die-on-no-aux
+if [ ! -e '$1.aux' ]; then \
+	$(call colorize-latex-errors,$1.log); \
+	exit 1; \
+fi
+endef
+
+# Outputs all index files to stdout.  Arg 1 is the source file stem, arg 2 is
+# the list of targets for the discovered dependency.
+#
+# $(call get-log-index,<log file stem>,<target files>)
+define get-log-index
+$(SED) \
+-e 's/^No file \(.*\.ind\)\.$$/TARGETS=\1/' \
+-e 's/^No file \(.*\.[gn]ls\)\.$$/TARGETS=\1/' \
+-e 's/[[:space:]]/\\&/g' \
+-e '/^TARGETS=/{' \
+-e '  h' \
+-e '  s/^TARGETS=/$2: /p' \
+-e '  g' \
+-e '  s/^TARGETS=\(.*\)/\1: $1.tex/p' \
+-e '}' \
+-e 'd' \
+'$1.log' | $(SORT) | $(UNIQ)
+endef
+
+
+# Outputs all bibliography files to stdout.  Arg 1 is the source stem, arg 2 is
+# a list of targets for each dependency found.
+#
+# The script kills all lines that do not contain bibdata.  Remaining lines have
+# the \bibdata macro and delimiters removed to create a dependency list.  A
+# trailing comma is added, then all adjacent commas are collapsed into a single
+# comma.  Then commas are replaced with the string .bib[space], and the
+# trailing space is killed off.  Finally, all filename spaces are escaped.
+# This produces a list of space-delimited .bib filenames, which is what the
+# make dep file expects to see.
+#
+# Note that we give kpsewhich a bogus argument so that a failure of sed to
+# produce output will not cause an error.
+#
+# $(call get-bibs,<aux file>,<targets>)
+define get-bibs
+$(SED) \
+-e '/^\\bibdata/!d' \
+-e 's/\\bibdata{\([^}]*\)}/\1,/' \
+-e 's/,\{2,\}/,/g' \
+-e 's/[[:space:]]/\\&/g' \
+-e 's/,/.bib /g' \
+-e 's/ \{1,\}$$//' \
+$1 | $(XARGS) $(KPSEWHICH) '#######' | \
+$(SED) \
+-e 's/^/$2: /' | \
+\$(SORT) | $(UNIQ)
+endef
+
+# Makes a an aux file that only has stuff relevant to the target in it
+# $(call make-auxtarget-file,<flattened-aux>,<new-aux>)
+define make-auxtarget-file
+$(SED) \
+-e '/^\\newlabel/!d' \
+$1 > $2
+endef
+
+# Makes an aux file that only has stuff relevant to the bbl in it
+# $(call make-auxbbl-file,<flattened-aux>,<new-aux>)
+define make-auxbbl-file
+$(SED) \
+-e '/^\\newlabel/d' \
+$1 > $2
+endef
+
+# Makes a .gpi.d file from a .gpi file
+# $(call make-gpi-d,<.gpi>,<.gpi.d>)
+define make-gpi-d
+$(ECHO) '# vim: ft=make' > $2; \
+$(ECHO) 'ifndef INCLUDED_$(call cleanse-filename,$2)' >> $2; \
+$(ECHO) 'INCLUDED_$(call cleanse-filename,$2) := 1' >> $2; \
+$(call get-gpi-deps,$1,$(addprefix $(2:%.gpi.d=%).,$(GNUPLOT_OUTPUT_EXTENSION) gpi.d)) >> $2; \
+$(ECHO) 'endif' >> $2;
+endef
+
+# Parse .gpi files for data and loaded dependencies, output to stdout
+#
+# The sed script here tries to be clever about obtaining valid
+# filenames from the gpi file.  It assumes that the plot command starts its own
+# line, which is not too difficult a constraint to satisfy.
+#
+# This command script also generates 'include' directives for every 'load'
+# command in the .gpi file.  The load command must appear on a line by itself
+# and the file it loads must have the suffix .gpi.  If you don't want it to be
+# compiled when running make graphics, then give it a suffix of ._include_.gpi.
+#
+# $(call get-gpi-deps,<gpi file>,<targets>)
+define get-gpi-deps
+$(SED) \
+-e '/^[[:space:]]*s\{0,1\}plot/,/[^\\]$$/{' \
+-e ' H' \
+-e ' /[^\\]$$/{' \
+-e '  s/.*//' \
+-e '  x' \
+-e '  s/\\\{0,1\}\n//g' \
+-e '  s/^[[:space:]]*s\{0,1\}plot[[:space:]]*\(\[[^]]*\][[:space:]]*\)*/,/' \
+-e '  s/[[:space:]]*\(['\''"][^'\''"]*['\''"]\)\{0,1\}[^,]*/\1/g' \
+-e '  s/,['\''"]-\{0,1\}['\''"]//g' \
+-e '  s/[,'\''"]\{1,\}/ /g' \
+-e '  s!.*!$2: &!' \
+-e '  p' \
+-e ' }' \
+-e ' d' \
+-e '}' \
+-e 's/^[[:space:]]*load[[:space:]]*['\''"]\([^'\''"]*\.gpi\)['\''"].*$$/-include \1.d/p' \
+-e 'd' \
+$1
+endef
+
+# Colorizes real, honest-to-goodness LaTeX errors that can't be overcome with
+# recompilation.
+#
+# Note that we only ignore file not found errors for things that we know how to
+# build, like graphics files.
+#
+# $(call colorize-latex-errors,<log file>)
+define colorize-latex-errors
+$(SED) \
+-e '$$ b para' \
+-e '/^$$/b para' \
+-e 'H' \
+-e 'd' \
+-e ':para' \
+-e 'x' \
+-e '/^$$/d' \
+-e 's/^\n*//' \
+-e '/^! LaTeX Error: File /{' \
+-e '  s/^/::DOUBLE_PARAGRAPH::/' \
+-e '  h' \
+-e '  d' \
+-e '}' \
+-e 's/^::DOUBLE_PARAGRAPH:://' \
+-e '/could not locate the file with any of these extensions:/d' \
+-e '/Missing .begin.document/{' \
+-e '  h' \
+-e '  s/.*/Are you trying to build an include file?/' \
+-e '  x' \
+-e '  G' \
+-e '}' \
+-e '/ LaTeX Error: Cannot determine size/d' \
+-e 's/.* LaTeX Error .*/$(C_ERROR)&$(C_RESET)/p' \
+-e 's/Error: pdflatex (file .*/$(C_ERROR)& - try specifying it without an extension$(C_RESET)/p' \
+-e '/.*\*hyperref using.*driver \(.*\)\*.*/{' \
+-e '  s//\1/' \
+-e '  /^$(hyperref_driver_pattern)$$/!{' \
+-e '    s/.*//' \
+-e '    p' \
+-e '    s/.*/$(C_ERROR)--- Using incorrect driver for hyperref! ---$(C_RESET)/' \
+-e '    p' \
+-e '    s/.*/$(C_ERROR)$(hyperref_driver_error)$(C_RESET)/' \
+-e '    p' \
+-e '  }' \
+-e '  d' \
+-e '}' \
+-e '/ LaTeX Error: Unknown graphics extension/{' \
+-e '  s/^/     /' \
+-e '  h' \
+-e '  s/.*/--- Graphics extension error:/' \
+-e '  G' \
+-e '  h' \
+-e '  s/.*/--- If you specified the extension explicitly in your .tex file, try removing it./' \
+-e '  H' \
+-e '  g' \
+-e '  s/.*/$(C_ERROR)&$(C_RESET)/' \
+-e '  p' \
+-e '  s/.*//' \
+-e '  h' \
+-e '  b' \
+-e '}' \
+-e 's/.*\(\n\{0,\}! .*\)/$(C_ERROR)\1$(C_RESET)/p' \
+-e 'd' \
+$1
+endef
+
+# Colorize Makeindex errors
+define colorize-makeindex-errors
+$(SED) \
+-e '/^!! /{' \
+-e '  N' \
+-e '  s/^.*$$/$(C_ERROR)&$(C_RESET)/' \
+-e '  p' \
+-e '}' \
+-e 'd' \
+$1
+endef
+
+# Colorize epstopdf errors
+#
+# $(call colorize-epstopdf-errors,<log file>)
+define colorize-epstopdf-errors
+$(SED) \
+-e '/^Error:/,/^Execution stack:/{' \
+-e '  /^Execution stack:/d' \
+-e '  s/.*/$(C_ERROR)&$(C_RESET)/' \
+-e '  p' \
+-e '}' \
+-e 'd' \
+$1
+endef
+
+# Colorize GNUplot errors
+#
+# $(call colorize-gnuplot-errors,<log file>)
+define colorize-gnuplot-errors
+$(SED) \
+-e '/, line [0-9]*:/!{' \
+-e '  H' \
+-e '  x' \
+-e '  s/.*\n\(.*\n.*\)$$/\1/' \
+-e '  x' \
+-e '}' \
+-e '/, line [0-9]*:/{' \
+-e '  H' \
+-e '  /unknown.*terminal type/{' \
+-e '    s/.*/--- Try changing the GNUPLOT_OUTPUT_EXTENSION variable to 'eps'./' \
+-e '	H' \
+-e '  }' \
+-e '  /gpihead/{' \
+-e '    s/.*/--- This could be a Makefile bug - contact the maintainer./' \
+-e '    H' \
+-e '  }' \
+-e '  g' \
+-e '  s/.*/$(C_ERROR)&$(C_RESET)/' \
+-e '  p' \
+-e '}' \
+-e '/^gnuplot>/,/^$$/{' \
+-e '  s/^gnuplot.*/$(C_ERROR)&/' \
+-e '  s/^$$/$(C_RESET)/' \
+-e '  p' \
+-e '}' \
+-e 'd' \
+$1
+endef
+
+# Colorize GraphViz errors
+#
+# $(call colorize-dot-errors,<log file>)
+define colorize-dot-errors
+$(SED) \
+-e '/^Error:/,/context:/s/.*/$(C_ERROR)&$(C_RESET)/p' \
+-e 's/^Warning:.*/$(C_WARNING)&$(C_RESET)/p' \
+-e 'd' \
+'$1'
+endef
+
+# Get all important .aux files from the top-level .aux file and merges them all
+# into a single file, which it outputs to stdout.
+#
+# $(call flatten-aux,<toplevel aux>,<output file>)
+define flatten-aux
+$(SED) \
+-e '/\\@input{\(.*\)}/{' \
+-e     's//\1/' \
+-e     's![.:]!\\&!g' \
+-e     'h' \
+-e     's!.*!\\:\\\\@input{&}:{!' \
+-e     'p' \
+-e     'x' \
+-e     's/\\././g' \
+-e     's/.*/r &/p' \
+-e     's/.*/d/p' \
+-e     's/.*/}/p' \
+-e     'd' \
+-e '}' \
+-e 'd' \
+'$1' > "$1.$$$$.sed.make"; \
+$(SED) -f "$1.$$$$.sed.make" '$1' > "$1.$$$$.make"; \
+$(SED) \
+-e '/^\\relax/d' \
+-e '/^\\bibcite/d' \
+-e 's/^\(\\newlabel{[^}]\{1,\}}\).*/\1/' \
+"$1.$$$$.make" | $(SORT) > '$2'; \
+$(call remove-temporary-files,$1.$$$$.make $1.$$$$.sed.make)
+endef
+
+# Generate pdf from postscript
+#
+# Note that we don't just call ps2pdf, since there are so many versions of that
+# script on various systems.  Instead, we call the postscript interpreter
+# directly.
+#
+# $(call ps2pdf,infile,outfile,[embed fonts])
+define ps2pdf
+	$(GS) \
+		-dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \
+		$(if $3,$(PS_EMBED_OPTIONS)) \
+		-q -dNOPAUSE -dBATCH \
+		-sDEVICE=pdfwrite -sstdout=%stderr \
+		'-sOutputFile=$2' \
+		-dSAFER -dCompatibilityLevel=$(PS_COMPATIBILITY) \
+		$(if $3,$(PS_EMBED_OPTIONS)) \
+		-c .setpdfwrite \
+		-f '$1'
+endef
+
+# Colorize LaTeX output.
+# This uses a neat trick from the Sed & Awk Book from O'Reilly:
+# 1) If a line has a single ending paren, delete it to make a blank line (so
+#	that we catch the first error, which is not always preceded by a blank
+#	line).
+# 2) Ensure that the last line of the file gets appended to the hold buffer,
+# 	and blank it out to trigger end-of-paragraph logic below.
+# 3) When encountering a blank line (LaTeX output helpfully breaks output on
+# 	newlines)
+# 	a) swap the hold buffer (containing the paragraph) into the pattern buffer (putting a blank line into the hold buffer),
+# 	b) remove the newline at the beginning (don't ask),
+# 	c) apply any colorizing substitutions necessary to ensure happiness.
+# 	d) get the newline out of the hold buffer and append it
+# 	e) profit! (print)
+# 4) Anything not colorized is deleted, unless in verbose mode.
+color_tex	:= \
+	$(SED) \
+	-e '$${' \
+	-e '  /^$$/!{' \
+	-e '    H' \
+	-e '    s/.*//' \
+	-e '  }' \
+	-e '}' \
+	-e '/^$$/!{' \
+	-e '  H' \
+	-e '  d' \
+	-e '}' \
+	-e '/^$$/{' \
+	-e '  x' \
+	-e '  s/^\n//' \
+	-e '  /Output written on /{' \
+	-e '    s/.*Output written on \([^(]*\) (\([^)]\{1,\}\)).*/Success!  Wrote \2 to \1/' \
+	-e '    s/[[:digit:]]\{1,\}/$(C_PAGES)&$(C_RESET)/g' \
+	-e '    s/Success!/$(C_SUCCESS)&$(C_RESET)/g' \
+	-e '    s/to \(.*\)$$/to $(C_SUCCESS)\1$(C_RESET)/' \
+	-e '    b end' \
+	-e '  }' \
+	-e '  / *LaTeX Error:.*/{' \
+	-e '    s/.*\( *LaTeX Error:.*\)/$(C_ERROR)\1$(C_RESET)/' \
+	-e '    b end' \
+	-e '  }' \
+	-e '  /.*Warning:.*/{' \
+	-e '    s//$(C_WARNING)&$(C_RESET)/' \
+	-e '    b end' \
+	-e '  }' \
+	-e '  /Underfull.*/{' \
+	-e '    s/.*\(Underfull.*\)/$(C_UNDERFULL)\1$(C_RESET)/' \
+	-e '    b end' \
+	-e '  }' \
+	-e '  /Overfull.*/{' \
+	-e '    s/.*\(Overfull.*\)/$(C_OVERFULL)\1$(C_RESET)/' \
+	-e '    b end' \
+	-e '  }' \
+	$(if $(VERBOSE),,-e '  d') \
+	-e '  :end' \
+	-e '  G' \
+	-e '}' \
+
+# Colorize BibTeX output.
+color_bib	:= \
+	$(SED) \
+	-e 's/^Warning--.*/$(C_WARNING)&$(C_RESET)/' -e 't' \
+	-e '/---/,/^.[^:]/{' \
+	-e '  H' \
+	-e '  /^.[^:]/{' \
+	-e '    x' \
+	-e '    s/\n\(.*\)/$(C_ERROR)\1$(C_RESET)/' \
+	-e '	p' \
+	-e '    s/.*//' \
+	-e '    h' \
+	-e '    d' \
+	-e '  }' \
+	-e '  d' \
+	-e '}' \
+	-e '/(.*error.*)/s//$(C_ERROR)&$(C_RESET)/' \
+	$(if $(VERBOSE),,-e 'd')
+
+
+# Make beamer output big enough to print on a full page.  Landscape doesn't
+# seem to work correctly.
+enlarge_beamer	= $(PSNUP) -l -1 -W128mm -H96mm -pletter
+
+# $(call test-run-again,<source stem>)
+test-run-again	= $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.)$$' $1.log
+
+# This tests whether the build target commands should be run at all, from
+# viewing the log file.
+# $(call test-log-for-need-to-run,<source stem>)
+define test-log-for-need-to-run
+$(SED) \
+-e '/^No file $(call escape-dots,$1)\.aux\./d' \
+$1.log \
+| $(EGREP) -q '^(.*Rerun .*|No file $1\.[^.]+\.|No file .+\.tex\.|LaTeX Warning: File.*)$$'
+endef
+
+# LaTeX invocations
+#
+# $(call latex,<tex file>,[<extra LaTeX args>])
+run-latex	= $(latex_build_program) --interaction=batchmode $(if $2,$2,) $1 > /dev/null
+
+# $(call latex-color-log,<LaTeX stem>)
+latex-color-log	= $(color_tex) $1.log
+
+# $(call run-makeindex,<input>,<output>,<log>,<extra flags>)
+define run-makeindex
+success=1; \
+if ! $(MAKEINDEX) -q $1 -t $3 -o $2 $4 > /dev/null || $(EGREP) -q '^!!' $3; then \
+	$(call colorize-makeindex-errors,$3); \
+	$(RM) -f '$2'; \
+	success=0; \
+fi; \
+[ "$$success" = "1" ] && $(sh_true) || $(sh_false);
+endef
+
+# This runs the given script to generate output, and it uses MAKE_RESTARTS to
+# ensure that it never runs it more than once for a particular root make
+# invocation.
+#
+# $(call run-script,<interpreter>,<input>,<output>)
+define run-script
+[ ! -e '$2.cookie' ] && $(ECHO) "restarts=$(RESTARTS)" > $2.cookie && $(ECHO) "level=$(MAKELEVEL)" >> $2.cookie; \
+restarts=`$(SED) -n -e 's/^restarts=//p' $2.cookie`; \
+level=`$(SED) -n -e 's/^level=//p' $2.cookie`; \
+if $(EXPR) $(MAKELEVEL) '<=' $$level '&' $(RESTARTS) '<=' $$restarts >/dev/null; then \
+	$(call echo-build,$2,$3,$(RESTARTS)-$(MAKELEVEL)); \
+	$1 '$2' '$3'; \
+	$(ECHO) "restarts=$(RESTARTS)" > '$2.cookie'; \
+	$(ECHO) "level=$(MAKELEVEL)" >> '$2.cookie'; \
+fi
+endef
+
+# BibTeX invocations
+#
+# $(call run-bibtex,<tex stem>)
+run-bibtex	= $(BIBTEX) $1 | $(color_bib)
+
+
+# $(call convert-eps-to-pdf,<eps file>,<pdf file>,[gray])
+# Note that we don't use the --filter flag because it has trouble with bounding boxes that way.
+define convert-eps-to-pdf
+$(if $3,$(CAT) '$1' | $(call kill-ps-color) > '$1.cookie',$(CP) '$1' '$1.cookie'); \
+$(EPSTOPDF) '$1.cookie' --outfile='$2' > $1.log; \
+$(call colorize-epstopdf-errors,$1.log);
+endef
+
+# $(call convert-gpi,<gpi file>,<output file>,[gray])
+#
+define convert-gpi
+$(ECHO) 'set terminal $(if $(filter %.pdf,$2),pdf enhanced,postscript enhanced eps)' \
+$(if $(filter %.pdf,$2),fsize ,)$(call get-default,$(strip \
+$(firstword \
+	$(shell \
+		$(SED) \
+			-e 's/^\#\#FONTSIZE=\([[:digit:]]\{1,\}\)/\1/p' \
+			-e 'd' \
+			$1 $(strip $(gpi_global)) \
+	) \
+) \
+),$(if $(filter %.pdf,$2),$(DEFAULT_GPI_PDF_FONTSIZE),$(DEFAULT_GPI_EPS_FONTSIZE))) \
+$(strip $(if $3,monochrome,$(if \
+$(shell $(EGREP) '^\#\#[[:space:]]*GRAY[[:space:]]*$$' $< $(gpi_global)),\
+,color))) > $1head.make; \
+$(ECHO) 'set output "$2"' >> $1head.make; \
+$(if $(gpi_global),$(CAT) $(gpi_global) >> $1head.make;,) \
+fnames='$1head.make $1';\
+$(if $(gpi_sed),\
+	$(SED) -f '$(gpi_sed)' $$fnames > $1.temp.make; \
+	fnames=$1.temp.make;,\
+) \
+success=1; \
+if ! $(GNUPLOT) $$fnames 2>$1.log; then \
+	$(call colorize-gnuplot-errors,$1.log); \
+	success=0; \
+fi; \
+$(if $(gpi_sed),$(call remove-temporary-files,$1.temp.make);,) \
+$(call remove-temporary-files,$1head.make); \
+[ "$$success" = "1" ] && $(sh_true) || $(sh_false);
+endef
+
+# Creation of .eps files from .png files
+#
+# The intermediate step of PNM (using NetPBM) produces much nicer output than
+# ImageMagick's "convert" binary.  I couldn't get the right combination of
+# flags to make it look nice, anyway.
+#
+# To handle gray scale conversion, we pipe things through ppmtopgm in the
+# middle.
+#
+# $(call convert-png,<png file>,<eps file>)
+define convert-png
+$(PNGTOPNM) "$1" \
+	$(if $3,| $(PPMTOPGM),) \
+	| $(PNMTOPS) -noturn \
+	> "$2"
+endef
+
+# Creation of .eps files from .jpg files
+#
+# Thanks to brubakee for this solution.
+#
+# Uses Postscript level 2 to avoid file size bloat
+# $(call convert-jpg,<jpg file>,<eps file>)
+define convert-jpg
+$(CONVERT) $(if $3,-type Grayscale,) '$1' eps2:'$2'
+endef
+
+# Creation of .eps files from .fig files
+# $(call convert-fig,<fig file>,<output file>,[gray])
+convert-fig	= $(FIG2DEV) -L $(if $(filter %.pdf,$2),pdf,eps) $(if $3,-N,) $1 $2
+
+# Creation of .pstex files from .fig files
+# $(call convert-fig-pstex,<fig file>,<pstex file>)
+convert-fig-pstex	= $(FIG2DEV) -L pstex $1 $2 > /dev/null 2>&1
+
+# Creation of .pstex_t files from .fig files
+# $(call convert-fig-pstex-t,<fig file>,<pstex file>,<pstex_t file>)
+convert-fig-pstex-t	= $(FIG2DEV) -L pstex_t -p $3 $1 $2 > /dev/null 2>&1
+
+# Creation of .dot_t files from .dot files
+# #(call convert-dot-tex,<dot file>,<dot_t file>)
+convert-dot-tex		= $(DOT2TEX) '$1' > '$2'
+
+# Converts svg files into .eps files
+#
+# $(call convert-svg,<svg file>,<eps file>,[gray])
+convert-svg	= $(INKSCAPE) --export-eps='$2' '$1'
+
+# Converts xvg files into .eps files
+#
+# $(call convert-xvg,<xvg file>,<eps file>,[gray])
+convert-xvg	= $(XMGRACE) '$1' -printfile - -hardcopy -hdevice $(if $3,-mono,) EPS > '$2'
+
+# Converts .eps.gz files into .eps files
+#
+# $(call convert-epsgz,<eps.gz file>,<eps file>,[gray])
+convert-epsgz	= $(GUNZIP) -c '$1' $(if $3,| $(call kill-ps-color)) > '$2'
+
+# Converts .eps files into .eps files (usually a no-op, but can make grayscale)
+#
+# $(call convert-eps,<in file>,<out file>,[gray])
+convert-eps	= $(if $3,$(call kill-ps-color) $1 > $2)
+
+# The name of the file containing special postscript commands for grayscale
+gray_eps_file	:= gray.eps.make
+
+# Changes sethsbcolor and setrgbcolor calls in postscript to always produce
+# grayscale.  In general, this is accomplished by writing new versions of those
+# functions into the user dictionary space, which is looked up before the
+# global or system dictionaries (userdict is one of the permanent dictionaries
+# in postscript and is not read-only like systemdict).
+#
+# For setrgbcolor, the weighted average of the triple is computed and the
+# triple is replaced with three copies of that average before the original
+# procedure is called: .299R + .587G + .114B
+#
+# For sethsbcolor, the color is first converted to RGB, then to grayscale by
+# the new setrgbcolor operator as described above.  Why is this done?
+# Because simply using the value component will tend to make pure colors
+# white, a very undesirable thing.  Pure blue should not translate to white,
+# but to some level of gray.  Conversion to RGB does the right thing.  It's
+# messy, but it works.
+#
+# From
+# http://en.wikipedia.org/wiki/HSV_color_space#Transformation_from_HSV_to_RGB,
+# HSB = HSV (Value = Brightness), and the formula used to convert to RGB is
+# as follows:
+#
+# Hi = int(floor(6 * H)) mod 6
+# f = 6 * H - Hi
+# p = V(1-S)
+# q = V(1-fS)
+# t = V(1-(1-f)S)
+# if Hi = 0: R G B <-- V t p
+# if Hi = 1: R G B <-- q V p
+# if Hi = 2: R G B <-- p V t
+# if Hi = 3: R G B <-- p q V
+# if Hi = 4: R G B <-- t p V
+# if Hi = 5: R G B <-- V p q
+#
+# The messy stack-based implementation is below
+# $(call create-gray-eps-file,filename)
+define create-gray-eps-file
+$(ECHO) -n -e '\
+/OLDRGB /setrgbcolor load def\n\
+/setrgbcolor {\n\
+    .114 mul exch\n\
+    .587 mul add exch\n\
+    .299 mul add\n\
+    dup dup\n\
+    OLDRGB\n\
+} bind def\n\
+/OLDHSB /sethsbcolor load def\n\
+/sethsbcolor {\n\
+    2 index                     % H V S H\n\
+    6 mul floor cvi 6 mod       % Hi V S H\n\
+    3 index                     % H Hi V S H\n\
+    6 mul                       % 6H Hi V S H\n\
+    1 index                     % Hi 6H Hi V S H\n\
+    sub                         % f Hi V S H\n\
+    2 index 1                   % 1 V f Hi V S H\n\
+    4 index                     % S 1 V f Hi V S H\n\
+    sub mul                     % p f Hi V S H\n\
+    3 index 1                   % 1 V p f Hi V S H\n\
+    6 index                     % S 1 V p f Hi V S H\n\
+    4 index                     % f S 1 V p f Hi V S H\n\
+    mul sub mul                 % q p f Hi V S H\n\
+    4 index 1 1                 % 1 1 V q p f Hi V S H\n\
+    5 index                     % f 1 1 V q p f Hi V S H\n\
+    sub                         % (1-f) 1 V q p f Hi V S H\n\
+    8 index                     % S (1-f) 1 V q p f Hi V S H\n\
+    mul sub mul                 % t q p f Hi V S H\n\
+    4 -1 roll pop               % t q p Hi V S H\n\
+    7 -2 roll pop pop           % t q p Hi V\n\
+    5 -2 roll                   % Hi V t q p\n\
+    dup 0 eq\n\
+    {1 index 3 index 6 index}\n\
+    {\n\
+        dup 1 eq\n\
+        {3 index 2 index 6 index}\n\
+        {\n\
+            dup 2 eq\n\
+            {4 index 2 index 4 index}\n\
+            {\n\
+                dup 3 eq\n\
+                {4 index 4 index 3 index}\n\
+                {\n\
+                    dup 4 eq\n\
+                    {2 index 5 index 3 index}\n\
+                    {\n\
+                        dup 5 eq\n\
+                        {1 index 5 index 5 index}\n\
+                        {0 0 0}\n\
+                        ifelse\n\
+                    }\n\
+                    ifelse\n\
+                }\n\
+                ifelse\n\
+            }\n\
+            ifelse\n\
+        }\n\
+        ifelse\n\
+    }\n\
+    ifelse                      % B G R Hi V t q p\n\
+    setrgbcolor\n\
+    5 {pop} repeat\n\
+} bind def\n'\
+> $1
+endef
+
+# This actually inserts the color-killing code into a postscript file
+# $(call kill-ps-color)
+define kill-ps-color
+$(SED) -e '/%%EndComments/r $(gray_eps_file)'
+endef
+
+# Converts graphviz .dot files into .eps files
+# Grayscale is not directly supported by dot, so we pipe it through fig2dev in
+# that case.
+# $(call convert-dot,<dot file>,<eps file>,<log file>,[gray])
+define convert-dot
+$(DOT) -Tps '$1' 2>'$3' $(if $4,| $(call kill-ps-color)) > $2; \
+$(call colorize-dot-errors,$3)
+endef
+
+# Convert DVI to Postscript
+# $(call make-ps,<dvi file>,<ps file>,<log file>,[<paper size>])
+make-ps		= \
+	$(DVIPS) -o '$2' $(if $(filter-out BEAMER,$4),-t$(firstword $4),) '$1' \
+		$(if $(filter BEAMER,$4),| $(enlarge_beamer)) > $3 2>&1
+
+# Convert Postscript to PDF
+# $(call make-pdf,<ps file>,<pdf file>,<log file>,<embed file>)
+make-pdf	= \
+	$(call ps2pdf,$1,$2,$(filter 1,$(shell $(CAT) '$4'))) > '$3' 2>&1
+
+# Display information about what is being done
+# $(call echo-build,<input file>,<output file>,[<run number>])
+echo-build	= $(ECHO) "$(C_BUILD)= $1 --> $2$(if $3, ($3),) =$(C_RESET)"
+echo-graphic	= $(ECHO) "$(C_GRAPHIC)= $1 --> $2 =$(C_RESET)"
+echo-dep	= $(ECHO) "$(C_DEP)= $1 --> $2 =$(C_RESET)"
+
+# Display a list of something
+# $(call echo-list,<values>)
+echo-list	= for x in $1; do $(ECHO) "$$x"; done
+
+#
+# DEFAULT TARGET
+#
+
+.PHONY: all
+all: $(default_pdf_targets) ;
+
+.PHONY: all-pdf
+all-pdf: $(default_pdf_targets) ;
+
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+.PHONY: all-ps
+all-ps: $(default_ps_targets) ;
+
+.PHONY: all-dvi
+all-dvi: $(default_dvi_targets) ;
+endif
+
+#
+# VIEWING TARGET
+#
+.PHONY: show
+show: all
+	$(QUIET)for x in $(default_pdf_targets); do \
+		[ -e "$$x" ] && $(VIEW_PDF) $$x & \
+	done
+
+#
+# INCLUDES
+#
+source_includes	:= $(addsuffix .d,$(source_stems_to_include))
+graphic_includes := $(addsuffix .gpi.d,$(graphic_stems_to_include))
+
+# Include only the dependencies used
+ifneq "" "$(source_includes)"
+include $(source_includes)$(call include-message,$(source_includes))
+endif
+ifneq "" "$(graphic_includes)"
+include $(graphic_includes)$(call include-message,$(graphic_includes))
+endif
+
+#
+# MAIN TARGETS
+#
+
+# Note that we don't just say %: %.pdf here - this can tend to mess up our
+# includes, which detect what kind of file we are asking for.  For example,
+# asking to build foo.pdf is much different than asking to build foo when
+# foo.gpi exists, because we look through all of the goals for *.pdf that
+# matches *.gpi, then use that to determine which include files we need to
+# build.
+#
+# Thus, we invoke make recursively with better arugments instead, restarting
+# all of the appropriate machinery.
+.PHONY: $(default_stems_ss)
+$(default_stems_ss): %: %.pdf ;
+
+# This builds and displays the wanted file.
+.PHONY: $(addsuffix ._show,$(stems_ssg))
+%._show: %.pdf
+	$(QUIET)$(VIEW_PDF) $< &
+
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+.SECONDARY: $(all_pdf_targets)
+%.pdf: %.ps %.embed.make
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call make-pdf,$<,$@.temp,$@.log,$*.embed.make); \
+	if [ x"$$?" = x"0" ]; then \
+	    $(if $(VERBOSE),$(CAT) $@.log,:); \
+	    $(RM) -f '$@'; \
+	    $(MV) '$@.temp' '$@'; \
+	    $(TOUCH) '$@'; \
+	    $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \
+	else \
+	    $(CAT) $@.log; \
+	    $(call remove-temporary-files,'$@.temp'); \
+	    $(sh_false); \
+	fi
+
+.SECONDARY: $(all_ps_targets)
+%.ps: %.dvi %.paper.make
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call make-ps,$<,$@.temp,$@.log,\
+			$(firstword $(shell $(CAT) $*.paper.make))); \
+	if [ x"$$?" = x"0" ]; then \
+	    $(if $(VERBOSE),$(CAT) $@.log,:); \
+	    $(RM) -f '$@'; \
+	    $(MV) '$@.temp' '$@'; \
+	    $(TOUCH) '$@'; \
+	    $(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \
+	else \
+	    $(CAT) $@.log; \
+	    $(call remove-temporary-files,'$@.temp'); \
+	    $(sh_false); \
+	fi
+endif
+
+# Build the final target (dvi or pdf) file.  This is a very tricky rule because
+# of the way that latex runs multiple times, needs graphics after the first run
+# (or maybe already has them), and relies on bibliographies or indices that may
+# not exist.
+#
+#	Check the log for fatal errors.  If they exist, colorize and bail.
+#
+#	Create the .auxtarget.cookie file.  (Needed for next time if not present)
+#
+#	If any of the following are true, we must rebuild at least one time:
+#
+#	* the .bbl was recently rebuilt
+#
+#		check a cookie, then delete it
+#
+#	* any of several output files was created or changed:
+#
+#		check $*.run.cookie, then delete it
+#
+#	* the .aux file changed in a way that necessitates attention
+#
+#		Note that if the .auxtarget.make file doesn't exist, this means
+#		that we are doing a clean build, so it doesn't figure into the
+#		test for running again.
+#
+#		compare against .auxtarget.make
+#
+#		move if different, remove if not
+#
+#	* the .log file has errors or warnings requiring at least one more run
+#
+#	We use a loop over a single item to simplify the process of breaking
+#	out when we find one of the conditions to be true.
+#
+#	If we do NOT need to run latex here, then we move the $@.1st.make file
+#	over to $@ because the target file has already been built by the first
+#	dependency run and is valid.
+#
+#	If we do, we delete that cookie file and do the normal multiple-runs
+#	routine.
+#
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+.SECONDARY: $(all_dvi_targets)
+endif
+%.$(build_target_extension): %.bbl %.aux %.$(build_target_extension).1st.make
+	$(QUIET)\
+	fatal=`$(call colorize-latex-errors,$*.log)`; \
+	if [ x"$$fatal" != x"" ]; then \
+		$(ECHO) "$$fatal"; \
+		exit 1; \
+	fi; \
+	$(call make-auxtarget-file,$*.aux.make,$*.auxtarget.cookie); \
+	run=0; \
+	for i in 1; do \
+		if $(call test-exists,$*.bbl.cookie); then \
+			run=1; \
+			break; \
+		fi; \
+		if $(call test-exists,$*.run.cookie); then \
+			run=1; \
+		    	break; \
+		fi; \
+		if $(call \
+		test-exists-and-different,$*.auxtarget.cookie,$*.auxtarget.make);\
+		then \
+			run=1; \
+			break; \
+		fi; \
+		if $(call test-log-for-need-to-run,$*); then \
+			run=1; \
+			break; \
+		fi; \
+	done; \
+	$(call remove-temporary-files,$*.bbl.cookie $*.run.cookie); \
+	$(MV) $*.auxtarget.cookie $*.auxtarget.make; \
+	if [ x"$$run" = x"1" ]; then \
+		$(call remove-files,$@.1st.make); \
+		for i in 2 3 4 5; do \
+			$(if $(findstring 3.79,$(MAKE_VERSION)),\
+				$(call echo-build,$*.tex,$@,$(RESTARTS)-$$$$i),\
+				$(call echo-build,$*.tex,$@,$(RESTARTS)-$$i)\
+			); \
+			$(call run-latex,$*); \
+			$(CP) '$*.log' '$*.'$(RESTARTS)-$$i'.log'; \
+			$(call test-run-again,$*) || break; \
+		done; \
+	else \
+		$(MV) '$@.1st.make' '$@'; \
+	fi; \
+	$(call copy-with-logging,$@,$(BINARY_TARGET_DIR)); \
+	$(call latex-color-log,$*)
+
+# Build the .bbl file.  When dependencies are included, this will (or will
+# not!) depend on something.bib, which we detect, acting accordingly.  The
+# dependency creation also produces the %.auxbbl.make file.  BibTeX is a bit
+# finicky about what you call the actual files, but we can rest assured that if
+# a .auxbbl.make file exists, then the .aux file does, as well.  The
+# .auxbbl.make file is a cookie indicating whether the .bbl needs to be
+# rewritten.  It only changes if the .aux file changes in ways relevant to .bbl
+# creation.
+#
+# Note that we do NOT touch the .bbl file if there is no need to
+# create/recreate it.  We would like to leave existing files alone if they
+# don't need to be changed, thus possibly avoiding a rebuild trigger.
+%.bbl: %.auxbbl.make
+	$(QUIET)\
+	$(if $(filter %.bib,$^),\
+		$(call echo-build,$(filter %.bib,$?) $*.aux,$@); \
+		$(call run-bibtex,$*); \
+		$(TOUCH) $@.cookie; \
+	) \
+	if $(EGREP) -q 'bibstyle.(apacann|chcagoa|[^}]*annot)' '$*.aux'; then \
+		$(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-1); \
+		$(call run-latex,$*); \
+		$(CP) '$*.log' '$*.$(RESTARTS)-annotated.log'; \
+		$(if $(filter %.bib,$^),\
+			$(call echo-build,** annotated extra bibtex ** $(filter %.bib,$?) $*.aux,$@); \
+			$(call run-bibtex,$*); \
+			$(TOUCH) $@.cookie; \
+		) \
+		$(call echo-build,** annotated extra latex **,output ignored,$(RESTARTS)-2); \
+		$(call run-latex,$*); \
+	fi
+
+# Create the index file - note that we do *not* depend on %.tex here, since
+# that unnecessarily restricts the kinds of indices that we can build to those
+# with exactly the same stem as the source file.  Things like splitidx create
+# idx files with other names.
+#
+# Therefore, we add the .tex dependency in the sourcestem.d file in the call to
+# get index file dependencies from the logs.
+%.ind:	%.idx
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call run-makeindex,$<,$@,$*.ilg)
+
+# Create the glossary file
+%.gls:	%.glo %.tex
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call run-makeindex,$<,$@,$*.glg,-s nomencl.ist)
+
+# Create the nomenclature file
+%.nls:	%.nlo %.tex
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call run-makeindex,$<,$@,$*.nlg,-s nomencl.ist)
+
+# SCRIPTED LaTeX TARGETS
+#
+# Keep the generated .tex files around for debugging if needed.
+.SECONDARY: $(all_tex_targets)
+
+%.tex::	%.tex.sh
+	$(QUIET)$(call run-script,$(SHELL),$<,$@)
+
+%.tex::	%.tex.py
+	$(QUIET)$(call run-script,$(PYTHON),$<,$@)
+
+%.tex::	%.tex.pl
+	$(QUIET)$(call run-script,$(PERL),$<,$@)
+
+%.tex::	%.rst $(RST_STYLE_FILE)
+	$(QUIET)\
+	$(call run-script,$(RST2LATEX)\
+		--documentoptions=letterpaper\
+		$(if $(RST_STYLE_FILE),--stylesheet=$(RST_STYLE_FILE),),$<,$@)
+
+#
+# GRAPHICS TARGETS
+#
+.PHONY: all-graphics
+all-graphics:	$(all_graphics_targets);
+
+ifneq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+.PHONY: all-pstex
+all-pstex:	$(all_pstex_targets);
+endif
+
+.PHONY: all-dot2tex
+all-dot2tex:	$(all_dot2tex_targets);
+
+.PHONY: show-graphics
+show-graphics: all-graphics
+	$(VIEW_GRAPHICS) $(all_known_graphics)
+
+$(gray_eps_file):
+	$(QUIET)$(call echo-build,$^,$@)
+	$(QUIET)$(call create-gray-eps-file,$@)
+
+ifeq "$(strip $(BUILD_STRATEGY))" "pdflatex"
+%.pdf: %.eps $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-eps-to-pdf,$<,$@,$(GRAY))
+
+ifeq "$(strip $(GNUPLOT_OUTPUT_EXTENSION))" "pdf"
+%.pdf:	%.gpi %.gpi.d $(gpi_sed)
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-gpi,$<,$@,$(GRAY))
+endif
+
+%.pdf:	%.fig
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-fig,$<,$@,$(GRAY))
+
+endif
+
+%.eps:	%.gpi %.gpi.d $(gpi_sed)
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-gpi,$<,$@,$(GRAY))
+
+%.eps: %.fig
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-fig,$<,$@,$(GRAY))
+
+%.eps: %.dot $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-dot,$<,$@,$<.log,$(GRAY))
+
+%.eps: %.xvg $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-xvg,$<,$@,$(GRAY))
+
+%.eps: %.svg $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-svg,$<,$@,$(GRAY))
+
+%.eps: %.jpg $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-jpg,$<,$@,$(GRAY))
+
+%.eps: %.png $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-png,$<,$@,$(GRAY))
+
+%.eps: %.eps.gz $(if $(GRAY),$(gray_eps_file))
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-epsgz,$<,$@,$(GRAY))
+
+%.pstex: %.fig
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-fig-pstex,$<,$@,$(GRAY))
+
+%.pstex_t: %.fig %.pstex
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-fig-pstex-t,$<,$@,$*.pstex,$(GRAY))
+
+%.dot_t: %.dot
+	$(QUIET)$(call echo-graphic,$^,$@)
+	$(QUIET)$(call convert-dot-tex,$<,$@)
+
+#
+# DEPENDENCY-RELATED TARGETS.
+#
+
+# Generate all of the information needed to get dependencies
+# As a side effect, this creates a .dvi or .pdf file (depending on the build
+# strategy).  We need to be sure to remove it if there are errors.  Errors can
+# take several forms and all of them are found within the log file:
+#	* There was a LaTeX error
+#	* A needed file was not found
+#	* Cross references need adjustment
+#
+# Behavior:
+#	This rule is responsible for generating the following:
+#	%.aux
+#	%.d
+#	%.aux.make
+#	%.(pdf|dvi).1st.make (the .pdf or .dvi output file, moved)
+#
+#	Steps:
+#
+#	Run latex
+#	Move .pdf or .dvi somewhere else (make no judgements about success)
+#	Flatten the .aux file into another file
+#	Add source dependencies
+#	Add graphic dependencies
+#	Add bib dependencies
+#
+#	Create cookies for various suffixes that may represent files that
+#	need to be read by LaTeX in order for it to function properly.
+#
+#	Note that if some of the dependencies are discovered because they turn
+#	up missing in the log file, we really need the .d file to be reloaded.
+#	Adding a sleep command helps with this.  Otherwise make is extremely
+#	nondeterministic, sometimes working, sometimes not.
+#
+#	Usually we can force this by simply removing the generated pdf file and
+#	not creating a .1st.make file..
+#
+%.$(build_target_extension).1st.make %.d %.aux %.aux.make %.fls: %.tex
+	$(QUIET)$(call echo-build,$<,$*.d $*.$(build_target_extension).1st.make,$(RESTARTS)-1)
+	$(QUIET)\
+	$(call run-latex,$<,--recorder) || $(sh_true); \
+	$(CP) '$*.log' '$*.$(RESTARTS)-1.log'; \
+	$(call die-on-dot2tex,$*.log); \
+	$(call die-on-no-aux,$*); \
+	$(call flatten-aux,$*.aux,$*.aux.make); \
+	$(ECHO) "# vim: ft=make" > $*.d; \
+	$(ECHO) ".PHONY: $*._graphics" >> $*.d; \
+	$(call get-inputs,$*.fls,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \
+	$(call get-missing-inputs,$*.log,$(addprefix $*.,aux aux.make d $(build_target_extension))) >> $*.d; \
+	$(ECHO) ".SECONDEXPANSION:" >> $*.d; \
+	$(call get-graphics,$*) >> $*.d; \
+	$(call get-log-index,$*,$(addprefix $*.,d aux aux.make)) >> $*.d; \
+	$(call get-bibs,$*.aux.make,$(addprefix $*.,bbl aux aux.make)) >> $*.d; \
+	$(EGREP) -q "# MISSING" $*.d && $(SLEEP) 1 && $(RM) $*.pdf; \
+	$(call move-if-exists,$*.$(build_target_extension),$*.$(build_target_extension).1st.make); \
+	for s in toc out lot lof lol nav; do \
+		if [ -e "$*.$$s" ]; then \
+			if ! $(DIFF) -q $*.$$s $*.$$s.make >/dev/null 2>&1; then \
+				$(TOUCH) $*.run.cookie; \
+			fi; \
+			$(CP) $*.$$s $*.$$s.make; \
+		fi; \
+	done
+
+# This is a cookie that is updated if the flattened aux file has changed in a
+# way that affects the bibliography generation.
+.SECONDARY: $(addsuffix .auxbbl.make,$(stems_ssg))
+%.auxbbl.make: %.aux.make
+	$(QUIET)\
+	$(call make-auxbbl-file,$<,$@.temp); \
+	$(call replace-if-different-and-remove,$@.temp,$@)
+
+# Build a dependency file for .gpi files.  These often plot data files that
+# also reside in the directory, so if a data file changes, it's nice to know
+# about it.  This also handles loaded .gpi files, whose filename should have
+# _include_. in it.
+%.gpi.d: %.gpi
+	$(QUIET)$(call echo-build,$<,$@)
+	$(QUIET)$(call make-gpi-d,$<,$@)
+
+# Store the paper size for this document -- note that if beamer is used we set
+# it to the special BEAMER paper size.  We only do this, however, if the
+# special comment exists, in which case we enlarge the output with psnup.
+#
+#	The paper size is extracted from a documentclass attribute.
+%.paper.make: %.tex
+	$(QUIET)$(SED) \
+	-e '/\\documentclass/,/}/{' \
+	-e '  s/%.*//' \
+	-e '  H' \
+	-e '  /}/{' \
+	-e '    s/.*//' \
+	-e '    x' \
+	-e '    /\\documentclass/!d' \
+	-e '    s/[\n[:space:]]*//g' \
+	-e '    s/\([,{[]\)\([[:alnum:]]\{1,\}\)paper\([],}]\)/\1%-\2-%\3/g' \
+	-e '    s/\([,{[]\)\(landscape\)\([],}]\)/\1%-\2-%\3/g' \
+	-e '    s/^[^%]*%-//' \
+	-e '    s/-%[^%]*$$//' \
+	-e '    s/-%[^%]%-/ /g' \
+	-e '    p' \
+	-e '  }' \
+	-e '  d' \
+	-e '}' \
+	-e 'd' \
+	$< > $@; \
+	$(EGREP) -q '^[^%]*\\documentclass[^{]*{beamer}' $< && \
+	(\
+		$(EGREP) -q '^%%[[:space:]]*BEAMER[[:space:]]*LARGE$$' $< && \
+		$(ECHO) "BEAMER" > $@ || \
+		: > $@ \
+	) || $(sh_true)
+
+# Store embedding instructions for this document using a special comment
+%.embed.make: %.tex
+	$(QUIET)$(EGREP) '^%%[[:space:]]*NO[[:space:]]*EMBED[[:space:]]*$$' $< \
+		&& $(ECHO) '' > $@ \
+		|| $(ECHO) '1' > $@;
+
+#
+# HELPFUL PHONY TARGETS
+#
+
+.PHONY: _all_programs
+_all_programs:
+	$(QUIET)$(ECHO) "== All External Programs Used =="
+	$(QUIET)$(call output-all-programs)
+
+.PHONY: _check_programs
+_check_programs:
+	$(QUIET)$(ECHO) "== Checking Makefile Dependencies =="; $(ECHO)
+	$(QUIET) \
+	$(ECHO) hi; \
+	allprogs=`\
+	 ($(call output-all-programs)) | \
+	 $(SED) \
+	 -e 's/^[[:space:]]*//' \
+	 -e '/^#/d' \
+	 -e 's/[[:space:]]*#.*//' \
+	 -e '/^=/s/[[:space:]]/_/g' \
+	 -e '/^[[:space:]]*$$/d' \
+	 -e 's/^[^=].*=[[:space:]]*\([^[:space:]]\{1,\}\).*$$/\\1/' \
+	 `; \
+	spaces='                             '; \
+	for p in $${allprogs}; do \
+	case $$p in \
+		=*) $(ECHO); $(ECHO) "$$p";; \
+		*) \
+			$(ECHO) -n "$$p:$$spaces" | $(SED) -e 's/^\(.\{0,20\}\).*$$/\1/'; \
+			loc=`$(WHICH) $$p`; \
+			if [ x"$$?" = x"0" ]; then \
+				$(ECHO) "$(C_SUCCESS)Found:$(C_RESET) $$loc"; \
+			else \
+				$(ECHO) "$(C_FAILURE)Not Found$(C_RESET)"; \
+			fi; \
+			;; \
+	esac; \
+	done
+
+.PHONY: _check_gpi_files
+_check_gpi_files:
+	$(QUIET)$(ECHO) "== Checking all .gpi files for common errors =="; \
+	$(ECHO); \
+	for f in $(files.gpi); do \
+	result=`$(EGREP) '^([^#]*set terminal |set output )' $$f`; \
+	$(ECHO) -n "$$f: "; \
+	if [ x"$$result" = x"" ]; then \
+		$(ECHO) "$(C_SUCCESS)Okay$(C_RESET)"; \
+	else \
+		$(ECHO) "$(C_FAILURE)Warning: Problematic commands:$(C_RESET)";\
+		$(ECHO) "$(C_ERROR)$$result$(C_RESET)"; \
+	fi; \
+	done; \
+	$(ECHO)
+
+.PHONY: _all_stems
+_all_stems:
+	$(QUIET)$(ECHO) "== All Stems =="
+	$(QUIET)$(call echo-list,$(sort $(default_stems_ss)))
+
+.PHONY: _includes
+_includes:
+	$(QUIET)$(ECHO) "== Include Stems =="
+	$(QUIET)$(ECHO) "=== Sources ==="
+	$(QUIET)$(call echo-list,$(sort $(source_includes)))
+	$(QUIET)$(ECHO) "=== Graphics ==="
+	$(QUIET)$(call echo-list,$(sort $(graphic_includes)))
+
+.PHONY: _all_sources
+_all_sources:
+	$(QUIET)$(ECHO) "== All Sources =="
+	$(QUIET)$(call echo-list,$(sort $(all_files.tex)))
+
+.PHONY: _dependency_graph
+_dependency_graph:
+	$(QUIET)$(ECHO) "/* LaTeX Dependency Graph */"
+	$(QUIET)$(call output-dependency-graph)
+
+.PHONY: _show_dependency_graph
+_show_dependency_graph:
+	$(QUIET)$(call output-dependency-graph,$(graph_stem).dot)
+	$(QUIET)$(DOT) -Tps -o $(graph_stem).eps $(graph_stem).dot
+	$(QUIET)$(VIEW_POSTSCRIPT) $(graph_stem).eps
+	$(QUIET)$(call remove-temporary-files,$(graph_stem).*)
+
+.PHONY: _sources
+_sources:
+	$(QUIET)$(ECHO) "== Sources =="
+	$(QUIET)$(call echo-list,$(sort $(files.tex)))
+
+.PHONY: _scripts
+_scripts:
+	$(QUIET)$(ECHO) "== Scripts =="
+	$(QUIET)$(call echo-list,$(sort $(files_scripts)))
+
+.PHONY: _graphic_outputs
+_graphic_outputs:
+	$(QUIET)$(ECHO) "== Graphic Outputs =="
+	$(QUIET)$(call echo-list,$(sort $(all_graphics_targets)))
+
+.PHONY: _env
+_env:
+ifdef .VARIABLES
+	$(QUIET)$(ECHO) "== MAKE VARIABLES =="
+	$(QUIET)$(call echo-list,$(foreach var,$(sort $(.VARIABLES)),'$(var)'))
+endif
+	$(QUIET)$(ECHO) "== ENVIRONMENT =="
+	$(QUIET)$(ENV)
+
+#
+# CLEAN TARGETS
+#
+# clean-generated is somewhat unique - it relies on the .fls file being
+# properly built so that it can determine which of the files was generated, and
+# which was not.  Expect it to silently fail if the .fls file is missing.
+#
+# This is used to, e.g., clean up index files that are generated by the LaTeX.
+.PHONY: clean-generated
+clean-generated:
+	$(QUIET)$(call clean-files,$(foreach e,$(addsuffix .fls,$(all_stems_source)),\
+						$(shell $(call get-generated-names,$e))))
+
+.PHONY: clean-deps
+clean-deps:
+	$(QUIET)$(call clean-files,$(all_d_targets) *.make *.make.temp *.cookie)
+
+.PHONY: clean-tex
+clean-tex: clean-deps
+	$(QUIET)$(call clean-files,$(rm_tex))
+
+.PHONY: clean-graphics
+# TODO: This *always* deletes pstex files, even if they were not generated by
+# anything....  In other words, if you create a pstex and pstex_t pair by hand
+# an drop them in here without the generating fig file, they will be deleted
+# and you won't get them back.  It's a hack put in here because I'm not sure we
+# even want to keep pstex functionality, so my motivation is not terribly high
+# for doing it right.
+clean-graphics:
+	$(QUIET)$(call clean-files,$(all_graphics_targets) $(intermediate_graphics_targets) *.gpi.d *.pstex *.pstex_t *.dot_t)
+
+.PHONY: clean-backups
+clean-backups:
+	$(QUIET)$(call clean-files,$(backup_patterns) *.temp)
+
+.PHONY: clean-auxiliary
+clean-auxiliary:
+	$(QUIET)$(call clean-files,$(graph_stem).*)
+
+.PHONY: clean-nographics
+clean-nographics: clean-tex clean-deps clean-backups clean-auxiliary ;
+
+.PHONY: clean
+clean:	clean-generated clean-tex clean-graphics clean-deps clean-backups clean-auxiliary
+
+#
+# HELP TARGETS
+#
+
+.PHONY: help
+help:
+	$(help_text)
+
+.PHONY: version
+version:
+	$(QUIET)\
+	$(ECHO) "$(fileinfo) Version $(version)"; \
+	$(ECHO) "by $(author)"; \
+
+#
+# HELP TEXT
+#
+
+define help_text
+# $(fileinfo) Version $(version)
+#
+# by $(author)
+#
+# Generates a number of possible output files from a LaTeX document and its
+# various dependencies.  Handles .bib files, \include and \input, and .eps
+# graphics.  All dependencies are handled automatically by running LaTeX over
+# the source.
+#
+# USAGE:
+#
+#    make [GRAY=1] [VERBOSE=1] [SHELL_DEBUG=1] <target(s)>
+#
+# STANDARD OPTIONS:
+#    GRAY:
+#        Setting this variable forces all recompiled graphics to be grayscale.
+#        It is useful when creating a document for printing.  The default is
+#        to allow colors.  Note that it only changes graphics that need to be
+#        rebuilt!  It is usually a good idea to do a 'make clean' first.
+#
+#    VERBOSE:
+#        This turns off all @ prefixes for commands invoked by make.  Thus,
+#        you get to see all of the gory details of what is going on.
+#
+#    SHELL_DEBUG:
+#        This enables the -x option for sh, meaning that everything it does is
+#        echoed to stderr.  This is particularly useful for debugging
+#        what is going on in $$(shell ...) invocations.  One of my favorite
+#        debugging tricks is to do this:
+#
+#        make -d SHELL_DEBUG=1 VERBOSE=1 2>&1 | less
+#
+# STANDARD AUXILIARY FILES:
+#
+#      Makefile.ini
+#
+#          This file can contain variable declarations that override various
+#          aspects of the makefile.  For example, one might specify
+#
+#          neverclean := *.pdf *.ps
+#          onlysources.tex := main.tex
+#          LATEX_COLOR_WARNING := 'bold red uline'
+#
+#          And this would override the neverclean setting to ensure that pdf
+#          and ps files always remain behind, set the makefile to treat all
+#          .tex files that are not "main.tex" as includes (and therefore not
+#          default targets).  It also changes the LaTeX warning output to be
+#          red, bold, and underlined.
+#
+#          There are numerous variables in this file that can be overridden in
+#          this way.  Search for '?=' to find them all.
+#
+#          Also, you can put arbitrary targets into it if, for example, you
+#          want your source built from something else, e.g.:
+#
+#          generated.tex: generating_script.weird_lang depA depB
+#          	./generating_script.weird_lang > $$@
+#
+#          Note that if you are not careful, you can override the default
+#          target (what happens when you type "make" without arguments), so if
+#          you do use Makefile.ini, you probably want to start it with
+#          something like the following line:
+#
+#          default: all
+#
+#          Since the first target in any makefile is automatically the default,
+#          and the makefile already has a sensible "all" target, this will do
+#          what you want.
+#
+#          The Makefile.ini is imported before *anything else* is done, so go
+#          wild with your ideas for changes to this makefile in there.  It
+#          makes it easy to test them before submitting patches.
+#
+# STANDARD ENVIRONMENT VARIABLES:
+#
+#      LATEX_COLOR_WARNING		'$(LATEX_COLOR_WARNING)'
+#      LATEX_COLOR_ERROR		'$(LATEX_COLOR_ERROR)'
+#      LATEX_COLOR_UNDERFULL		'$(LATEX_COLOR_UNDERFULL)'
+#      LATEX_COLOR_OVERFULL		'$(LATEX_COLOR_OVERFULL)'
+#      LATEX_COLOR_PAGES		'$(LATEX_COLOR_PAGES)'
+#      LATEX_COLOR_BUILD		'$(LATEX_COLOR_BUILD)'
+#      LATEX_COLOR_GRAPHIC		'$(LATEX_COLOR_GRAPHIC)'
+#      LATEX_COLOR_DEP			'$(LATEX_COLOR_DEP)'
+#      LATEX_COLOR_SUCCESS		'$(LATEX_COLOR_SUCCESS)'
+#      LATEX_COLOR_FAILURE		'$(LATEX_COLOR_FAILURE)'
+#
+#   These may be redefined in your environment to be any of the following:
+#
+#      black
+#      red
+#      green
+#      yellow
+#      blue
+#      magenta
+#      cyan
+#      white
+#
+#   Bold or underline may be used, as well, either alone or in combination
+#   with colors:
+#
+#      bold
+#      uline
+#
+#   Order is not important.  You may want, for example, to specify:
+#
+#   export LATEX_COLOR_SUCCESS='bold blue uline'
+#
+#   in your .bashrc file.  I don't know why, but you may want to.
+#
+# STANDARD TARGETS:
+#
+#    all:
+#        Make all possible documents in this directory.  The documents are
+#        determined by scanning for .tex and .tex.sh (described in more detail
+#        later) and omitting any file that ends in ._include_.tex or
+#        ._nobuild_.tex.  The output is a set of .pdf files.
+#
+#        If you wish to omit files without naming them with the special
+#        underscore names, set the following near the top of the Makefile,
+#        or (this is recommended) within a Makefile.ini in the same directory:
+#
+#        	includes.tex := file1.tex file2.tex
+#
+#        This will cause the files listed to be considered as include files.
+#
+#        If you have only few source files, you can set
+#
+#        	onlysources.tex := main.tex
+#
+#        This will cause only the source files listed to be considered in
+#        dependency detection.  All other .tex files will be considered as
+#        include files.  Note that these options work for *any* source type,
+#        so you could do something similar with includes.gpi, for example.
+#        Note that this works for *any valid source* target.  All of the
+#        onlysources.* variables are commented out in the shipping version of
+#        this file, so it does the right thing when they simply don't exist.
+#        The comments are purely documentation.  If you know, for example, that
+#        file.mycoolformat is supported by this Makefile, but don't see the
+#        "onlysources.mycoolformat" declared in the comments, that doesn't mean
+#        you can't use it.  Go ahead and set "onlysources.mycoolformat" and it
+#        should do the right thing.
+#
+#    show:
+#        Builds and displays all documents in this directory.  It uses the
+#        environment-overridable value of VIEW_PDF (currently $(VIEW_PDF)) to
+#        do its work.
+#
+#    all-graphics:
+#        Make all of the graphics in this directory.
+#
+#    all-pstex (only for BUILD_STRATEGY=latex):
+#        Build all fig files into pstex and pstex_t files.  Gray DOES NOT WORK.
+#
+#    all-gray-pstex (only for BUILD_STRATEGY=latex):
+#    	 Build all fig files into grayscale pstex and pstex_t files.
+#
+#    all-dot2tex:
+#    	 Build all dot files into tex files.
+#
+#    show-graphics:
+#        Builds and displays all graphics in this directory.  Uses the
+#        environment-overridable value of VIEW_GRAPHICS (currently
+#        $(VIEW_GRAPHICS)) to do its work.
+#
+#    clean:
+#        Remove ALL generated files, leaving only source intact.
+#        This will *always* skip files mentioned in the "neverclean" variable,
+#        either in this file or specified in Makefile.ini:
+#
+#        	neverclean := *.pdf *.ps
+#
+#       The neverclean variable works on all "clean" targets below, as well.
+#
+#    clean-graphics:
+#        Remove all generated graphics files.
+#
+#    clean-backups:
+#        Remove all backup files: $(backup_patterns)
+#        (XFig and other editors have a nasty habit of leaving them around)
+#        Also removes Makefile-generated .temp files
+#
+#    clean-tex:
+#        Remove all files generated from LaTeX invocations except dependency
+#        information.  Leaves graphics alone.
+#
+#    clean-deps:
+#        Removes all auto-generated dependency information.
+#
+#    clean-auxiliary:
+#        Removes extra files created by various targets (like the dependency
+#        graph output).
+#
+#    clean-nographics:
+#        Cleans everything *except* the graphics files.
+#
+#    help:
+#        This help text.
+#
+#    version:
+#        Version information about this LaTeX makefile.
+#
+# DEBUG TARGETS:
+#
+#    _all_programs:
+#        A list of the programs used by this makefile.
+#
+#    _check_programs:
+#        Checks your system for the needed software and reports what it finds.
+#
+#    _check_gpi_files:
+#        Checks the .gpi files in the current directory for common errors, such
+#        as specification of the terminal or output file inside of the gpi file
+#        itself.
+#
+#    _dependency_graph:
+#        Outputs a .dot file to stdout that represents a graph of LaTeX
+#        dependencies.  To see it, use the _show_dependency_graph target or
+#        direct the output to a file, run dot on it, and view the output, e.g.:
+#
+#        make _dependency_graph > graph.dot
+#        dot -T ps -o graph.eps graph.dot
+#        gv graph.eps
+#
+#    _show_dependency_graph:
+#        Makes viewing the graph simple: extracts, builds and displays the
+#        dependency graph given in the _dependency_graph target using the value
+#        of the environment-overridable VIEW_POSTSCRIPT variable (currently set
+#        to $(VIEW_POSTSCRIPT)).  The postscript viewer is used because it
+#        makes it easier to zoom in on the graph, a critical ability for
+#        something so dense and mysterious.
+#
+#    _all_sources:
+#        List all .tex files in this directory.
+#
+#    _sources:
+#        Print out a list of all compilable sources in this directory.  This is
+#        useful for determining what make thinks it will be using as the
+#        primary source for 'make all'.
+#
+#    _scripts:
+#        Print out a list of scripts that make knows can be used to generate
+#        .tex files (described later).
+#
+#    _all_stems:
+#        Print a list of stems.  These represent bare targets that can be
+#        executed.  Listing <stem> as a bare target will produce <stem>.pdf.
+#
+#    _includes:
+#        A list of .d files that would be included in this run if _includes
+#        weren't specified.  This target may be used alone or in conjunction
+#        with other targets.
+#
+#    _graphic_outputs:
+#        A list of all generated .eps files
+#
+#    _env:
+#        A list of environment variables and their values.  If supported by
+#        your version of make, also a list of variables known to make.
+#
+# FILE TARGETS:
+#
+#    %, %.pdf:
+#        Build a PDF file from the corresponding %.tex file.
+#
+#        If BUILD_STRATEGY=pdflatex, then this builds the pdf directly.
+#        Otherwise, it uses this old-school but effective approach:
+#
+#            latex -> dvips -> ps2pdf
+#
+#        The BUILD_STRATEGY can be overridden in Makefile.ini in the same
+#        directory.  The default is pdflatex.
+#
+#        Reasons for using latex -> dvips include the "psfrag" package, and the
+#        generation of postscript instead of PDF.  Arguments for using pdflatex
+#        include "new and shiny" and "better supported."  I can't argue with
+#        either of those, and supporting them both didn't turn out to be that
+#        difficult, so there you have it.  Choices.
+#
+#    %._show:
+#        A phony target that builds the pdf file and then displays it using the
+#        environment-overridable value of VIEW_PDF ($(VIEW_PDF)).
+#
+#    %._graphics:
+#        A phony target that generates all graphics on which %.pdf (or %.dvi)
+#        depends.
+#
+#    %.ps (only for BUILD_STRATEGY=latex):
+#        Build a Postscript file from the corresponding %.tex file.
+#        This is done using dvips.  Paper size is automatically
+#        extracted from the declaration
+#
+#        \documentclass[<something>paper]
+#
+#        or it is the system default.
+#
+#        If using beamer (an excellent presentation class), the paper
+#        size is ignored.  More on this later.
+#
+#    %.dvi (only for BUILD_STRATEGY=latex):
+#        Build the DVI file from the corresponding %.tex file.
+#
+#    %.ind:
+#        Build the index for this %.tex file.
+#
+#    %.gls:
+#        Build the nomenclature glossary for this %.tex file.
+#
+#    %.nls:
+#        Build the (newer) nomenclature file for this %.tex file.
+#
+#    %.eps:
+#        Build an eps file from one of the following file types:
+#
+#       .dot    : graphviz
+#       .gpi    : gnuplot
+#       .fig    : xfig
+#       .xvg    : xmgrace
+#       .svg    : scalable vector graphics (goes through inkscape)
+#       .png    : png (goes through NetPBM)
+#       .jpg	: jpeg (goes through ImageMagick)
+#       .eps.gz : gzipped eps
+#
+#       The behavior of this makefile with each type is described in
+#       its own section below.
+#
+#    %.pstex{,_t} (only for BUILD_STRATEGY=latex):
+#       Build a .pstex_t file from a .fig file.
+#
+# FEATURES:
+#
+#    Optional Binary Directory:
+#        If you create the _out_ directory in the same place as the makefile,
+#        it will automatically be used as a dumping ground for .pdf (or .dvi,
+#        .ps, and .pdf) output files.
+#
+#        Alternatively, you can set the BINARY_TARGET_DIR variable, either as a
+#        make argument or in Makefile.ini, to point to your directory of
+#        choice.  Note that no pathname wildcard expansion is done in the
+#        makefile, so make sure that the path is complete before going in
+#        there.  E.g., if you want to specify something in your home directory,
+#        use $$HOME/ instead of ~/ so that the shell expands it before it gets
+#        to the makefile.
+#
+#    External Program Dependencies:
+#        Every external program used by the makefile is represented by an
+#        ALLCAPS variable at the top of this file.  This should allow you to
+#        make judgments about whether your system supports the use of this
+#        makefile.  The list is available in the ALL_PROGRAMS variable and,
+#        provided that you are using GNU make 3.80 or later (or you haven't
+#        renamed this file to something weird like "mylatexmakefile" and like
+#        invoking it with make -f) can be viewed using
+#
+#        make _all_programs
+#
+#        Additionally, the availability of these programs can be checked
+#        automatically for you by running
+#
+#        make _check_programs
+#
+#        The programs are categorized according to how important they are and
+#        what function they perform to help you decide which ones you really
+#        need.
+#
+#    Colorized Output:
+#        The output of commands is colorized to highlight things that are often
+#        important to developers.  This includes {underfull,overfull}
+#        {h,v}boxes, general LaTeX Errors, each stage of document building, and
+#        the number of pages in the final document.  The colors are obtained
+#        using 'tput', so colorization should work pretty well on any terminal.
+#
+#        The colors can be customized very simply by setting any of the
+#        LATEX_COLOR_<CONTEXT> variables in your environment (see above).
+#
+#    Predecessors to TeX Files:
+#        Given a target <target>, if no <target>.tex file exists but a
+#        corresponding script or predecessor file exists, then appropriate
+#        action will be taken to generate the tex file.
+#
+#        Currently supported script or predecessor languages are:
+#
+#        sh:     %.tex.sh
+#        perl:   %.tex.pl
+#        python: %.tex.py
+#
+#           Calls the script using the appropriate interpreter, assuming that
+#           its output is a .tex file.
+#
+#           The script is called thus:
+#
+#              <interpreter> <script file name> <target tex file>
+#
+#           and therefore sees exactly one parameter: the name of the .tex
+#           file that it is to create.
+#
+#           Why does this feature exist?  I ran into this while working on
+#           my paper dissertation.  I wrote a huge bash script that used a
+#           lot of sed to bring together existing papers in LaTeX.  It
+#           would have been nice had I had something like this to make my
+#           life easier, since as it stands I have to run the script and
+#           then build the document with make.  This feature provides hooks
+#           for complicated stuff that you may want to do, but that I have
+#           not considered.  It should work fine with included dependencies,
+#           too.
+#
+#           Scripts are run every time make is invoked.  Some trickery is
+#           employed to make sure that multiple restarts of make don't cause
+#           them to be run again.
+#
+#        reST: %.rst
+#
+#           Runs the reST to LaTeX converter to generate a .tex file
+#           If it finds a file names _rststyle_._include_.tex, uses it as
+#           the "stylesheet" option to rst2latex.
+#
+#           Note that this does not track sub-dependencies in rst files.  It
+#           assumes that the top-level rst file will change if you want a
+#           rebuild.
+#
+#    Dependencies:
+#
+#        In general, dependencies are extracted directly from LaTeX output on
+#        your document.  This includes
+#
+#        *    Bibliography information
+#        *    \include or \input files (honoring \includeonly, too)
+#        *    Graphics files inserted by the graphicx package
+#
+#        Where possible, all of these are built correctly and automatically.
+#        In the case of graphics files, these are generated from the following
+#        file types:
+#
+#        GraphViz:      .dot
+#        GNUPlot:       .gpi
+#        XFig:          .fig
+#        XMgrace:       .xvg
+#        SVG:           .svg
+#        PNG:           .png
+#        JPEG:          .jpg
+#        GZipped EPS:   .eps.gz
+#
+#        If the file exists as a .eps already, it is merely used (and will not
+#        be deleted by 'clean'!).
+#
+#        LaTeX and BibTeX are invoked correctly and the "Rerun to get
+#        cross-references right" warning is heeded a reasonable number of
+#        times.  In my experience this is enough for even the most troublesome
+#        documents, but it can be easily changed (if LaTeX has to be run after
+#        BibTeX more than three times, it is likely that something is moving
+#        back and forth between pages, and no amount of LaTeXing will fix
+#        that).
+#
+#        \includeonly is honored by this system, so files that are not
+#        specified there will not trigger a rebuild when changed.
+#
+#    Beamer:
+#        A special TeX source comment is recognized by this makefile (only when
+#        BUILD_STRATEGY=latex, since this invokes psnup):
+#
+#        %%[[:space:]]*BEAMER[[:space:]]*LARGE
+#
+#        The presence of this comment forces the output of dvips through psnup
+#        to enlarge beamer slides to take up an entire letter-sized page.  This
+#        is particularly useful when printing transparencies or paper versions
+#        of the slides.  For some reason landscape orientation doesn't appear
+#        to work, though.
+#
+#        If you want to put multiple slides on a page, use this option and then
+#        print using mpage, a2ps, or psnup to consolidate slides.  My personal
+#        favorite is a2ps, but your mileage may vary.
+#
+#        When beamer is the document class, dvips does NOT receive a paper size
+#        command line attribute, since beamer does special things with sizes.
+#
+#    GNUPlot Graphics:
+#        When creating a .gpi file, DO NOT INCLUDE the "set terminal" or "set
+#        output" commands!  The makefile will include terminal information for
+#        you.  Besides being unnecessary and potentially harmful, including the
+#        terminal definition in the .gpi file makes it harder for you, the one
+#        writing the document, to preview your graphics, e.g., with
+#
+#           gnuplot -persist myfile.gpi
+#
+#        so don't do specify a terminal or an output file in your .gpi files.
+#
+#        When building a gpi file into an eps file, there are several features
+#        available to the document designer:
+#
+#        Global Header:
+#            The makefile searches for the files in the variable GNUPLOT_GLOBAL
+#            in order:
+#
+#            ($(GNUPLOT_GLOBAL))
+#
+#            Only the first found is used.  All .gpi files in the directory are
+#            treated as though the contents of GNUPLOT_GLOBAL were directly
+#            included at the top of the file.
+#
+#            NOTE: This includes special comments! (see below)
+#
+#        Font Size:
+#            A special comment in a .gpi file (or a globally included file) of
+#            the form
+#
+#            ## FONTSIZE=<number>
+#
+#            will change the font size of the GPI output.  If font size is
+#            specified in both the global file and the GPI file, the
+#            specification in the individual GPI file is used.
+#
+#        Grayscale Output:
+#            GNUplot files also support a special comment to force them to be
+#            output in grayscale *no matter what*:
+#
+#            ## GRAY
+#
+#            This is not generally advisable, since you can always create a
+#            grayscale document using the forms mentioned above.  But, if your
+#            plot simply must be grayscale even in a document that allows
+#            colors, this is how you do it.
+#
+#    XFig Graphics:
+#            No special handling is done with XFig, except when a global
+#            grayscale method is used, e.g.
+#
+#                make GRAY=1 document
+#
+#            In these cases the .eps files is created using the -N switch to
+#            fig2dev to turn off color output.  (Only works with eps, not pstex
+#            output)
+#
+#    GraphVis Graphics:
+#            Color settings are simply ignored here.  The 'dot' program is used
+#            to transform a .dot file into a .eps file.
+#
+#            If you want, you can use the dot2tex program to convert dot files
+#            to tex graphics.  The default is to just call dot2tex with no
+#            arguments, but you can change the DOT2TEX definition to include
+#            options as needed (in your Makefile.ini).
+#
+#            Note that, as with pstex, the makefile cannot use latex's own
+#            output to discover all missing dot_t (output) files, since anytime
+#            TeX includes TeX, it has to bail when it can't find the include
+#            file.  It can therefore only stop on the first missing file it
+#            discovers, and we can't get a large list of them out easily.
+#
+#            So, the makefile errors out if it's missing an included dot_t
+#            file, then prompts the user to run this command manually:
+#
+#                make all-dot2tex
+#
+#    GZipped EPS Graphics:
+#
+#        A .eps.gz file is sometimes a nice thing to have.  EPS files can get
+#        very large, especially when created from bitmaps (don't do this if you
+#        don't have to).  This makefile will unzip them (not in place) to
+#        create the appropriate EPS file.
+#
+endef
+
+#
+# DEPENDENCY CHART:
+#
+#digraph "g" {
+#    rankdir=TB
+#    size="9,9"
+#    edge [fontsize=12 weight=10]
+#    node [shape=box fontsize=14 style=rounded]
+#
+#    eps [
+#        shape=Mrecord
+#        label="{{<gpi> GNUplot|<epsgz> GZip|<dot> Dot|<fig> XFig}|<eps> eps}"
+#        ]
+#    pstex [label="%.pstex"]
+#    pstex_t [label="%.pstex_t"]
+#    tex_outputs [shape=point]
+#    extra_tex_files [shape=point]
+#    gpi_data [label="<data>"]
+#    gpi_includes [label="_include_.gpi"]
+#    aux [label="%.aux"]
+#    fls [label="%.fls"]
+#    idx [label="%.idx"]
+#    glo [label="%.glo"]
+#    ind [label="%.ind"]
+#    log [label="%.log"]
+#    tex_sh [label="%.tex.sh"]
+#    rst [label="%.rst"]
+#    tex [
+#        shape=record
+#        label="<tex> %.tex|<include> _include_.tex"
+#        ]
+#    include_aux [label="_include_.aux"]
+#    file_bib [label=".bib"]
+#    bbl [label="%.bbl"]
+#    dvi [label="%.dvi"]
+#    ps [label="%.ps"]
+#    pdf [label="%.pdf"]
+#    fig [label=".fig"]
+#    dot [label=".dot"]
+#    gpi [label=".gpi"]
+#    eps_gz [label=".eps.gz"]
+#
+#    gpi_files [shape=point]
+#
+#    rst -> tex:tex [label="reST"]
+#    tex_sh -> tex:tex [label="sh"]
+#    tex_pl -> tex:tex [label="perl"]
+#    tex_py -> tex:tex [label="python"]
+#    tex -> tex_outputs [label="latex"]
+#    tex_outputs -> dvi
+#    tex_outputs -> aux
+#    tex_outputs -> log
+#    tex_outputs -> fls
+#    tex_outputs -> idx
+#    tex_outputs -> include_aux
+#    aux -> bbl [label="bibtex"]
+#    file_bib -> bbl [label="bibtex"]
+#    idx -> ind [label="makeindex"]
+#    glo -> gls [label="makeindex"]
+#    nlo -> nls [label="makeindex"]
+#    gls -> extra_tex_files
+#    nls -> extra_tex_files
+#    ind -> extra_tex_files
+#    bbl -> extra_tex_files
+#    eps -> extra_tex_files
+#    extra_tex_files -> dvi [label="latex"]
+#    gpi_files -> eps:gpi [label="gnuplot"]
+#    gpi -> gpi_files
+#    gpi_data -> gpi_files
+#    gpi_includes -> gpi_files
+#    eps_gz -> eps:epsgz [label="gunzip"]
+#    fig -> eps:fig [label="fig2dev"]
+#    fig -> pstex [label="fig2dev"]
+#    fig -> pstex_t [label="fig2dev"]
+#    pstex -> pstex_t [label="fig2dev"]
+#    dot -> eps:dot [label="dot"]
+#    dvi -> ps [label="dvips"]
+#    include_aux -> bbl [label="bibtex"]
+#    ps -> pdf [label="ps2pdf"]
+#
+#    edge [ color=blue label="" style=dotted weight=1 fontcolor=blue]
+#    fls -> tex:include [label="INPUT: *.tex"]
+#    fls -> file_bib [label="INPUT: *.aux"]
+#    aux -> file_bib [label="\\bibdata{...}"]
+#    include_aux -> file_bib [label="\\bibdata{...}"]
+#    log -> gpi [label="Graphic file"]
+#    log -> fig [label="Graphic file"]
+#    log -> eps_gz [label="Graphic file"]
+#    log -> dot [label="Graphic file"]
+#    log -> idx [label="No file *.ind"]
+#    log -> glo [label="No file *.gls"]
+#    log -> nlo [label="No file *.nls"]
+#    gpi -> gpi_data [label="plot '...'"]
+#    gpi -> gpi_includes [label="load '...'"]
+#    tex:tex -> ps [label="paper"]
+#    tex:tex -> pdf [label="embedding"]
+#}
+
+#
+# DEPENDENCY CHART SCRIPT
+#
+# $(call output_dependency_graph,[<output file>])
+define output-dependency-graph
+	if [ -f '$(this_file)' ]; then \
+	$(SED) \
+		-e '/^[[:space:]]*#[[:space:]]*DEPENDENCY CHART:/,/^$$/!d' \
+		-e '/DEPENDENCY CHART/d' \
+		-e '/^$$/d' \
+		-e 's/^[[:space:]]*#//' \
+		$(this_file) $(if $1,> '$1',); \
+	else \
+		$(ECHO) "Cannot determine the name of this makefile."; \
+	fi
+endef
+# vim: noet sts=0 sw=8 ts=8
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/adding_new_languages.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,23 @@
+\subsection{Adding new Languages}
+The GNV-Server has the possibility to handle different languages. It is
+necessary to configure those.
+
+The configuration is divided into three steps:
+
+\begin{enumerate}
+   \item Adding the required resource-file to the GNV-Server
+   \\{\tt /gnv-artifacts/src/main/resources/lang }
+   \item Adding the required resource-file to the GNV-Web-Client
+   {\tt /gnv/src/main/resources}
+   \item Publishing the new language to the GNV-Server by adding the
+   language-code to the file 
+   \\{\tt /gnv-artifacts/src/main/resources/lang/lang.conf}
+\end{enumerate}
+
+To generate the resource-files it might be helpful to copy an existing one and
+translate its content into the desired language.
+
+Please note that you have to re-package the modules gnv and gnv-artifacts to
+enable the new languages - currently, only german and english are provided.
+If you want to provide further languages you have to change the toggle-mechanism
+for switching the language in the web-client.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/administering_artifact-server.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,103 @@
+\subsection{Configuring and Running the Artifact-Server}
+
+This section describes the possibilities to configure the
+artifact-server. The following properties do affect mostly technical
+funtions of the server.
+
+This section describes the possibilities in a kind of a reference
+manual. Information for the process of installing and integration can be
+found in the Administration Manual of the GNV-System.
+The following elements are covered here:
+
+\begin{lstlisting}
+artifact-database
+|-- geo-backend # pointing to database connection, SQL configuration
+|-- rest-server # port, listen addresses
+|-- database # internal database storing artifacts
+|-- ehcache # pointing to cache configuration
+|-- cleaner # time of cleanups FIXME
+`-- export-secret # signing project files
+\end{lstlisting}
+
+\paragraph*{geo-backend}
+{\em Function}: The geo-backend encapsulates the logic for accessing the
+database backend. At this time, the use of ESRI ArcSDE 9.3.1 is supported.
+
+At least, the following options for configuring the element {\tt
+geo-backend} are required:
+
+\begin{itemize}
+    \item {\tt backend-configuration}: path to the file defining the
+    connection properties to the database backend, preconfigured to {\tt
+    arcsdeconnection.properties}. Normally, just the
+    connection parameters have to de adapted. Further information can be
+    found in the file itself.
+
+    \item {\tt query-configuration}: path to the file listing a SQL statements,\\
+    preconfigured to \texttt{queries.properties}. Further information can be
+    found at chapter~\ref{ref:queries.properties},
+    p.~\ref{ref:queries.properties}
+\end{itemize}
+
+
+\paragraph*{rest-server}
+{\em Function}: The REST-Server needs a HTTP binding configured via:
+
+\begin{itemize}
+    \item {\tt port}: port the server should listen on. Preconfigured on
+    8181.
+    \item {\tt listen}: for security reason the accessibility can be
+    limited. The parameter needs an IP-address or a hostname.
+    Accessibility to the entire network can be done by
+    removing/commenting out of the element.
+\end{itemize}
+
+
+\paragraph*{database}
+{\em Function}: The internal database of the system for storing
+artifacts representing a parameterisation of a client session. So fare,
+the filebased database H2 is supported. Connecting to other backends can
+be provided.
+
+\begin{itemize}
+    \item {\tt user}: database user for connecting to the
+    artifact-database. In new installations "SA" is used.
+    \item {\tt password}: password of the database user for
+    authentification.
+    \item {\tt url}: Connection URL to the database-files.
+    In the preconfiguration, they are written to \\
+    \verb| ${artifacts.config.dir}/../artifactdb|
+\end{itemize}
+
+
+\paragraph*{ehcache}
+{\em Function}: The cache for storing result sets of the database. The
+configuration in {\tt ehcache.xml} should not been adapted. Changing has
+at least consequence to the system requirements.
+
+\begin{itemize}
+    \item {\tt configuration}: the path to the configuration file. \\
+    Preconfigured: \verb+${artifacts.config.dir}/ehcache.xml+
+\end{itemize}
+
+
+\paragraph*{cleaner}
+{\em Function}: Process for cleaning up the artifact-database. Artifacts
+have a time-to-life. Died artifacts need to be removed. Changing the
+interval has consequences to the size of the database.
+
+\begin{itemize}
+    \item {\tt sleep-time}: Time interval in milliseconds between 2
+    checks. Preconfigured: 60000 (1 minute)
+\end{itemize}
+
+
+\paragraph*{export-secret}
+{\em Function}: Signature for signing project files that were created by
+the artifact-server instance. Before reading a projectfile the server
+checks the file against that signature/check sum.
+
+{\bf Be aware, changing the signature of updating the source code of
+artifacts will prevent of using existing project-files.}
+
+For setting up the secret, c.f. the tips in the admin manual.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/config-manual.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,206 @@
+\documentclass[12pt]{scrartcl}
+
+%----------------------------------------------
+% Load packages
+
+\usepackage{a4}
+\usepackage{times}
+\usepackage[latin1]{inputenc}
+\usepackage{fancyhdr}
+%\usepackage{german}
+%\usepackage[marvosym]{eurofont}
+%\usepackage[all, light]{draftcopy}
+%\usepackage{supertabular}
+%\usepackage{colortbl}
+%\usepackage{epsf}
+\usepackage{graphicx}
+\usepackage{lastpage}
+%\usepackage{proposal}
+\usepackage{listings}
+\usepackage[hyperindex=true, bookmarks=true, breaklinks=true,
+colorlinks=true, linkcolor=red,bookmarksopen]{hyperref}
+
+%----------------------------------------------
+% Document DATE and VERSION
+% set these values when releasing a new version
+
+\newcommand{\documentdate}{May 12th, 2010}
+\newcommand{\documentversion}{1.0}
+\newcommand{\documentrevision}{FIXME SVN REV}
+\newcommand{\documentID}{config-manual.tex}
+%----------------------------------------------
+
+%----------------------------------------------
+% Document TITLE
+\newcommand{\documenttitle}{Generic Viewer -- Reference and Configuration}
+
+
+%----------------------------------------------
+% Some parameters for layouting
+
+\paperwidth=21cm
+\hoffset=-0.54cm
+\textwidth=17cm
+
+\paperheight=29.7cm
+\voffset=-1.5cm
+\topmargin=0cm
+\headheight=1cm
+\textheight=24cm
+
+\setcounter{secnumdepth}{4}
+\setcounter{tocdepth}{4}
+
+%----------------------------------------------
+
+\begin{document}
+
+\lstset{ %
+language=sh,
+basicstyle=\ttfamily,       % the size of the fonts that are used for the code
+numbers=left,                   % where to put the line-numbers
+numberstyle=\footnotesize,      % the size of the fonts that are used for the line-numbers
+numbersep=5pt,                  % how far the line-numbers are from the code
+% backgroundcolor=\color{white},  % choose the background color. You must add \usepackage{color}
+showspaces=false,               % show spaces adding particular underscores
+showstringspaces=false,         % underline spaces within strings
+showtabs=false,                 % show tabs within strings adding particular underscores
+frame=single,                   % adds a frame around the code
+tabsize=2,                      % sets default tabsize to 2 spaces
+captionpos=b,                   % sets the caption-position to bottom
+breaklines=true,                % sets automatic line breaking
+breakatwhitespace=false,        % sets if automatic breaks should only happen at whitespace
+title=\lstname,                 % show the filename of files included with \lstinputlisting; also try caption instead of title
+escapeinside={\%*}{*)}          % if you want to add a comment within your code
+% morekeywords={*,...}            % if you want to add more keywords to the set
+}
+
+%-----------------------------------
+% HEADER/FOOTER DEFINITION
+
+% for some pages latex switches back to pagestyle plain :-(
+\fancypagestyle{plain}{%
+	\fancyhf{} % clear all header and footer fields
+	\fancyhead[LO,RE]{\footnotesize \documenttitle\\ \leftmark}
+	\fancyfoot[RO,LE]{\footnotesize Intevation GmbH} % Author
+	\fancyfoot[CO,CE]{\footnotesize \thepage/\pageref{LastPage}}
+	\fancyfoot[LO,RE]{\footnotesize \documentdate
+	\\\documentID}
+	\renewcommand{\footrulewidth}{0.4pt}
+}
+
+% and now define pagestyle fancy
+\fancyhead{} % clear all fields
+\fancyhead[LO]{\footnotesize \documenttitle\\ \leftmark}
+
+\fancyfoot{}% clear all fields
+\fancyfoot[RO]{\footnotesize Intevation GmbH} % Author
+\fancyfoot[CO]{\footnotesize \thepage/\pageref{LastPage}}
+\fancyfoot[LO]{\footnotesize \documentdate
+\\\documentID}
+
+\renewcommand{\footrulewidth}{0.4pt}
+
+%
+% END Header/Footer Definition
+%-----------------------------------
+
+%----------------------------------------------
+% MACRO DEFINITION
+%
+%   \Fig{figure}{lof text}{caption} :
+%			places 'figure' and
+%                       writes 'caption' at the bottom with leading
+%                       'Abbildung figno:'. 'lof text' is added to the list of
+%                       figures.
+%                       Example:
+%                       \Fig{\epsfxsize30mm \epsffile{x.eps}}{the x}{the x}
+%
+%   \FigNoEntry{}{} :
+%			same as above, no entry in figures list
+%
+%   \FigCaption{} :
+%			line with figure caption, setting figure
+%                       counter and figures list
+%
+%   \Tab{table}{lot text}{caption} :
+%			places 'table' and writes caption on top of the table
+%			with leading 'Tabelle tabno:'. 'lot text' is added to
+%			the list of tables.
+%****************************************************************************
+%       Figure makro for graphics continously enumerated.
+%
+
+\newcounter{FigCnt}
+\newcounter{TabCnt}
+
+\newcommand{\Fig}[3]%
+{
+        \refstepcounter{FigCnt}
+        \addcontentsline{lof}{figure}%
+                {\protect\numberline{\arabic{FigCnt}}{#2}}
+        \mbox{#1}
+
+\nopagebreak
+        {Abbildung \arabic{FigCnt}: #3}
+
+}
+
+\newcommand{\FigNoEntry}[2]%
+{
+        \refstepcounter{FigCnt}
+        \mbox{#1}
+
+\nopagebreak
+        {Abbildung \arabic{FigCnt}: #2}
+
+}
+
+\newcommand{\FigCaption}[1]%
+{
+        \refstepcounter{FigCnt}
+        \addcontentsline{lof}{figure}%
+                {\protect\numberline{\arabic{FigCnt}}{#1}}
+
+        %{Figure \thesection.\arabic{FigCnt}: #1}
+}
+
+\newcommand{\Tab}[3]%
+{
+        \refstepcounter{TabCnt}
+        \addcontentsline{lot}{figure}%
+                {\protect\numberline{\arabic{TabCnt}}{#2}}
+        {Tabelle \arabic{TabCnt}: #3}
+\nopagebreak
+        #1
+
+}
+
+\hyphenation{Intevation}
+% end macro definition
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcounter{schritt}
+\renewcommand{\theschritt}{\Roman{schritt}}
+%\makeatletter\renewcommand{\p@schritt}{Abschnitt~\thesubsubsection~}\makeatother
+
+%-----------------------------------
+% DOCUMENT SETTINGS
+\pagestyle{fancy}
+\setlength{\parindent}{0cm}
+\setlength{\parskip}{5pt plus 2pt minus 1pt}
+
+% Start actual content here
+\include{title}
+\newpage
+\tableofcontents
+\include{overview}
+\include{general_settings}
+\include{administering_artifact-server}
+\include{generating_charts}
+\include{generating_maps}
+\include{adding_new_languages}
+\include{model_of_transitions}
+\include{miscellanea}
+\end{document}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/config-manual.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,59 @@
+Configuration of the GNV Artifact Server
+
+1. Overview of Artifact Server
+
+artifact-server
+|-- artifactdb
+|-- bin
+|   `-- lib
+|-- cache
+|-- conf
+|   |-- maptemplates
+|   |-- palette
+|   `-- products
+|-- install
+|   `-- debian
+|-- mapfiles
+`-- shapefiles
+
+2. General settings
+- structure of conf.xml
+- Port
+- Logging
+- ...
+
+
+3. Model of transitions
+    General principle of model of transitions
+        - FIS -> product -> transitions in data model
+
+    Adding a new FIS and product
+        - One short example: using timeseries on ArcMarineBSH TimeSeries
+
+    SQL:
+    Clarify the special mechanism of the internal functions
+    ST_ASTEXT(SHAPE)
+    ST_ASTEXT(RASTER)
+
+
+4. Configuring diagrams
+    Global template
+    Configuring 2D-diagrams
+        - matching mechanism
+
+
+5. Map Generator
+    General functionality
+        Configuring new maps
+            Self generated layers: Cross Sections
+                - matching mechanism
+            Complex data models from central datawarehouse
+                - matching mechanism!!!!!
+
+4. Other configurations
+- gap detection:
+%% FIXME HP: Meaning of keys time gap defintions (time_gap def.xml)
+%% Gaps are defined in WIKI of BSH. mediawiki/index.php/MEDIAN_Coded_Value_Domains#TSIntervalTypes
+%% FIXME HP: Gaps in verticalprofiles? configurable?
+- cache cleaner
+
Binary file doc/config-manual/figures/bsh_logo.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/figures/intevation-logo.eps	Fri Sep 28 12:15:18 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/general_settings.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,80 @@
+\section{Configuring the GNV-Server}
+
+The configuration of the artifact- and mapserver is been done in the
+central configuration directory at {\tt artifact-server/conf/}. The
+central entry point is the file {\tt conf.xml}. All components of the
+configuration are linked from this document. 
+
+{\bf Within the configuration the key 
+{\verb+${artifacts.config.dir}+} can be used to reference the central
+configuration directory of the artifact-server instance, e.g. 
+\texttt{/opt/artifact-server/conf}.}
+
+The following structure gives an overview of the entire structure
+starting from {\tt conf/}:
+
+%% tree /opt/artifact-server/
+\begin{lstlisting}
+conf/
+|-- arcsdeconnectionpool.properties # database connection
+|-- charttemplate.xml # general properties for chart generation
+|-- conf.xml # central configuration
+|-- ehcache.xml # configuration of caching system
+|-- log4j.properties # logging of server
+|-- maptemplates # style defintions for rendering maps
+|   `-- *.vm
+|-- meshwidth.xml # buffer-size for querying different FIS on
+                  # meshes
+|-- palette # styling for 2D charts
+|   `-- *.xml
+|-- products # configuration of steps in workflows
+|   |-- horizontalcrosssection
+|   |   `-- *.xml
+|   |-- horizontalprofile
+|   |   `-- *.xml
+|   |-- layer
+|   |   `-- *.xml
+|   |-- timeseries
+|   |   |-- *.xml
+|   |   `-- timegap_definition.xml # definition of a gaps as defines in MEDIAN Coded Value Domains section TSIntervalTypes. The meaning of the defined gaps are detailed  explained in the file itself.
+|   |-- verticalcrosssection
+|   |   `-- *.xml
+|   `-- verticalprofile
+|       `-- *.xml
+`-- queries.properties # SQL configuration according to products
+\end{lstlisting}
+
+
+The central config-file {\tt conf/conf.xml} is XML-based and contains the
+following main elements:
+
+\begin{lstlisting}
+artifact-database
+|-- geo-backend # pointing to database connection, SQL configuration
+|-- rest-server # port, listen addresses
+|-- database # internal database storing artifacts
+|-- ehcache # pointing to cache configuration
+|-- cleaner # time of cleanups FIXME
+|-- export-secret # signing project files
+|-- factories # list of expert information systems
+|-- artifacts # list of products
+|-- gnv # charts, palettes, interpolation parameters
+|-- mapserver # integration of mapserver
+`-- velocity # templating language used in maptemplates
+\end{lstlisting}
+
+The documentation of the configuration will be split up in 4 sections
+addressing different tasks:
+\begin{enumerate}
+    \item "Configuring and Running Artifact-Server" covering the main elements 
+    \texttt{
+geo-backend, rest-server, database, ehcache, cleaner, export-secret}
+    \item "Generating Charts -- Background and Configuration" covering
+    the main element {\tt gnv}
+    \item "Generating Maps -- Background and Configuration" covering the
+    main elements {\tt mapserver, velocity}
+    \item "Configuring FIS, Products, States, Transitions and
+    SQL-Statements" covering the main elements {\tt factories,
+    artifacts}
+\end{enumerate}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/generating_charts.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,84 @@
+\subsection{Generating Charts -- Background Information and Configuration}
+
+The artifact-server is able to render different types of charts like 1D
+(timeseries, vertical- and horizontalprofiles, horizontal-cross-section
+profiles (a special case of the horizontalprofiles) and histograms) and 2D-diagrams
+(vertical-cross section profiles). This section describes the
+possibilities to configure different aspects for interpolating of data and
+visualising them in charts.
+
+\begin{lstlisting}
+artifact-database
+`-- gnv # charts, palettes, interpolation parameters
+    |-- charttemplate
+    |-- palettes
+    |-- horizontal-cross-section-profile
+    `-- vertical-cross-section
+\end{lstlisting}
+
+\paragraph*{charttemplate}
+{\em Function}: The chart template is a global template for setting the
+visualization of charts globally like font styles, background, title,
+subtitle, etc. Further information can be found in the configuration
+file referenced via the attribute {\tt configuration}.
+
+\begin{itemize}
+    \item {\tt configuration}: path to the configuration XML-file.
+\end{itemize}
+
+
+\paragraph*{palettes}
+{\em Function}: This section lists the available palettes used for rendering
+vertical-cross-section charts (2D). Each {\tt palette}-element contains
+the following attributes:
+
+\begin{itemize}
+    \item {\tt name}: a descriptive name.
+    \item {\tt parameter-ids}: identifier used as keys for matching
+    between data (from the database) and palette. {\bf The {\tt
+    parameter-ids} have to been in sync with the database parameters
+    (normally in {\tt MEDIAN.Parameter})}
+    \item {\tt description}: a description.
+    \item {\tt file}: reference to the defintion of the palette.
+\end{itemize}
+
+For defining ranges for a palette, a range is definied by:
+
+\begin{itemize}
+    \item {\tt index}: Index for accessing the explicit range from the
+    program logic. 
+    \item {\tt from}: lower limit of a range.
+    \item {\tt to}: upper limit of a range
+    \item {\tt rgb}: Red-Green-Blue (RGB) value for rendering the range
+    \item {\tt description}: description for rendering the legend. For
+    special characters use HTML-encoded values like {\tt \&lt;} for $<$
+    or {\tt \&gt;} for $>$.
+\end{itemize}
+
+
+\paragraph*{horizontal-cross-section-profile}
+
+{\em Function}: Parameterization for the interpolation algorithm for
+horizontal-cross-section-profile calculating the interpolated value
+along the distance.
+
+\begin{itemize}
+    \item {\tt samples}: Number of samples calculated for a
+    interpolation along the passed geometric line.
+\end{itemize}
+
+
+\paragraph*{vertical-cross-section}
+{\em Function}: Parameterization for the interpolation algorithm for
+vertical-cross-sections (2D-charts).
+
+\begin{itemize}
+    \item {\tt samples}: Parameters for defining the interpolation grid.
+    {\tt width} for horizontal distances; {\tt height} for the vertical
+    distance.
+    \item {\tt ground}: {\tt interpolation} method for calculating the
+    interpolation from the last measured value against the seafloor.
+    Available methods are {\tt nearest-neighbor | bilinear | bicubic}.\\
+    {\tt fill-color}: setting the file color for the seafloor in the
+    diagram.
+\end{itemize}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/generating_maps.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,149 @@
+\subsection{Generating Maps-- Background Information and Configuration}
+
+The artifact-server is able to process geographic data and provide them
+for a WMS service rendering maps via a HTTP-based interface. The
+following process chains are covered. For generating horizontal-cross sections, 
+the following steps have to be processed:
+
+\begin{enumerate}
+%% FIXME: When do we clip? Sequence will influence the interpolation
+    \item Selecting the data from datawarehouse
+    \item Clipping the datasets along the passed polygon
+    \item Calculating interpolation in the plane
+    \item Generating contour lines
+    \item Matching processed parameter data to the corresponding style
+    \item Rendering requested map
+\end{enumerate}
+
+For generating maps from object-based datamodels like CONTIS, NAUTHIS
+and Marine Features, just the following steps are needed:
+
+\begin{enumerate}
+    \item Selecting the data from datawarehouse
+    \item Clipping the datasets along the passed polygon
+    \item Matching processed object data to the corresponding style
+    \item Rendering requested map
+\end{enumerate}
+
+In order to understand the configuration facilities for generating maps
+in more detail, the internal
+interaction of the artifact-server and the mapserver is described below
+for the use case when a user parameterizes a horizontal-cross-section
+profile and visualizes it as a map (without regarding the caching
+facilities)
+
+\begin{enumerate}
+    \item After finishing the parameterization, the artifact-server
+    requests the data from the database-backend and processes the data
+    (see above).    
+    
+    \item By requesting a map in the GNV-WebClient, the artifact-server writes
+    a ESRI shapefile with (clipped) geometries, attribute data, projection
+    information and a special file storing meta information (\texttt{meta.xml})
+    for this artifact in the a corresponding directory in the
+    \texttt{shapefile-directory}.
+    
+    \item After that the so called \texttt{map-generator} is triggered. The
+    map-generator searches the \texttt{shape-directory} and its subfolders with
+    all existing \texttt{meta.xml} files and generates a central configuration
+    file for the mapserver at \texttt{ map-generator/mapfile@path}. Each
+    shapefile will be published as a WMS layer. \\
+    The generated mapfile is constructed out of a base template from \texttt{
+    map-generator/templates/maptemplate} and a parameter-/layer-specific part
+    generated from \texttt{map-generator/templates/path}. The selection of the
+    correct file-based templates is extracted out of the
+    \texttt{meta.xml}-file.
+    
+    \item The matching between the generated geograpic data and the
+    corresponding style files is been done by the artifact-server, constructing
+    filenames of maptemplates out of parameter-information. For
+    horizontal-cross-sections the schema looks like this \texttt{
+    horizontalcrosssection\_\$NAME-OF-PARAMETER}; for layer-orientated FIS like
+    e.g. NAUTHIS and CONTIS like this \texttt{
+    layer\_\$ID\_MAPSERVICE\_\$ID\_LAYER}  e.g.
+    \texttt{layer\_BSH\_IMS\_CONTIS\_Resources\_2}.
+    %% FIXME@TE: Marine Feature? Name of WMS?
+    In order to set at least title, geometry-type and path to the
+    corresponding shapefile dynamically a templating language, called
+    \texttt{velocity} is used.
+
+    \item The corresponding subfolder of an artifact in \texttt{
+    shape-directory} with their shapefiles
+    and \texttt{meta.xml}-document will be deleted after the time of
+    expiry. By triggering the \texttt{map-generator} the next time, the
+    geographic data and the central configuration of the mapserver will
+    be updated.
+
+\end{enumerate}
+
+The coupling of the artifact-server and mapserver is free of
+maintenance. The artifact-server as master cares about deleting and
+updating the configuration of the mapserver.
+
+\begin{lstlisting}
+artifact-database
+|-- gnv # charts, palettes, interpolation parameters
+|   |-- map-generator 
+|   |-- shapefile-directory
+|   `-- horizontal-cross-section
+|-- mapserver
+`-- velocity
+\end{lstlisting}
+
+\paragraph*{mapserver}
+{\em Function}: URL of the mapserver where request can be send to. The
+URL will be used for displaying the location e.g. in the GNV-WebClient and in
+the {\tt meta.xml}-file.
+
+\begin{itemize}
+    \item {\tt server}: URL of the mapserver where request can send to.
+\end{itemize}
+
+\paragraph*{velocity}
+{\em Function}: Templating language used in the maptemplates at 
+\texttt{map-generator/templates/path} for accessing the parameters from
+dynamically generated \texttt{meta.xml}-configuration of artifacts.
+
+\begin{itemize}
+    \item {\tt logfile}: Setting the path to write log files. \\
+    Preconfigured to \texttt{/var/log/artifacts/velocity.log}. 
+    {\bf Just
+    absolute pathes are allowed here!}
+\end{itemize}
+
+\paragraph*{map-generator}
+{\em Function}: Mechanism for generating configuration for the {\tt
+mapserver} dynamically. For background information about the interaction
+between artifact-server and mapserver, see above.
+
+\begin{itemize}
+    \item {\tt mapfile}: path to the mapfile accessed by the WMS wrapper
+    {\tt gnv-wms}
+    \item {\tt templates}: \\ {\tt path} to the directory where
+    parameter-specific mapconfiguartions (as *.vm) are stored. 
+    \\ {\tt
+    maptemplate} containing the WMS instance-specific configurations and
+    metadata, like overall boundingbox, spatial reference systems and
+    contact data.
+    \end{itemize}
+
+\paragraph*{shapefile-directory}
+{\em Function}: Pointer where shapefiles for map-generation are stored 
+
+\begin{itemize}
+    \item {\tt path}: path to the directory where shapefiles are stored
+    and accessed by {\tt mapserver}
+\end{itemize}
+
+\paragraph*{horizontal-cross-section}
+{\em Function}: Parameterization for the interpolation algorithm for
+horizontal-cross-sections (maps).
+  
+
+\begin{itemize}
+    \item {\tt sample}: The attribute {\tt number} sets the number of
+    steps for the interpolation grid.
+    \item {\tt ground}: {\tt interpolation} method for calculating the
+    interpolation from the last measured value in meshes against the seafloor.
+    Available methods are {\tt nearest-neighbor | bilinear | bicubic}.
+\end{itemize}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/miscellanea.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,14 @@
+\section{Miscellanea}
+
+This section describes some additional possibilities to affect the
+behaviour of the GNV-server. They should only be used if the
+consequences for the system are known: 
+
+\begin{itemize}
+    \item artifact.database.dir The folder where the configuration of
+    the artifact-server is located.
+    \item caching.cleaner.interval: The Interval in seconds the caches should be 
+    cleaned compared to updates in the database.
+    \item chart.gap.percentage: gap-size in percent for evaluating gaps
+    in in the products timeseries, vertical- and horizontal-profile.
+\end{itemize}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/model_of_transitions.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,860 @@
+\section{Model of transitions}
+\subsection{Overview of Subject-Specific Configuration: From FIS, Products, States,
+Transitions and SQL-statements}
+
+The GNV-system provides several expert information systems (FIS). Within a FIS
+users can select products for analysing and visualising different
+subject-specific issues like timeseries diagrams and different types of
+profiles. In order to generate these products, different kind of data out of the
+dataware house is needed.
+
+The configuration is mainly split up into two steps\footnote{Except for
+integrating the MapViewer. There is a third step necessary by configuring
+additional tables in the datawarehouse}:
+\begin{enumerate}
+    \item FIS and their according products (Metainformation)
+    \item Products with their states, transitions, outputs and SQL-statements
+    (Implementation)
+\end{enumerate}
+
+%% TODO to improve: Add a Screenshot of the GNV WebClient marking GUI elements for FIS,
+%% product, states and transitions
+
+Main entry point for the configuration also is the file {\tt conf/conf.xml }
+defining the list of FIS and the according products based on the different
+datamodels in the datawarehouse. 
+
+The provided datamodels are:
+
+\begin{enumerate}
+    \item ESRI ArcMarineBSH with following subtypes
+        \begin{enumerate}
+            \item TimeSeriesPoints
+            \item MeshFeatures
+            \item Measurements/InstantaneousPoints
+            \item Marine Features
+        \end{enumerate}
+    \item ESRI ArcS57,
+    \item CONTIS
+\end{enumerate}
+
+Each product configuration consists of a datamodel specific configuration
+organized in a product specific folder in {\tt conf/products} \footnote{The
+special case of a {\tt Horizontales Schnittprofil} is configured in
+{\tt conf/horizontalprofile/conf\_mesh\_cross.xml} }. The directory layout looks
+like this:
+
+\begin{verbatim}
+products/
+|-- horizontalcrosssection
+|   `-- conf_mesh.xml
+|-- horizontalprofile
+|   |-- conf_instantaneouspoint.xml
+|   |-- conf_mesh.xml
+|   `-- conf_mesh_cross.xml
+|-- layer
+|   `-- conf.xml
+|-- timeseries
+|   |-- conf_mesh.xml
+|   |-- conf_timeseriespoint.xml
+|   `-- timegap_definition.xml
+|-- verticalcrosssection
+|   `-- conf_mesh.xml
+`-- verticalprofile
+    |-- conf_instantaneouspoint.xml
+    |-- conf_mesh.xml
+    `-- conf_timeseriespoint.xml
+\end{verbatim}
+
+The subtypes of the ArcMarineBSH based datamodel are configured in the files below:
+\begin{itemize}
+   \item TimeSeriesPoints: {\tt conf\_timeseriespoint.xml}
+   \item Mesh: {\tt conf\_mesh.xml}
+   \item InstantaneousPoints: {\tt conf\_instantaneouspoint.xml}
+\end{itemize}
+
+Within each of these files, the steps for gathering the values for the
+parameterisation are configured by defining states, transitions and outputs
+(c.f. \ref{ref:config-a-product}).  The definition of states, transitions and
+outputs reference the actual SQL-statements via an identifier. The SQL-statements
+are gathered in the file {\tt conf/queries.properties}.
+
+
+\subsection{Background information of the XML configuration}
+
+It is possible to configure the GNV in many ways.
+It is possible to add or remove FIS, add or remove products from a FIS or
+to manipulate the steps which must be prepared until products like
+a diagram or CSV-export can be generated.
+
+The configuration of the provided FIS are divided in three main parts.
+
+\begin{itemize}
+    \item Configuration of the list of FIS via {\tt artifact-factories}
+    \item Configuration of main {\tt artifacts} which will be instantiated if an 
+  {\tt artifact-factory} was called.
+    \item Configuration of the different {\tt artifacts} which provides products which can be 
+  served by the FIS.
+\end{itemize}
+
+\subsubsection{Configuration of a FIS}
+The point of entry into the system is to configure an {\tt artifact-factory}.
+Each artifact-factory represents one FIS.
+It is possible to configure several {\tt artifact-factories}, which
+represent the list of FIS in GUI.
+The {\tt artifact-factories} will be configured in the section 
+\texttt{/artifact-database/artifact-factories} of the configuration-file.
+
+\begin{lstlisting}
+<artifact-factory name='fis_NEWFISNAME' 
+                  description='Factory to create an artifact to be used with the FIS NEWFISNAME'  
+                  ttl='3600000' 
+                  artifact='de.intevation.artifactdatabase.ProxyArtifact'>
+                  de.intevation.gnv.artifacts.GNVProductArtifactFactory
+</artifact-factory>
+\end{lstlisting}
+
+At this moment the following attributes of an {\tt artifact-factory} are
+configurable:
+\begin{itemize}
+    \item {\tt name}: The name of the {\tt artifact}. Must be unique in one {\tt artifact-server}
+    \item {\tt description}: Short description which job the {\tt artifact-factory} has to do.
+    \item {\tt ttl}: The time to live: The time using milliseconds an
+    {\tt artifact}, created using this factory, can live without any
+    user-interaction.
+    \item {\tt artifact}: The name of the class of the {\tt artifact} which should be created.
+\end{itemize}
+
+The next listing shows the dependencies between the FIS and the name
+of the {\tt artifact-factory} which belongs to it.
+
+\begin{itemize}
+    \item Marnet: {\tt fis\_marnet}
+    \item IMIS: {\tt fis\_imis}
+    \item STAUN: {\tt fis\_staun}
+    \item Modeldata {\tt fis\_modeldata}
+    \item Iceclimatology: {\tt fis\_eisklimatologie}
+    \item Ice Station Report: {\tt fis\_icestations}
+    \item SST: {\tt fis\_sst}
+    \item Delphin: {\tt fis\_delphin}
+    \item Thermosalinograph: {\tt fis\_thermosalinograph}
+    \item Chemusurvey: {\tt fis\_chemusurvey}
+    \item GTS: {\tt fis\_gts}
+    \item CTD: {\tt fis\_bsh\_ctd}
+    \item XBT: {\tt fis\_bsh\_xbt}
+    \item SeaCat: {\tt fis\_seacat}
+    \item Sea State: {\tt fis\_seastate}
+    \item Current Meter: {\tt fis\_currentmeter}
+    \item Nauthis: {\tt fis\_nauthis}
+    \item Contis: {\tt fis\_contis}
+    \item Marine Features: {\tt fis\_marinefeatures}
+\end{itemize}
+
+\subsubsection{Configuration of main Artifact}
+For each {\tt artifact-factory} it is necessary to configure one {\tt artifact} which will be 
+created using the factory.
+This {\tt artifact} is the representation of the specific FIS.
+It contains the configuration which products will be served for this FIS.
+
+The {\tt artifacts} are configured in the section {\tt /artifact-database/artifacts} of 
+the configurationfile.
+
+\begin{lstlisting}
+<artifact name='fis_NEWFISNAME'>
+    <products>
+     ...
+    </products>
+</artifact>
+\end{lstlisting}
+
+The key is to use the same name for the {\tt artifact} as used for the {\tt artifact-factory}.
+The name has to be unique.
+In the section {\tt /artifact/products} it is possible to define several products as 
+explained in the next section.
+
+\subsection{Products to an FIS}
+One FIS can provide several products.
+To do this it is required to configure them as shown below in the section 
+{\tt /artifact/products}
+
+\begin{lstlisting}
+<product name= "timeSeries">
+      <artifact-factory name="timeSeries" 
+                        description="Artiefactfactory for Instantiating the Artifact for TimeSeries on TimeSeriesPoints"  
+                        ttl="300000" 
+                        artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">
+           de.intevation.gnv.artifacts.GNVArtifactFactory
+      </artifact-factory>
+      <parameters>
+          <parameter name="sourceid" 
+                     value="4"/>
+          <parameter name="fisname" 
+                     value="fis\_marnet"/>
+      </parameters>
+ </product>
+ \end{lstlisting}
+
+Each {\tt product} is also represented by an {\tt artifact}. In order to
+create this {\tt artifact}, the {\tt artifact-factory} has to be used.
+It is configured in each product 
+({\tt /product/artifact-factory}).
+
+Each product can have several parameters ({\tt
+/product/parameters/parameters}).  The {\tt parameter} named {\tt
+sourceid} and {\tt fisname} are required parameters.
+
+The parameter {\tt fisname} contains the key to the name of the FIS. The
+key must be unique.  The parameter {\tt sourceid} contains the key to
+identify the FIS in the datawarehouse. ({\tt MEDIAN.SOURCEINFO})
+
+
+\subsubsection{Configuration of an Product}
+\label{ref:config-a-product}
+The {\tt products} of the different FIS are also modeled as artifact-objects.
+The different products which are currently available are stored in separate
+files in the folder {\tt project}.
+
+In those files the workflow of each product is configured.  Each step which is
+required to model a new diagram is represented using a {\tt state} in the
+configuration-file.
+
+%% FIXME: fix wording
+To move between those {\tt states} it is required to model {\tt transitions} which define
+between which states it is possible to move and which conditions must be
+fulfilled.
+
+The last step is called {\tt output-state}. This state is responsible to generate the
+output for the different formats which can be served from the product ({\tt Diagram,
+CSV, ODV, WMS,..}.).
+
+\paragraph{States}
+A {\tt state} is one step which is required to fetch the data for generating e.g. an
+diagram.
+
+For example in each product it is possible to choose one or more parameters.
+
+To configure a state you have to use a XML-fragment as shown below:
+
+\begin{lstlisting}
+<state id="timeseries_parameter" description="timeseries_parameter" state="de.intevation.gnv.state.DefaultState">
+   <queryID>timeseries_parameter</queryID>
+   <dataname>parameterid</dataname>
+   <data-multiselect>true</data-multiselect>
+   <inputvalues>
+      ...
+   </inputvalues>
+</state>
+\end{lstlisting}
+
+At this moment the following attributes of an {\tt state} are configurable.
+\begin{itemize}
+    \item {\tt id}: The name of the artifact. Must be unique in one artifact-server
+    \item {\tt description}: Short description which job the artifact-factory has to do.
+    \item {\tt queryID}: The id of the query which should be used to fetch the data 
+                   displayed in this state. All queries are defined in the file
+                   conf/queries.properties
+    \item {\tt dataname}: The id of the data which will be displayed in this state.
+                    The id will be use to localize the description of the data.
+                    The localization is located in module gnv-artifacts in folder
+                    src/main/resources.
+    \item {\tt data-multiselect}: {\tt true} it is possible to select 1 or more items.
+                                 {\tt false} it is possible to select only one item.
+    \item {\tt inputvalues}: The values which can be "feed" to this state and which 
+                       will be used as values in SQL-statements.
+\end{itemize}
+
+\paragraph{Input Values of a State}
+At section {\tt /state/inputvalues} it is possible to add definitions for inputvalues.
+Those values have two meanings for the {\tt state}.
+
+\begin{itemize}
+     \item They were used to fill the SQL-statements to fetch the data.
+           (Each entry replace one ore more "?" )
+     \item They were used to validate the inputdata which is "feed" to
+           the FIS in the current state.
+\end{itemize}
+
+{\bf WARNING: The order of the input-values is significant at which position the value will
+be put into the SQL-statement!}
+
+It is possible to add one inputvalue twice or more often to put its value at
+different positions of the SQL-statement.
+
+\begin{lstlisting}
+<inputvalues>
+    <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="1"/>
+    <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+    <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0"/>
+</inputvalues>
+\end{lstlisting}
+
+\begin{itemize}
+    \item {\tt name}: Name of the value that could be feed or should be used in SQL-statment.
+                The name must fit to one dataname configured in this state or one other
+                state which was visited before.
+    \item {\tt type}: The type of the value. This is required for the validation 
+                of the value.
+                This might be String, Integer, Double, Date, Point, LineString, 
+                Polygon, Coordinate, Geometry and AttributeName. \\
+                Coordinate is a format which accepts geographical coordinates in 
+                the following Syntax: 56n30 6e20 \\
+                AttributeName marks a stringvalue which will be used in 
+                SQL-statement without surrounding with "'" in the statement.
+                Usage is e.g. for determining the Axis (i or j) in the workflow
+                of Horizontalprofiles.
+    \item {\tt multiselect}: true if more than on value can be feed or put into the SQL-statement.
+                       false if one on value will be accepted.
+    \item {\tt usedinquery}: Number how often the value should be put into the SQL-statement:
+                       0: Value will not out into the statement.
+                       1: Value will put once into the statement,
+                       2 or more: Value will be put as often as configured 
+                                  into the SQL-statement (this is useful if 
+                                  inner-selects are used)
+\end{itemize}
+
+The next part will explain the usage of inputvalues.
+
+This SQL-statement is configured to use in the state above, which will fetch
+all parameter-ids with the according german name which are reffered to the given
+TimeSeriesPoint (e.g.Arkona Basin Buoy FeatureID = 100011 )
+
+ 
+\begin{lstlisting}
+SELECT DISTINCT 
+       p.PARAMETERID KEY, 
+       p.GERMANNAME || '  ['|| p.UNIT ||']' VALUE, 
+       p.GERMANNAME 
+FROM MEDIAN.PARAMETER P, 
+     MEDIAN.TIMESERIES TS, 
+     MEDIAN.TIMESERIESVALUE TSV, 
+     MEDIAN.MEASUREMENT M, 
+     MEDIAN.TIMESERIESPOINT TSP 
+WHERE M.FEATUREID = TSP.FEATUREID AND 
+      M.MEASUREMENTID = TSV.MEASUREMENTID AND 
+      TS.TIMESERIESID = TSV.TIMESERIESID AND 
+      P.PARAMETERID = TS.PARAMETERID AND 
+      TSP.FEATUREID = ? 
+ORDER BY P.GERMANNAME
+\end{lstlisting}
+
+Including inputvalues, the example for choosing the FIS ({\tt fisname})
+and the Station 342 ({\tt featureid}: Arkona Basin Buoy) will look like
+this: 
+\begin{itemize}
+    \item {\tt featureid}: 100011 (Marnet $\rightarrow$ Arkona Basin Buoy)
+    \item {\tt fisname}: fis\_marnet
+    \item {\tt parameterid}: not set because it's the value that should be 
+                       chosen in this state. 
+\end{itemize}
+
+\begin{lstlisting}
+SELECT DISTINCT 
+       p.PARAMETERID KEY, 
+       p.GERMANNAME || '  ['|| p.UNIT ||']' VALUE, 
+       p.GERMANNAME 
+FROM MEDIAN.PARAMETER P,  
+       MEDIAN.TIMESERIES TS, 
+       MEDIAN.TIMESERIESVALUE TSV, 
+       MEDIAN.MEASUREMENT M, 
+       MEDIAN.TIMESERIESPOINT TSP  
+WHERE M.FEATUREID = TSP.FEATUREID AND 
+      M.MEASUREMENTID = TSV.MEASUREMENTID AND 
+      TS.TIMESERIESID = TSV.TIMESERIESID AND 
+      P.PARAMETERID = TS.PARAMETERID AND 
+      TSP.FEATUREID = 100011
+ORDER BY P.GERMANNAME
+\end{lstlisting}
+
+The value of {\tt featureid} will be inserted into the query because
+the attribute {\tt usedinquery} is set to "1".
+
+The values of the inputvalues {\tt fisname} and {\tt parameterid} will be
+excluded because the attribute {\tt usedinquery} is set to "0"
+
+
+If the attribute {\tt usedinquery} of the inputvalue {\tt featureid} is set to "2"
+this might happen.
+
+\begin{lstlisting}
+<inputvalues>
+    <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="2"/>
+    <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+    <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0"/>
+</inputvalues>
+\end{lstlisting}
+
+\begin{lstlisting}
+SELECT DISTINCT 
+    ...
+    TSP.FEATUREID = ? AND
+    TSP.FEATUREID = ? 
+ ORDER BY P.GERMANNAME
+\end{lstlisting}
+
+This SQL-statement will be modified to
+
+\begin{lstlisting}
+SELECT DISTINCT 
+    ...
+    TSP.FEATUREID = 100011 AND
+    TSP.FEATUREID = 100011 
+ORDER BY P.GERMANNAME
+\end{lstlisting}
+
+
+At the next step of the workflow it is nessesary to determine all depths where
+the choosen parameters are measured.
+To do this we might have the following inputvalues:
+
+\begin{lstlisting}
+<inputvalues>
+    <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="2"/>
+    <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+    <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+    <inputvalue name="measurementid" type="Integer" multiselect="true" usedinquery="0"/>
+</inputvalues>
+\end{lstlisting}
+
+\begin{itemize}
+   \item {\tt featureid}: 100011 (Marnet $\rightarrow$ Arkona Basin Buoy)
+   \item {\tt fisname}: fis\_marnet
+   \item {\tt parameterid}: 2 (Salzgehalt [pSal])
+   \item {\tt measurementid}: not set because it's the value that should be
+                        chosen in this state.
+\end{itemize}
+
+\begin{lstlisting}
+SELECT DISTINCT 
+       M.MEASUREMENTID KEY, 
+       M.ZLOCATION VALUE, 
+       P.PARAMETERID PARAMETERID 
+FROM MEDIAN.MEASUREMENT M, 
+     MEDIAN.TIMESERIESVALUE TSV, 
+     MEDIAN.TIMESERIES T, 
+     MEDIAN.PARAMETER P 
+WHERE M.MEASUREMENTID = TSV.MEASUREMENTID AND 
+      TSV.TIMESERIESID = T.TIMESERIESID AND 
+      T.PARAMETERID = P.PARAMETERID AND 
+      M.FEATUREID = ? AND 
+      M.FEATUREID = ? AND 
+      P.PARAMETERID IN (?)
+ORDER BY m.ZLOCATION DESC
+\end{lstlisting}
+
+This SQL-statement will be modified to
+
+\begin{lstlisting}
+SELECT DISTINCT 
+       M.MEASUREMENTID KEY, 
+       M.ZLOCATION VALUE, 
+       P.PARAMETERID PARAMETERID 
+FROM MEDIAN.MEASUREMENT M, 
+     MEDIAN.TIMESERIESVALUE TSV, 
+     MEDIAN.TIMESERIES T, 
+     MEDIAN.PARAMETER P 
+WHERE M.MEASUREMENTID = TSV.MEASUREMENTID AND 
+      TSV.TIMESERIESID = T.TIMESERIESID AND 
+      T.PARAMETERID = P.PARAMETERID AND 
+      M.FEATUREID = 100011 AND 
+      M.FEATUREID = 100011 AND 
+      P.PARAMETERID IN (2)
+ORDER BY m.ZLOCATION DESC
+\end{lstlisting}
+
+The queries which are shown above are configurable.
+Configuring takes place in the \\ file \texttt{queries.properties } which will
+be explained in the next paragraph.
+
+\paragraph{Query-configuration (queries.properties)}
+\label{ref:queries.properties}
+
+This file contains key-value-pairs to define SQL-statements.
+All queries will be handle using the prepared-statement-syntax using "?"
+to define a place where an dynamic value should be placed into the statement.
+ 
+There is one special implementation to support spatial access to the 
+{\tt ESRI ArcSDE}-database. This mechanism is used to realize the access to spatial-
+objects.
+
+All queries containing the following literals will be handled separatly
+using the ESRI ArcSDE-API.
+
+\begin{itemize}
+    \item {\tt ST\_ASTEXT(SHAPE)}: Will return the geometry as an WellKnowText (WKT)
+    \item {\tt ST\_ASTEXT(RASTER)}: Will return the raster in an readable way.
+    \item {\tt INTERSECTS(SHAPE,"?")}: Will only return the elements which geometry
+                                 intersects the given geometry ("?" will be
+                                 replace with an WKT)
+\end{itemize}
+
+
+\paragraph{Transitions}
+
+To move between two states it is necessary to configure dependencies
+between the different states.  This dependencies are called {\tt
+transitions}.
+
+There are different kinds of {\tt transitions} which can be used.
+\begin{itemize}
+  \item Transitions which only link two states
+  \item Transition which link two states with a additional condition. 
+        (e.g. If a region was selected in the Regionfilter or not )
+\end{itemize}
+
+The listing below shows a transition with an additional condition.
+\begin{lstlisting}
+<transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+    <from state="timeseries_area"/>
+    <to state="timeseries_without_geom"/>
+    <condition inputvalue="areaid" value="n/n" operator="equal"/>
+</transition>
+\end{lstlisting}
+
+\begin{itemize}
+  \item {\tt from}: The {\tt id} of the {\tt state} which you have to come from
+  \item {\tt to}:   The {\tt id} of the {\tt state} which can be reached.
+  \item {\tt condition}: The condition which have to be fulfilled.
+\end{itemize}
+
+At this moment only {\tt EQUAL} and {\tt NOTEQUAL} are supported as 
+{\tt condition} for an {\tt ValueCompare\-Transition}.
+
+\paragraph{Outputstate}
+
+The {\tt outputstate} is a special {\tt state} which was created to define
+the different possibilities of outputs for each product.
+An {\tt outputstate} is handled as a {\tt state} which is described above.
+Additionally you are able to configure which kind of outputs should
+be provided.
+
+There are several {\tt outputstates}. Each one is designed to create 
+the output for one special product.
+
+\begin{itemize}
+  \item TimeSeries: {\tt TimeSeriesOutputState}
+  \item Horizontalprofile: {\tt HorizontalProfileOutputState}
+  \item Horizontalprofile on Meshes: {\tt HorizontalProfileMeshOutputState}
+  \item Verticalcrosssection: {\tt VerticalCrossSectionOutputState}
+  \item Verticalprofiles: {\tt VerticalProfileOutputState}
+  \item Horizontalcrosssections: {\tt HorizontalCrossSectionMeshOutputState}
+  \item Layer: {\tt LayerOutputState}
+\end{itemize}
+
+All these outputstates are implemented in {\tt package de.intevation.gnv.state}
+and its {\tt sub\-packages}. 
+
+The fullqualified name of the {\tt outputstate} to the attribute 
+{\tt state} is shown below.
+
+An example for an {\tt outputstate}:
+
+\begin{lstlisting}
+<state id="timeseries_calculate_results" description="timeseries_interval" state="de.intevation.gnv.state.timeseries.TimeSeriesOutputState">
+    <queryID>timeseries_chart_data</queryID>
+     ...
+    <outputsModes>
+        <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
+        ...
+        </outputsMode>
+    </outputsModes>
+ </state>
+\end{lstlisting}
+
+At section {\tt /state/outputsModes} it is possible to add one ore more 
+{\tt outputmodes} to one state as shown in the next paragraph.
+
+\paragraph{OutputModes}
+
+It is possible to configure several {\tt outputmodes} in one {\tt outputstate}.
+Inserting or deleting the configuration of a special
+{\tt outputmode} will control if an item in the GUI will be displayed.
+
+{\bf
+WARNING: IT MIGHT BE POSSIBLE THAT ONE OR MORE OUTPUTMODES ARE NOT
+         SUPPORTED BY AN PRODUCT. IN THAT CASE IT IS NECESSARY TO
+         IMPLEMENT THE REQUIRED FUNCTIONALITY BEFORE IT IS POSSIBLE
+         TO OFFER THIS OUTPUTMODE.
+}
+
+Currently the following {\tt outputmodes} are supported:
+
+\begin{itemize}
+   \item {\tt chart}
+   \item {\tt histogram}
+   \item {\tt csv}
+   \item {\tt odv}
+   \item {\tt statistics}
+   \item {\tt wms}
+   \item {\tt shapefile}
+\end{itemize}
+
+The following example shows how to configure an {\tt outputmode chart}:
+
+\begin{lstlisting}
+<outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
+    <parameters>
+        <inputvalue name="width" type="Integer" value="600"/>
+        <inputvalue name="height" type="Integer" value="400"/>
+        <inputvalue name="points" type="Boolean" value="false"/>
+    </parameters>
+    <exportModes>
+        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+      </exportModes>
+</outputsMode>
+\end{lstlisting}
+
+
+\begin{itemize}
+   \item {\tt name}: The name of the mode. This must not be changed because it 
+                     is used by the program.
+   \item {\tt description}: a short description of this outputmode. 
+   \item {\tt parameters}: one ore more parameters which will be shown in the 
+                           GUI e.g. for changing the size of an chart.
+   \item {\tt exportModes} : one or more formats which can be served.
+\end{itemize}
+
+
+\section{Adding a new FIS}
+In this section it will be explained which steps have to be done to integrate a
+new FIS into the {\tt artifact-server}.  This will be done using the configuration for
+a FIS which uses data from the table {\tt MEDIAN.TIMESERIES} section of
+the datawarehouse (e.g. MARNET or STAUN).
+
+For publishing the changes to the {\tt artifact-server}, it needs to be
+restarted. 
+
+\subsection{Adding a new Artifact-factory}
+First step is to add a new {\tt artifact-factory} to the configuration conf/conf.xml
+To do this you have to add a new XML-fragment into the section 
+/factories/artifact-factories  which look like that:
+
+\begin{lstlisting}
+<artifact-factory name='fis_NEWFISNAME' 
+                  description='Factory to create an artifact to be used with the FIS NEWFISNAME'  
+                  ttl='3600000' 
+                  artifact='de.intevation.artifactdatabase.ProxyArtifact'>
+                  de.intevation.gnv.artifacts.GNVProductArtifactFactory
+</artifact-factory>
+\end{lstlisting}
+ 
+In this XML-fragment you only have to replace the placeholder {\tt NEWFISNAME}
+with a unique short name for the new FIS.
+
+\paragraph*{Example}
+This example shows how to add a FIS and illustrates the effect on the
+artifact-server's output.
+
+First , the following {\tt artifact-factory} has to be added into the file 
+{\tt conf/conf.xml} in section {\tt /artifact-database/artifact-factories} 
+adding a new FIS called {\tt justanewfis} to the server:
+
+\begin{lstlisting}
+<artifact-factory name='fis_justanewfis' 
+                  description='Factory to create an artifact to be used with the FIS NEWFISNAME'  
+                  ttl='3600000' 
+                  artifact='de.intevation.artifactdatabase.ProxyArtifact'>
+                  de.intevation.gnv.artifacts.GNVProductArtifactFactory
+</artifact-factory>
+\end{lstlisting}
+
+Restart the {\tt artifact-database} executing:
+
+\begin{lstlisting}
+/etc/init.d/artifact-server restart
+\end{lstlisting}
+
+Checking if the new FIS is served by the REST-Server
+calling the following command:
+
+\begin{lstlisting}
+curl http://localhost:8181/factories | xmllint --format - | grep fis_justanewfis
+\end{lstlisting}
+
+If the FIS was added, the new {\tt artifact-factory} will be found in the generated 
+XML-output. Otherwise no XML-output will be shown.
+
+\subsection{Adding a new Artifact for Artifact-factory}
+The next step is to define the artifact itself.
+For this it is necessary to add an XML-fragment into the section 
+{\tt /artifacts} of the main configurationfile {\tt /conf/conf.xml}.
+
+\begin{lstlisting}
+<artifact name='fis_NEWFISNAME'>
+    <products>
+     ...
+    </products>
+</artifact>
+\end{lstlisting}
+
+In this XML-fragment it is also required to replace the placeholder {\tt NEWFISNAME}
+with the name which was used to configure the {\tt artifact-factory}.
+
+Now the {\tt artifact-server} can handle an additional FIS without any products yet.
+
+To prevent needless configuration-work, it is a useful way to clone an
+existing artifact handling the same kind of work.
+
+
+\paragraph*{Example}
+Now will an artifact to the FIS {\tt fis\_justanewfis}, will be configured.
+
+The following XML-fragment has to be added to the file 
+{\tt conf/conf.xml} in section {\tt /artifact-database/artifacts}:
+
+\begin{lstlisting}
+<artifact name='fis_justanewfis'>
+    <products>
+    </products>
+</artifact>
+\end{lstlisting}
+
+Restart the artifact-server
+
+\begin{lstlisting}
+/etc/init.d/artifact-server restart
+\end{lstlisting}
+
+Now it should be possible to choose the artifact.
+
+The listbox in the GUI would be empty.
+\begin{lstlisting}
+curl -d "@sample-documents/create-artifact.xml"  http://localhost:8181/create | xmllint --format -
+\end{lstlisting}
+
+\subsection{Adding/Removing Products to the Specific Artifact}
+Next step is, to configure the different products which the FIS should
+be able to provide.  To do this it is necessary to copy the
+XML-fragments of the products into the XML-element {\tt products} of the
+previously integrated artifact.
+
+\begin{lstlisting}
+<artifact name='fis_NEWFISNAME'>
+     <products>
+         <product name= "timeSeries">
+              <artifact-factory name="timeSeries" 
+                                description="Artifactfactory for instantiating the artifact for TimeSeries on TimeSeriesPoints"  
+                                ttl="300000" 
+                                artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">
+                  de.intevation.gnv.artifacts.GNVArtifactFactory
+              </artifact-factory>
+              <parameters>
+                  <parameter name="sourceid" 
+                             value="VALUEOFSOURCEID"/>
+                  <parameter name="fisname" 
+                             value="fis\_NEWFISNAME"/>
+              </parameters>
+          </product>
+          <product name= "verticalProfile">
+              <artifact-factory name="verticalProfile" 
+                                description="Artifactfactory for instantiating the artifact for Verticalprofiles on TimeSeriesPoints"  
+                                ttl="300000" 
+                                artifact="de.intevation.gnv.profile.vertical.VerticalProfileArtifact">
+                  de.intevation.gnv.artifacts.GNVArtifactFactory
+              </artifact-factory>
+              <parameters>
+                  <parameter name="sourceid" 
+                             value="VALUEOFSOURCEID"/>
+                  <parameter name="fisname" 
+                             value="fis\_NEWFISNAME"/>
+              </parameters>
+          </product>
+     </products>
+</artifact>
+\end{lstlisting}
+
+In this XML-fragment the placeholders {\tt NEWFISNAME} have to be
+replaced. The source-id \texttt{VALUEOFSOURCEID} with the value for the new
+FIS as defined in the table {\tt MEDIAN.SOURCEINFO} needs to be added.
+
+\paragraph*{Example}
+Adding a product to the new FIS, choosing sourceid of an existing FIS
+(e.g 4 $\rightarrow$ Marnet).
+
+Add the following XML-fragment to the new artifact.
+\begin{lstlisting}
+<product name= "timeSeries">
+    <artifact-factory name="timeSeries" 
+                      description="Artifactfactory for instantiating the artifact for TimeSeries on TimeSeriesPoints"  
+                      ttl="300000" 
+                      artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">
+                      de.intevation.gnv.artifacts.GNVArtifactFactory
+    </artifact-factory>
+    <parameters>
+        <parameter name="sourceid" 
+                 value="4"/>
+        <parameter name="fisname" 
+                 value="fis\_justanewfis"/>
+    </parameters>
+</product>
+\end{lstlisting}
+
+Restart the artifact-server
+
+\begin{lstlisting}
+/etc/init.d/artifact-server restart
+\end{lstlisting}
+
+If 
+\begin{lstlisting}
+curl -d "@sample-documents/create-artifact.xml"  http://localhost:8181/create | xmllint --format -
+\end{lstlisting}
+
+is called, the product {\tt timeSeries} should be available for the FIS {\tt justanewfis}.
+ 
+Now, it should be able to choose the product.
+This product including the definied outputformats should be available in
+the GUI.
+
+\subsection{Adding a new Product}
+To add a new product to the system it is necessary that the required 
+artifact representation is implemented in the {\tt sourcecode}.
+Without doing that step it is not possible to create a new product.
+
+All products are configured in separated files that will be included into the 
+main configuration using Xlink-references.
+
+First step is to create a new file in the folder {\tt products} and in the 
+sub-folder where the product belongs to ({\tt timeseries,verticalprofile,
+horizontalprofile,horizontal\-crosssection,layer,...})
+
+Then the new product can be referenced in the file {\tt /conf/conf.xml} in the
+section {\tt/artifacts} using the following XML-fragment.
+
+\begin{lstlisting}
+<artifact name="timeSeries" 
+          xmlns:xlink="http://www.w3.org/1999/xlink" 
+          xlink:href="${artifacts.config.dir}/products/PATHTOFILE" /> 
+\end{lstlisting}
+
+The placeholder {\tt PATHTOFILE} has to be replaced with the relative path and
+the name of the file starting in the folder products.  
+
+Then it is possible to add the product to a FIS as explained in the next section.
+Please note that the defined name of the {\tt artifact-factory} has to match to the 
+name of the added products which is also designed as an artifact.
+
+\subsection{Adding an additional Product to a FIS}
+To add an additional product to a FIS the XML-fragment which 
+represents the product to the artifact-configuration of the FIS in section
+{\tt /artifacts/artifact/products} needs to be added.
+
+\begin{lstlisting}
+ <product name= "timeSeries">
+     <artifact-factory name="timeSeries" 
+                       description="Artifactfactory for instantiating the artifact for TimeSeries on TimeSeriesPoints"  
+                       ttl="300000" 
+                       artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">
+          de.intevation.gnv.artifacts.GNVArtifactFactory
+     </artifact-factory>
+     <parameters>
+         <parameter name="sourceid" 
+                    value="VALUEOFSOURCEID"/>
+         <parameter name="fisname" 
+                    value="fis\_NEWFISNAME"/>
+     </parameters>
+ </product>
+ \end{lstlisting}
+
+Please note that the placeholders have to be explained above.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/overview.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,88 @@
+\section{Overview of the GNV-Server}
+
+\subsection{Tasks and Components of the GNV-Server}
+
+The GNV-server is a middleware-component and consists of two functional
+components:
+\begin{enumerate}
+    \item artifact-server -- providing access to the database and
+    managing the users' workflow to the GNV-WebClient
+    \item mapserver -- providing user-generated maps. Mapserver is
+    controlled by the artifact-server.
+\end{enumerate}
+
+%% TODO includegraphics
+
+The central concept of the artifact-server is to model the workflow of
+users by the following steps:
+\begin{enumerate}
+    \item selection of data (parameterization)
+    \item processing of result sets (interpolation, clipping)
+    \item exporting processed result sets (charts, statistics, raw data)
+\end{enumerate}
+
+Within the artifact-server, these steps are supported by the following
+core components for the entire GNV-system.  The naming refers to
+components used in the configuration. In order to simplify a first
+orientation in the configuration and this manual, the XML-tags/words in
+the central configuration file at {\tt conf/conf.xml} are used. They are
+marked in {\tt typewriter} style:
+
+\begin{itemize}
+   \item {\tt geo-backend} -- access to the database backend
+   \item {\tt rest-server} -- providing a RESTful-Interface with a
+   XML-based protocol to serve the expert information systems (FIS) with
+   their products to different clients, e.g. GNV WebClient
+   \item {\tt factories/*}, {\tt artifacts/*} --  managing the steps and
+   operations of users' workflow for all expert information
+   systems (FIS)
+   \item {\tt gnv} -- processing pipeline providing results of the
+   products with the following subtasks:
+     \begin{itemize}
+       \item processing of result sets like interpolation, clipping 
+       \item visualization of charts and maps
+       \item exporting selected raw data
+     \end{itemize}
+   \item {\tt mapserver} -- managing the Web Map Service for creating maps
+   dynamically
+\end{itemize}
+
+Each component has a specific configuration for its functionality and
+subsystems. 
+
+\subsection{Internal Structure of the GNV-Server}
+
+\subsubsection{Internal Structure of Artifact-Server}
+Per default the artifact-server can be found at {\tt
+/opt/artifact-server}\footnote{Information about installation and
+operation can be found in the admin-manual.}. The internal directory
+structure of the artifact-server looks like this:
+
+%% tree /opt -d -L1
+\begin{lstlisting}
+artifact-server
+|-- artifactdb # storing artifacts in a database
+|-- bin # binaries including all libraries
+|-- cache # storage for cached data (e.g. result sets)
+|-- conf # central configuration of artifact-server
+|-- install # files for system integration (just for setup)
+|-- mapfiles # generated configurations for map-server (done by
+             # map-generator)
+`-- shapefiles # raw data for map generating (done by map-generator)
+\end{lstlisting}
+
+
+\subsubsection{Internal Structure of Mapserver}
+Per default the mapserver can be found at {\tt
+/usr/lib/cgi-bin}.\footnote{Information about installation and
+operation can be found in the admin-manual.} The internal structure of
+the mapserver looks like this:
+
+%% tree /usr/lib/
+\begin{lstlisting}
+cgi-bin/
+|-- gnv-wms # wrapper pointing to the configuration (default:
+            # artifact-server/mapfiles/mapfile.map), invoked by
+            # webserver
+`-- mapserv-gp # binary of mapserver, invoked by wrapper
+\end{lstlisting}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/sample-documents/create-artifact.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,1 @@
+<?xml version="1.0" encoding="UTF-8"?><art:action xmlns:art="http://www.intevation.de/2009/artifacts"><art:type name="create"/><art:factory name="fis_justanewfis"/></art:action>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/config-manual/title.tex	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,52 @@
+%-----------------------------------
+% TITLE PAGE
+
+% FIXME BSH Logo
+
+\begin{figure}[ht]
+  \begin{minipage}[b]{0.5\linewidth}
+    \centering
+    \includegraphics[scale=0.75]{figures/bsh_logo} \\
+     {\tt http://www.bsh.de/en}\\[4.0cm]
+  \end{minipage}
+  \begin{minipage}[b]{0.5\linewidth}
+    \centering
+    \includegraphics[width=0.75\textwidth]{figures/intevation-logo}
+     {\tt http://intevation.de/geospatial}\\[2.0cm]
+  \end{minipage}
+\end{figure}
+ 
+ \vspace{4cm}
+ 
+ {
+ 	\sffamily\large
+ 	Documentation Generic Viewer
+ 
+ 	\vspace{1cm}
+ 	{
+ 		\bfseries\huge
+ 	        Configuration and Reference
+ 	}
+ 
+ 	\vspace{1cm}
+ 	Version \documentversion~-~Date: \documentdate
+ 
+% 	Revision \documentrevision
+ }
+ 
+ \vspace{4cm}
+ 
+ \thispagestyle{empty}
+ 
+ \vfill
+ 
+ \begin{flushleft}
+ Authors:\\
+ Tim Englich$<$tim.englich@intevation.de$>$\\
+ Hans Plum $<$hans.plum@intevation.de$>$\\
+ {\bf Intevation GmbH},\\
+ Neuer Graben 17, 49074 Osnabrück, Germany\\
+ Tel: ++49 541 33 50 83 - 0 \\
+ http://www.intevation.net/geospatial
+ 
+ \end{flushleft}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/licenses/overview.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,225 @@
+===============================================================================
+Primärabhängigkeiten:
+    * junit-3.8.1.jar (gnv + gnv-artifacts + geo-backend)
+    - Common Public License Version 1.0
+    - http://www.opensource.org/licenses/cpl1.0.txt
+
+    * log4j-1.2.14.jar (gnv + gnv-artifacts + geo-backend)
+    - Apache License Version 2.0
+
+    * jfreechart-1.0.13.jar (gnv-artifacts)
+    - LGPL v2.1 or later
+
+    * batik-dom-1.7.jar (gnv-artifacts)
+    - Apache License Version 2.0
+
+    * batik-svggen-1.7.jar (gnv-artifacts)
+    - Apache License Version 2.0
+
+    * velocity-1.6.1.jar (gnv-artifacts)
+    - Apache License 2.0
+
+    * itext-2.1.7.jar (gnv-artifacts)
+    - Mozilla Public License 1.1
+
+    * opencsv-2.0.jar (gnv-artifacts)
+    - Apache License Version 2.0
+
+    * commons-math-2.0.jar (gnv-artifacts + geo-backend)
+    - Apache License Version 2.0)
+
+    * ehcache-1.6.2.jar (gnv-artifacts + geo-backend)
+    - Apache License Version 2.0
+
+    * commons-validator-1.3.1.jar (gnv + gnv-artifacts)
+    - Apache License Version 2.0
+
+    * oro-2.0.8.jar (gnv-artifacts)
+    - Apache License 1.1
+
+    * gt-epsg-wkt-2.5.8.jar (gnv-artifacts)
+    - LGPL v2 or later
+
+    * gt-shapefile-2.5.8.jar (gnv-artifact)
+    - LGPL v2 or later
+
+    * jts-1.9.jar (gnv-artifacts + geo-backend)
+    - LGPL v2.1 or later)
+
+    * trove-2.1.1.jar (gnv-artifacts)
+    - LGPL v2.1 or later
+
+    * commons-fileupload-1.2.1.jar (gnv)
+    - Apache License Version 2.0
+
+    * commons-pool-1.3.jar (artifact-database + gnv-artifacts + geo-backend)
+    - Apache License Version 2.0)
+
+    * org.restlet-2.0-SNAPSHOT.jar (artifact-database + gnv + gnv-artifacts)
+    - LGPL V3.0 or LGPL V2.1 or CDDL V1.0 or EPL V1.0)
+
+    * org.restlet.ext.xml-2.0-SNAPSHOT.jar (artifact-database + gnv + gnv-artifacts)
+    - LGPL V3.0 or LGPL V2.1 or CDDL V1.0 or EPL V1.0
+
+    * servlet-api-5.5.15.jar (gnv)
+    - Apache License 2.0
+
+    * struts-1.2.9.jar (gnv)
+    - Apache License 2.0
+
+    * struts-el-1.2.9.jar (gnv)
+    - Apache License 2.0
+
+    * h2-1.1.117.jar (artifact-database + gnv-artifacts)
+    - Dual licensed:
+        - MPL 1.1 
+          - http://www.mozilla.org/MPL
+        - EPL 1.0
+          - http://opensource.org/licenses/eclipse-1.0.php
+
+    * postgresql-8.3-603.jdbc4.jar (artifact-database + gnv-artifacts)
+    - BSD License
+
+    * commons-codec-1.4.jar (artifact-database + gnv-artifacts)
+    - Apache License Version 2.0
+
+    * jul-to-slf4j-1.5.11.jar (artifact-database + gnv-artifacts)
+    - MIT License
+
+    * slf4j-log4j12-1.5.11.jar (artifact-database + gnv-artifacts)
+    - MIT License
+
+===============================================================================
+Sekundärabhängigkeiten:
+    * antlr-2.7.2.jar (gnv)
+    - ANTLR 3 License
+    - http://www.antlr.org/license.html
+
+    * batik-awt-util-1.7.jar (gnv-artifacts)
+    - Apache License Version 2.0
+
+    * batik-css-1.7.jar (gnv-artifacts)
+    - Apache License Version 2.0
+
+    * batik-ext-1.7.jar (gnv-artifacts)
+    - Apache License Version 2.0
+
+    * batik-util-1.7.jar (gnv-artifacts)
+    - Apache License Version 2.0
+
+    * batik-xml-1.7.jar (gnv-artifacts)
+    - Apache License Version 2.0
+
+    * bcmail-jdk14-1.38.jar (gnv-artifacts)
+    - Bouncy Castle Licence (Adaption der Apache License)
+    - http://www.bouncycastle.org/licence.html
+
+    * bcprov-jdk14-1.38.jar (gnv-artifacts)
+    - Bouncy Castle Licence (Adaption der Apache License)
+    - http://www.bouncycastle.org/licence.html
+
+    * bctsp-jdk14-1.38.jar  (gnv-artifacts)
+    - Bouncy Castle Licence (Adaption der Apache License)
+    - http://www.bouncycastle.org/licence.html
+
+    * commons-beanutils-1.7.0.jar (gnv + gnv-artifacts)
+    - Apache License Version 2.0
+
+    * commons-collections-3.2.1.jar (gnv + gnv-artifacts)
+    - Apache License Version 2.0
+
+    * commons-dbcp-1.2.2.jar (artifact-database + gnv-artifacts)
+    - Apache License Version 2.0
+
+    * commons-digester-1.6.jar (gnv + gnv-artifacts)
+    - Apache License Version 2.0
+
+    * commons-lang-2.4.jar (gnv-artifacts)
+    - Apache License Version 2.0
+
+    * commons-logging-1.0.4.jar (gnv + gnv-artifacts)
+    - Apache License Version 2.0
+
+    * geoapi-2.2.0.jar (gnv-artifacts)
+    - eine OGC License
+    - http://www.opengeospatial.org/ogc/legal
+
+    * gt-api-2.5.8.jar (gnv-artifacts)
+    - LGPL v2 or later
+
+    * gt-main-2.5.8.jar (gnv-artifacts)
+    - LGPL v2 or later
+
+    * gt-metadata-2.5.8.jar (gnv-artifacts)
+    - LGPL v2 or later
+
+    * gt-referencing-2.5.8.jar (gnv-artifacts)
+    - LGPL v2 or later
+
+    * jcommon-1.0.13.jar (gnv-artifacts)
+    - LGPL v2.1 or later
+
+    * jdom-1.0.jar (gnv-artifacts)
+    - eigene Lizenz
+    - (siehe ./licenses/JDOM-LICENSE.txt)
+
+    * jsr-275-1.0-beta-2.jar (gnv-artifacts)
+    - BSD License
+    - http://jscience.org/doc/license.txt
+
+    * jstl-1.0.6.jar (gnv)
+    - Apache License 2.0
+
+    * oro-2.0.7.jar (gnv)
+    - Apache License 1.1
+
+    * osgi_R4_core-1.0.jar (artifact-database + gnv + gnv-artifacts)
+    - EPL 1.0
+
+    * slf4j-api-1.5.11.jar (artifact-database + gnv-artifacts)
+    - MIT License
+
+    * standard-1.0.6.jar (gnv)
+    - Apache License 2.0
+
+    * velocity-1.4.jar (gnv-artifacts)
+    - Apache License 2.0
+
+    * velocity-dep-1.4.jar (gnv-artifacts)
+    - Apache License 2.0
+
+    * xalan-2.6.0.jar (gnv-artifacts)
+    - Apache License 2.0
+
+    * xalan-2.5.1.jar (gnv)
+    - Apache License 2.0
+
+    * xml-apis-1.0.b2.jar (gnv)
+    - Apache License 2.0
+    - W3C License (siehe ./licenses/XML-APIS-DOM-LICENSE.txt)
+
+    * xml-apis-1.3.04.jar (gnv-artifacts)
+    - Apache License 2.0 and W3C License
+    - (siehe ./licenses/XML-APIS-DOM-LICENSE.txt)
+
+    * xml-apis-ext-1.3.04.jar (gnv-artifacts)
+    - Apache License 2.0 and W3C License
+    - (siehe ./licenses/XML-APIS-DOM-LICENSE.txt)
+
+===============================================================================
+Proprietäre Bibliotheken:
+    * jpe_sdkres-9.3.jar (gnv-artifacts + geo-backend)
+
+    * jsde_sdk-9.3.jar (gnv-artifacts + geo-backend)
+
+    * jpe_sdk-9.3.jar (gnv-artifacts + geo-backend)
+
+===============================================================================
+Bibliotheken mit unklarer Lizenz:
+    * icu4j-3.2.jar (gnv-artifacts + geo-backend)
+    - ICU License
+    - http://source.icu-project.org/repos/icu/icu/trunk/license.html
+
+    * vecmath-1.3.1.jar (gnv-artifacts)
+    - JRL
+    - (siehe ./licenses/JRL.txt)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/test-guideline/README	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,5 @@
+This directory contains a test guideline for the GNV-system.
+So fare, it is just a guideline and not a entire test protocol. 
+Therefore, static test data sets are needed.
+
+For an entry goto "gnv-test-guideline.txt"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/test-guideline/gnv-framework.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+GNV Framework
+
+- Behaviour 
+    - when Server is down: Parameter, Loading of an artifact
+    - when a process hangs
+    - when a user switches the language
+
+- Different instances in the same browser
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/test-guideline/gnv-horizontal-cross-section.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,57 @@
+6. Horizontal cross-section
+
+6.1 Horizontal cross-section@Modeldata (ArcMarineBSH MeshFeature)
+
+# General Szenario
+- No multiple selections available for one of the list of parameters
+
+a. fill paramterization
+
+Data set: Modeldata
+Product: Horizontal cross-section
+	
+Area: No Selection
+	
+Mesh: Tagesmittel Nord- und Ostseemodell
+	
+Area (WKT) 	
+POLYGON ((-1.5763 58.3616, 0.7526 53.8428, 4.2686 53.1972, 7.9217 54.1441, 7.6020 56.2959, 11.5747 57.2857, 10.4788 58.4908, 4.2686 58.8996, 0.0219 58.5768, -1.5763 58.3616))
+	
+Layer and Depth range [m] 	
+Layer 
+	
+Parameter 	
+Temperatur [degC]
+	
+Year 	
+2010
+	
+Measurement date 	
+2010.04.26 12:00:00
+
+b. draw map
+
+
+# Reactions: Elements to check
+# General (static)
+metainformation
+    - URL
+    - Name
+    - TTL
+shapes
+    - color palette
+curves/isolines
+    - range
+    - colors
+    - with points
+legend
+    - entries
+    - labeling
+    - title
+
+
+
+c. save as project
+e. reload project
+f. change WMS options
+k. export as raw data (Shapefile)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/test-guideline/gnv-horizontales-schnittprofil.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,43 @@
+4. Horizontales Schnittprofil
+
+4.1 Horizontales Schnittprofil@Modeldata (ArcMarineBSH MeshFeatures)
+
+# Scenario
+
+Parameter: 1
+
+Depth: 1
+
+a. fill paramterization
+
+Data set: Modeldata
+Product: Horizontales Schnittprofil
+Area: No Selection
+Mesh: Tagesmittel Nord- und Ostseemodell
+	
+Line (WKT) 	
+LINESTRING (0.4911 56.2489, 10.4464 58.1608, 12.2321 56.4127, 13.1250 54.8832, 15.4018 54.5008, 19.6875 56.4127, 20.6250 59.0349, 28.1250 60.2640)
+	
+Parameter 	
+Temperatur [degC]
+	
+Layer and Depth range [m] 	
+Layer 1: 0 - 8
+	
+Year 	
+2010
+	
+Measurement date 	
+2010.04.26 12:00:00
+
+b. draw diagram
+f. change diagram options
+g. export diagram as file (PNG, PDF, SVG)
+h. calculate statistics
+i. draw histogram
+j. change histogram options
+k. export as raw data (CSV, ODV, Shapefile)
+
+
+Notices:
+- Check ODV with several parameters and depths
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/test-guideline/gnv-horizontalprofile.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,158 @@
+3. Horizontalprofile
+
+3.1 Horizontalprofile@Modeldata (ArcMarineBSH MeshFeatures)
+
+# General Data Range
+Sample:
+Modeldata
+Tagesmittel Nord- und Ostseemodell
+# for gap detection
+<- Janckes Test
+# One arbitary point of time
+2010.04.25 12:00:00
+
+# Scenario for a  parameters that can be used out of a list:
+# Vary one parameter of each testcase
+Depth: 1 Layer
+    0-8
+
+Depth: 2 Layers
+    0-8
+    depthest layer (with data?)
+
+
+a. fill parameterization
+# ~ Depth
+# Aim: One depth as status for 2 layers
+
+
+
+b. draw diagram
+# Reactions: Elements to check
+# General (static)
+y-axis
+    - range
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+helperlines
+    - direction
+curves
+    - colors
+    - with points
+legend
+    - entries
+    - labeling
+
+# Dynamic part
+titel
+    - content 
+y-axis
+    - rang
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+legend
+    - entries
+    - labeling
+
+c. save as project
+e. reload project
+f. change diagram options
+g. export diagram as file (PNG, PDF, SVG)
+h. calculate statistics
+i. draw histogram
+j. change histogram options
+k. export as raw data (CSV, ODV, Shapefile)
+
+
+# ~ Number of Parameters
+a. fill paramterization
+
+Parameter: 
+    1 Parameter
+
+Parameter: 
+    2 Parameters with different units
+
+
+# Reactions: Elements to check
+# General (static)
+
+nothing so fare
+
+
+# Dynamic part
+titel
+    - content 
+y-axis
+    - rang
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+legend
+    - entries
+    - labeling
+helperline
+    - directions
+curves
+    - colors
+
+b. draw diagram
+g. export diagram as file (PNG, PDF, SVG)
+h. calculate statistics
+i. draw histogram
+j. change histogram options
+k. export as raw data (CSV, ODV, Shapefile)
+
+
+
+a. fill paramterization
+
+Axis: 
+    East-West
+
+Axis:
+    North-South
+
+b. draw diagram
+
+# Dynamic part
+title
+    - content - Does it have to change?
+
+k. export as raw data (CSV, ODV, Shapefile)
+
+
+3.2. Horitontalprofile@Thermosalinograph (ArcMarineBSH Measurements)
+
+a. fill paramterization
+
+Ship: FS Gauss
+Cruise: FS Gauss 412 TSG
+Track: 28.01.2004 06:33 - 03.02.2004 15:42 - FS Gauss 412 TSG
+Survey Info: 28.01.2004 06:33 - 03.02.2004 15:42 - FS Gauss 412 TSG
+
+# ~ Parameters
+
+Parameter:
+    1 (Salzgehalt)
+
+Parameters:
+    2 (Salzgehalt, Temperatur)
+
+# ~ Depth
+# so fare just one deepth for Thermosalinograph
+
+
+b. draw diagram
+k. export as raw data (CSV, ODV, Shapefile)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/test-guideline/gnv-layer.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,26 @@
+7. User-generated Layers from object-oriented data models
+
+7.1 Layers@NAUTHIS (ArcS57)
+
+
+
+FIS: NAUTHIS
+Product: Layer
+
+
+a. fill paramterization
+
+# Aim: Select relevant data within the selected area
+# Scenarios:
+# ~ Area
+# ~ Subtype
+
+Area: No selection
+Area: A clipping polygon
+
+Subtype: Using one with a join
+
+b. draw a map
+c. save as project
+e. reload project
+k. export as raw data (Shapefile)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/test-guideline/gnv-test-guideline.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,85 @@
+Guideline for testing the GNV-System
+
+This guideline can be used for testing the entire GNV-system based on
+features of the specification. From the perspective of the database
+schemas and procucts, there are 11 unique combinations.
+
+Testing matrix of products to database schemata:
+Testing products on the following FIS should test all functionality in
+the sense of different types of data models
+
+  - TimeSeries: Marnet, Modeldata
+  - Verticalprofile: Marnet, Modeldata, CTD
+  - Horizontalprofile: Modeldata, Thermosalinograph
+  - ("Horizontales Schnittprofil"): Modeldata
+  - Vertical Cross-Section: Modeldata
+  - Horizontal Cross-Section: Modeldata
+  - Layer: NAUTHIS, CONTIS
+
+
+Test procedures:
+Environment for the client
+Browser: Firefox 3.6.3 and Internet Explorer 8.0.6 
+Resolution: 1024x768
+Language: English
+
+Environment for the server
+Operating System: Debian GNU/Linux 5.0.x (Lenny)
+
+a. fill paramterization
+b. draw diagram
+c. save as project
+e. reload project
+f. change diagram options
+g. export diagram as file (PNG, PDF, SVG)
+h. calculate statistics
+i. draw histogram
+j. change histogram options
+k. export as raw data (CSV, ODV, Shapefile)
+
+For each product, there is a guideline testing the product against the
+different database schemata:
+
+- gnv-timerseries.txt
+- gnv-verticalprofile.txt
+- gnv-horizontalprofile.txt
+- gnv-horizontales-schnittprofil.txt
+- gnv-vertical-cross-section.txt
+- gnv-horizontal-cross-section.txt
+- gnv-layer.txt
+- gnv-framework.txt
+
+Notes for the matrix:
+- Relationship between Products and and different Datamodels 
+    - ArcMarineBSH TimeSeries
+    - ArcMarineBSH Measurements
+    - ArcMarineBSH MeshFeatures
+    - ArcS57
+    - CONTIS
+
+
+- All products can be tested based on minimal amount of the following
+  FIS using different data models:
+    - Marnet (ArcMarineBSH TimeSeries): 
+        - TimeSeries, 
+        - Verticalprofile
+
+    - Modeldata (ArcMarineBSH MeshFeatures): 
+        - TimeSeries,
+        - Verticalprofile, 
+        - Horizontalprofile, 
+        - ("Horizontales Schnittprofil"), 
+        - Vertical Cross-Section, 
+        - Horizontal Cross-Section
+
+    - Thermosalinograph (ArcMarineBSH Measurements): 
+        - Horizontalprofile
+
+    - CTD (ArcMarineBSH Measurements): 
+        - Verticalprofile
+
+    - NAUTHIS (ArcS57): 
+        - Layer
+
+    - CONTIS (CONTIS): 
+        - Layer
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/test-guideline/gnv-timerseries.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,182 @@
+1. Timeseries 
+1.1 Timeseries on Marnet (ArcMarineBSH TimeSeries)
+
+# General Data Range
+Sample:
+MARNET 
+FINO1 
+Salzgehalt
+# for gap detection
+6m 25m (?)
+# 1.5 years with change of year
+2005.08.21 12:15:00
+2007.01.21 12:15:00
+
+a. fill parameterization
+# ~ Time
+# Aim: Check for labeling of axis 
+# Aim: General check for all elements
+Time: 1 Day
+    2006.12.31 12:15:00
+    2007.01.01 12:15:00
+
+Time: 1 Month
+    2006.12.21 12:15:00
+    2007.01.21 12:15:00
+
+Time: 1 Year
+    2006.01.21 12:15:00
+    2007.01.21 12:15:00
+
+Time: Max
+
+b. draw diagram
+# Reactions: Elements to check
+# General (static)
+titel
+    - content 
+y-axis
+    - rang
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+helperlines
+    - direction
+curves
+    - colors
+    - with points
+legend
+    - entries
+    - labeling
+
+# Dynamic part
+titel
+    - content 
+y-axis
+    - rang
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+legend
+    - entries
+    - labeling
+
+c. save as project
+e. reload project
+f. change diagram options
+g. export diagram as file (PNG, PDF, SVG)
+h. calculate statistics
+i. draw histogram
+j. change histogram options
+k. export as raw data (CSV, ODV)
+
+a. fill parameterization
+# ~Depth
+# Aim: Check for labeling of legend
+# Aim: Check for different curves with same axis
+Time: 1 Month
+    2006.12.21 12:15:00
+    2007.01.21 12:15:00
+
+Depth: 1
+
+Depth: 2
+
+(Depth: 3)
+
+b. draw diagram
+# Reactions: Elements to check
+# Dynamic part
+y-axis
+    - rang
+    - labeling
+    - units
+curves
+    - colors
+    - with points
+legend
+    - entries
+    - labeling
+
+h. calculate statistics
+i. draw histogram
+k. export as raw data (CSV, ODV)
+
+
+a. fill parameterization
+# ~ Parameter: 1 and more
+# Aim: Check for axis with different units and ranges
+Time: 1 Year
+    2006.01.21 12:15:00
+    2007.01.21 12:15:00
+
+Parameters: 2 parameters with same unit but different name: 
+Temperatur [degC] and Lufttemperatur [degC]
+
+Parameters: 4 different parameters (to get 2 axis at each side):
+Temperatur [degC], Lufttemperatur [degC], Salzgehalt [] and Luftdruck[hPa]
+
+b. draw diagram
+# Reactions: Elements to check
+# Dynamic part
+y-axis
+    - amount of axis
+    - range
+    - units
+x-axis
+    - range
+helperlines
+    - direction: 1 (without horizontal lines)
+curves
+    - colors
+
+k. export as raw data (CSV, ODV)
+
+
+a. fill parameterization
+# ~ Area
+# Aim: Check for Selection of Stations: One and Many
+# Fehler in Abb 3.19: Verbindung von Line zu einem Punkt? Soll dies ein
+Korridor sein?
+
+Area: Point (with Buffer)
+
+[Line: Line with Buffer]
+
+Area: Polygon
+
+# Reactions: List of Selections or direct
+
+# Dynamic part
+Station: 
+    - One result
+    - List of Results
+
+c. save as project
+e. reload project
+
+
+
+
+1.2 Timeseries on Modeldata (ArcMarineBSH MeshFeatures)
+
+# Task: What's the difference between TimeSeriesPoint and
+MeshPoint/-Feature?
+
+? Wenn die Daten als Key-Value angeliefert werden, sollten die Code-Pfade ab 
+da gleich sein. Richtig?
+
+Sample:
+Modeldata 
+Tagesmittel Nord- und Ostseemodell
+Layer 0-8
+Temperatur
+youngest date
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/test-guideline/gnv-vertical-cross-section.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,46 @@
+5. Vertical Cross-Section Profile
+
+5.1  Vertical Cross-Section Profile@Modeldata (ArcMarineBSH MeshFeatures)
+
+a. fill paramterization
+
+# just one Tupel is  allowed
+# no list of any parameter
+
+Data set: Modeldata
+Product: Vertical cross-section
+Area: No Selection
+Mesh: Tagesmittel Nord- und Ostseemodell
+Line (WKT) 	
+LINESTRING (0.4911 56.2489, 10.4464 58.1608, 12.2321 56.4127, 13.1250 54.8832, 15.4018 54.5008, 19.6875 56.4127, 20.6250 59.0349, 28.1250 60.2640)
+Parameter 	
+Salzgehalt [pSal]
+	
+Measurement date 	
+2010.04.26 12:00:00
+
+# Reactions: Elements to check
+# General (static)
+titel
+    - content 
+y-axis
+    - rang
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+curves/isolines
+    - colors
+    - with points
+legend
+    - entries
+    - labeling
+
+b. draw diagram
+
+f. change diagram options
+g. export diagram as file (PNG, PDF, SVG)
+k. export as raw data (ODV)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/test-guideline/gnv-verticalprofile.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,240 @@
+2. Verticalprofile: 
+
+2.1 Verticalprofile@MARNET (ArcMarineBSH TimeSeriesPoint)
+
+# General Data Range
+Sample:
+MARNET 
+FINO1 
+Salzgehalt
+# for gap detection
+??? - c.f. specification
+# Just one arbitrary point of time
+2007.01.21 12:15:00
+
+a. fill parameterization
+# ~ Range of Depth
+# Aim: Check for drawing of curve
+# Aim: General check for all elements
+
+# General Case
+Depth: End-Start= Max
+
+# Clipping one Point of Measurement
+Depth: End-Start= Max-1
+
+# None Range
+Depth: End=Start
+
+# Out of Range
+Depth: End-Start<0
+
+b. draw diagram
+# Reactions: Elements to check
+# General (static)
+titel
+    - content
+y-axis
+    - rang
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+helperlines
+    - direction
+curves
+    - colors
+    - with points
+legend
+    - entries
+    - labeling
+
+# Dynamic part
+titel
+    - content 
+y-axis
+    - rang
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+legend
+    - entries
+    - labeling
+
+c. save as project
+e. reload project
+f. change diagram options
+g. export diagram as file (PNG, PDF, SVG)
+h. calculate statistics
+i. draw histogram
+j. change histogram options
+k. export as raw data (CSV, ODV)
+
+
+a. fill parameterization
+# ~Depth
+# Aim: Check for labeling of legend
+# Aim: Check for different curves with same axis
+Time: 1 Month
+    2006.12.21 12:15:00
+    2007.01.21 12:15:00
+
+Number of Depth: 1
+
+Number of Depth: 2
+
+(Number of Depth: 3)
+
+b. draw diagram
+# Reactions: Elements to check
+# Dynamic part
+y-axis
+    - rang
+    - labeling
+    - units
+curves
+    - colors
+    - with points
+legend
+    - entries
+    - labeling
+
+
+
+2.2 Verticalprofile@Modeldata (ArcMarineBSH MeshFeatures)
+
+# General Data Range
+Sample:
+Modeldata
+56n30 6e20
+56°N 33,000' 06°O 15,000'
+
+# for gap detection
+??? - specified?
+# Just one arbitrary point of time
+2010.03.13 12:00:00
+
+a. fill parameterization
+# ~ Range of Depth
+# Aim: Check for drawing of curve
+# Aim: General check for all elements
+
+# Further need for this cases? Difference between TimeSeriesPoint 
+and Modeldata?
+# General Case
+Depth: End-Start= Max
+
+# Clipping one Point of Measurement
+Depth: End-Start= Max-1
+
+# None Range
+Depth: End=Start
+
+# Out of Range
+Depth: End-Start<0
+
+b. draw diagram
+# Reactions: Elements to check
+# General (static)
+titel
+    - content
+y-axis
+    - rang
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+helperlines
+    - number of directions (1|2)
+curves
+    - colors
+    - with points
+legend
+    - entries
+    - labeling
+
+# Dynamic part
+titel
+    - content 
+y-axis
+    - rang
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+legend
+    - entries
+    - labeling
+
+
+h. calculate statistics
+i. draw histogram
+k. export as raw data (CSV, ODV, Shapefile)
+
+
+2.3 Verticalprofile@CTD (ArcMarineBSH Measurements)
+
+
+# General Data Range
+Sample:
+CTD
+Area: No Selection
+Series: FS Alkor 292
+23.01.2007 10:17 - 54°N 1,960' 08°O 12,550'
+
+
+# for gap detection
+??? - specified?
+# Just one arbitrary point of time
+23.01.2007 10:17
+
+a. fill parameterization
+# ~ Range of Depth
+# Aim: Check for drawing of curve
+# Aim: General check for all elements
+
+# General Case
+Depth: End-Start= Max
+
+b. draw diagram
+# Reactions: Elements to check
+# General (static)
+titel
+    - content
+helperlines
+    - number of directions (1|2)
+curves
+    - colors
+    - with points
+legend
+    - entries
+    - labeling
+
+# Dynamic part
+titel
+    - content 
+y-axis
+    - rang
+    - labeling
+    - units
+x-axis
+    - range
+    - labeling
+    - units
+legend
+    - entries
+    - labeling
+
+
+h. calculate statistics
+i. draw histogram
+k. export as raw data (CSV, ODV, Shapefile)
--- a/geo-backend/ChangeLog	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/ChangeLog	Fri Sep 28 12:15:18 2012 +0200
@@ -1,4 +1,563 @@
-2009-12-171	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+2010-11-02  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java,
+	  src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java,
+	  src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java,
+	  src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java,
+	  src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java,
+	  src/main/java/de/intevation/gnv/geobackend/config/Configuration.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/DefaultQueryContainer.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/QueryContainerException.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleaner.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/Result.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/UncacheableSDEResultSet.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java,
+	  src/main/java/de/intevation/gnv/geobackend/util/XMLUtils.java,
+	  src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java:
+	  Added license headers at the top of each of these files.
+
+	* LGPL.txt: Added license file of the GNU LGPL v2.1
+
+2010-06-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	RELEASE 1.1
+
+	* ChangeLog, Changes, NEWS: Summarized changes.
+
+2010-06-14  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* pom.xml: Write svn revision to MANIFEST file while creating jar archive.
+
+2010-06-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java:
+	  The ehcache CacheManager and the MBeanServer of the JVM are connected
+	  so that the statistics of the sql-cache is available as MBean using
+	  JConsole.
+
+2010-06-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.java:
+	  A new marker interface. It should be implemented by objects that should
+	  not be cached.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/UncacheableSDEResultSet.java:
+	  A new SDEResultSet class that implements Uncacheable. Currently, it is
+	  used for raster elements returned from ArcSDE.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java:
+	  Raster elements are put into an UncacheableSDEResultSet container. This
+	  has the effect that raster elements are not cached.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java:
+	  Only objects that do not implement Uncacheable will be cached.
+
+2010-06-03  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/config/Configuration.java: A
+	  global configuration for this geo-backend. Before using the geo-backend,
+	  it is now necessary to create an instance of this class and call its
+	  initialize(.) method. This method currently takes the following arguments:
+
+	   - conf: an xml document that should contain a node named 'geo-backend'
+	     that contains all configurations required by the geo-backend.
+	   - configDir: the absolute path to the root configuration directory that
+	     might contain further configuration files.
+	   - placeholder: the placeholder string that is used in the central config
+	     file to replace the path to the configuration directory.
+
+	  Furthermore, this Configuration is used to initialize the so-called
+	  'sql-cache' that caches sql statements - it has been configured via system
+	  properties until now.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java:
+	  The sql-cache configuration is not read from system properties but from
+	  global configuration now.
+
+2010-06-03  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/util/XMLUtils.java: Some
+	  functions to handle xml stuff.
+
+2010-05-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java:
+	  Show the execution time of a database query as INFO log.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	RELEASE 1.0
+
+	* Changes, NEWS, ChangeLog: Summarized changes.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleaner.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java,
+	  src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java: Removed
+	  trailing whitespace.
+
+2010-04-20  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/ressources/QueryExecutorTestCase.properties,
+	  src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java:
+	  Integrated Testcase for testing the Basefunctionality of the CacheCleaner.
+
+2010-04-20  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java: 
+	  Integrated the initialization of the CacheCleaner if an SQl-Cache is used.
+	  Also implemented the Method for CleanUp the SQL-Cache in the extended
+	  QueryExecutor.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java: 
+	  Extended Interface adding an Method that should do the Cleanup of the
+	  SQL-Cache.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/cache/package.html: 
+	  Added Documentation.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleaner.java: 
+	  Added Threadimplementation that looks every n-Seconds into the Database 
+	  if there are Tables that where updated during the Time to the last Cleanup.
+	  If there are Tables that has been modified the CacheCleaner will call the
+	  used QueryExecutor. The Queryexecutor will clean up it's Cache using the 
+	  Names of the affected Tables.
+	  It is Possible to configure the Interval between two cleanups. for this 
+	  you have to set the Systemproperty -Dcaching.cleaner.interval using Seconds
+	  as unit.
+
+2010-04-16	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java,
+	  src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java:
+	  Using unix line endings only.
+
+2010-04-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java:
+	  Removed trailing whitespace.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/util/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/sde/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/exception/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java, 
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/package.html,
+	  src/main/java/de/intevation/gnv/geobackend/base/package.html: 
+	  Added more Javadoc.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/Result.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java:
+	  Modified some JavaDoc so that the Warnings that where caused by mistakes
+	  are removed.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/Result.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java,
+	  src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java:
+	  Modified some JavaDoc so that the Warnings that where caused by mistakes 
+	  are removed.
+
+2009-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/**/package.html: New.
+	  Added package description with text 'DOCUMENT ME!'.
+
+2009-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/test/java/de/intevation/gnv/geobackend/**/*.java:
+	  Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
+
+	  find -name \*.java | \
+	  xargs sed -i \
+	  -e 's/@author[ ]\+\([^(<]\+\)[<(]\([^>)]\+\)[>)]/@author <a href="mailto:\2">\1<\/a>/g' \
+	  -e 's@[ ]\+</a>@</a>@g'
+
+2009-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/**/*.java:
+	  Ordered imports. Removed empty headers.
+
+2009-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java,
+	  src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java,
+	  src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java,
+	  src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java,
+	  src/main/java/de/intevation/gnv/geobackend/util/BlockCollection.java,
+	  src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java:
+	  Removed trailing whitespace.
+	  find -name \*.java | xargs sed -i 's/[ \t]\+$//'
+
+2010-03-26  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/*.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/*.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/*.java:
+	  Updated Javadocs to the Listed Classes.
+	  Also done some Codecleanup and removed unused Methods from the Code.
+	
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionParams.java:
+	  Removed unused Class ArcSDEConnectionParams.
+
+2010-03-26  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Datasource.java: 
+	  Removed unused Class Datasource.
+
+2010-03-26  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/DatasourceConnection.java: 
+	  Removed unused Class DatasourceConnection.
+
+2010-03-26  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java: 
+	  Removed unused Class SDEQuery.
+
+2010-03-16  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java (createPoints): 
+	  Now it is also possible to extract Points from a given LineString.
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java (executeQuery): 
+	  Added Support for SpatialQueries using LineString as Geometry of Interest.
+
+2010-03-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue):
+	  Added support for MultiLineString-Geometries. The Points do not belong to one 
+	  Geometryelement. We have to lookup if the Geometry is Multiparted.
+	  If it is we have to split the Points into several LineStrings which belongs 
+	  to one MultiLineString.
+
+2010-03-12  Tim Englich  <tim.englich@intevation.de>
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java (getColumnClassName): 
+	  Added more ClassName identificaton for the different datatypes of the ArcSDE.
+	  Now it is possible to distinguish between Integer, Long, String, Date, 
+	  Float and Double Objects.
+	  This is required to get a valid Shape- and WMS-Export.
+
+2010-03-09  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue): 
+	  Switched to using asText(...)-Function of SeShapes-Objects for generating 
+	  an WKT-String for Polygons. Going this way we are able to produce valid 
+	  WKT for all kinds of Polygons deliverd by the ArcSDE.
+	  We cannot use this Method for Points and LineStrings because the WKT 
+	  which will be produced is invalid e.g. Point Z (...) LineString m (...)
+	  I didn't find Invalid WKTs for Polygons which in Database-Rables we are 
+	  using right now. 
+	  
+	  It has to be monitored if there are Polygons in the  Database which will 
+	  produce invalid WKT-Strings.
+
+2010-03-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue): 
+	  Implemented Support of MultiPolygons. The Points do not belong to one 
+	  Geometryelement. We have to Lookup ifthe Geometry is Multiparted.
+	  If it is we have to split the Points into several Polygons which belongs 
+	  to one Multipolygon.
+	  This Fix solve did not solve any Parsingerros. Some geometries are still 
+	  corrupt.
+	  
+2010-03-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java (getPosValue): 
+	  Added Suport for the Geometrytyp SimpleLine.
+	  SimpleLine will be handled as an Line.
+
+2010-02-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue170
+	
+	* artifact-database/pom.xml: Changed log4j version to 1.2.14 (later version
+	  causes errors and breaks while maven build process).
+
+2010-02-05  Tim Englich  <tim.englich@intevation.de>
+
+	* pom.xml: 
+	  Changed from ArcSDE version 9.2.5 to Version 9.3
+	  You have to Install the required Libraries as described in
+	  https://bsh-intern.intevation.de/Mavenbuildprozess
+
+2010-01-27  Hans Plum <hans@intevation.de>
+
+	RELEASE 0.4
+
+	* Changes, NEWS, ChangeLog: Summarized changes.
+
+2009-01-25	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	Fix for gnv/issue107
+
+	* src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java:
+	  New. Used to reduce the redundancy of data in SQL result sets. Column
+	  values are very distinct so the degree or redundancy is very high. E.g 
+	  the SDE produces for each date value a java.util.GregorianCalendar object
+	  which are very heavy weighted. We only use them r/o so we can hash each date 
+	  value to one unique representative. Same logic applys to integer values 
+	  and so on.
+	  
+	  With this technique we are able to reduce the memory consumption by
+	  over 90%. Because it is not very feasible to store the whole history
+	  of column we only have a limited number of cached values per column.
+	  This is controlled via the system property
+	  "de.intevation.gnv.geobackend.util.RedundancyRemover.lookback" which
+	  defaults to 1029.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java:
+	  Use RedundancyRemovers to filter the incoming traffic from SDE.
+
+2010-01-26  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java : 
+	  Added Sample for bug in ArcSDE 9.3 using to_char-Function with SpatialQuery
+	* src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java : 
+	  Added Sample for Bug in ArcSDE using group by with SpatialQuery
+
+2009-01-25	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	Another attempt to fix gnv/issue34
+
+	* src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java:
+	  Add a toString() method.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java:
+	  Added an idle time detection mechanism. You can call touch() on
+	  a connection to refresh the internal timestamp and ask with isActive()
+	  if a constructor given time interval in milliseconds is exceeded.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java:
+	  Added a check of inactivity to validateObject() before relying on SDE logic.
+	  This is the last line of defence if the testServer() call is going not to respond.
+	  This duplicates the eviction policy of Apache Commons pool a bit but I found
+	  this way to be more trustworthy.
+
+	  The idle time is configure with the property 'serverInactiveInterval'.
+	  units: seconds. Defaults to 5 minutes.
+
+	  The unit of 'serverRoundtripInterval' (parameter of testServer()) is now
+	  in seconds, too. Default: 5 seconds. This is the value used in GeoTools.
+
+2009-01-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java:
+	  Cleanup imports.
+
+2010-01-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java (isValid): 
+	  Implemented the isValid-method of the ArcSDEConnection for 
+	  getting a propper Validation of the used SEConnection.
+	  For the Validation the Method testServer of the SEConnection is used.
+	
+	* src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java (ArcSDEPoolableObjectFactory): 
+	  Added Member serverRoundtripInterval to represent the Time in 
+	  Milliseconds which is allowed to reused a returned Connection.
+	  Also used Connection.isValid Method instead of Connection.isClosed 
+	  to validate the Connection befor it could be borrowed from the Pool.
+
+2009-01-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java:
+	  Added bicubic spline interpolation on raster tiles. This
+	  should increase the 'virtual' resolution more than the
+	  bilinear interpolation. To enable it write 'bicubic' into
+	  the configuration file.
+
+	* pom.xml: Added dependency to Apache Common Math 2.0 for
+	  the cubic spline interpolation.
+
+2009-01-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java:
+	  Added static method to fetch matching interpolation type for
+	  given string. Defaults to nearest neighbor if no string is matching.
+
+2009-01-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java:
+	  Implemented bilinear interpolation.
+
+2009-01-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java:
+	  Fixed transformations to figure out the right tile in the SDE.
+	  Taking the tile origin into account now and does not do wrong rounding
+	  of column and row indices. Simplified the code a lot.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java:
+	  Fixed access to right right pixel now. Removed the envelope code because
+	  its not needed any longer. You can ask a RasterObject directly now if
+	  a given coordinate is on the tile now. The tile space is now correctly
+	  spanned between (0, 0) and (tile width - 1, tile height - 1) now which
+	  allows other access patterns like bilinear interpolation. TODO: implement
+	  bilinear interpolation.
+
+2010-01-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java, 
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java, 
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java (initializeConnectionPool): 
+	  Removed Encodingerrors from listed Files. All Files are now UTF-8 compliant.
+
+2010-01-05  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java:
+	  Made it serializable to be cachable beyond reboot.
+
+2010-01-05  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java (handleResultSet): 
+	  Switched to return the RasterObject instead of the depth in an Rasterquery.
+	  This should help to get a better performance.
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java (RasterObject): 
+	  Added new Object for Caching Rastertiles and all Informations that are
+	  required for calculating the Depth to a given Coordinate.
+
+2010-01-04  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java (handleResultSet): 
+	  Added Rasterdatasupport to the ARCSDESTATEMENT.
+	  Now it is possible to Query the Value of an Pixel like that:
+	  SELECT ST_ASTEXT(RASTER) FROM MEDIAN.TOPO_BS_D_6X10SEC where INTERSECTS(RASTER, "POINT( 12.084721594184593 54.35583351483295)")
+
+2009-12-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* contrib/sql-cache.xml: Configured disk storage to survive restarts.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java:
+	  Added explicit shutdown hook.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java:
+	  Fixed spelling of cacheResults() which prevented results to be stored in cache.
+	  Added some logging.
+
+2009-12-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	Experimental caching of SQL results via Ehcache
+
+	* pom.xml: Added dependency to Ehcache
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java:
+	  Extended interface to support caching by SQL statements as Strings.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java:
+	  Implements new interface with no caching
+	
+	* src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java:
+	  synchronized access to singleton.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java:
+	  calls caching methods of base class.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java:
+	  When system property 'query.executor.factory' is given the value is used as
+	  a class name to be instantiated as a sub class of QueryExecutorFactory.
+	  This happens if the singleton of QueryExecutorFactory is created. With the
+	  mechanism it is possible to replace the standard behavior of creating QueryExecutors.
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java:
+	  New: This class extends QueryExecutorFactory and can be used as replacement for
+	  the standard QueryExecutorFactory. Usage: 
+
+	  -Dquery.executor.factory=de.intevation.gnv.geobackend.base.query.CachingQueryExecutorFactory
+
+	  If you pass in another system property 'caching.query.executor.config' you can
+	  customize the caching. The value is used as a file name to an XML file with 
+	  Ehcache configuration.
+
+	* contrib/sql-cache.xml: Demo configuration for sql caching. Usage:
+
+	  -Dquery.executor.factory=de.intevation.gnv.geobackend.base.query.CachingQueryExecutorFactory
+	  -Dcaching.query.executor.config=contrib/sql-cache.xml
+
+2009-12-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	RELEASE 0.3
 
--- a/geo-backend/Changes	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/Changes	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,62 @@
+2010-06-30  RELEASE 1.1
+
+    NEW:
+
+        * Cache statistics are available as MBean using JConsole.
+
+        * Deactivated the caching of raster elements to improve performance.
+
+    DDED:
+
+        * A central Configuration instance that might be used to adjust settings
+          of the geo-backend.
+
+
+2010-04-28  RELEASE 1.0
+
+    NEW:
+
+        * Support for MultiLinestring and MultiPolygon detection retrieved by
+          the database.
+
+        * Spatial queries using LineStrings can be sent to the database.
+
+        * Sql-cache synchronization after database upates have taken place. A
+          thread is started in a specific time interval. Elements are removed
+          from cache if the sql-statement that has been used to retrieve these
+          elements contains a table that have been updated since the last 
+          synchronization. The time interval (in seconds) can be configured via 
+          system property 'caching.cleaner.interval' (e.g.
+          caching.cleaner.interval=600 for an interval of 10 minutes).
+
+    Added:
+
+        * JavaDoc documentation.
+
+
+2010-03-08  RELEASE 0.5
+
+
+2010-01-27  RELEASE 0.4
+
+    New:
+
+    * Experimental Cache for database queries and 
+    results of parameterisation: Database queries are 
+    transparent against cache.
+
+    * Support for raster data access to SDE via RasterObject
+
+    * Added interpolation for bilinear and bicubic 
+    spline interpolation on rasters
+
+    * Improved connection pooling for re-use of connections (#34)
+
+    * Improved memory consumption of SQL results produced by SDE by 
+    over 90% while removing redundancies for objects (especially 
+    date objects): e.g. from 256 MB per Interpolation to 15 MB. (#107)
+
+
 2009-12-17  RELEASE 0.3
 
     New:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/LGPL.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
--- a/geo-backend/NEWS	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/NEWS	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,50 @@
+2010-06-30  RELEASE 1.1
+
+    * Evaluable cache statistics
+
+    * Central configuration for this Geo-Backend
+
+
+2010-04-28  RELEASE 1.0
+
+    NEW:
+
+        * Support for MultiPolygons retrieved by database.
+
+        * Support for MultiLinestrings retrieved by database.
+
+        * Support for spatial queries using LineStrings.
+
+        * Support for cache synchronization after database updates.
+
+
+    Added:
+
+        * Added JavaDoc documentation.
+
+
+2010-03-08  RELEASE 0.5
+
+
+2010-01-27  RELEASE 0.4
+
+    * Support for raster data access to SDE via RasterObject
+
+    * Added interpolation for bilinear and bicubic 
+    spline interpolation on rasters
+
+    * Improved connection pooling for re-use of connections (#34)
+
+    * Improved memory consumption of SQL results produced by SDE by 
+    over 90% while removing redundancies for objects (especially 
+    date objects): e.g. from 256 MB per Interpolation to 15 MB. (#107)
+
+    * Experimental Cache for database queries and 
+    results of parameterisation: Database queries are 
+    transparent against cache. 
+    Acceleration by at least factor 5-8 depending on circumstances.
+
+
 2009-12-17  RELEASE 0.3
 
     New:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/contrib/sql-cache.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ehcache>
+    <diskStore path="java.io.tmpdir/sql-cache"/>
+    <defaultCache 
+        maxElementsInMemory="100"
+        eternal="false"
+        overflowToDisk="true"
+        memoryStoreEvictionPolicy="LFU"
+        diskPersistent="true"
+        maxElementsOnDisk="512"
+        timeToIdleSeconds="10800"
+        timeToLiveSeconds="14400"
+        />
+</ehcache>
+
--- a/geo-backend/pom.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/pom.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -4,10 +4,14 @@
   <groupId>de.intevation.bsh</groupId>
   <artifactId>geo-backend</artifactId>
   <packaging>jar</packaging>
-  
-   <version>1.0-SNAPSHOT</version>
+  <version>1.0-SNAPSHOT</version>
   <name>geo-backend</name>
   <url>http://maven.apache.org</url>
+  <scm>
+    <connection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/geo-backend</connection>
+    <developerConnection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/geo-backend</developerConnection>
+    <url>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/geo-backend</url>
+  </scm>
   <build>
     <plugins>
       <plugin>
@@ -24,6 +28,36 @@
           <target>1.5</target>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>buildnumber-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>validate</phase>
+            <goals>
+              <goal>create</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <doCheck>true</doCheck>
+          <doUpdate>false</doUpdate>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+            </manifest>
+            <manifestEntries>
+              <SCM-Revision>${buildNumber}</SCM-Revision>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <dependencies>
@@ -36,13 +70,19 @@
     <dependency>
       <groupId>com.esri.sde</groupId>
       <artifactId>jsde_sdk</artifactId>
-      <version>9.2.5</version>
+      <version>9.3</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
       <groupId>com.esri.sde</groupId>
       <artifactId>jpe_sdk</artifactId>
-      <version>9.2.5</version>
+      <version>9.3</version>
+      <scope>compile</scope>
+    </dependency>
+     <dependency>
+      <groupId>com.esri.sde</groupId>
+      <artifactId>jpe_sdkres</artifactId>
+      <version>9.3</version>
       <scope>compile</scope>
     </dependency>
     <dependency>
@@ -54,7 +94,7 @@
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
-      <version>[1.2,)</version>
+      <version>1.2.14</version>
     </dependency>
     <dependency>
       <groupId>commons-pool</groupId>
@@ -62,10 +102,20 @@
       <version>1.5.2</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-math</artifactId>
+      <version>2.0</version>
+    </dependency>
+    <dependency>
       <groupId>com.vividsolutions</groupId>
       <artifactId>jts</artifactId>
       <version>1.9</version>
     </dependency>
+    <dependency>
+      <groupId>net.sf.ehcache</groupId>
+      <artifactId>ehcache</artifactId>
+      <version>1.6.2</version>
+    </dependency>
   </dependencies>
   <repositories>
     <repository>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,40 +1,40 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base;
 
 import java.util.Date;
 import java.util.GregorianCalendar;
-import java.util.HashMap;
 
 import de.intevation.gnv.geobackend.util.DateUtils;
 
 /**
  * Defaultimplementation of the Interface Result.
  * This Class stores the Attributevalues of one Result.
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
-public class DefaultResult 
-implements   Result 
+public class DefaultResult
+implements   Result
 {
     /**
      * THE UID of this Classe
      */
     private static final long serialVersionUID = -6886218808840982766L;
-
-
     /**
-     * HashMap which stores the Columnvalues identified by the unique Columnname
+     * Array which stores the Columnvalues
      */
-
      private Object [] values;
-    
     /**
      * The ResultDescriptor which describes the ColumnValues
      */
     private ResultDescriptor resultDescriptor = null;
-    
+
     /**
      * Constructor
      */
@@ -50,6 +50,9 @@
         return getDate(resultDescriptor.getColumnIndex(columnName));
     }
 
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getDate(int)
+     */
     public Date getDate(int column) {
         Object o = values[column];
         Date d = null;
@@ -68,6 +71,9 @@
         return getDouble(resultDescriptor.getColumnIndex(columnName));
     }
 
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getDouble(int)
+     */
     public Double getDouble(int column) {
         return (Double)values[column];
     }
@@ -79,6 +85,9 @@
         return getFloat(resultDescriptor.getColumnIndex(columnName));
     }
 
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getFloat(int)
+     */
     public Float getFloat(int column) {
         return (Float)values[column];
     }
@@ -88,11 +97,12 @@
      */
     public Integer getInteger(String columnName) {
         int idx = resultDescriptor.getColumnIndex(columnName);
-
         return idx > -1 ? getInteger(idx) : -1;
-        //return getInteger(resultDescriptor.getColumnIndex(columnName));
     }
 
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getInteger(int)
+     */
     public Integer getInteger(int column) {
         Object value = values[column];
         if (value instanceof Double){
@@ -100,6 +110,7 @@
         }
         return (Integer)value;
     }
+
     /**
      * @see de.intevation.gnv.geobackend.base.Result#getResultDescriptor()
      */
@@ -112,28 +123,26 @@
      */
     public String getString(String columnName) {
         int idx = resultDescriptor.getColumnIndex(columnName);
-
         return idx > -1 ? getString(idx) : null;
     }
 
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getString(int)
+     */
     public String getString(int column) {
-
         Object o = values[column];
-
         if (o instanceof Date){
             return DateUtils.getPatternedDateAmer((Date)o);
         }
-
         if (o instanceof GregorianCalendar){
             Date d = ((GregorianCalendar)o).getTime();
             return DateUtils.getPatternedDateAmer(d);
         }
-
         return o != null ? o.toString() : null;
     }
 
     /**
-     * @see de.intevation.gnv.geobackend.base.Result#addColumnValue(java.lang.String, java.lang.Object)
+     * @see de.intevation.gnv.geobackend.base.Result#addColumnValue(int, java.lang.Object)
      */
     public void addColumnValue(int column, Object value) {
         values[column] = value;
@@ -146,6 +155,9 @@
         return getObject(resultDescriptor.getColumnIndex(columnName));
     }
 
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getObject(int)
+     */
     public Object getObject(int column) {
         return values[column];
     }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base;
 
 import java.util.ArrayList;
@@ -11,7 +16,7 @@
 /**
  * This Class is the DefaultImplementation of the
  * Interface ResultDescriptor
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class DefaultResultDescriptor implements ResultDescriptor {
@@ -20,22 +25,19 @@
      *The Uid of this Class
      */
     private static final long serialVersionUID = 7016889733270716130L;
-
     /**
      * The Names of the Columns of one Result
      */
     private List<String> columnNames = new ArrayList<String>();
-    
     /**
      * The Name of the Classes of the Values of one Result.
      */
     private List<String> columnClassNames = new ArrayList<String>();
-    
     /**
-     * 
+     * The Lookup for the Columnindex of the Columnnames
      */
     private Map<String, Integer> columnIndexLookup = new HashMap<String, Integer>();
-    
+
     /**
      * Constructor
      */
@@ -80,13 +82,10 @@
         if (columnNames == null) {
             return null;
         }
-
         int [] indices = new int[columnNames.length];
-
         for (int i = 0; i < indices.length; ++i) {
             indices[i] = this.getColumnIndex(columnNames[i]);
         }
-
         return indices;
     }
 
@@ -94,8 +93,27 @@
      * @see de.intevation.gnv.geobackend.base.ResultDescriptor#getColumnIndex(java.lang.String)
      */
     public int getColumnIndex(String columnName) {
-        
+
         Integer value = this.columnIndexLookup.get(columnName);
         return value != null ? value.intValue() : -1;
     }
+
+    /**
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder("[");
+        int N = Math.min(columnNames.size(), columnClassNames.size());
+        for (int i = 0; i < N; ++i) {
+            if (i > 0) {
+                sb.append(", ");
+            }
+            sb.append(columnNames.get(i))
+              .append(": ")
+              .append(columnClassNames.get(i));
+        }
+        sb.append(']');
+        return sb.toString();
+    }
 }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/Result.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/Result.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,27 +1,31 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base;
 
 import java.io.Serializable;
 import java.util.Date;
 
-
 /**
  * Interface which provides the Methods for Accessing
  * the Data of an ResultEntry
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public interface Result extends Serializable{
-  
+
     /**
      * Returns the ResultDescriptor which provides the
      * ResultMetadatse
      * @return the ResultDescriptor
      */
     public ResultDescriptor getResultDescriptor();
-    
+
     /**
      * Returns the Columnvalue as a String
      * @param columnName the Name of the column
@@ -29,9 +33,13 @@
      */
     public String getString(String columnName);
 
+    /**
+     * Returns the Columnvalue as a String
+     * @param column the Position of the Column that should be returned.
+     * @return the Columnvalue as a String
+     */
+    public String getString(int column);
 
-    public String getString(int column);
-    
     /**
      * Returns the Columnvalue as a Date
      * @param columnName the Name of the column
@@ -39,8 +47,13 @@
      */
     public Date getDate(String columnName);
 
+    /**
+     * Returns the Columnvalue as a Date
+     * @param column the Position of the Column that should be returned.
+     * @return the Columnvalue as a Date
+     */
     public Date getDate(int column);
-    
+
     /**
      * Returns the Columnvalue as a Integer
      * @param columnName the Name of the column
@@ -48,6 +61,11 @@
      */
     public Integer getInteger(String columnName);
 
+    /**
+     * Returns the Columnvalue as a Integer
+     * @param column the Position of the Column that should be returned.
+     * @return the Columnvalue as a Integer
+     */
     public Integer getInteger(int column);
 
     /**
@@ -57,8 +75,13 @@
      */
     public Float getFloat(String columnName);
 
+    /**
+     * Returns the Columnvalue as a Float
+     * @param column the Position of the Column that should be returned.
+     * @return the Columnvalue as a Float
+     */
     public Float getFloat(int column);
-    
+
     /**
      * Returns the Columnvalue as a Double
      * @param columnName the Name of the column
@@ -66,8 +89,13 @@
      */
     public Double getDouble(String columnName);
 
+    /**
+     * Returns the Columnvalue as a Double
+     * @param column the Position of the Column that should be returned.
+     * @return the Columnvalue as a Double
+     */
     public Double getDouble(int column);
-    
+
     /**
      * Returns the Columnvalue as a Object
      * @param columnName the Name of the column
@@ -75,11 +103,16 @@
      */
     public Object getObject(String columnName);
 
+    /**
+     * Returns the Columnvalue as a Object
+     * @param column the Position of the Column that should be returned.
+     * @return the Columnvalue as a Object
+     */
     public Object getObject(int column);
-    
+
     /**
-     * Adds an new Coumnvalue to the Result.
-     * @param columnName the Name of the Column
+     * Adds an new Columnvalue to the Result.
+     * @param column the Position where the column should be inserted.
      * @param value the Value of the Column
      */
     public void addColumnValue(int column, Object value);
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base;
 
 import java.io.Serializable;
@@ -8,7 +13,7 @@
 /**
  * Interface which provides the Methods for Accessing
  * the MetaData of an ResultEntry
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface ResultDescriptor extends Serializable{
 
@@ -18,20 +23,20 @@
      * @return the Classname of the Column
      */
     public String getColumnClassName(int column);
-    
+
     /**
      * Returns the Number of Columns
      * @return the Number of Columns
      */
     public int getColumnCount();
-    
+
     /**
      * Returns the Name of the Column which belongs to the given Columnindex
      * @param column the Index of the Column
      * @return the Name of the Column
      */
     public String getColumnName(int column);
-    
+
     /**
      * Adds a new ColumnDescription into the Descriptor
      * @param name the Name of the Column (unique)
@@ -39,7 +44,19 @@
      */
     public void addColumn(String name, String className);
 
+    /**
+     * Returns the Indices of the Columns which are specified in the
+     * param columnNames.
+     * @param columnNames the Name of the Columns for which the Indices should returned.
+     * @return the Indices of the Columns which are specified in the
+     * param columnNames.
+     */
     public int [] getColumnIndices(String [] columnNames);
 
+    /**
+     * Returns the index of the given columnName
+     * @param columnName the Name of the Index which should be looked up.
+     * @return the index of the given columnName
+     */
     public int getColumnIndex(String columnName);
 }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,19 +1,28 @@
-package de.intevation.gnv.geobackend.base.connectionpool;
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
 
-import java.sql.Connection;
-import java.util.Properties;
+package de.intevation.gnv.geobackend.base.connectionpool;
 
 import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
 
+import java.sql.Connection;
+
+import java.util.Properties;
+
 /**
  * Interfacedefinition for an Generic ConnectionPool
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface ConnectionPool {
-    
+
     /**
      * Delivers the Connection to the Database
-     * @param connectionID the ID of the Connection 
+     * @param connectionID the ID of the Connection
      * @return the Connection to the Database
      * @throws ConnectionException
      */
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,23 @@
-/**
- * 
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.connectionpool;
 
+import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEConnectionPool;
+
 import java.util.Properties;
 
 import org.apache.log4j.Logger;
 
-import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEConnectionPool;
-
 /**
  * Factoryimplementation for the Interface ConnectionPool.
  * This factory delivers Instances of the Interface ConnectionPool.
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class ConnectionPoolFactory {
 
@@ -21,7 +26,7 @@
      */
     private static Logger log = Logger.getLogger(ConnectionPoolFactory.class);
 
-    
+
     /**
      * The singleton Instance of this Factory.
      */
@@ -49,8 +54,7 @@
         }
         return instance;
     }
-    
-    
+
     /**
      * Getting the ConnectionPool
      * @return the ConnectionPool
@@ -67,12 +71,12 @@
     public void initializeConnectionPool(Properties properties){
         log.debug("ConnectionPoolFactory.initializeConnectionPool");
         if (this.connectionPool == null){
-            //TODO: Hier könnte anhand eines Flags die Instanz des Connectionpools umgeschaltet werden.
+            //TODO: Here it might be possible to switch the ConnectionPoolInstance using a FLAG.
             this.connectionPool = new ArcSDEConnectionPool();
             this.connectionPool.initialize(properties);
         }else{
             log.warn("ConnectionPool already initialized");
-        }	
+        }
     }
 
     /**
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,114 +1,111 @@
-/**
- * Title:           lConnectionException, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/ConnectionException.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/ConnectionException.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     21.11.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: drewnak $
- * modified on:     $Date: 2008/08/18 14:50:33 $
- * Version:         $Revision: 1.2 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.base.connectionpool.exception;
-
-import com.esri.sde.sdk.client.SeError;
-import com.esri.sde.sdk.client.SeException;
-
-import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
-
-import org.apache.log4j.Logger;
-
-/**
- * The class <code>lConnectionException</code> fulfills the following purposes:
- * <ol>
- * <li></li>
- * </ol>
- *
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 21.11.2007 08:13:05
- */
-public class ConnectionException extends TechnicalException {
-
-    /**
-     * Default Logging instance
-     */
-    private static Logger sLogger = Logger.getLogger(ConnectionException.class);
-
-    /**
-     * Constructs a new exception with <code>null</code> as its detail message.
-     * The cause is not initialized, and may subsequently be initialized by a
-     * call to {@link #initCause}.
-     */
-    public ConnectionException() {
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message.  The
-     * cause is not initialized, and may subsequently be initialized by
-     * a call to {@link #initCause}.
-     *
-     * @param message the detail message. The detail message is saved for
-     *                later retrieval by the {@link #getMessage()} method.
-     */
-    public ConnectionException(String message) {
-        super(message);
-    }
-    public ConnectionException(Throwable pCause) {
-        super(pCause);
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message and
-     * cause.  <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message (which is saved for later retrieval
-     *                by the {@link #getMessage()} method).
-     * @param cause   the cause (which is saved for later retrieval by the
-     *                {@link #getCause()} method).  (A <tt>null</tt> value is
-     *                permitted, and indicates that the cause is nonexistent or
-     *                unknown.)
-     * @since 1.4
-     */
-    public ConnectionException(String message, Throwable cause) {
-        super(message, cause);
-    }
-
-    /**
-     * Displays the details of an SeException (if available).
-     *
-     */
-    public void printError() {
-        if (getCause() != null && getCause() instanceof SeException) {
-            SeException exception = (SeException) getCause();
-            SeError error = exception.getSeError();
-
-            sLogger.debug("\n ArcSDE Error Number        : " + error.getSdeError());
-            sLogger.debug(" Error Description          : " + error.getErrDesc());
-
-            int extError = error.getExtError();
-            if (extError != 0)
-                sLogger.debug(" Extended Error Number      : " + extError);
-
-            String desc = error.getSdeErrMsg();
-            if (desc != null && desc.length() != 0)
-                sLogger.debug(" Extended Error Description : " + desc);
-
-            desc = error.getExtErrMsg();
-            if (desc != null && desc.length() != 0)
-                sLogger.debug(" Extended Error Description : " + desc);
-
-            sLogger.debug(exception);
-
-        }
-
-    }
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.base.connectionpool.exception;
+
+import com.esri.sde.sdk.client.SeError;
+import com.esri.sde.sdk.client.SeException;
+
+import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>lConnectionException</code> fulfills the following purposes:
+ *
+ * @author blume
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class ConnectionException extends TechnicalException {
+
+    /**
+     * The UID of this Class.
+     */
+    private static final long serialVersionUID = 102459262123219617L;
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(ConnectionException.class);
+
+    /**
+     * Constructs a new exception with <code>null</code> as its detail message.
+     * The cause is not initialized, and may subsequently be initialized by a
+     * call to {@link #initCause}.
+     */
+    public ConnectionException() {
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message.  The
+     * cause is not initialized, and may subsequently be initialized by
+     * a call to {@link #initCause}.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public ConnectionException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructor
+     * @param pCause the Throwable which cause this exception
+     */
+    public ConnectionException(Throwable pCause) {
+        super(pCause);
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message and
+     * cause.  <p>Note that the detail message associated with
+     * <code>cause</code> is <i>not</i> automatically incorporated in
+     * this exception's detail message.
+     *
+     * @param message the detail message (which is saved for later retrieval
+     *                by the {@link #getMessage()} method).
+     * @param cause   the cause (which is saved for later retrieval by the
+     *                {@link #getCause()} method).  (A <tt>null</tt> value is
+     *                permitted, and indicates that the cause is nonexistent or
+     *                unknown.)
+     * @since 1.4
+     */
+    public ConnectionException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Displays the details of an SeException (if available).
+     *
+     */
+    public void printError() {
+        if (getCause() != null && getCause() instanceof SeException) {
+            SeException exception = (SeException) getCause();
+            SeError error = exception.getSeError();
+
+            sLogger.debug("\n ArcSDE Error Number        : " + error.getSdeError());
+            sLogger.debug(" Error Description          : " + error.getErrDesc());
+
+            int extError = error.getExtError();
+            if (extError != 0)
+                sLogger.debug(" Extended Error Number      : " + extError);
+
+            String desc = error.getSdeErrMsg();
+            if (desc != null && desc.length() != 0)
+                sLogger.debug(" Extended Error Description : " + desc);
+
+            desc = error.getExtErrMsg();
+            if (desc != null && desc.length() != 0)
+                sLogger.debug(" Extended Error Description : " + desc);
+
+            sLogger.debug(exception);
+
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Package that contains Exceptionclasses for it's Parentpackage.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains Classes that provides an <code>ConnectionPool</code>
+for <code>java.sql.Connection</code>-Objects
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains Interfaces and Classes to provide Access to Data without
+using an <code>java.sql.ResultSet</code>-object in the Code that use this Module.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/CachingQueryExecutorFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.base.query;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.geobackend.base.query.cache.CacheCleaner;
+
+import de.intevation.gnv.geobackend.config.Configuration;
+
+import java.lang.management.ManagementFactory;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.management.MBeanServer;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+
+import net.sf.ehcache.management.ManagementService;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class CachingQueryExecutorFactory
+extends      QueryExecutorFactory
+{
+    public static final String CACHE_NAME             = "sql.cache";
+
+    private static Logger log = Logger.getLogger(CachingQueryExecutorFactory.class);
+
+    protected CacheManager manager;
+
+    public CachingQueryExecutorFactory() {
+        log.info("using SQL cache");
+        init();
+    }
+
+    private void init() {
+        Configuration config = Configuration.getInstance();
+
+        if (config == null) {
+            log.error("No geobackend configuration found. " +
+                "Wasn't able to initialize cache.");
+            return;
+        }
+        String configFile = config.getCacheConfiguration();
+        manager = configFile != null
+            ? new CacheManager(configFile)
+            : new CacheManager();
+        manager.addCache(CACHE_NAME);
+        MBeanServer mBeanServer =
+            ManagementFactory.getPlatformMBeanServer();
+        ManagementService.registerMBeans(
+            manager, mBeanServer, false, false, false, true);
+        CacheCleaner cc = new CacheCleaner();
+        cc.start();
+    }
+
+    public QueryExecutor getQueryExecutor() {
+        return new DefaultQueryExceutor() {
+
+            public Collection<Result> cachedResults(String query) {
+                Cache   cache   = manager.getCache(CACHE_NAME);
+                Element element = cache.get(query);
+                if (log.isDebugEnabled()) {
+                    log.debug("found results in SQL cache: " + (element != null));
+                }
+                return element != null
+                    ? (Collection<Result>)element.getObjectValue()
+                    : null;
+            }
+
+            public void cacheResults(String query, Collection<Result> results) {
+                log.debug("store results in SQL cache");
+                Cache cache = manager.getCache(CACHE_NAME);
+                cache.put(new Element(query, results));
+            }
+
+            public void clearCache(String[] tableNames) {
+                Cache   cache   = manager.getCache(CACHE_NAME);
+                Iterator keys = cache.getKeys().iterator();
+                while (keys.hasNext()){
+                    String origKey = (String)keys.next();
+                    String key = origKey.toUpperCase();
+                    log.debug(key);
+                    for (int i = 0; i < tableNames.length; i++){
+                        if (key.contains(tableNames[i])){
+                            log.debug(tableNames[i]+ " is contained in "+key);
+                            log.debug("Cacheentry will be removed");
+                            boolean success = cache.remove(origKey);
+                            if (!success){
+                                log.warn("Object could not be reoved from Cache.");
+                            }
+                            break;
+                        }
+                    }
+                }
+            }
+        };
+    }
+
+    public void shutdown() {
+        log.info("shutting down SQL cache");
+        manager.getCache(CACHE_NAME).flush();
+        manager.shutdown();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,43 +1,57 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.query;
 
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool;
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
+
+import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
+
+import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory;
+
+import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
+
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+
+import de.intevation.gnv.geobackend.sde.datasources.Uncacheable;
+
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+
 import java.util.Collection;
+import java.util.Date;
 
 import org.apache.log4j.Logger;
 
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool;
-import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
-import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
-import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory;
-import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
-import de.intevation.gnv.geobackend.base.query.exception.QueryException;
-
 /**
  * This is an Standard Implementation of the Interface QueryExecutor.
  * It fetchs the Query from the Querycontainer an put the Filtervalues into the Query.
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class DefaultQueryExceutor extends QueryExecutorBase{
-    
-    
+
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(DefaultQueryExceutor.class);
-    
+
     /**
      * The ConnectionID identifing the Connection to use executing the Query.
      */
     private String connectionID = "N/N";
-    
+
     /**
      * Constructor
      */
@@ -57,25 +71,49 @@
                   //Insert the Filtervalues into the QueryString
                     queryString = super.setFilterValues(queryString, filter);
                 }
-                
-                log.debug("############   QUERY ##################");
-                log.debug(queryString);
-                log.debug("#######################################");
-                Connection connection = null;
+
+                if (log.isDebugEnabled()) {
+                    log.debug("############   QUERY ##################");
+                    log.debug(queryString);
+                    log.debug("#######################################");
+                }
+
+                returnValue = cachedResults(queryString);
+
+                if (returnValue != null) {
+                    return returnValue;
+                }
+
+                boolean cacheable             = true;
+                Connection connection         = null;
                 ConnectionPool connectionPool = ConnectionPoolFactory.getInstance().getConnectionPool();
                 try {
                     // Submit the Query
                     connection = connectionPool.getConnection(this.connectionID);
                     if (connection != null){
                         Statement stmt = connection.createStatement();
+                        Date start = new Date();
                         ResultSet rs = stmt.executeQuery(queryString);
+                        Date end = new Date();
+                        log.info("-> Database query took " +
+                            (end.getTime() - start.getTime()) + " ms.");
+
+                        cacheable = !(rs instanceof Uncacheable);
+
                         returnValue = super.createResultCollection(rs);
-                        
                     }else{
                         log.error("Could not establish Databaseconnection.");
                         throw new QueryException("Could not establish Databaseconnection.");
                     }
-                    
+
+                    if (cacheable) {
+                        log.debug("Elements are cacheable.");
+                        cacheResults(queryString, returnValue);
+                    }
+                    else {
+                        log.debug("Elements are NOT cacheable.");
+                    }
+
                 } catch (ConnectionException e) {
                     log.error(e,e);
                     throw new QueryException("Could not establish Databaseconnection.",e);
@@ -96,11 +134,12 @@
                 log.error("No QueryString defined for "+queryID);
                 throw new QueryException("Cannot get the Querystring");
             }
-        
+
         } catch (QueryContainerException e) {
             log.error(e,e);
             throw new QueryException("Cannot get the Querystring",e);
         }
+
         return returnValue;
     }
 }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.query;
 
 import java.util.Collection;
@@ -11,7 +16,7 @@
 /**
  * This Interface provides the Method to execute Queries
  * against a Datastore eg. Databases
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public interface QueryExecutor {
@@ -25,5 +30,27 @@
      * @return the fetched Values
      * @throws QueryException
      */
-    public Collection<Result> executeQuery(String queryID, String[] filter) throws QueryException;
+    Collection<Result> executeQuery(String queryID,
+                                    String[] filter)
+                                    throws QueryException;
+
+    /**
+     * Returns the cached results to a given Query.
+     * @param query the Query that should identify the Result
+     * @return the Cached results or null if no results are cached.
+     */
+    Collection<Result> cachedResults(String query);
+
+    /**
+     * Writes the Result into the Cache
+     * @param query the Query that will be used as Identifier.
+     * @param results The Results that should be cached.
+     */
+    void cacheResults(String query, Collection<Result> results);
+
+    /**
+     * Clears the Cache using the Names of the Database-Tables
+     * @param tableNames the Tablenames that should be used to Clear the Cache.
+     */
+    void clearCache(String[] tableNames);
 }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.query;
 
 import java.sql.ResultSet;
@@ -18,7 +23,7 @@
 /**
  * This is an abstract Basicimplementation of the Interface
  * QueryExecutor providing several Helpermethods.
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public abstract class QueryExecutorBase implements QueryExecutor {
@@ -29,7 +34,7 @@
     public QueryExecutorBase() {
         super();
     }
-    
+
     /**
      * This Method puts the Filtervalues into the Querystring
      * @param queryString the Query which should be manipulated
@@ -43,7 +48,7 @@
         }
         return returnValue;
     }
-    
+
     /**
      * This Methods converts the ResultSet into an Collection of Result-objects
      * @param resultSet the ResultSet which should be converted
@@ -52,7 +57,7 @@
      */
     protected Collection<Result> createResultCollection(ResultSet resultSet) throws SQLException{
         Collection<Result> returnValue =  new ArrayList<Result>();
-        
+
         ResultDescriptor resultDescriptor = null;
         int columns = -1;
 
@@ -68,9 +73,9 @@
                     resultDescriptor.addColumn(rsmd.getColumnName(i), rsmd.getColumnClassName(i));
                 }
             }
-            
+
             Result result = convertResult(resultSet, resultDescriptor);
-            
+
             returnValue.add(result);
         }
         return returnValue;
@@ -94,4 +99,14 @@
         return result;
     }
 
+    public Collection<Result> cachedResults(String query) {
+        return null;
+    }
+
+    public void cacheResults(String query, Collection<Result> result) {
+    }
+
+    public void clearCache(String[] tableNames) {
+    }
+
 }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,22 +1,31 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.query;
 
+import de.intevation.gnv.geobackend.config.Configuration;
+
 import org.apache.log4j.Logger;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class QueryExecutorFactory {
-    
+
+    public static final String QUERY_EXECUTOR_FACTORY = "query.executor.factory";
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(QueryExecutorFactory.class);
 
-    
+
     /**
      * The singleton Instance of this Factory.
      */
@@ -25,7 +34,7 @@
     /**
      * Basic-Constructor of this Class
      */
-    private QueryExecutorFactory() {
+    public QueryExecutorFactory() {
         super();
     }
 
@@ -33,14 +42,30 @@
      * This Method provides an singleton Instance of this Class.
      * @return an singleton Instance of this Class
      */
-    public static QueryExecutorFactory getInstance(){
-        if (instance == null){
+    public static synchronized QueryExecutorFactory getInstance(){
+        if (instance == null) {
+            Configuration config = Configuration.getInstance();
+
+            if (config.isCacheEnabled()) {
+                final QueryExecutorFactory factory =
+                    new CachingQueryExecutorFactory();
+                Runtime.getRuntime().addShutdownHook(new Thread() {
+                    @Override
+                    public void run() {
+                        factory.shutdown();
+                    }
+                });
+                return instance = factory;
+            }
+
             instance = new QueryExecutorFactory();
         }
         return instance;
     }
-    
-    
+
+    public void shutdown() {
+    }
+
     /**
      * Getting the QueryExecutor
      * @return the QueryExecutor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleaner.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query.cache;
+
+import java.sql.Date;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.query.DefaultQueryExceutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+import de.intevation.gnv.geobackend.util.DateUtils;
+
+/**
+ * Thread that looks every n - Minutes if an Cache has to be cleanedup.
+ * You can configure the Timeout in Seconds using the Systemproperty
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class CacheCleaner extends Thread {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(CacheCleaner.class);
+
+    /**
+     * The Systemproperty-identifier for the Configuration of the TimeInterval
+     */
+    public static final String CACHE_CLEANER_INTERVAL = "caching.cleaner.interval";
+
+    /**
+     * The Time To wait between two Cleanups.
+     */
+    private long timeout = 1000 * 60; // 1 Minute
+
+    /**
+     * The Border which has to be used to Query the updated Tables.
+     */
+    private long lowerBorderTime = 0;
+
+    /**
+     * The Id to Lookup the SQL-Statement for fetchung the Names of the
+     * updated Tables.
+     */
+    private String queryID = "updated_tables";
+
+    /**
+     * Constructor
+     */
+    public CacheCleaner() {
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     */
+    public CacheCleaner(Runnable arg0) {
+        super(arg0);
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     */
+    public CacheCleaner(String arg0) {
+        super(arg0);
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     */
+    public CacheCleaner(ThreadGroup arg0, Runnable arg1) {
+        super(arg0, arg1);
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     */
+    public CacheCleaner(ThreadGroup arg0, String arg1) {
+        super(arg0, arg1);
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     */
+    public CacheCleaner(Runnable arg0, String arg1) {
+        super(arg0, arg1);
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     * @param arg2
+     */
+    public CacheCleaner(ThreadGroup arg0, Runnable arg1, String arg2) {
+        super(arg0, arg1, arg2);
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     * @param arg2
+     * @param arg3
+     */
+    public CacheCleaner(ThreadGroup arg0, Runnable arg1, String arg2, long arg3) {
+        super(arg0, arg1, arg2, arg3);
+        this.setUp();
+    }
+
+    /**
+     * Sets up the members of the CacheCleaner.
+     */
+    protected void setUp(){
+        String intervalValue = System.getProperty(CACHE_CLEANER_INTERVAL);
+        if (intervalValue != null){
+            log.info("Set Interval to "+intervalValue+" Seconds");
+            try {
+                this.timeout = Long.parseLong(intervalValue) * 1000;
+            } catch (NumberFormatException e) {
+                log.error(e,e);
+            }
+        }
+    }
+
+    /**
+     * This Method can be used do run the Main-Mechanism of the Thread e.g
+     * from a Unittest.
+     * @return
+     */
+    public boolean test(){
+        log.debug("CacheCleaner.test");
+        this.cleanup();
+        return true;
+    }
+
+    @Override
+    public void run() {
+        log.debug("CacheCleaner.run");
+        long requiredTime = 0;
+        this.lowerBorderTime = System.currentTimeMillis();
+        while (true){
+            long startTime = 0;
+            try {
+                long nextTimeout = timeout-requiredTime;
+                if (nextTimeout > 0){
+                    Thread.sleep(nextTimeout);
+                }
+                startTime = System.currentTimeMillis();
+                log.debug("Sleep "+nextTimeout+"ms cleanup Cache now");
+                this.cleanup();
+            } catch (InterruptedException e) {
+                log.error(e,e);
+            } catch (Exception e){
+                log.error(e,e);
+            }  catch (Throwable t){
+                log.error(t,t);
+            }finally{
+                requiredTime = System.currentTimeMillis() - startTime;
+                log.debug("CleanUp required "+requiredTime);
+            }
+        }
+    }
+
+    /**
+     * Method that do the Cleanup-Work
+     */
+    protected void cleanup(){
+        log.debug("CacheCleaner.cleanup");
+        try {
+            // We have to go this Way to avoid using the Cache for this Query.
+            String[] tableNames = this.getUpdatedTableNames();
+            if (tableNames != null){
+                QueryExecutorFactory.getInstance()
+                                    .getQueryExecutor().clearCache(tableNames);
+            }
+        } catch (QueryException e) {
+            log.error(e,e);
+        }
+
+    }
+
+    /**
+     * Returns the Names of the Tables which have been updated.
+     * @return the Names of the Tables which have been updated.
+     * @throws QueryException
+     */
+    protected String[] getUpdatedTableNames()throws QueryException {
+        String[] tableNames = null;
+        QueryExecutor queryExecutor = new DefaultQueryExceutor();
+        Date date = new Date(this.lowerBorderTime);
+        this.lowerBorderTime = System.currentTimeMillis();
+        log.debug("New Lookup at "+DateUtils.getPatternedDateAmer(new Date(lowerBorderTime)));
+        String queryDate = DateUtils.getPatternedDateAmer(date);
+        Collection<Result> result = queryExecutor.
+                                      executeQuery(queryID,
+                                                   new String[]{queryDate});
+        if (result != null && !result.isEmpty()){
+            tableNames = new String[result.size()];
+            Iterator<Result> it = result.iterator();
+            int i = 0;
+            while (it.hasNext()){
+                tableNames[i++] = it.next().getString(0).toUpperCase();
+                log.debug("Table that was updated: "+tableNames[i-1]);
+            }
+        }
+        return tableNames;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/cache/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains the CacheCleaner. An Thread that is responsible to 
+Cleanup the SQL-Cache if the Data in the Database has been updated.
+</body>
+</html>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/DefaultQueryContainer.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/DefaultQueryContainer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,16 +1,21 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.query.container;
 
+import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
+
 import java.util.Properties;
 
-import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
-
 /**
  * Defaultimplementation of an QueryContainer.
  * All Queries are provided using a Propertiescontainer.
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class DefaultQueryContainer implements QueryContainer {
 
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.query.container;
 
 import java.util.Properties;
@@ -8,11 +13,13 @@
 import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * Querycontainer is an Interface which defines the Method that are
+ * required to provide the access to SQL-Queries.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public interface QueryContainer {
-    
+
 
     /**
      * Returns the Query specified by the given queryID.
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.query.container;
 
 import java.util.Properties;
@@ -10,17 +15,18 @@
 import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- *
+ * Factoryclass to provide a singleton-Instance of an
+ * <code>QueryContainer</code>-Object
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class QueryContainerFactory {
-    
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(QueryContainerFactory.class);
 
-    
+
     /**
      * The singleton Instance of this Factory.
      */
@@ -42,14 +48,14 @@
      * This Method provides an singleton Instance of this Class.
      * @return an singleton Instance of this Class
      */
-    public static QueryContainerFactory getInstance(){
+    public static synchronized QueryContainerFactory getInstance(){
         if (instance == null){
             instance = new QueryContainerFactory();
         }
         return instance;
     }
-    
-    
+
+
     /**
      * Getting the QueryContainer
      * @return the QueryContainer
@@ -62,7 +68,7 @@
      * Initializes the QueryContainer.
      * Should only be called once on system startup
      * @param properties the Properties for the Individual Configuration of the QueryContainerbb
-     * @throws QueryContainerException 
+     * @throws QueryContainerException
      */
     public synchronized void initializeQueryContainer(Properties properties) throws QueryContainerException{
         log.debug("ConnectionPoolFactory.initializeConnectionPool");
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/QueryContainerException.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/QueryContainerException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,17 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.query.container.exception;
+
 /**
  * Exceptioncalls which will be used to retun Exception in
  * the QuerContainer-Package.
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class QueryContainerException extends Exception {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Package that contains Exceptionclasses for it's Parentpackage.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains Classes which provide the Access to SQL-Queries which
+are stored in an separate Resource-File (e.g. an Propertiesfile).
+</body>
+</html>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,9 +1,17 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.query.exception;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * This is a specialized Exceptionclass for Exceptions that occurse during
+ * querying Data from the Database-
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class QueryException extends Exception {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/exception/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Package that contains Exceptionclasses for it's Parentpackage.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains Interfaces and Classes which provide the possibility to 
+send a SQL-Query against a Databasebackend and get the returned Rows as Result.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/config/Configuration.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.config;
+
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
+
+import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory;
+
+import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
+
+import de.intevation.gnv.geobackend.util.XMLUtils;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.util.Properties;
+
+import javax.xml.xpath.XPathConstants;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public final class Configuration {
+
+    public static final String CONFIGURATION_ROOT  = "geo-backend";
+    public static final String XPATH_QUERIES       = "query-configuration";
+    public static final String XPATH_BACKEND       = "backend-configuration";
+    public static final String XPATH_CACHE         = "cache";
+    public static final String XPATH_CACHE_ENABLED = "@enabled";
+    public static final String XPATH_CACHE_CONFIG  = "configuration";
+
+    private static Logger logger = Logger.getLogger(Configuration.class);
+
+    private static Configuration instance;
+
+    private Node   config;
+    private String configDir;
+    private String placeholder;
+
+    private boolean cacheEnabled;
+    private String  cacheConfiguration;
+
+
+
+    /**
+     * Returns an instance of Configuration.
+     *
+     * @return an instance of Configuration.
+     */
+    public static Configuration getInstance() {
+        if (instance == null)
+            instance = new Configuration();
+
+        return instance;
+    }
+
+
+    /**
+     * Constructor that creates a new Configuration object with disabled cache.
+     */
+    public Configuration() {
+        cacheEnabled = false;
+    }
+
+
+    /**
+     * Initialize the geo-backend before it is ready to be used. This method
+     * calls other <i>init*</i> methods.
+     *
+     * @param conf A configuration document. This document should contain a node
+     * <i>geo-backend</i>. If there are more nodes named <i>geo-backend</i>, the
+     * first node is used.
+     * @param configDir The path to the root configuration directory.
+     * @param placeholder The placeholder used in the configuration document for
+     * the root configuration directory.
+     */
+    public void init(Document conf, String configDir, String placeholder)
+    throws QueryContainerException, FileNotFoundException, IOException
+    {
+        this.config      = conf;
+        this.configDir   = configDir;
+        this.placeholder = placeholder;
+
+        NodeList root = conf.getElementsByTagName(CONFIGURATION_ROOT);
+        if (root == null || root.getLength() == 0) {
+            logger.error("No valid configuration for this geobackend given!");
+            return;
+        }
+
+        initQueries(root.item(0));
+        initConnection(root.item(0));
+        initCache(root.item(0));
+    }
+
+
+    /**
+     * Initialize sql statements.
+     *
+     * @param conf The geo-backend configuration node.
+     */
+    protected void initQueries(Node conf)
+    throws FileNotFoundException, IOException, QueryContainerException
+    {
+        String queriesFile = (String) XMLUtils.xpath(
+            conf, XPATH_QUERIES, XPathConstants.STRING, null);
+
+        queriesFile = replaceConfigDir(queriesFile);
+        logger.info("Initialize queries: " + queriesFile);
+
+        Properties queries        = getProperties(queriesFile);
+        QueryContainerFactory qcf = QueryContainerFactory.getInstance();
+        qcf.initializeQueryContainer(queries);
+    }
+
+
+    /**
+     * Initialize necessary objects used for the database connection.
+     *
+     * @param connection The geo-backend configuration node.
+     */
+    protected void initConnection(Node connection)
+    throws FileNotFoundException, IOException
+    {
+        String config = (String)XMLUtils.xpath(
+            connection, XPATH_BACKEND, XPathConstants.STRING, null);
+
+        config = replaceConfigDir(config);
+        logger.info("Initialize database connection: " + config);
+
+        Properties properties     = getProperties(config);
+        ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
+        cpf.initializeConnectionPool(properties);
+    }
+
+
+    /**
+     * Initialize necessary objects used for the sql cache.
+     *
+     * @param conf The geo-backend configuration node.
+     */
+    protected void initCache(Node conf) {
+        Node cache = (Node) XMLUtils.xpath(
+            conf, XPATH_CACHE, XPathConstants.NODE, null);
+
+        String on = (String) XMLUtils.xpath(
+            cache, XPATH_CACHE_ENABLED, XPathConstants.STRING, null);
+
+        boolean enabled = Boolean.parseBoolean(on);
+
+        if (enabled) {
+            String config = (String) XMLUtils.xpath(
+                cache, XPATH_CACHE_CONFIG, XPathConstants.STRING, null);
+
+            if (config != null && config.length() > 0) {
+                config = replaceConfigDir(config);
+                logger.info("Initialize sql cache with config: " + config);
+
+                this.cacheConfiguration = config;
+                this.cacheEnabled       = true;
+            }
+            else {
+                logger.error("SQL cache is enabled, " +
+                    "but no configuration was found.");
+            }
+        }
+        else {
+            logger.info("SQL cache is disabled.");
+        }
+    }
+
+
+    /**
+     * Replace placeholder in the configuration. Placeholder are used for the
+     * base configuration directory.
+     *
+     * @param path A string that might contain placeholders.
+     *
+     * @return <i>path</i> with replaced placeholder.
+     */
+    protected String replaceConfigDir(String path) {
+        return path.replace(placeholder, configDir);
+    }
+
+
+    /**
+     * Read a file that contains properties and return a Java Properties object.
+     *
+     * @param path Path to a properties file.
+     *
+     * @return the properties contained in the file.
+     */
+    protected Properties getProperties(String path)
+    throws    FileNotFoundException, IOException
+    {
+        InputStream inputStream = null;
+
+        try {
+            inputStream = new FileInputStream(path);
+            Properties properties = new Properties();
+            properties.load(inputStream);
+
+            return properties;
+        }
+        finally {
+            if (inputStream != null) {
+                try {
+                    inputStream.close();
+                }
+                catch (IOException ioe) {
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Returns the state of the cache.
+     *
+     * @return true if sql queries are cache, otherwise false.
+     */
+    public boolean isCacheEnabled() {
+        return cacheEnabled;
+    }
+
+
+    /**
+     * Returns the path of the cache configuration file.
+     *
+     * @return configuration path.
+     */
+    public String getCacheConfiguration() {
+        return cacheConfiguration;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.geobackend.sde.connectionpool;
 
 import java.sql.Connection;
@@ -12,8 +20,8 @@
 
 /**
  *This is the ArcSDE specific implementation of the Interface ConnectionPool
- * 
- * @author Tim Englich <tim.englich@intevation.de>
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class ArcSDEConnectionPool implements ConnectionPool {
 
@@ -29,7 +37,7 @@
     private GenericObjectPool pool = null;
 
     /**
-     * @see de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool#closeConnection(java.lang.Object)
+     * @see de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool#closeConnection(java.sql.Connection)
      */
     public void closeConnection(Connection connection)
                                                       throws ConnectionException {
@@ -103,7 +111,7 @@
         boolean testWhileIdle = Boolean.parseBoolean(properties
                 .getProperty("testWhileIdle",
                         "" + GenericObjectPool.DEFAULT_TEST_WHILE_IDLE));
-        
+
         log.info("Maximum Number of active Connections: " + maxActive);
         log.info("Maximum Number of waiting: " + maxWait);
         log.info("Maximum Number of idle: " + maxIdle);
@@ -114,7 +122,7 @@
         log.info("NumTestsPerEvictionRun: " + numTestsPerEvictionRun);
         log.info("MinEvictableIdleTimeMillis: " + minEvictableIdleTimeMillis);
         log.info("TestWhileIdle: " + testWhileIdle);
-        
+
         this.pool = new GenericObjectPool(poolableObjectFactory, maxActive,
                                             GenericObjectPool.DEFAULT_WHEN_EXHAUSTED_ACTION, maxWait,
                                             maxIdle, minIdle, testOnBorrow, testOnReturn,
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,28 +1,50 @@
-/**
- * 
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.sde.connectionpool;
 
+import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
+
+import de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnection;
+
 import java.sql.Connection;
 import java.sql.SQLException;
+
 import java.util.Properties;
 
 import org.apache.commons.pool.PoolableObjectFactory;
+
 import org.apache.log4j.Logger;
 
-import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
-import de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnection;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * ArcSDE specific Implementation of an PoolableObjectFactory.
+ * This factory instantiate Objects of type ArcSDEConnection.
  *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class ArcSDEPoolableObjectFactory implements PoolableObjectFactory {
 
     /**
      * the logger, used to log exceptions and additonaly information
      */
-    private static Logger log = Logger.getLogger(ArcSDEPoolableObjectFactory.class);
+    private static Logger log = Logger.getLogger(
+        ArcSDEPoolableObjectFactory.class);
+
+    /**
+     *  The 5 seconds are inspired by GeoTools's testServer() usage.
+     */
+    private int serverRoundtripInterval = 5;
+    /**
+     * The value of the  maximum Time a Connection is allowed to
+     * be inactive without the validation of the Connection.
+     */
+    private long serverInactiveInterval = 5L*60L*1000L; // 5 minutes
     /**
      * The URL to the ArcSDE Server
      */
@@ -43,25 +65,54 @@
      * The Credentials which belongs to the User
      */
     private String credentials = null;
-      
+
     /**
      * Constructor of this Class
      * @param properties the Properties which includes the ConnectionParams to the Database
      */
     public ArcSDEPoolableObjectFactory(Properties properties) {
+
         log.debug("ArcSDEPoolableObjectFactory.Constructor");
-        this.server = properties.getProperty("server");
-        this.port = properties.getProperty("port");
-        this.database = properties.getProperty("database");
-        this.username = properties.getProperty("username");
-        this.credentials = properties.getProperty("credentials");
-        
+
+        server      = properties.getProperty("server");
+        port        = properties.getProperty("port");
+        database    = properties.getProperty("database");
+        username    = properties.getProperty("username");
+        credentials = properties.getProperty("credentials");
+
+        String serverRoundtripIntervalValue =
+            properties.getProperty("serverRoundtripInterval");
+        String serverInactiveIntervalValue =
+            properties.getProperty("serverInactiveInterval");
+
+        try {
+            if (serverRoundtripIntervalValue != null) {
+                serverRoundtripInterval =
+                    Integer.parseInt(serverRoundtripIntervalValue);
+            }
+        }
+        catch (NumberFormatException e) {
+            log.error(e,e);
+        }
+
+        try {
+            if (serverInactiveIntervalValue != null) {
+                serverInactiveInterval = 1000L * // input in seconds!
+                    Long.parseLong(serverInactiveIntervalValue);
+            }
+        }
+        catch (NumberFormatException e) {
+            log.error(e,e);
+        }
+
         log.info("ArcSDEPoolableObjectFactory initialized");
-        log.info("Server: "+this.server);
-        log.info("Port: "+this.port);
-        log.info("Database: "+this.database);
-        log.info("User: "+this.username);
-        }
+        log.info("Server: "                   + server);
+        log.info("Port: "                     + port);
+        log.info("Database: "                 + database);
+        log.info("User: "                     + username);
+        log.info("Roundtrip check interval: " + serverRoundtripInterval);
+        log.info("Inactive  check interval: " + serverInactiveInterval);
+    }
 
     /**
      * @see org.apache.commons.pool.PoolableObjectFactory#activateObject(java.lang.Object)
@@ -89,10 +140,19 @@
         log.debug("ArcSDEPoolableObjectFactory.makeObject");
         Connection con;
         try {
-            con = new ArcSDEConnection(this.server, this.port, this.database, this.username, this.credentials);
+            con = new ArcSDEConnection(
+                server,
+                port,
+                database,
+                username,
+                credentials,
+                serverRoundtripInterval,
+                serverInactiveInterval);
         }
         catch (ConnectionException e) {
-            throw new ConnectionException("Establishing a connection to database failed: " + e.toString(), e);
+            throw new ConnectionException(
+                "Establishing a connection to database failed: " +
+                    e.toString(), e);
         }
         return con;
     }
@@ -101,21 +161,52 @@
      * @see org.apache.commons.pool.PoolableObjectFactory#passivateObject(java.lang.Object)
      */
     public void passivateObject(Object arg0) throws Exception {
-        log.debug("ArcSDEPoolableObjectFactory.passivateObject");
+
+        boolean debug = log.isDebugEnabled();
+
+        if (debug) {
+            log.debug("ArcSDEPoolableObjectFactory.passivateObject");
+        }
+
+        if (arg0 instanceof ArcSDEConnection) {
+            if (debug) {
+                log.debug("    touching connection");
+            }
+            ((ArcSDEConnection)arg0).touch();
+        }
     }
 
     /**
      * @see org.apache.commons.pool.PoolableObjectFactory#validateObject(java.lang.Object)
      */
     public boolean validateObject(Object arg0) {
-        log.debug("ArcSDEPoolableObjectFactory.validateObject");
-        boolean returnValue = false;
+
+        boolean debug = log.isDebugEnabled();
+
+        if (debug) {
+            log.debug("ArcSDEPoolableObjectFactory.validateObject");
+        }
+
+        if (!(arg0 instanceof ArcSDEConnection)) {
+            return false;
+        }
+
         try {
-            returnValue = arg0 instanceof ArcSDEConnection
-                ? !((ArcSDEConnection)arg0).isClosed()
-                : false;
+            ArcSDEConnection con = (ArcSDEConnection)arg0;
+
+            boolean isValid =
+                con.isActive() && con.isValid(serverRoundtripInterval);
+
+            if (!isValid && debug) {
+                log.debug("connection is invalid!");
+            }
+
+            return isValid;
         }
-        catch (SQLException sqle) {}
-        return returnValue;
+        catch (SQLException sqle) {
+            log.error(sqle, sqle);
+        }
+
+        return false;
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains Classes that provides an <code>ConnectionPool</code>
+for <code>ArcSDEConnection</code>-Objects.
+</body>
+</html>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,7 +1,12 @@
-/**
-		*
-		*/
-		package de.intevation.gnv.geobackend.sde.datasources;
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources;
 
 import java.sql.Array;
 import java.sql.Blob;
@@ -30,331 +35,384 @@
 import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- *
+ * Wrapperclass between an @see java.sql.Connection and an
+ * @see com.esri.sde.sdk.client.SeConnection
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class ArcSDEConnection implements Connection {
 
-	/**
+    /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(ArcSDEPoolableObjectFactory.class);
-    
-	private SeConnection seConnection = null;
-	
+
+    /**
+     * The Connection to the ArcSDE-backend.
+     */
+    private SeConnection seConnection = null;
+    /**
+     * Time that have to be gone until the Server will be requested if
+     * the Connection is valid.
+     */
+    private long serverRoundtripInterval ;
+
+    /**
+     * The Time which a Connection can be inactive until the Connection
+     * will be set to invalid.
+     */
+    private long inactiveInterval;
+
+    /**
+     * The TimeStamp of the last usage of this Connection.
+     */
+    private long lastTouch;
 
 
-	/**
-	 * Constructor
-	 */
-	public ArcSDEConnection(String server,String port,String database,String username,String credentials) throws ConnectionException {
-		try {
-	        seConnection = new SeConnection(server,port,database,username,credentials);
-        } catch (SeException e) {
-	        log.error(e,e);
-	        throw new ConnectionException(e);
-        }
-	}
-
-	/**
-	 * @see java.sql.Connection#clearWarnings()
-	 */
-	public void clearWarnings() throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Connection#close()
-	 */
-	public void close() throws SQLException {
-		try {
-	        this.seConnection.close();
-        } catch (SeException e) {
-	        log.error(e,e);
-	        throw new SQLException(e.getMessage());
-        }
-	}
-
-	/**
-	 * @see java.sql.Connection#commit()
-	 */
-	public void commit() throws SQLException {
-		try{
-			this.seConnection.commitTransaction();
-		} catch (SeException e) {
-	        log.error(e,e);
-	        throw new SQLException(e.getMessage());
-        }
-	}
-
-	/**
-	 * @see java.sql.Connection#createStatement()
-	 */
-	public Statement createStatement() throws SQLException {
-		
-		return new ArcSDEStatement(this);
-	}
-
-	/**
-	 * @see java.sql.Connection#createStatement(int, int)
-	 */
-	public Statement createStatement(int resultSetType, int resultSetConcurrency)
-	        throws SQLException {
-		// TODO: Übergabeparameter beachten ?
-		return new ArcSDEStatement(this);
-	}
-
-	/**
-	 * @see java.sql.Connection#createStatement(int, int, int)
-	 */
-	public Statement createStatement(int resultSetType,
-	        int resultSetConcurrency, int resultSetHoldability)
-	        throws SQLException {
-		// TODO: Übergabeparameter beachten?
-		return new ArcSDEStatement(this);
-	}
-
-	/**
-	 * @see java.sql.Connection#getAutoCommit()
-	 */
-	public boolean getAutoCommit() throws SQLException {
-		return false;
-	}
-
-	/**
-	 * @see java.sql.Connection#getCatalog()
-	 */
-	public String getCatalog() throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#getHoldability()
-	 */
-	public int getHoldability() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Connection#getMetaData()
-	 */
-	public DatabaseMetaData getMetaData() throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#getTransactionIsolation()
-	 */
-	public int getTransactionIsolation() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Connection#getTypeMap()
-	 */
-	public Map<String, Class<?>> getTypeMap() throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#getWarnings()
-	 */
-	public SQLWarning getWarnings() throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#isClosed()
-	 */
-	public boolean isClosed() throws SQLException {
-		try{
-			return this.seConnection.isClosed();
-		} catch (Exception e) {
-	        log.error(e,e);
-	        throw new SQLException(e.getMessage());
-	    }
-	}
-
-	/**
-	 * @see java.sql.Connection#isReadOnly()
-	 */
-	public boolean isReadOnly() throws SQLException {
-		return false;
-	}
-
-	/**
-	 * @see java.sql.Connection#nativeSQL(java.lang.String)
-	 */
-	public String nativeSQL(String sql) throws SQLException {
-		return null;
-	}
+    /**
+     * Constructor
+     * @param server the URL to the Server
+     * @param port the Port of the Server
+     * @param database the Name of the Database
+     * @param username the Name of the User
+     * @param credentials the Credentials to the User-
+     * @param serverRoundtripInterval Time that have to be gone until the Server
+     *                                will be requested if the Connection is valid.
+     * @param inactiveInterval the Time which a Connection can be inactive until
+     *                         the Connection will be set to invalid.
+     * @throws ConnectionException
+     */
+    public ArcSDEConnection(
+        String server,
+        String port,
+        String database,
+        String username,
+        String credentials,
+        long   serverRoundtripInterval,
+        long   inactiveInterval
+    )
+    throws ConnectionException
+    {
+        this.serverRoundtripInterval = serverRoundtripInterval;
+        this.inactiveInterval        = inactiveInterval;
+        lastTouch                    = System.currentTimeMillis();
 
-	/**
-	 * @see java.sql.Connection#prepareCall(java.lang.String)
-	 */
-	public CallableStatement prepareCall(String sql) throws SQLException {
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#prepareCall(java.lang.String, int, int)
-	 */
-	public CallableStatement prepareCall(String sql, int resultSetType,
-	        int resultSetConcurrency) throws SQLException {
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int)
-	 */
-	public CallableStatement prepareCall(String sql, int resultSetType,
-	        int resultSetConcurrency, int resultSetHoldability)
-	        throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#prepareStatement(java.lang.String)
-	 */
-	public PreparedStatement prepareStatement(String sql) throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#prepareStatement(java.lang.String, int)
-	 */
-	public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
-	        throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#prepareStatement(java.lang.String, int[])
-	 */
-	public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
-	        throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[])
-	 */
-	public PreparedStatement prepareStatement(String sql, String[] columnNames)
-	        throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#prepareStatement(java.lang.String, int, int)
-	 */
-	public PreparedStatement prepareStatement(String sql, int resultSetType,
-	        int resultSetConcurrency) throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int)
-	 */
-	public PreparedStatement prepareStatement(String sql, int resultSetType,
-	        int resultSetConcurrency, int resultSetHoldability)
-	        throws SQLException {
+        try {
+            seConnection = new SeConnection( server, port, database, username, credentials);
+        }
+        catch (SeException e) {
+            log.error(e,e);
+            throw new ConnectionException(e);
+        }
+    }
 
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint)
-	 */
-	public void releaseSavepoint(Savepoint savepoint) throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Connection#rollback()
-	 */
-	public void rollback() throws SQLException {
-		try {
-	        this.seConnection.rollbackTransaction();
-        } catch (SeException e) {
-	        log.error(e,e);
-	        throw new SQLException(e.getMessage());
+    /**
+     * Validates if the Connection is active
+     * @return true if the Connection is active. False if not.
+     */
+    public boolean isActive() {
+        long current = System.currentTimeMillis();
+        long last;
+        synchronized (this) {
+            last = lastTouch;
         }
-	}
-
-	/**
-	 * @see java.sql.Connection#rollback(java.sql.Savepoint)
-	 */
-	public void rollback(Savepoint savepoint) throws SQLException {
-		this.rollback();
-	}
-
-	/**
-	 * @see java.sql.Connection#setAutoCommit(boolean)
-	 */
-	public void setAutoCommit(boolean autoCommit) throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Connection#setCatalog(java.lang.String)
-	 */
-	public void setCatalog(String catalog) throws SQLException {
-	}
+        return Math.abs(current - last) < inactiveInterval;
+    }
 
-	/**
-	 * @see java.sql.Connection#setHoldability(int)
-	 */
-	public void setHoldability(int holdability) throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Connection#setReadOnly(boolean)
-	 */
-	public void setReadOnly(boolean readOnly) throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Connection#setSavepoint()
-	 */
-	public Savepoint setSavepoint() throws SQLException {
-
-		return null;
-	}
+    /**
+     * Sets the last-Usage-Time to the Current-time
+     */
+    public void touch() {
+        long time = System.currentTimeMillis();
+        synchronized (this) {
+            lastTouch = time;
+        }
+    }
 
-	/**
-	 * @see java.sql.Connection#setSavepoint(java.lang.String)
-	 */
-	public Savepoint setSavepoint(String name) throws SQLException {
-
-		return null;
-	}
+    /**
+     * @see java.sql.Connection#clearWarnings()
+     */
+    public void clearWarnings() throws SQLException {
+    }
 
-	/**
-	 * @see java.sql.Connection#setTransactionIsolation(int)
-	 */
-	public void setTransactionIsolation(int level) throws SQLException {
-	}
+    /**
+     * @see java.sql.Connection#close()
+     */
+    public void close() throws SQLException {
+        try {
+            this.seConnection.close();
+        } catch (SeException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
 
-	/**
-	 * @see java.sql.Connection#setTypeMap(java.util.Map)
-	 */
-	public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
-	}
-	
-	/**
+    /**
+     * @see java.sql.Connection#commit()
+     */
+    public void commit() throws SQLException {
+        try{
+            this.seConnection.commitTransaction();
+        } catch (SeException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+
+    /**
+     * @see java.sql.Connection#createStatement()
+     */
+    public Statement createStatement() throws SQLException {
+        return new ArcSDEStatement(this);
+    }
+
+    /**
+     * @see java.sql.Connection#createStatement(int, int)
+     */
+    public Statement createStatement(int resultSetType, int resultSetConcurrency)
+            throws SQLException {
+        return new ArcSDEStatement(this);
+    }
+
+    /**
+     * @see java.sql.Connection#createStatement(int, int, int)
+     */
+    public Statement createStatement(int resultSetType,
+            int resultSetConcurrency, int resultSetHoldability)
+            throws SQLException {
+        return new ArcSDEStatement(this);
+    }
+
+    /**
+     * @see java.sql.Connection#getAutoCommit()
+     */
+    public boolean getAutoCommit() throws SQLException {
+        return false;
+    }
+
+    /**
+     * @see java.sql.Connection#getCatalog()
+     */
+    public String getCatalog() throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#getHoldability()
+     */
+    public int getHoldability() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Connection#getMetaData()
+     */
+    public DatabaseMetaData getMetaData() throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#getTransactionIsolation()
+     */
+    public int getTransactionIsolation() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Connection#getTypeMap()
+     */
+    public Map<String, Class<?>> getTypeMap() throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#getWarnings()
+     */
+    public SQLWarning getWarnings() throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#isClosed()
+     */
+    public boolean isClosed() throws SQLException {
+        try{
+            return this.seConnection.isClosed();
+        } catch (Exception e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+
+    /**
+     * @see java.sql.Connection#isReadOnly()
+     */
+    public boolean isReadOnly() throws SQLException {
+        return false;
+    }
+
+    /**
+     * @see java.sql.Connection#nativeSQL(java.lang.String)
+     */
+    public String nativeSQL(String sql) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#prepareCall(java.lang.String)
+     */
+    public CallableStatement prepareCall(String sql) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#prepareCall(java.lang.String, int, int)
+     */
+    public CallableStatement prepareCall(String sql, int resultSetType,
+            int resultSetConcurrency) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int)
+     */
+    public CallableStatement prepareCall(String sql, int resultSetType,
+            int resultSetConcurrency, int resultSetHoldability)
+            throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#prepareStatement(java.lang.String)
+     */
+    public PreparedStatement prepareStatement(String sql) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#prepareStatement(java.lang.String, int)
+     */
+    public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys)
+            throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#prepareStatement(java.lang.String, int[])
+     */
+    public PreparedStatement prepareStatement(String sql, int[] columnIndexes)
+            throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[])
+     */
+    public PreparedStatement prepareStatement(String sql, String[] columnNames)
+            throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#prepareStatement(java.lang.String, int, int)
+     */
+    public PreparedStatement prepareStatement(String sql, int resultSetType,
+            int resultSetConcurrency) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int)
+     */
+    public PreparedStatement prepareStatement(String sql, int resultSetType,
+            int resultSetConcurrency, int resultSetHoldability)
+            throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint)
+     */
+    public void releaseSavepoint(Savepoint savepoint) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Connection#rollback()
+     */
+    public void rollback() throws SQLException {
+        try {
+            this.seConnection.rollbackTransaction();
+        } catch (SeException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+
+    /**
+     * @see java.sql.Connection#rollback(java.sql.Savepoint)
+     */
+    public void rollback(Savepoint savepoint) throws SQLException {
+        this.rollback();
+    }
+
+    /**
+     * @see java.sql.Connection#setAutoCommit(boolean)
+     */
+    public void setAutoCommit(boolean autoCommit) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Connection#setCatalog(java.lang.String)
+     */
+    public void setCatalog(String catalog) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Connection#setHoldability(int)
+     */
+    public void setHoldability(int holdability) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Connection#setReadOnly(boolean)
+     */
+    public void setReadOnly(boolean readOnly) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Connection#setSavepoint()
+     */
+    public Savepoint setSavepoint() throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#setSavepoint(java.lang.String)
+     */
+    public Savepoint setSavepoint(String name) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Connection#setTransactionIsolation(int)
+     */
+    public void setTransactionIsolation(int level) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Connection#setTypeMap(java.util.Map)
+     */
+    public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
+    }
+
+    /**
      * @return the seConnection
      */
     public SeConnection getSeConnection() {
-    	return seConnection;
+        return seConnection;
     }
 
     public Array createArrayOf(String arg0, Object[] arg1) throws SQLException {
@@ -390,7 +448,15 @@
     }
 
     public boolean isValid(int arg0) throws SQLException {
-        return false;
+        boolean valid = true;
+        try {
+            this.seConnection.testServer(serverRoundtripInterval);
+        } catch (SeException e) {
+            log.debug("The validation of the Connection has occured an Error. The connection is invalid.");
+            valid = false;
+        }
+
+        return valid;
     }
 
     public void setClientInfo(Properties arg0) throws SQLClientInfoException {
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionParams.java	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/**
- * Title:           ArcSDEConnectionParams, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEConnectionParams.java,v 1.1 2007/11/22 07:40:11 blume Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEConnectionParams.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     22.11.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: blume $
- * modified on:     $Date: 2007/11/22 07:40:11 $
- * Version:         $Revision: 1.1 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.sde.datasources;
-
-import org.apache.log4j.Logger;
-
-/**
- * The class <code>ArcSDEConnectionParams</code> fulfills the following purposes:
- * <ol>
- * <li></li>
- * </ol>
- *
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 22.11.2007 08:10:11
- */
-public class ArcSDEConnectionParams {
-
-    /**
-     * Default Logging instance
-     */
-    private static Logger sLogger = Logger.getLogger(ArcSDEConnectionParams.class);
-    private static boolean sDebug = sLogger.isDebugEnabled();
-
-    private String mServer;
-    private int mInstance;
-    private String mDatabase;
-    private String mUser;
-    private String mPwd;
-    private int mInitConnections;
-    private int mMaxConnections;
-    private long mTimeToHold;
-
-    public ArcSDEConnectionParams(String pServer, int pInstance, String pDatabase, String pUser, String pPwd, int pInitConnections, int pMaxConnections, long pTimeToHold) {
-        mServer = pServer;
-        mInstance = pInstance;
-        mDatabase = pDatabase;
-        mUser = pUser;
-        mPwd = pPwd;
-        mMaxConnections = pMaxConnections;
-        mInitConnections = pInitConnections;
-        mTimeToHold = pTimeToHold;
-    }
-
-
-    public String getServer() {
-        return mServer;
-    }
-
-    public int getInstance() {
-        return mInstance;
-    }
-
-    public String getDatabase() {
-        return mDatabase;
-    }
-
-    public String getUser() {
-        return mUser;
-    }
-
-    public String getPwd() {
-        return mPwd;
-    }
-
-    public int getInitConnections() {
-        return mInitConnections;
-    }
-
-    public int getMaxConnections() {
-        return mMaxConnections;
-    }
-
-    public long getTimeToHold() {
-        return mTimeToHold;
-    }
-}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,19 +1,31 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.sde.datasources;
 
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
+
 import java.util.List;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * This Class is an Wrapperclass for the ResultSetMetaData and the
+ * ColumnDefinitions which are retrieved from the ArcSDE-Backend.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class ArcSDEResultSetMetaData implements ResultSetMetaData {
 
+    /**
+     * The Columndefinitions which are required to explain the retrieved Data.
+     */
     private List<ColDefinition> columnDefinitions = null;
+
     /**
      * Constructor
      */
@@ -25,7 +37,6 @@
      * @see java.sql.ResultSetMetaData#getCatalogName(int)
      */
     public String getCatalogName(int column) throws SQLException {
-
         return null;
     }
 
@@ -33,14 +44,26 @@
      * @see java.sql.ResultSetMetaData#getColumnClassName(int)
      */
     public String getColumnClassName(int column) throws SQLException {
-        
         int type = this.getColumnType(column);
-        Class clazz = java.lang.Object.class;
-        if (type == 2){
-            clazz = int.class;
+        if (type == ColDefinition.INT16){
+            return "Integer";
+        }else if (type == ColDefinition.INT32){
+            return "Integer";
+        }else if (type == ColDefinition.INT64){
+            return "Long";
+        }else if (type == ColDefinition.NSTRING || type == ColDefinition.STRING){
+            return "String";
+        }else if (type == ColDefinition.DATE){
+            return "Date";
+        }else if (type == ColDefinition.FLOAT){
+            return "Float";
+        }else if (type == ColDefinition.FLOAT32){
+            return "Double";
+        }else if (type == ColDefinition.FLOAT64){
+            return "Double";
+        }else{
+            return java.lang.Object.class.getName();
         }
-        // TODO weitere Klassen Implementieren
-        return  clazz.getName();
     }
 
     /**
@@ -54,7 +77,6 @@
      * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int)
      */
     public int getColumnDisplaySize(int column) throws SQLException {
-
         return 0;
     }
 
@@ -83,7 +105,6 @@
      * @see java.sql.ResultSetMetaData#getColumnTypeName(int)
      */
     public String getColumnTypeName(int column) throws SQLException {
-
         return null;
     }
 
@@ -91,7 +112,6 @@
      * @see java.sql.ResultSetMetaData#getPrecision(int)
      */
     public int getPrecision(int column) throws SQLException {
-
         return 0;
     }
 
@@ -99,7 +119,6 @@
      * @see java.sql.ResultSetMetaData#getScale(int)
      */
     public int getScale(int column) throws SQLException {
-
         return 0;
     }
 
@@ -107,7 +126,6 @@
      * @see java.sql.ResultSetMetaData#getSchemaName(int)
      */
     public String getSchemaName(int column) throws SQLException {
-
         return null;
     }
 
@@ -115,7 +133,6 @@
      * @see java.sql.ResultSetMetaData#getTableName(int)
      */
     public String getTableName(int column) throws SQLException {
-
         return null;
     }
 
@@ -123,7 +140,6 @@
      * @see java.sql.ResultSetMetaData#isAutoIncrement(int)
      */
     public boolean isAutoIncrement(int column) throws SQLException {
-
         return false;
     }
 
@@ -131,7 +147,6 @@
      * @see java.sql.ResultSetMetaData#isCaseSensitive(int)
      */
     public boolean isCaseSensitive(int column) throws SQLException {
-
         return false;
     }
 
@@ -139,7 +154,6 @@
      * @see java.sql.ResultSetMetaData#isCurrency(int)
      */
     public boolean isCurrency(int column) throws SQLException {
-
         return false;
     }
 
@@ -147,7 +161,6 @@
      * @see java.sql.ResultSetMetaData#isDefinitelyWritable(int)
      */
     public boolean isDefinitelyWritable(int column) throws SQLException {
-
         return false;
     }
 
@@ -155,7 +168,6 @@
      * @see java.sql.ResultSetMetaData#isNullable(int)
      */
     public int isNullable(int column) throws SQLException {
-
         return 0;
     }
 
@@ -163,7 +175,6 @@
      * @see java.sql.ResultSetMetaData#isReadOnly(int)
      */
     public boolean isReadOnly(int column) throws SQLException {
-
         return true;
     }
 
@@ -171,7 +182,6 @@
      * @see java.sql.ResultSetMetaData#isSearchable(int)
      */
     public boolean isSearchable(int column) throws SQLException {
-
         return true;
     }
 
@@ -189,10 +199,16 @@
         return false;
     }
 
+    /**
+     * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
+     */
     public boolean isWrapperFor(Class<?> iface) throws SQLException {
         return false;
     }
 
+    /**
+     * @see java.sql.Wrapper#unwrap(java.lang.Class)
+     */
     public <T> T unwrap(Class<T> iface) throws SQLException {
         return null;
     }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,8 +1,41 @@
-/**
-		*
-		*/
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.geobackend.sde.datasources;
 
+import com.esri.sde.sdk.client.SDEPoint;
+import com.esri.sde.sdk.client.SeColumnDefinition;
+import com.esri.sde.sdk.client.SeConnection;
+import com.esri.sde.sdk.client.SeException;
+import com.esri.sde.sdk.client.SeExtent;
+import com.esri.sde.sdk.client.SeFilter;
+import com.esri.sde.sdk.client.SeLayer;
+import com.esri.sde.sdk.client.SeQuery;
+import com.esri.sde.sdk.client.SeQueryInfo;
+import com.esri.sde.sdk.client.SeRaster;
+import com.esri.sde.sdk.client.SeRasterAttr;
+import com.esri.sde.sdk.client.SeRasterBand;
+import com.esri.sde.sdk.client.SeRasterConstraint;
+import com.esri.sde.sdk.client.SeRasterTile;
+import com.esri.sde.sdk.client.SeRow;
+import com.esri.sde.sdk.client.SeShape;
+import com.esri.sde.sdk.client.SeShapeFilter;
+import com.esri.sde.sdk.client.SeSqlConstruct;
+
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.Point;
+import com.vividsolutions.jts.geom.Polygon;
+
+import com.vividsolutions.jts.io.WKTReader;
+
+import de.intevation.gnv.geobackend.util.RedundancyRemover;
+
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.SQLException;
@@ -11,194 +44,195 @@
 
 import org.apache.log4j.Logger;
 
-import com.esri.sde.sdk.client.SDEPoint;
-import com.esri.sde.sdk.client.SeColumnDefinition;
-import com.esri.sde.sdk.client.SeConnection;
-import com.esri.sde.sdk.client.SeException;
-import com.esri.sde.sdk.client.SeFilter;
-import com.esri.sde.sdk.client.SeLayer;
-import com.esri.sde.sdk.client.SeQuery;
-import com.esri.sde.sdk.client.SeQueryInfo;
-import com.esri.sde.sdk.client.SeRow;
-import com.esri.sde.sdk.client.SeShape;
-import com.esri.sde.sdk.client.SeShapeFilter;
-import com.esri.sde.sdk.client.SeSqlConstruct;
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.Point;
-import com.vividsolutions.jts.geom.Polygon;
-import com.vividsolutions.jts.io.WKTReader;
-
-
-		/**
- * @author Tim Englich <tim.englich@intevation.de>
- *
+/**
+ * This Class wrapps an SDE-Statment to an java.sql.Statement.
+ * This Class also handles the SDE-Specific -Spatial-Queries and
+ * RasterQueries.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class ArcSDEStatement implements Statement {
 
-	/**
+    /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(ArcSDEStatement.class);
-    
-	private ArcSDEConnection connection = null;
-	
-	/**
-	 * Constructor
-	 */
-	public ArcSDEStatement(ArcSDEConnection connection) {
-		this.connection = connection;
-	}
-
-	/**
-	 * @see java.sql.Statement#addBatch(java.lang.String)
-	 */
-	public void addBatch(String arg0) throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Statement#cancel()
-	 */
-	public void cancel() throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Statement#clearBatch()
-	 */
-	public void clearBatch() throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Statement#clearWarnings()
-	 */
-	public void clearWarnings() throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Statement#close()
-	 */
-	public void close() throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Statement#execute(java.lang.String)
-	 */
-	public boolean execute(String arg0) throws SQLException {
-
-		return false;
-	}
-
-	/**
-	 * @see java.sql.Statement#execute(java.lang.String, int)
-	 */
-	public boolean execute(String arg0, int arg1) throws SQLException {
-
-		return false;
-	}
-
-	/**
-	 * @see java.sql.Statement#execute(java.lang.String, int[])
-	 */
-	public boolean execute(String arg0, int[] arg1) throws SQLException {
-
-		return false;
-	}
-
-	/**
-	 * @see java.sql.Statement#execute(java.lang.String, java.lang.String[])
-	 */
-	public boolean execute(String arg0, String[] arg1) throws SQLException {
-
-		return false;
-	}
-
-	/**
-	 * @see java.sql.Statement#executeBatch()
-	 */
-	public int[] executeBatch() throws SQLException {
-
-		return null;
-	}
 
-	/**
-	 * @see java.sql.Statement#executeQuery(java.lang.String)
-	 */
-	public ResultSet executeQuery(String statement) throws SQLException {
-		try {
-		    SeQuery query = null;
-	        if (statement.toLowerCase().contains("st_astext")  || statement.toLowerCase().contains("intersects")){
-	            
-	            String[] values =  statement.toLowerCase().split("where", 2);
-	            String where = values.length > 1 ? values[1].trim() : "";
-	            String[] tableNames = values[0].substring(values[0].indexOf("from")).replaceFirst("from", "").toUpperCase().trim().split(", ");
-	            String columnValueString = values[0].substring(0, values[0].indexOf("from")).trim();
-	            columnValueString = columnValueString.replaceFirst("select", "").trim();
-	            String[] returnFields  = columnValueString.split(", ");
-	            String geometryColumnName = null;
-	            String byClause = null;
-	            int byClausePos = where.indexOf("group by");
-	            if (byClausePos < 0){
-	                byClausePos = where.indexOf("order by");
-	            }
-	            if (byClausePos > 0){
-	                byClause = where.substring(byClausePos);
-	                where = where.substring(0,byClausePos);
-	            }
-	            
-	            for (int i = 0; i < returnFields.length; i++){
-	                returnFields[i] = returnFields[i].trim();
-	                if (returnFields[i].startsWith("st_astext(")){
-	                    returnFields[i] = returnFields[i].replaceAll("st_astext", "");
-	                    returnFields[i] = returnFields[i].substring(1, returnFields[i].length()-1);
-	                    geometryColumnName = returnFields[i];
-	                }
-	            }
-	            
-	            for (int i = 0; i < tableNames.length; i++){
-	                tableNames[i] = tableNames[i].trim();
-	            }
-	            
-	            Geometry g = null;
-	            int pos = where.indexOf("intersects");
-	            if (pos > 0 ){
-	                String substr =  where.substring(pos);
-	                where = where.substring(0,where.lastIndexOf("intersects")); // TODO auch or unterstützen
-	                where = where.substring(0,where.lastIndexOf("and")); // TODO auch or unterstützen
-	                String intersectsStmt = substr.substring(0, substr.lastIndexOf(")")); // Annahme räumliches Stmt steht am Ende
-	                String wkt = null;
-	                if (intersectsStmt.contains("select")){
-	                    // Anstelle eines WKT ist ein InnerSelect zum Bestimmen der Comparatorgeometrie gegeben.
-	                    String stmt = intersectsStmt.substring(intersectsStmt.indexOf("select"),intersectsStmt.lastIndexOf(")"));
-	                    ResultSet resultSet = this.executeQuery(stmt);
-	                    if (resultSet != null && resultSet.next()){
-	                        // TODO Selektion von mehreren Geometrien unterstützen.
-	                        wkt = resultSet.getString("SHAPE");
-	                    }
-	                }else{
-	                    wkt = intersectsStmt.substring(intersectsStmt.indexOf("\""), intersectsStmt.lastIndexOf("\"")).replace("\"", "").trim();
-	                }
-	                g = new WKTReader().read(wkt.toUpperCase());
-	                
-	                if (geometryColumnName == null){
-	                    geometryColumnName = "SHAPE"; // TODO dynamisch aus Intersects auslesen.
-	                }
-	                
-	            }
-	            return this.executeQuery(this.connection.getSeConnection(), tableNames, geometryColumnName, where, g, returnFields,byClause);
-	        }else{
-	            query = new SeQuery(this.connection.getSeConnection());
-	            query.prepareSql(statement);
-	            query.execute();
-	            return this.handleResultSet(query);
-	        }
-	       
-		} catch (Exception e) {
-	        log.error(e,e);
-	        throw new SQLException(e.getMessage());
+    /**
+     * The Connection to the ArcSDE-Backend
+     */
+    private ArcSDEConnection connection = null;
+
+    /**
+     * Constructor
+     * @param connection the Connection to the ArcSDE-Backend.
+     */
+    public ArcSDEStatement(ArcSDEConnection connection) {
+        this.connection = connection;
+    }
+
+    /**
+     * @see java.sql.Statement#addBatch(java.lang.String)
+     */
+    public void addBatch(String arg0) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#cancel()
+     */
+    public void cancel() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#clearBatch()
+     */
+    public void clearBatch() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#clearWarnings()
+     */
+    public void clearWarnings() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#close()
+     */
+    public void close() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#execute(java.lang.String)
+     */
+    public boolean execute(String arg0) throws SQLException {
+        return false;
+    }
+
+    /**
+     * @see java.sql.Statement#execute(java.lang.String, int)
+     */
+    public boolean execute(String arg0, int arg1) throws SQLException {
+        return false;
+    }
+
+    /**
+     * @see java.sql.Statement#execute(java.lang.String, int[])
+     */
+    public boolean execute(String arg0, int[] arg1) throws SQLException {
+        return false;
+    }
+
+    /**
+     * @see java.sql.Statement#execute(java.lang.String, java.lang.String[])
+     */
+    public boolean execute(String arg0, String[] arg1) throws SQLException {
+        return false;
+    }
+
+    /**
+     * @see java.sql.Statement#executeBatch()
+     */
+    public int[] executeBatch() throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Statement#executeQuery(java.lang.String)
+     */
+    public ResultSet executeQuery(String statement) throws SQLException {
+        try {
+            SeQuery query = null;
+            if (statement.toLowerCase().contains("st_astext")  || statement.toLowerCase().contains("intersects")){
+
+                String[] values =  statement.toLowerCase().split("where", 2);
+                String where = values.length > 1 ? values[1].trim() : "";
+                String[] tableNames = values[0].substring(values[0].indexOf("from")).replaceFirst("from", "").toUpperCase().trim().split(", ");
+                String columnValueString = values[0].substring(0, values[0].indexOf("from")).trim();
+                columnValueString = columnValueString.replaceFirst("select", "").trim();
+                String[] returnFields  = columnValueString.split(", ");
+                String geometryColumnName = null;
+                String byClause = null;
+                int byClausePos = where.indexOf("group by");
+                if (byClausePos < 0){
+                    byClausePos = where.indexOf("order by");
+                }
+                if (byClausePos > 0){
+                    byClause = where.substring(byClausePos);
+                    where = where.substring(0,byClausePos);
+                }
+
+                for (int i = 0; i < returnFields.length; i++){
+                    returnFields[i] = returnFields[i].trim();
+                    if (returnFields[i].startsWith("st_astext(")){
+                        returnFields[i] = returnFields[i].replaceAll("st_astext", "");
+                        returnFields[i] = returnFields[i].substring(1, returnFields[i].length()-1);
+                        geometryColumnName = returnFields[i];
+                    }
+                }
+
+                for (int i = 0; i < tableNames.length; i++){
+                    tableNames[i] = tableNames[i].trim();
+                }
+
+                Geometry g = null;
+                int pos = where.indexOf("intersects");
+                if (pos >= 0 ){
+                    String substr =  where.substring(pos);
+                    where = where.substring(0,where.lastIndexOf("intersects"));
+                    int andPos = where.lastIndexOf("and");
+                    if (andPos < 0){
+                        andPos = 0;
+                    }
+                    where = where.substring(0,andPos); // TODO support or also
+                    String intersectsStmt = substr.substring(0, substr.lastIndexOf(")")); // Spatial-Statment is the last one
+                    String wkt = null;
+                    if (intersectsStmt.contains("select")){
+                        // Anstelle eines WKT ist ein InnerSelect zum Bestimmen der Comparatorgeometrie gegeben.
+                        String stmt = intersectsStmt.substring(intersectsStmt.indexOf("select"),intersectsStmt.lastIndexOf(")"));
+                        ResultSet resultSet = this.executeQuery(stmt);
+                        if (resultSet != null && resultSet.next()){
+                            // TODO: Support the selection of more than one Geometry
+                            wkt = resultSet.getString("SHAPE");
+                        }
+                    }else{
+                        wkt = intersectsStmt.substring(intersectsStmt.indexOf("\""), intersectsStmt.lastIndexOf("\"")).replace("\"", "").trim();
+                    }
+                    g = new WKTReader().read(wkt.toUpperCase());
+
+                    if (geometryColumnName == null){
+                        geometryColumnName = "SHAPE"; // TODO dynamisch aus Intersects auslesen.
+                    }
+
+                }
+
+                return this.executeQuery(this.connection.getSeConnection(), tableNames, geometryColumnName, where, g, returnFields,byClause);
+            }else{
+                query = new SeQuery(this.connection.getSeConnection());
+                query.prepareSql(statement);
+                query.execute();
+                return this.handleResultSet(query,false,null);
+            }
+
+        } catch (Exception e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
         }
-        
-        
-	}
-	
+
+
+    }
+    /**
+     * This Methods Executes the ArcSDE Query if Spatial-Restrictions
+     * are given
+     * @param con The Connection to the ArcSDE-Backend.
+     * @param pLayername The Name of tables which should be used in the Query
+     * @param pSpatialColumnName the Name of the Spatial Column.
+     * @param pWhere The where-Clause to limit the Data
+     * @param g the Geometry to limit the Data
+     * @param pReturnFields the Fileds that should be fetched from the Database
+     * @param byClause the byClaus to order the Results.
+     * @return the @see java.sql.ResultSet with the Data which was retrieved.
+     * @throws SQLException
+     */
     private ResultSet executeQuery(SeConnection con, String[] pLayername,
                                    String pSpatialColumnName, String pWhere,
                                    Geometry g, String[] pReturnFields, String byClause)
@@ -206,40 +240,46 @@
         log.debug("executeQuery()");
         try {
             // get the layer for querying
-           
+            boolean isRaster = pSpatialColumnName.equalsIgnoreCase("raster");
+
             SeShapeFilter[] filters  = null;
             if (g != null){
-                SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName);
-                SeShape shape = new SeShape();
-                shape.setCoordRef(lLayer.getCoordRef());
-                
-                SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g);
-    
-                int searchMode = SeFilter.METHOD_AI;
-                if (g instanceof Polygon){
-                    shape.generatePolygon(lPoints.length, 1, null, lPoints);
-                }else if (g instanceof Point){
-                    shape.generatePoint(1, lPoints);
-                    searchMode = SeFilter.METHOD_PC;
+                if (!isRaster){
+                    SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName);
+                    SeShape shape = new SeShape();
+                    shape.setCoordRef(lLayer.getCoordRef());
+
+                    SDEPoint[] lPoints = new ArcSDEUtils().createPoints(g);
+
+                    int searchMode = SeFilter.METHOD_AI;
+                    if (g instanceof Polygon){
+                        shape.generatePolygon(lPoints.length, 1, null, lPoints);
+                    }else if (g instanceof Point){
+                        shape.generatePoint(1, lPoints);
+                        searchMode = SeFilter.METHOD_PC;
+                    }else if (g instanceof LineString){
+                        shape.generateLine(lPoints.length, 1, null, lPoints);
+                        searchMode = SeFilter.METHOD_LCROSS;
+                    }
+
+                    SeShapeFilter filter = new SeShapeFilter(pLayername[0],
+                            pSpatialColumnName, shape,searchMode);
+                    filters = new SeShapeFilter[1];
+                    filters[0] = filter;
                 }
-                
-                SeShapeFilter filter = new SeShapeFilter(pLayername[0],
-                        pSpatialColumnName, shape,searchMode);
-                filters = new SeShapeFilter[1];
-                filters[0] = filter;
             }
 
             SeQuery spatialQuery = null;
             SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere);
             spatialQuery = new SeQuery(con);//, pReturnFields, sqlCons);
-            
+
             SeQueryInfo queryInfo = new SeQueryInfo();
             queryInfo.setColumns(pReturnFields);
-            
+
             if (byClause != null){
                 queryInfo.setByClause(byClause);
             }
-            
+
             queryInfo.setConstruct(sqlCons);
             spatialQuery.prepareQueryInfo(queryInfo);
 
@@ -250,9 +290,12 @@
                 spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false,
                         filters);
             }
-            spatialQuery.execute();
 
-            return this.handleResultSet(spatialQuery);
+            if (!isRaster){
+                spatialQuery.execute();
+            }
+
+            return this.handleResultSet(spatialQuery,isRaster,g);
 
         } catch (Exception e) {
             if (e instanceof SeException){
@@ -260,252 +303,380 @@
             }else{
                 log.error(e.getMessage(), e);
             }
-            
+
             throw new SQLException(e.getMessage());
         }
     }
 
-	/**
-	 * @see java.sql.Statement#executeUpdate(java.lang.String)
-	 */
-	public int executeUpdate(String arg0) throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#executeUpdate(java.lang.String, int)
-	 */
-	public int executeUpdate(String arg0, int arg1) throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#executeUpdate(java.lang.String, int[])
-	 */
-	public int executeUpdate(String arg0, int[] arg1) throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[])
-	 */
-	public int executeUpdate(String arg0, String[] arg1) throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#getConnection()
-	 */
-	public Connection getConnection() throws SQLException {
-		return this.connection;
-	}
-
-	/**
-	 * @see java.sql.Statement#getFetchDirection()
-	 */
-	public int getFetchDirection() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#getFetchSize()
-	 */
-	public int getFetchSize() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#getGeneratedKeys()
-	 */
-	public ResultSet getGeneratedKeys() throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Statement#getMaxFieldSize()
-	 */
-	public int getMaxFieldSize() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#getMaxRows()
-	 */
-	public int getMaxRows() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#getMoreResults()
-	 */
-	public boolean getMoreResults() throws SQLException {
-
-		return false;
-	}
-
-	/**
-	 * @see java.sql.Statement#getMoreResults(int)
-	 */
-	public boolean getMoreResults(int arg0) throws SQLException {
-
-		return false;
-	}
-
-	/**
-	 * @see java.sql.Statement#getQueryTimeout()
-	 */
-	public int getQueryTimeout() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#getResultSet()
-	 */
-	public ResultSet getResultSet() throws SQLException {
+    /**
+     * @see java.sql.Statement#executeUpdate(java.lang.String)
+     */
+    public int executeUpdate(String arg0) throws SQLException {
+        return 0;
+    }
 
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Statement#getResultSetConcurrency()
-	 */
-	public int getResultSetConcurrency() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#getResultSetHoldability()
-	 */
-	public int getResultSetHoldability() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#getResultSetType()
-	 */
-	public int getResultSetType() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#getUpdateCount()
-	 */
-	public int getUpdateCount() throws SQLException {
-
-		return 0;
-	}
-
-	/**
-	 * @see java.sql.Statement#getWarnings()
-	 */
-	public SQLWarning getWarnings() throws SQLException {
-
-		return null;
-	}
-
-	/**
-	 * @see java.sql.Statement#setCursorName(java.lang.String)
-	 */
-	public void setCursorName(String arg0) throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Statement#setEscapeProcessing(boolean)
-	 */
-	public void setEscapeProcessing(boolean arg0) throws SQLException {
-	}
+    /**
+     * @see java.sql.Statement#executeUpdate(java.lang.String, int)
+     */
+    public int executeUpdate(String arg0, int arg1) throws SQLException {
+        return 0;
+    }
 
-	/**
-	 * @see java.sql.Statement#setFetchDirection(int)
-	 */
-	public void setFetchDirection(int arg0) throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Statement#setFetchSize(int)
-	 */
-	public void setFetchSize(int arg0) throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Statement#setMaxFieldSize(int)
-	 */
-	public void setMaxFieldSize(int arg0) throws SQLException {
-	}
-
-	/**
-	 * @see java.sql.Statement#setMaxRows(int)
-	 */
-	public void setMaxRows(int arg0) throws SQLException {
-	}
+    /**
+     * @see java.sql.Statement#executeUpdate(java.lang.String, int[])
+     */
+    public int executeUpdate(String arg0, int[] arg1) throws SQLException {
+        return 0;
+    }
 
-	/**
-	 * @see java.sql.Statement#setQueryTimeout(int)
-	 */
-	public void setQueryTimeout(int arg0) throws SQLException {
-	}
-	
-	/**
-	 * Copied from de.intevation.gnv.geobackend.sde.datasources.SDEQuery
-	 *  @param pSeQuery
-	 *  @return
-	 * @throws SeException
-	 */
-    private ResultSet handleResultSet(SeQuery pSeQuery) throws SeException {
-        log.debug("ArcSDEStatement,handleResultSet()");
-        SDEResultSet lSet = new SDEResultSet();
-        SeRow row;
+    /**
+     * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[])
+     */
+    public int executeUpdate(String arg0, String[] arg1) throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Statement#getConnection()
+     */
+    public Connection getConnection() throws SQLException {
+        return this.connection;
+    }
+
+    /**
+     * @see java.sql.Statement#getFetchDirection()
+     */
+    public int getFetchDirection() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Statement#getFetchSize()
+     */
+    public int getFetchSize() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Statement#getGeneratedKeys()
+     */
+    public ResultSet getGeneratedKeys() throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Statement#getMaxFieldSize()
+     */
+    public int getMaxFieldSize() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Statement#getMaxRows()
+     */
+    public int getMaxRows() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Statement#getMoreResults()
+     */
+    public boolean getMoreResults() throws SQLException {
+        return false;
+    }
+
+    /**
+     * @see java.sql.Statement#getMoreResults(int)
+     */
+    public boolean getMoreResults(int arg0) throws SQLException {
+        return false;
+    }
+
+    /**
+     * @see java.sql.Statement#getQueryTimeout()
+     */
+    public int getQueryTimeout() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Statement#getResultSet()
+     */
+    public ResultSet getResultSet() throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Statement#getResultSetConcurrency()
+     */
+    public int getResultSetConcurrency() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Statement#getResultSetHoldability()
+     */
+    public int getResultSetHoldability() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Statement#getResultSetType()
+     */
+    public int getResultSetType() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Statement#getUpdateCount()
+     */
+    public int getUpdateCount() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.Statement#getWarnings()
+     */
+    public SQLWarning getWarnings() throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.Statement#setCursorName(java.lang.String)
+     */
+    public void setCursorName(String arg0) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#setEscapeProcessing(boolean)
+     */
+    public void setEscapeProcessing(boolean arg0) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#setFetchDirection(int)
+     */
+    public void setFetchDirection(int arg0) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#setFetchSize(int)
+     */
+    public void setFetchSize(int arg0) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#setMaxFieldSize(int)
+     */
+    public void setMaxFieldSize(int arg0) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#setMaxRows(int)
+     */
+    public void setMaxRows(int arg0) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Statement#setQueryTimeout(int)
+     */
+    public void setQueryTimeout(int arg0) throws SQLException {
+    }
+
+    /**
+     * This Method fetches all Rows from the SeQuery-Object and convert it into
+     * an @see java.sql.ResultSet.
+     *
+     * @param pSeQuery the Queryobject where the Data should be fetched from.
+     * @param isRaster Flag which indicates if the Result is Rasterdata.
+     * @param geometry The Geometry which might be used to limit the data.
+     * @return an java.sql:ResultSet which contains the Data.
+     * @throws SeException
+     */
+    private ResultSet handleResultSet(SeQuery pSeQuery,
+                                      boolean isRaster,
+                                      Geometry geometry) throws SeException {
+        boolean debug = log.isDebugEnabled();
+
+        if (debug) {
+            log.debug("ArcSDEStatement.handleResultSet()");
+        }
+
+        SDEResultSet lSet = isRaster
+            ? new UncacheableSDEResultSet()
+            : new SDEResultSet();
+        SeRow row = null;
         int lCount;
-        for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) {
-            // one time execution
-            if (lCount == 0) {
-                // analyze cols of result set
-                SeColumnDefinition[] lCols = row.getColumns();
-                for (SeColumnDefinition lCol : lCols) {
-                    lSet.addCol(new ColDefinition(lCol.getName(), lCol.getType()));// notice: esri-types have been copied into colDefinition class!
+        if (!isRaster){
+            RedundancyRemover  [] removers = null;
+            SeColumnDefinition [] lCols    = null;
+
+            for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) {
+                // one time execution
+                if (lCount == 0) {
+                    // analyze cols of result set
+                    lCols = row.getColumns();
+                    for (SeColumnDefinition lCol : lCols) {
+                        lSet.addCol(new ColDefinition(lCol.getName(), lCol.getType()));
+                        // notice: esri-types have been copied into colDefinition class!
+                    }
+                    removers = new RedundancyRemover[lCols.length];
+                    for (int i = 0; i < removers.length; ++i) {
+                        removers[i] = new RedundancyRemover();
+                    }
                 }
+                short lNumCols = row.getNumColumns();
+                Row lBackingRow = new Row(lNumCols);
+                for (int i = 0; i < lNumCols; i++) {
+                    lBackingRow.addObject(
+                        removers[i].filter(row.getObject(i)),
+                        i);
+                }
+                lSet.addRow(lBackingRow);
             }
-            short lNumCols = row.getNumColumns();
-            Row lBackingRow = new Row(lNumCols);
-            for (int i = 0; i < lNumCols; i++) {
-                lBackingRow.addObject(row.getObject(i), i);
+
+            if (debug && removers != null) {
+                log.debug("datasets: " + lCount);
+                StringBuilder sb = new StringBuilder("removed redundancy: ");
+                float percent = 100f/lCount;
+                for (int i = 0; i < removers.length; ++i) {
+                    if (i > 0) sb.append(", ");
+                    sb.append(lCols[i].getName())
+                      .append(": ").append(removers[i].numRemoved())
+                      .append(" (").append(removers[i].numRemoved()*percent)
+                      .append("%)");
+                }
+                log.debug(sb.toString());
             }
-            lSet.addRow(lBackingRow);
+        }else{
+            try {
+                pSeQuery.execute();
+                row = pSeQuery.fetch();
+                SeRasterAttr    attr       = row.getRaster(0);
+                SeRaster        raster     = attr.getRasterInfo();
+                SeRasterBand [] bands      = raster.getBands();
+                SeRasterBand    rasterBand = bands[0];
+
+                SeExtent extent = rasterBand.getExtent();
+
+                double x = ((Point)geometry).getX();
+                double y = ((Point)geometry).getY();
+
+                boolean isPointInRaster =
+                        x >= extent.getMinX() && x <= extent.getMaxX()
+                    &&  y >= extent.getMinY() && y <= extent.getMaxY();
+
+                if (isPointInRaster){
+
+                    if (row == null){
+                        pSeQuery.execute();
+                        row = pSeQuery.fetch();
+                    }
+
+                    double midX = 0.5d*(extent.getMinX() + extent.getMaxX());
+                    double midY = 0.5d*(extent.getMinY() + extent.getMaxY());
+
+                    SDEPoint origin = rasterBand.getTileOrigin();
+
+                    double maxX = origin.getX() < midX
+                        ? extent.getMaxX()
+                        : extent.getMinX();
+
+                    double maxY = origin.getY() < midY
+                        ? extent.getMaxY()
+                        : extent.getMinY();
+
+                    double mx = rasterBand.getBandWidth()/(maxX-origin.getX());
+                    double bx = -origin.getX()*mx;
+                    double px = mx*x + bx;
+
+                    double my = rasterBand.getBandHeight()/(maxY-origin.getY());
+                    double by = -origin.getY()*my;
+                    double py = my*y + by;
+
+                    SeRasterConstraint constraint = new SeRasterConstraint();
+                    constraint.setLevel(0); // best resolution
+                    constraint.setBands(rasterBand.getBandNumber());
+                    int tx = (int)Math.floor(px / rasterBand.getTileWidth());
+                    int ty = (int)Math.floor(py / rasterBand.getTileHeight());
+                    constraint.setEnvelope(tx, ty, tx, ty);
+
+                    pSeQuery.queryRasterTile(constraint);
+                    SeRasterTile tile = row.getRasterTile();
+
+                    if (tile != null){
+                        double[] tileValues = new double[tile.getNumPixels()];
+                        tileValues = tile.getPixels(tileValues);
+                        lSet.addCol(new ColDefinition("tile", ColDefinition.FLOAT64));
+                        Row lBackingRow = new Row(1);
+
+                        double wx1 = (rasterBand.getTileWidth()*tx - bx)/mx;
+                        double wx2 = (rasterBand.getTileWidth()*(tx+1) - bx)/mx;
+                        double mxt = (rasterBand.getTileWidth()-1e-5d)/(wx2 - wx1);
+                        double bxt = -wx1*mxt;
+
+                        double wy1 = (rasterBand.getTileHeight()*ty - by)/my;
+                        double wy2 = (rasterBand.getTileHeight()*(ty+1) - by)/my;
+                        double myt = (rasterBand.getTileHeight()-1e-5d)/(wy2 - wy1);
+                        double byt = -wy1*myt;
+
+                        RasterObject ro = new RasterObject(
+                            mxt, bxt,
+                            myt, byt,
+                            tile.getColumnIndex(),
+                            tile.getRowIndex(),
+                            tileValues,
+                            rasterBand.getTileWidth(),
+                            rasterBand.getTileHeight());
+                        lBackingRow.addObject(ro, 0);
+                        lSet.addRow(lBackingRow);
+
+                     }
+                }
+                else{
+                    log.debug("The Query doesn't deliver any Information " +
+                        "because the Point is located outside the Raster.");
+                }
+            } catch (Exception e) {
+                log.error(e,e);
+            }
         }
         pSeQuery.close();
         return lSet;
     }
 
+    /**
+     * @see java.sql.Statement#isClosed()
+     */
     public boolean isClosed() throws SQLException {
         return false;
     }
 
+    /**
+     * @see java.sql.Statement#isPoolable()
+     */
     public boolean isPoolable() throws SQLException {
         return false;
     }
 
+    /**
+     * @see java.sql.Statement#setPoolable(boolean)
+     */
     public void setPoolable(boolean arg0) throws SQLException {
     }
 
+    /**
+     * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
+     */
     public boolean isWrapperFor(Class<?> iface) throws SQLException {
         return false;
     }
 
+    /**
+     * @see java.sql.Wrapper#unwrap(java.lang.Class)
+     */
     public <T> T unwrap(Class<T> iface) throws SQLException {
         return null;
+
     }
-
 }
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,163 +1,92 @@
-/**
- * Title:           ArcSDEUtils, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEUtils.java,v 1.7 2007/11/28 14:05:39 blume Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEUtils.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     21.11.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: blume $
- * modified on:     $Date: 2007/11/28 14:05:39 $
- * Version:         $Revision: 1.7 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.sde.datasources;
-
-import java.util.Vector;
-
-import org.apache.log4j.Logger;
-
-import com.esri.sde.sdk.client.SDEPoint;
-import com.esri.sde.sdk.client.SeColumnDefinition;
-import com.esri.sde.sdk.client.SeError;
-import com.esri.sde.sdk.client.SeException;
-import com.esri.sde.sdk.client.SeTable;
-import com.vividsolutions.jts.geom.Coordinate;
-import com.vividsolutions.jts.geom.Geometry;
-import com.vividsolutions.jts.geom.Point;
-import com.vividsolutions.jts.geom.Polygon;
-
-/**
- * The class <code>ArcSDEUtils</code> fulfills the following purposes:
- * <ol>
- * <li></li>
- * </ol>
- * 
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 21.11.2007 08:20:40
- */
-public class ArcSDEUtils {
-
-    /**
-     * Default Logging instance
-     */
-    private static Logger sLogger = Logger.getLogger(ArcSDEUtils.class);
-
-    public void displayStats(SeTable.SeTableStats tableStats) {
-
-        sLogger.debug("\n--> Table Statistics\n");
-        if (tableStats != null) {
-
-            sLogger.debug("Average - " + tableStats.getAverage());
-            sLogger.debug("No of rows - " + tableStats.getCount());
-            sLogger.debug("Maximum Value - " + tableStats.getMax());
-            sLogger.debug("Minimum Value - " + tableStats.getMin());
-            sLogger.debug("No of distinct values - "
-                          + tableStats.getNumDistinct());
-            sLogger.debug("Standard Deviation - " + tableStats.getStdDev());
-
-            sLogger.debug("Distinct type - "
-                          + ArcSDEUtils.resolveType(tableStats
-                                  .getDistinctType()));
-
-            int[] distinctFreq = tableStats.getDistinctValueFrequencies();
-            Vector distinctValues = tableStats.getDistinctValues();
-            sLogger.debug("Distinct values & their frequencies : ");
-            for (int i = 0; i < distinctFreq.length; i++)
-                sLogger.debug(distinctValues.elementAt(i) + " - "
-                              + distinctFreq[i]);
-        }// End if
-
-    }// End displayStats
-
-    /**
-     * Takes an integer corresponding to an ArcSDE data type and returns a
-     * string description of the type.
-     * 
-     * @param type
-     *            SDE data type bit-mask.
-     */
-    public static String resolveType(int type) {
-
-        String typeName = "Invalid Type";
-        switch (type) {
-
-        case SeColumnDefinition.TYPE_SMALLINT:
-            typeName = "Small Int";
-            break;
-        case SeColumnDefinition.TYPE_INTEGER:
-            typeName = "Int";
-            break;
-        case SeColumnDefinition.TYPE_FLOAT:
-            typeName = "Float";
-            break;
-        case SeColumnDefinition.TYPE_DOUBLE:
-            typeName = "Double";
-            break;
-        case SeColumnDefinition.TYPE_STRING:
-            typeName = "String";
-            break;
-        case SeColumnDefinition.TYPE_BLOB:
-            typeName = "Blob";
-            break;
-        case SeColumnDefinition.TYPE_DATE:
-            typeName = "Date";
-            break;
-        case SeColumnDefinition.TYPE_SHAPE:
-            typeName = "Shape";
-            break;
-        case SeColumnDefinition.TYPE_RASTER:
-            typeName = "Raster";
-            break;
-        }
-        return typeName;
-    }// End method resolveType
-
-    public static void printError(SeException exception) {
-
-        SeError error = exception.getSeError();
-
-        sLogger.debug("\n ArcSDE Error Number        : " + error.getSdeError());
-        sLogger.debug(" Error Description          : " + error.getErrDesc());
-
-        int extError = error.getExtError();
-        if (extError != 0)
-            sLogger.debug(" Extended Error Number      : " + extError);
-
-        String desc = error.getSdeErrMsg();
-        if (desc != null && desc.length() != 0)
-            sLogger.debug(" Extended Error Description : " + desc);
-
-        desc = error.getExtErrMsg();
-        if (desc != null && desc.length() != 0)
-            sLogger.debug(" Extended Error Description : " + desc);
-
-        sLogger.debug(exception);
-
-    }// End printError
-
-    public SDEPoint[] createPoints(Geometry g) {
-        sLogger.debug("createPoints()");
-        Coordinate[] coords = null;
-        if (g instanceof Polygon) {
-            coords = ((Polygon) g).getCoordinates();
-        }else if (g instanceof Point){
-            coords = ((Point)g).getCoordinates();
-        }
-        if (coords != null){
-            SDEPoint[] lSDEPoints = new SDEPoint[coords.length];
-            for (int i = 0; i < coords.length; i++) {
-                lSDEPoints[i] = new SDEPoint(coords[i].x, coords[i].y);
-            }
-            return lSDEPoints;
-        }else{
-            return null;
-        }
-
-    }
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import com.esri.sde.sdk.client.SDEPoint;
+import com.esri.sde.sdk.client.SeError;
+import com.esri.sde.sdk.client.SeException;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.Point;
+import com.vividsolutions.jts.geom.Polygon;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>ArcSDEUtils</code> fulfills the following purposes:
+ *
+ * @author blume
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class ArcSDEUtils {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(ArcSDEUtils.class);
+
+    /**
+     * Prints an SEEsception into the Logger of this Class
+     * @param exception
+     */
+    public static void printError(SeException exception) {
+
+        SeError error = exception.getSeError();
+
+        sLogger.debug("\n ArcSDE Error Number        : " + error.getSdeError());
+        sLogger.debug(" Error Description          : " + error.getErrDesc());
+
+        int extError = error.getExtError();
+        if (extError != 0)
+            sLogger.debug(" Extended Error Number      : " + extError);
+
+        String desc = error.getSdeErrMsg();
+        if (desc != null && desc.length() != 0)
+            sLogger.debug(" Extended Error Description : " + desc);
+
+        desc = error.getExtErrMsg();
+        if (desc != null && desc.length() != 0)
+            sLogger.debug(" Extended Error Description : " + desc);
+
+        sLogger.debug(exception);
+
+    }
+
+    /**
+     * Generate an SDEPoint-Array from a given Geometry.
+     * This Method did not put the Holes to the Array.
+     * @param g The Geometry which should be converted.
+     * @return an SDEPoint-Array from a given Ggeometry.
+     */
+    public SDEPoint[] createPoints(Geometry g) {
+        sLogger.debug("createPoints()");
+        Coordinate[] coords = null;
+        if (g instanceof Polygon) {
+            coords = ((Polygon) g).getCoordinates();
+        }else if (g instanceof Point){
+            coords = ((Point)g).getCoordinates();
+        }else if (g instanceof LineString){
+            coords = ((LineString)g).getCoordinates();
+        }else{
+            coords = g.getCoordinates();
+        }
+
+        if (coords != null){
+            SDEPoint[] lSDEPoints = new SDEPoint[coords.length];
+            for (int i = 0; i < coords.length; i++) {
+                lSDEPoints[i] = new SDEPoint(coords[i].x, coords[i].y);
+            }
+            return lSDEPoints;
+        }else{
+            return null;
+        }
+    }
+}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,86 +1,85 @@
-/**
- * Title:           ColDefinition, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ColDefinition.java,v 1.2 2007/12/21 12:31:15 blume Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ColDefinition.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     21.11.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: blume $
- * modified on:     $Date: 2007/12/21 12:31:15 $
- * Version:         $Revision: 1.2 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.sde.datasources;
-
-import org.apache.log4j.Logger;
-
-/**
- * The class <code>ColDefinition</code> fulfills the following purposes:
- * <ol>
- * <li></li>
- * </ol>
- *
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 21.11.2007 10:59:45
- */
-public class ColDefinition {
-
-    /**
-     * Default Logging instance
-     */
-    private static Logger sLogger = Logger.getLogger(ColDefinition.class);
-
-    /**
-     * @deprecated
-     */
-    public static final int SMALLINT = 1;
-    /**
-     * @deprecated
-     */
-    public static final int INTEGER = 2;
-    /**
-     * @deprecated
-     */
-    public static final int FLOAT = 3;
-    /**
-     * @deprecated
-     */
-    public static final int DOUBLE = 4;
-    public static final int INT16 = 1;
-    public static final int INT32 = 2;
-    public static final int FLOAT32 = 3;
-    public static final int FLOAT64 = 4;
-    public static final int STRING = 5;
-    public static final int BLOB = 6;
-    public static final int DATE = 7;
-    public static final int SHAPE = 8;
-    public static final int RASTER = 9;
-    public static final int XML = 10;
-    public static final int INT64 = 11;
-    public static final int UUID = 12;
-    public static final int CLOB = 13;
-    public static final int NSTRING = 14;
-    public static final int NCLOB = 15;
-
-    private String mName;
-    private int mType;
-
-    public ColDefinition(String pName, int pType) {
-        mName = pName;
-        mType = pType;
-    }
-
-    public String getName() {
-        return mName;
-    }
-
-    public int getType() {
-        return mType;
-    }
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>ColDefinition</code> fulfills the following purposes:
+ * @author blume
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class ColDefinition {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(ColDefinition.class);
+
+    /**
+     * @deprecated
+     */
+    public static final int SMALLINT = 1;
+    /**
+     * @deprecated
+     */
+    public static final int INTEGER = 2;
+    /**
+     * @deprecated
+     */
+    public static final int FLOAT = 3;
+    /**
+     * @deprecated
+     */
+    public static final int DOUBLE = 4;
+    public static final int INT16 = 1;
+    public static final int INT32 = 2;
+    public static final int FLOAT32 = 3;
+    public static final int FLOAT64 = 4;
+    public static final int STRING = 5;
+    public static final int BLOB = 6;
+    public static final int DATE = 7;
+    public static final int SHAPE = 8;
+    public static final int RASTER = 9;
+    public static final int XML = 10;
+    public static final int INT64 = 11;
+    public static final int UUID = 12;
+    public static final int CLOB = 13;
+    public static final int NSTRING = 14;
+    public static final int NCLOB = 15;
+
+    private String mName;
+    private int mType;
+
+    /**
+     * Constructor
+     * @param pName the Name of an Column.
+     * @param pType the Type of an Column.
+     */
+    public ColDefinition(String pName, int pType) {
+        mName = pName;
+        mType = pType;
+    }
+
+    /**
+     * Returns the Name of an Column.
+     * @return the Name of an Column.
+     */
+    public String getName() {
+        return mName;
+    }
+
+    /**
+     * Returns the Type of an Column.
+     * @return the Type of an Column.
+     */
+    public int getType() {
+        return mType;
+    }
+}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Datasource.java	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,92 +0,0 @@
-/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
- * All rights reserved
- *
- * $Id: Datasource.java,v 1.4 2008/01/30 12:38:34 blume Exp $
- *
- * created by:      drewnak
- * created at :     21.11.2007
- * created at :     14:25:50
- *
- * modified by:     $Author: blume $
- * modified at:     $Date: 2008/01/30 12:38:34 $
- */
-package de.intevation.gnv.geobackend.sde.datasources;
-
-import java.util.Map;
-
-import de.intevation.gnv.geobackend.sde.datasources.exception.DatasourceException;
-
-/**
- * Abstract class for handling different datasources.
- * This method provides a static method for creating dataosurce objects.
- *
- * @author drewnak
- */
-public abstract class Datasource {
-
-    protected Map mParameters;
-
-    protected String mName;
-
-
-    /**
-     * Triggers the creation of a dataosurce object. Following the guidelines, the parameters for creating this datasource are delivered by the configuration file.
-     *
-     * @param pName      a name for the datasource.
-     * @param pClassname The name of the class extending this abstract datasource class. Used to create a new instance.
-     * @param pParams    a Map of Parameters needed for the initialization of the datasource.
-     * @return a datasourceobject
-     * @throws DatasourceException if the class could not be found or the initialization of the datasource fails.
-     */
-    public static final Datasource create(String pName, String pClassname,
-                                          Map pParams) throws DatasourceException {
-        Class lDatasourceClass;
-        try {
-            lDatasourceClass = Class.forName(pClassname);
-        } catch (ClassNotFoundException e) {
-            throw new DatasourceException("Could not load class " + pClassname);
-        }
-        Datasource lNewInstance;
-        try {
-            lNewInstance = (Datasource) lDatasourceClass.newInstance();
-        } catch (Exception e) {
-            throw new DatasourceException("Could not create instance of " + pClassname, e);
-        }
-        lNewInstance.init(pName, pParams);
-
-        return lNewInstance;
-    }
-
-    /**
-     * An abstract method for the initialization of a datasource instance.
-     * Of course, only the concrete implementation knwos about the ncessary parameters for the initialization.
-     *
-     * @param pName   a name for the datasource.
-     * @param pParams a Map of Parameters needed for the initialization of the datasource.
-     */
-    protected abstract void init(String pName, Map pParams) throws DatasourceException;
-
-    /**
-     * @return
-     */
-    public String getName() {
-        return mName;
-    }
-
-
-    /**
-     * This method returns a datasourceconnection.
-     * Only the concrete implementation of the Datasource knwos about the DatasourceConnection-Implementation to return.
-     *
-     * @return a DatasourceConnection
-     */
-    public abstract DatasourceConnection getConnection();
-
-    /**
-     * Returns a DatasourceConnection. This method is usualy called after an executed query.
-     * See: Some datasource implementations need to explicitly close an existing connection.
-     *
-     * @param pConnection the connection to be returned.
-     */
-    public abstract void returnConnection(DatasourceConnection pConnection);
-}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/DatasourceConnection.java	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/**
- * Title:           IDatasourceConnection, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/DatasourceConnection.java,v 1.2 2008/01/30 12:38:34 blume Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/DatasourceConnection.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     21.11.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: blume $
- * modified on:     $Date: 2008/01/30 12:38:34 $
- * Version:         $Revision: 1.2 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.sde.datasources;
-
-/**
- * The interface <code>DatasourceConnection</code> fulfills the following purposes:
- * <ol>
- * <li>Beeing a marker interface for datasource connections.</li>
- * </ol>
- *
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 21.11.2007 08:50:20
- */
-public interface DatasourceConnection {
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/RasterObject.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import com.vividsolutions.jts.geom.Coordinate;
+
+import java.io.Serializable;
+
+import org.apache.commons.math.ArgumentOutsideDomainException;
+
+import org.apache.commons.math.analysis.interpolation.SplineInterpolator;
+
+import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class RasterObject
+implements   Serializable
+{
+    private static Logger log = Logger.getLogger(RasterObject.class);
+
+    public static final int NEAREST_NEIGHBOR = 0;
+    public static final int BILINEAR         = 1;
+    public static final int BICUBIC          = 2;
+
+    private double mx;
+    private double bx;
+    private double my;
+    private double by;
+
+    private int columnIndex;
+    private int rowIndex;
+
+    private int tileWidth;
+    private int tileHeight;
+
+    private double [] rasterData;
+
+    private transient PolynomialSplineFunction [] splines;
+    private transient double [] columns;
+
+    public RasterObject() {
+    }
+
+    public RasterObject(
+        double mx, double bx,
+        double my, double by,
+        int       columnIndex,
+        int       rowIndex,
+        double [] rasterData,
+        int       tileWidth,
+        int       tileHeight
+    ){
+        this.mx          = mx;
+        this.bx          = bx;
+        this.my          = my;
+        this.by          = by;
+        this.columnIndex = columnIndex;
+        this.rowIndex    = rowIndex;
+        this.rasterData  = rasterData;
+        this.tileWidth   = tileWidth;
+        this.tileHeight  = tileHeight;
+    }
+
+    public boolean contains(Coordinate coordinate) {
+        double px = mx*coordinate.x + bx;
+        double py = my*coordinate.y + by;
+        return px >= 0d && py >= 0d && px < tileWidth && py < tileHeight;
+    }
+
+    public final double get(int posX, int posY) {
+        return rasterData[posY*tileWidth + posX];
+    }
+
+    public int getTileWidth() {
+        return tileWidth;
+    }
+
+    public int getTileHeight() {
+        return tileWidth;
+    }
+
+    public int getColumnIndex() {
+        return columnIndex;
+    }
+
+    public int getRowIndex() {
+        return rowIndex;
+    }
+
+    public double getValue(Coordinate coordinate) {
+        return getValue(coordinate, NEAREST_NEIGHBOR);
+    }
+
+    public final double interpolateBilinear(double px, double py) {
+
+        if (px < 0.5d) { // left border
+            if (py < 0.5d) { // upper left edge
+                return rasterData[0];
+            }
+            if (py > tileHeight-0.5d) { // lower left edge
+                return rasterData[rasterData.length-tileWidth];
+            }
+            // center left
+            int    i = (int)(py -= 0.5d);
+            double t = py - i;
+            i *= tileWidth;
+            return (1d-t)*rasterData[i] + t*rasterData[i+tileWidth];
+        }
+
+        if (px > tileWidth-0.5d) { // right border
+            if (py < 0.5d) { // upper right edge
+                return rasterData[tileWidth-1];
+            }
+            if (py > tileHeight-0.5d) { // lower right edge
+                return rasterData[rasterData.length-1];
+            }
+            // center right
+            int    i = (int)(py -= 0.5d);
+            double t = py - i;
+            i = i*tileWidth + tileWidth-1;
+            return (1d-t)*rasterData[i] + t*rasterData[i+tileWidth];
+        }
+
+        if (py < 0.5d) { // top border
+            int    i = (int)(px -= 0.5d);
+            double t = px - i;
+            return (1d-t)*rasterData[i] + t*rasterData[i+1];
+        }
+
+        if (py > tileHeight-0.5d) { // bottom border
+            int    i = (int)(px -= 0.5d);
+            double t = px - i;
+            i += rasterData.length-tileWidth;
+            return (1d-t)*rasterData[i] + t*rasterData[i+1];
+        }
+
+        // center
+        int    i  = (int)(py -= 0.5d);
+        int    j  = (int)(px -= 0.5d);
+        double ti = py - i;
+        double tj = px - j;
+
+        int idx = i*tileWidth + j;
+
+        double v1j1 = rasterData[idx];
+        double v2j1 = rasterData[idx+1];
+
+        idx += tileWidth;
+
+        double v1j2 = rasterData[idx];
+        double v2j2 = rasterData[idx+1];
+
+        double v1 = (1d-tj)*v1j1 + tj*v2j1;
+        double v2 = (1d-tj)*v1j2 + tj*v2j2;
+
+        return (1d-ti)*v1 + ti*v2;
+    }
+
+    protected PolynomialSplineFunction [] createSplines() {
+        PolynomialSplineFunction [] splines =
+            new PolynomialSplineFunction[tileHeight];
+
+        double [] x = new double[tileWidth];
+        double [] y = new double[tileWidth];
+
+        for (int i = 0; i < tileWidth; ++i) {
+            x[i] = i + 0.5d;
+        }
+
+        columns = new double[tileHeight];
+
+        SplineInterpolator interpolator = new SplineInterpolator();
+
+        for (int i = 0; i < tileHeight; ++i) {
+            int row = i*tileWidth;
+            for (int j = 0; j < tileWidth; ++j) {
+                y[j] = rasterData[row + j];
+            }
+            splines[i] = interpolator.interpolate(x, y);
+            columns[i] = i + 0.5d;
+        }
+
+        return splines;
+    }
+
+    protected synchronized PolynomialSplineFunction [] getSplines() {
+        if (splines == null) {
+            splines = createSplines();
+        }
+        return splines;
+    }
+
+    protected double [] columnValues(double x) {
+        PolynomialSplineFunction [] splines = getSplines();
+        double [] y = new double[tileHeight];
+        try {
+            for (int i = 0; i < tileHeight; ++i) {
+                y[i] = splines[i].value(x);
+            }
+        }
+        catch (ArgumentOutsideDomainException aode) {
+            log.error(aode.getLocalizedMessage(), aode);
+        }
+        return y;
+    }
+
+    private final double evaluateBicubicVertical(double x, double y) {
+        try {
+            SplineInterpolator interpolator = new SplineInterpolator();
+            double [] cs = columnValues(x);
+            PolynomialSplineFunction spline = interpolator.interpolate(
+                columns, cs);
+            return spline.value(y);
+        }
+        catch (ArgumentOutsideDomainException aode) {
+            log.error(aode.getLocalizedMessage(), aode);
+        }
+        return 0d;
+    }
+
+    private final double evaluateBicubicHorizonal(int index, double x) {
+        try {
+            PolynomialSplineFunction spline = getSplines()[index];
+            return spline.value(x);
+        }
+        catch (ArgumentOutsideDomainException aode) {
+            log.error(aode.getLocalizedMessage(), aode);
+        }
+        return 0d;
+    }
+
+    public double interpolateBicubic(double px, double py) {
+
+        if (px <= 0.5d) { // left
+            if (py <= 0.5d) { // upper left
+                return rasterData[0];
+            }
+            if (py >= tileHeight-0.5d) {
+                return rasterData[rasterData.length-tileWidth];
+            }
+            return evaluateBicubicVertical(0.5d, py);
+        }
+
+        if (px >= tileWidth-0.5d) { // right
+            if (py < 0.5d) { // upper right edge
+                return rasterData[tileWidth-1];
+            }
+            if (py > tileHeight-0.5d) { // lower right edge
+                return rasterData[rasterData.length-1];
+            }
+            return evaluateBicubicVertical(tileHeight-0.5d, py);
+        }
+
+        if (py <= 0.5d) { // top
+            return evaluateBicubicHorizonal(0, px);
+        }
+
+        if (py >= tileHeight-0.5d) { // bottom
+            return evaluateBicubicHorizonal(tileHeight-1, px);
+        }
+
+        return evaluateBicubicVertical(px, py);
+    }
+
+    public double getValue(Coordinate coordinate, int interpolationType) {
+
+        double px = mx*coordinate.x + bx;
+        double py = my*coordinate.y + by;
+
+        if (px < 0d || py < 0d || px >= tileWidth || py >= tileHeight) {
+            return Double.NaN;
+        }
+
+        switch (interpolationType) {
+            case BILINEAR: return interpolateBilinear(px, py);
+            case BICUBIC : return interpolateBicubic (px, py);
+        }
+
+        int posX = Math.min(tileWidth-1,  (int)Math.round(px));
+        int posY = Math.min(tileHeight-1, (int)Math.round(py));
+
+        return get(posX, posY);
+    }
+
+    public static final int getInterpolationType(String key) {
+        if (key == null || (key = key.trim().toLowerCase()).length() == 0) {
+            return NEAREST_NEIGHBOR;
+        }
+
+        if ("bilinear".equals(key)) {
+            return BILINEAR;
+        }
+
+        if ("bicubic".equals(key)) {
+            return BICUBIC;
+        }
+
+        return NEAREST_NEIGHBOR;
+    }
+}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,68 +1,55 @@
-/**
- * Title:           ResultSet, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ResultSet.java,v 1.2 2008/01/30 12:38:34 blume Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ResultSet.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     21.11.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: blume $
- * modified on:     $Date: 2008/01/30 12:38:34 $
- * Version:         $Revision: 1.2 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.sde.datasources;
-
-import org.apache.log4j.Logger;
-
-/**
- * The class <code>ResultSet</code> fulfills the following purposes:
- * <ol>
- * <li>Providing an abstract object for dealing with result sets.</li>
- * </ol>
- *
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 21.11.2007 09:26:53
- */
-public abstract class ResultSet implements java.sql.ResultSet {
-
-    /**
-     * Default Logging instance
-     */
-    private static Logger sLogger = Logger.getLogger(ResultSet.class);
-
-    /**
-     * Returns the number of hits.
-     *
-     * @return count of results.
-     */
-    public abstract int getCount();
-
-    /**
-     * Returns the number of columns returned through the query.
-     *
-     * @return the number of columns.
-     */
-    public abstract int getNumberOfColumns();
-
-    /**
-     * A ResultSet can tell about the concrete definition of each column.
-     * This method returns an array of {@link de.conterra.bsh.gdi.gnviewer.datasources.ColDefinition}-Objects.
-     *
-     * @return the definitions describing the result set.
-     */
-    public abstract ColDefinition[] getColumnDefinitions();
-
-    /**
-     * Returns an array of Rows. The rows contain the "content" of the current ResultSet.
-     *
-     * @return the results itself.
-     */
-    public abstract Row[] getResults();
-
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>ResultSet</code> fulfills the following purposes:
+ * <ol>
+ * <li>Providing an abstract object for dealing with result sets.</li>
+ * </ol>
+ *
+ * @author blume
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public abstract class ResultSet implements java.sql.ResultSet {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(ResultSet.class);
+
+    /**
+     * Returns the number of hits.
+     * @return count of results.
+     */
+    public abstract int getCount();
+
+    /**
+     * Returns the number of columns returned through the query.
+     * @return the number of columns.
+     */
+    public abstract int getNumberOfColumns();
+
+    /**
+     * A ResultSet can tell about the concrete definition of each column.
+     * This method returns an array of ColDefinition-Objects.
+     * @return the definitions describing the result set.
+     */
+    public abstract ColDefinition[] getColumnDefinitions();
+
+    /**
+     * Returns an array of Rows. The rows contain the "content" of the current ResultSet.
+     *
+     * @return the results itself.
+     */
+    public abstract Row[] getResults();
+
+}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,312 +1,294 @@
-/**
- * Title:           Row, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/Row.java,v 1.4 2008/01/30 12:38:34 blume Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/Row.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     21.11.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: blume $
- * modified on:     $Date: 2008/01/30 12:38:34 $
- * Version:         $Revision: 1.4 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.sde.datasources;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-
-import org.apache.log4j.Logger;
-
-import com.esri.sde.sdk.client.SDEPoint;
-import com.esri.sde.sdk.client.SeException;
-import com.esri.sde.sdk.client.SeShape;
-
-import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
-import de.intevation.gnv.geobackend.util.DateUtils;
-
-/**
- * A Row represents a set of values.
- * In a technical manner (e.g. database manner) a row contains all attributes of a single "hit".
- *
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 21.11.2007 11:00:54
- */
-public class Row {
-
-    /**
-     * Default Logging instance
-     */
-    private static Logger sLogger = Logger.getLogger(Row.class);
-
-    /**
-     * Data container.
-     */
-    private Object[] mObjects;
-
-    /**
-     * Constructor.
-     *
-     * @param pRowSize the number of attributes contained by this row.
-     */
-    public Row(int pRowSize) {
-        mObjects = new Object[pRowSize];
-    }
-    
-    /**
-     * Constructor.
-     *
-     * @param ArrayStr a line from CSV-File.
-     */
-    public Row (String[] ArrayStr){
-    	this (ArrayStr.length);
-    	int nLength = ArrayStr.length;
-    	for (int i=0; i < nLength; i++){
-    		addObject(ArrayStr[i], i);
-    		
-    	}	
-    	
-    }
-    
-    
-    /**
-     * Adds an attribute value to a specific position of this row.
-     *
-     * @param pObject the object to be stored.
-     * @param pPos    the postion the value to be saved
-     */
-    public void addObject(Object pObject, int pPos) {
-        mObjects[pPos] = pObject;
-    }
-
-    /**
-     * Returns a Value out of the Row.
-     *
-     * @param pPos the position of the value to be returned.
-     * @return an Object! (not strongly typed)
-     * @throws TechnicalException
-     */
-    public Object getValue(int pPos) throws TechnicalException {
-        if (pPos < mObjects.length) {
-            
-            Object o =  mObjects[pPos];
-            if (o instanceof SeShape){
-                return this.getPosValue(pPos);
-            }else{
-                return o;
-            }
-        } else {
-            throw new TechnicalException("Cannot access this field position. Size is: " + mObjects.length);
-        }
-    }
-
-
-    /**
-     * This is a covenient method for getting strongly typed objects out of the row.
-     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
-     * In fact, this method executes a simple cast to the desired type.
-     *
-     * @param pPos the position of the object to be resolved.
-     * @return a strongly typed Date
-     * @throws TechnicalException
-     * @see #getValue(int)
-     */
-    public Date getDateValue(int pPos) throws TechnicalException {
-    	Date date =  null;
-        try {
-            Calendar lCalendar = (Calendar) getValue(pPos);
-            date = lCalendar.getTime();
-        } 
-        catch (ClassCastException e) {
-        	try{
-        		//SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
-        		date = DateUtils.getDateFromString ((String)getValue(pPos)); //(Date)formatter.parse((String)getValue(pPos));
-        	    
-        		
-        	}
-        	catch (Exception ex){
-        		sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex);
-        		throw new TechnicalException("Could not cast this value to the Date Type. Object is of value type: " + getValue(pPos).getClass().getName());
-        	}
-        }	
-      
-        return date;
-    }
-
-    /**
-     * This is a covenient method for getting strongly typed objects out of the row.
-     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
-     * In fact, this method executes a simple cast to the desired type.
-     *
-     * @param pPos the position of the object to be resolved.
-     * @return a strongly typed String
-     * @throws TechnicalException
-     * @see #getValue(int)
-     */
-    public String getStringValue(int pPos) throws TechnicalException {
-        try {
-            Object o = this.getValue(pPos);
-            String returnValue = null;
-            if (o instanceof SeShape){
-                returnValue = this.getPosValue(pPos);
-            }else{
-                returnValue = (String)o;
-            }
-            return returnValue;
-        } catch (ClassCastException e) {
-            throw new TechnicalException("Could not cast this value to the String Type. Object is of value type: " + getValue(pPos).getClass().getName());
-        }
-    }
-
-    /**
-     * This is a covenient method for getting strongly typed objects out of the row.
-     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
-     * In fact, this method executes a simple cast to the desired type.
-     *
-     * @param pPos the position of the object to be resolved.
-     * @throws TechnicalException
-     * @see #getValue(int)
-     *      * @return a strongly typed int
-     */
-    public int getIntValue(int pPos) throws TechnicalException {
-        try {
-            return (Integer) getValue(pPos);
-        } catch (ClassCastException e) {
-            throw new TechnicalException("Could not cast this value to the Integer Type. Object is of value type: " + getValue(pPos).getClass().getName());
-        }
-    }
-
-    /**
-     * This is a covenient method for getting strongly typed objects out of the row.
-     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
-     * In fact, this method executes a simple cast to the desired type.
-     *
-     * @param pPos the position of the object to be resolved.
-     * @throws TechnicalException
-     * @see #getValue(int)
-     *      * @return a strongly typed Double
-     */
-    public Double getDoubleValue(int pPos) throws TechnicalException {
-        try {
-            return (Double) getValue(pPos);
-        } catch (ClassCastException e) {
-        	try{
-        		return new Double ((String)getValue(pPos));
-        	}
-        	catch(Exception ex){
-        		sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex);
-        		throw new TechnicalException("Could not cast this value to the Double Type. Object is of value type: " + getValue(pPos).getClass().getName());
-        	}
-        }
-    }
-
-    /**
-     * This is a covenient method for getting strongly typed objects out of the row.
-     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
-     * In fact, this method executes a simple cast to the desired type.
-     *
-     * @param pPos the position of the object to be resolved.
-     * @return a strongly typed Float
-     * @throws TechnicalException
-     * @see #getValue(int)
-     */
-    public Float getFloatValue(int pPos) throws TechnicalException {
-        try {
-            return (Float) getValue(pPos);
-        } catch (ClassCastException e) {
-            throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName());
-        }
-    }
-    /**
-     * This is a covenient method for getting strongly typed objects out of the row.
-     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
-     * In fact, this method executes a simple cast to the desired type.
-     *
-     * @param pPos the position of the object to be resolved.
-     * @return a strongly typed Float
-     * @throws TechnicalException
-     * @see #getValue(int)
-     */    
-    public String getPosValue(int pPos)throws TechnicalException{
-        SeShape val;
-        ArrayList aList;
-        SDEPoint mPoint[];
-        StringBuffer returnValue = new StringBuffer();
-        synchronized (returnValue) {
-            try {
-                val = (SeShape) this.mObjects[pPos];
-                aList = val.getAllPoints(0,false);
-                mPoint = (SDEPoint[])aList.get(0);
-                if (val.isPoint()){
-                    returnValue.append("POINT(")
-                               .append(mPoint[0].getX())
-                               .append(" ")
-                               .append(mPoint[0].getY());
-                                if (mPoint[0].is3D()){
-                                   returnValue.append(" ")
-                                   .append(mPoint[0].getZ());
-                               }
-                                returnValue.append(")");
-                }else if (val.isLine()){
-                    returnValue.append("LINESTRING(");
-                    for (int i = 0; i< mPoint.length;i++){
-                        returnValue.append(mPoint[i].getX())
-                                   .append(" ")
-                                   .append(mPoint[i].getY());
-                                    if (mPoint[i].is3D()){
-                                        returnValue.append(" ")
-                                        .append(mPoint[i].getZ());
-                                    }
-                        if (i < mPoint.length-1){
-                            returnValue.append(" , ");
-                        }
-                    }
-                    returnValue.append(")");
-                } else if (val.isPolygon()){
-                    returnValue.append("POLYGON((");
-                    int length = mPoint.length;
-                    for (int i = 0; i< length ;i++){
-                       SDEPoint p = mPoint[i];
-                       returnValue.append(p.getX())
-                                   .append(" ")
-                                   .append(p.getY());
-                       if (p.is3D()){
-                           returnValue.append(" ")
-                                      .append(p.getZ());
-                       }
-                       if (i < length-1){
-                           returnValue.append(" , ");
-                       }
-                    }
-                    returnValue.append(")");
-                    // TODO Wie werden innere Ringe unterstützt.
-//                    for (int i =1 ; i < aList.size(); i++){
-//                        returnValue.append("(");
-//                        mPoint = (SDEPoint[])aList.get(i);
-//                        for (int j = 0; j < mPoint.length;j++){
-//                            returnValue.append(mPoint[j].getX())
-//                                       .append(" ")
-//                                       .append(mPoint[j].getY())
-//                                       .append(" ")
-//                                       .append(mPoint[i].getZ());
-//                            if (i < mPoint.length-1){
-//                                returnValue.append(" , ");
-//                            }
-//                        }
-//                        returnValue.append(")");
-//                    }
-                    returnValue.append(")");
-                }
-            } catch (SeException e) {
-                throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName());   
-            }
-        }
-        return returnValue.toString();
-    }
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import com.esri.sde.sdk.client.SDEPoint;
+import com.esri.sde.sdk.client.SeException;
+import com.esri.sde.sdk.client.SeShape;
+
+import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
+
+import de.intevation.gnv.geobackend.util.DateUtils;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.log4j.Logger;
+
+/**
+ * A Row represents a set of values.
+ * In a technical manner (e.g. database manner) a row contains all attributes of a single "hit".
+ *
+ * @author blume
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class Row {
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(Row.class);
+
+    /**
+     * Data container.
+     */
+    private Object[] mObjects;
+
+    /**
+     * Constructor.
+     * @param pRowSize the number of attributes contained by this row.
+     */
+    public Row(int pRowSize) {
+        mObjects = new Object[pRowSize];
+    }
+
+    /**
+     * Constructor.
+     * @param ArrayStr a line from CSV-File.
+     */
+    public Row (String[] ArrayStr){
+        this (ArrayStr.length);
+        int nLength = ArrayStr.length;
+        for (int i=0; i < nLength; i++){
+            addObject(ArrayStr[i], i);
+
+        }
+
+    }
+
+    /**
+     * Adds an attribute value to a specific position of this row.
+     *
+     * @param pObject the object to be stored.
+     * @param pPos    the postion the value to be saved
+     */
+    public void addObject(Object pObject, int pPos) {
+        mObjects[pPos] = pObject;
+    }
+
+    /**
+     * Returns a Value out of the Row.
+     *
+     * @param pPos the position of the value to be returned.
+     * @return an Object! (not strongly typed)
+     * @throws TechnicalException
+     */
+    public Object getValue(int pPos) throws TechnicalException {
+        if (pPos < mObjects.length) {
+
+            Object o =  mObjects[pPos];
+            if (o instanceof SeShape){
+                return this.getPosValue(pPos);
+            }else{
+                return o;
+            }
+        } else {
+            throw new TechnicalException("Cannot access this field position. Size is: " + mObjects.length);
+        }
+    }
+
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @return a strongly typed Date
+     * @throws TechnicalException
+     * @see #getValue(int)
+     */
+    public Date getDateValue(int pPos) throws TechnicalException {
+        Date date =  null;
+        try {
+            Calendar lCalendar = (Calendar) getValue(pPos);
+            date = lCalendar.getTime();
+        }
+        catch (ClassCastException e) {
+            try{
+                //SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
+                date = DateUtils.getDateFromString ((String)getValue(pPos)); //(Date)formatter.parse((String)getValue(pPos));
+
+
+            }
+            catch (Exception ex){
+                sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex);
+                throw new TechnicalException("Could not cast this value to the Date Type. Object is of value type: " + getValue(pPos).getClass().getName());
+            }
+        }
+
+        return date;
+    }
+
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @return a strongly typed String
+     * @throws TechnicalException
+     * @see #getValue(int)
+     */
+    public String getStringValue(int pPos) throws TechnicalException {
+        try {
+            Object o = this.getValue(pPos);
+            String returnValue = null;
+            if (o instanceof SeShape){
+                returnValue = this.getPosValue(pPos);
+            }else{
+                returnValue = (String)o;
+            }
+            return returnValue;
+        } catch (ClassCastException e) {
+            throw new TechnicalException("Could not cast this value to the String Type. Object is of value type: " + getValue(pPos).getClass().getName());
+        }
+    }
+
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @throws TechnicalException
+     * @see #getValue(int)
+     *      * @return a strongly typed int
+     */
+    public int getIntValue(int pPos) throws TechnicalException {
+        try {
+            return (Integer) getValue(pPos);
+        } catch (ClassCastException e) {
+            throw new TechnicalException("Could not cast this value to the Integer Type. Object is of value type: " + getValue(pPos).getClass().getName());
+        }
+    }
+
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @throws TechnicalException
+     * @see #getValue(int)
+     *      * @return a strongly typed Double
+     */
+    public Double getDoubleValue(int pPos) throws TechnicalException {
+        try {
+            return (Double) getValue(pPos);
+        } catch (ClassCastException e) {
+            try{
+                return new Double ((String)getValue(pPos));
+            }
+            catch(Exception ex){
+                sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex);
+                throw new TechnicalException("Could not cast this value to the Double Type. Object is of value type: " + getValue(pPos).getClass().getName());
+            }
+        }
+    }
+
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @return a strongly typed Float
+     * @throws TechnicalException
+     * @see #getValue(int)
+     */
+    public Float getFloatValue(int pPos) throws TechnicalException {
+        try {
+            return (Float) getValue(pPos);
+        } catch (ClassCastException e) {
+            throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName());
+        }
+    }
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @return a strongly typed Float
+     * @throws TechnicalException
+     * @see #getValue(int)
+     */
+    public String getPosValue(int pPos)throws TechnicalException{
+        StringBuffer returnValue = new StringBuffer();
+        synchronized (returnValue) {
+            try {
+                SeShape val = (SeShape) this.mObjects[pPos];
+                if (val.isPoint()){
+                    // Cannot use val.asText() because the
+                    // generated WKT is invalid.
+                    ArrayList aList = val.getAllPoints(0,false);
+                    SDEPoint[] mPoint = (SDEPoint[])aList.get(0);
+                    returnValue.append("POINT(")
+                               .append(mPoint[0].getX())
+                               .append(" ")
+                               .append(mPoint[0].getY());
+                    if (mPoint[0].is3D()){
+                       returnValue.append(" ").append(mPoint[0].getZ());
+                    }
+                    returnValue.append(")");
+                }else if (val.isLine() || val.isSimpleLine()){
+                    // Cannot use val.asText() because the
+                    // generated WKT is invalid.
+                    ArrayList aList = val.getAllPoints(0,false);
+                    SDEPoint[] mPoint = (SDEPoint[])aList.get(0);
+                    boolean isMultiLineString = val.isMultiPart();
+                    int length = mPoint.length;
+                    int nextOffset = length;
+                    int[] offsets = (int[])aList.get(1);
+                    int offsetPos = 1;
+
+                    if(isMultiLineString){
+                        returnValue.append("MULTILINESTRING((");
+                        nextOffset = offsets.length-1 >= offsetPos ? offsets[offsetPos++] : length;
+                    }else{
+                        returnValue.append("LINESTRING(");
+                    }
+
+                    for (int i = 0; i< length;i++){
+
+                        if (i == nextOffset){
+                            returnValue.append("),(");
+                            nextOffset = offsets.length-1 >= offsetPos ? offsets[offsetPos++] : length;
+                        }
+
+                        returnValue.append(mPoint[i].getX())
+                                   .append(" ")
+                                   .append(mPoint[i].getY());
+                        if (mPoint[i].is3D()){
+                            returnValue.append(" ").append(mPoint[i].getZ());
+                        }
+                        if (i < length-1 && i < nextOffset -1){
+                            returnValue.append(" , ");
+                        }
+                    }
+
+                    if(isMultiLineString){
+                        returnValue.append("))");
+                    }else{
+                        returnValue.append(")");
+                    }
+
+                } else{
+                    returnValue.append(val.asText(val.getTextSize()));
+                }
+            } catch (SeException e) {
+                throw new TechnicalException("Could not cast this value to the " +
+                                             "Float Type. Object is of value " +
+                                             "type: " +
+                                             getValue(pPos).getClass().getName());
+            }
+        }
+        return returnValue.toString();
+    }
+}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,383 +0,0 @@
-/**
- * Title:           SdeQuery, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEQuery.java,v 1.3 2008/01/30 12:38:34 blume Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEQuery.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     21.11.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: blume $
- * modified on:     $Date: 2008/01/30 12:38:34 $
- * Version:         $Revision: 1.3 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.sde.datasources;
-
-import java.sql.Connection;
-import java.sql.Statement;
-
-import org.apache.log4j.Logger;
-
-import com.esri.sde.sdk.client.SDEPoint;
-import com.esri.sde.sdk.client.SeColumnDefinition;
-import com.esri.sde.sdk.client.SeConnection;
-import com.esri.sde.sdk.client.SeCoordinateReference;
-import com.esri.sde.sdk.client.SeException;
-import com.esri.sde.sdk.client.SeFilter;
-import com.esri.sde.sdk.client.SeLayer;
-import com.esri.sde.sdk.client.SeQuery;
-import com.esri.sde.sdk.client.SeRow;
-import com.esri.sde.sdk.client.SeShape;
-import com.esri.sde.sdk.client.SeShapeFilter;
-import com.esri.sde.sdk.client.SeSqlConstruct;
-
-import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool;
-import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
-import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
-
-/**
- * // todo: supply a general interface for Query-Objects (Query = read access to datasource implementation)
- *
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 21.11.2007 11:32:19
- */
-public class SDEQuery {
-
-    /**
-     * Default Logging instance
-     */
-    private static final Logger sLogger = Logger.getLogger(SDEQuery.class);
-    private static boolean sDebug = sLogger.isDebugEnabled();
-
-
-    private ConnectionPool connectionPool = null;
-    private String connectionID = "N/N";
-
-    public SDEQuery(ConnectionPool connectionPool) {
-        if (sDebug) sLogger.debug("SDEQuery()");
-        this.connectionPool = connectionPool;
-    }
-
-    /**
-     * Execute a query against a sde datasource.
-     * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object.
-     *
-     * @param pTables
-     * @param pCols
-     * @param pWhere  the where-clause to be executed.
-     * @return a ResultSet
-     * @see SeSqlConstruct
-     * @see SeQuery
-     */
-    public ResultSet executeQuery(String pTables[], String pCols[], String pWhere) throws TechnicalException {
-        sLogger.debug("executeQuery()");
-        Connection con = null;
-        try {
-            con = getConnection();
-//            SeSqlConstruct lSeSqlConstruct = new SeSqlConstruct(pTables, pWhere);
-//            SeQuery lSeQuery = new SeQuery(con, pCols, lSeSqlConstruct);
-//            long lStart = System.currentTimeMillis();
-//            lSeQuery.prepareQuery();
-            ResultSet lSet = null;//handleResultSet(lSeQuery);
-//            long lEnd = System.currentTimeMillis();
-//            if (sDebug)
-//                sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString());
-            return lSet;
-        } catch (TechnicalException e) {
-            sLogger.error(e.getMessage(), e);
-            throw e;
-        } catch (Exception e) {
-            sLogger.error(e.getMessage(), e);
-            throw new TechnicalException("Error during executeQuery", e);
-        } finally {
-            returnConnection(con);
-        }
-
-    }
-
-    /**
-     * Execute a query against a sde datasource.
-     * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object.
-     *
-     * @param pSQLStatement the SQL-Statement to be executed.
-     * @return a ResultSet
-     * @see SeQuery
-     */
-    public ResultSet executeQuery(String pSQLStatement) throws TechnicalException {
-        if (sDebug) sLogger.debug("executeQuery():\n" + pSQLStatement);
-        Connection con = null;
-        try {
-            con = getConnection();
-
-
-            long lStart = System.currentTimeMillis();
-            
-            Statement stmt = con.createStatement();
-            java.sql.ResultSet rs = stmt.executeQuery(pSQLStatement);
-            
-            long lEnd = System.currentTimeMillis();
-            if (sDebug)
-                sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString());
-            return (ResultSet)rs;
-        } catch (TechnicalException e) {
-            sLogger.error(e.getMessage(), e);
-            throw e;
-        } catch (Exception e) {
-            sLogger.error(e.getMessage(), e);
-            throw new TechnicalException("Error during executeQuery", e);
-        } finally {
-            returnConnection(con);
-        }
-
-
-    }
-    
-//    /**
-//     * Execute a query against a sde datasource.
-//     * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object.
-//     *
-//     * @param pSQLStatement the SQL-Statement to be executed.
-//     * @return File
-//     * @see SeQuery
-//     */
-//    public TempFile  executeQueryDiagram (String pSQLStatement) throws TechnicalException {
-//        if (sDebug) sLogger.debug("executeQueryDiagram():\n" + pSQLStatement);
-//        SeConnection con = null;
-//        TempFile lImageFile = null;
-//        try {
-//            con = getConnection();
-//
-//            SeQuery lSeQuery = new SeQuery(con);
-//            long lStart = System.currentTimeMillis();
-//            lSeQuery.prepareSql(pSQLStatement);
-//            lSeQuery.execute();
-//
-//            //ResultSet lSet = handleResultSet(lSeQuery);
-//            lImageFile = handleRowToCSVFile(lSeQuery);
-//            
-//
-//            long lEnd = System.currentTimeMillis();
-//            if (sDebug)
-//                sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString());
-//            
-//        } catch (TechnicalException e) {
-//            sLogger.error(e.getMessage(), e);
-//            throw e;
-//        } catch (SeException e) {
-//            sLogger.error(e.getMessage(), e);
-//            throw new TechnicalException("Error during executeQuery", e);
-//        } finally {
-//            returnConnection(con);
-//        }
-//        return lImageFile;
-//
-//    }
-
-    /**
-     * Execute a spatial query against a sde datasource.
-     * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object.
-     * // todo: there is work needed to fully implement the wanted functionality.
-     *
-     * @param pLayername
-     * @param pSpatialColumnName
-     * @param pPoints
-     * @param pReturnFields
-     * @return a ResultSet
-     * @see SeShapeFilter
-     * @see SeQuery
-     */
-    public ResultSet executeQuery(String pLayername, String pSpatialColumnName, double[][] pPoints, String[] pReturnFields) throws TechnicalException {
-        sLogger.debug("executeQuery()");
-        Connection con = null;
-        try {
-            con = getConnection();
-//            // get the layer for querying
-//            SeLayer lLayer = new SeLayer(con, pLayername, pSpatialColumnName);
-//            SeCoordinateReference cref = lLayer.getCoordRef();
-//
-//
-//            SeShape shape = new SeShape();
-//            shape.setCoordRef(lLayer.getCoordRef());
-//            SDEPoint[] lPoints = ArcSDEUtils.createPoints(pPoints);
-//
-//            /*
-//            * int numPts, int numParts, int[] partOffsets,SDEPoint[] ptArray
-//            * */
-//            shape.generatePolygon(lPoints.length, 1, null, lPoints);
-//            SeShapeFilter filter = new SeShapeFilter(pLayername, pSpatialColumnName, shape, SeFilter.METHOD_AI);
-//            SeShapeFilter[] filters = new SeShapeFilter[1];
-//            filters[0] = filter;
-//
-//            SeQuery spatialQuery = null;
-//            SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername);
-//            spatialQuery = new SeQuery(con, pReturnFields, sqlCons);
-//            spatialQuery.prepareQuery();
-//            /*
-//            *   Set spatial constraints
-//            */
-//            spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, filters);
-//            spatialQuery.execute();
-
-            return null;//handleResultSet(spatialQuery);
-
-        } catch (TechnicalException e) {
-            sLogger.error(e.getMessage(), e);
-            throw e;
-        } catch (Exception e) {
-            sLogger.error(e.getMessage(), e);
-            throw new TechnicalException("Error accessing Spatial Database: " + e.getMessage(), e);
-        } finally {
-            returnConnection(con);
-        }
-    }
-    /**
-     * Execute a spatial query against a sde datasource.
-     * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object.
-     * // todo: there is work needed to fully implement the wanted functionality.
-     *
-     * @param pLayername
-     * @param pSpatialColumnName
-     * @param pPoints
-     * @param pReturnFields
-     * @return a ResultSet
-     * @see SeShapeFilter
-     * @see SeQuery
-     */
-    public ResultSet executeQuery(String pLayername, String pSpatialColumnName, String pWhere, double[][] pPoints, String[] pReturnFields) throws TechnicalException {
-        sLogger.debug("executeQuery()");
-        Connection con = null;
-        try {
-            con = getConnection();
-//            // get the layer for querying
-//            SeLayer lLayer = new SeLayer(con, pLayername, pSpatialColumnName);
-//            SeCoordinateReference cref = lLayer.getCoordRef();
-//
-//
-//            SeShape shape = new SeShape();
-//            shape.setCoordRef(lLayer.getCoordRef());
-//            SDEPoint[] lPoints = ArcSDEUtils.createPoints(pPoints);
-//
-//            /*
-//            * int numPts, int numParts, int[] partOffsets,SDEPoint[] ptArray
-//            * */
-//            shape.generatePolygon(lPoints.length, 1, null, lPoints);
-//            SeShapeFilter filter = new SeShapeFilter(pLayername, pSpatialColumnName, shape, SeFilter.METHOD_AI);
-//            SeShapeFilter[] filters = new SeShapeFilter[1];
-//            filters[0] = filter;
-//
-//            SeQuery spatialQuery = null;
-//            SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername,pWhere);
-//            spatialQuery = new SeQuery(con, pReturnFields, sqlCons);
-//            spatialQuery.prepareQuery();
-//            /*
-//            *   Set spatial constraints
-//            */
-//            spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, filters);
-//            spatialQuery.execute();
-
-            return null;//handleResultSet(spatialQuery);
-
-        } catch (TechnicalException e) {
-            sLogger.error(e.getMessage(), e);
-            throw e;
-        } catch (Exception e) {
-            sLogger.error(e.getMessage(), e);
-            throw new TechnicalException("Error accessing Spatial Database: " + e.getMessage(), e);
-        } finally {
-            returnConnection(con);
-        }
-    }
-    private Connection getConnection() throws TechnicalException {
-    	Connection  connection = connectionPool.getConnection(connectionID);
-        return connection;
-    }
-
-    private void returnConnection(Connection connection) {
-        try {
-	        this.connectionPool.closeConnection(connection);
-        } catch (ConnectionException e) {
-        	sLogger.error(e,e);
-        }
-    }
-
-
-    private ResultSet handleResultSet(SeQuery pSeQuery) throws SeException {
-        sLogger.debug("handleResultSet()");
-        SDEResultSet lSet = new SDEResultSet();
-        SeRow row;
-        int lCount;
-        for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) {
-            // one time execution
-            if (lCount == 0) {
-                // analyze cols of result set
-                SeColumnDefinition[] lCols = row.getColumns();
-                for (SeColumnDefinition lCol : lCols) {
-                    lSet.addCol(new ColDefinition(lCol.getName(), lCol.getType()));// notice: esri-types have been copied into colDefinition class!
-                }
-            }
-            short lNumCols = row.getNumColumns();
-            Row lBackingRow = new Row(lNumCols);
-            for (int i = 0; i < lNumCols; i++) {
-                lBackingRow.addObject(row.getObject(i), i);
-            }
-            lSet.addRow(lBackingRow);
-        }
-        pSeQuery.close();
-        return lSet;
-    }
- 
-//    private TempFile handleRowToCSVFile(SeQuery pSeQuery) throws SeException {
-//        sLogger.debug("handleRowToTempFile()");
-//        TempFile lImageFile = TemporaryFileDirectory.getInstance().createFile(".csv");
-//        sLogger.debug("handleRowToTempFile() erstellen " + lImageFile.getFile().getName());
-//        CSVWriter writer = null;
-//        ColDefinition[] lColDefinitions = null;
-//        
-//        SeRow row;
-//        int lCount;
-//        try {
-//	        writer = new CSVWriter(new FileWriter(lImageFile.getFile()), ';');
-//	        for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) {
-//	            // one time execution
-//	            if (lCount == 0) {
-//	            	lColDefinitions = new ColDefinition[row.getNumColumns()];
-//	                // analyze cols of result set
-//	                SeColumnDefinition[] lCols = row.getColumns();
-//	                int j = 0;
-//	                for (SeColumnDefinition lCol : lCols) {
-//	                	lColDefinitions[j] = new ColDefinition(lCol.getName(), lCol.getType());
-//	                	j = j + 1;
-//	                }
-//	            }
-//	            short lNumCols = row.getNumColumns();
-//	            Row lBackingRow = new Row(lNumCols);
-//	            for (int i = 0; i < lNumCols; i++) {
-//	                lBackingRow.addObject(row.getObject(i), i);
-//	            }
-//	          
-//	            writer.writeRow(lBackingRow,lColDefinitions, false);
-//	        }
-//        } catch (IOException e) {
-//        	 sLogger.error(e.getMessage(), e);
-//        } catch (TechnicalException e) {
-//        	 sLogger.error(e.getMessage(), e);     
-//        }
-//        finally {
-//        	pSeQuery.close();
-//        	try{
-//        	writer.close();
-//        	}
-//        	catch (Exception e){
-//        		sLogger.error(e.getMessage(), e);
-//        	}
-//        }
-//        
-//        return lImageFile;
-//    }
-
-}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,1351 +1,1516 @@
-/**
- * Title:           SDEResultSet, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEResultSet.java,v 1.2 2008/01/30 12:38:34 blume Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEResultSet.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     21.11.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: blume $
- * modified on:     $Date: 2008/01/30 12:38:34 $
- * Version:         $Revision: 1.2 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.sde.datasources;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.math.BigDecimal;
-import java.net.URL;
-import java.sql.Array;
-import java.sql.Blob;
-import java.sql.Clob;
-import java.sql.Date;
-import java.sql.NClob;
-import java.sql.Ref;
-import java.sql.ResultSetMetaData;
-import java.sql.RowId;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.SQLXML;
-import java.sql.Statement;
-import java.sql.Time;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-
-import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
-
-/**
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 21.11.2007 11:01:27
- */
-public class SDEResultSet extends ResultSet {
-    
-   /**
-     * Default Logging instance
-     */
-    private static Logger log = Logger.getLogger(SDEResultSet.class);
-    
-    private List<Row> mRows = Collections.synchronizedList(new ArrayList<Row>());
-    private List<ColDefinition> mCols = Collections.synchronizedList(new ArrayList<ColDefinition>());
-    
-    private Row currentRow = null;
-    private int cursor = 0;
-    
-    public SDEResultSet() {
-    }
-    
-    public int getCount() {
-    	return mRows.size();
-    }
-    
-    public int getNumberOfColumns() {
-    	return mCols.size();
-    }
-    
-    public ColDefinition[] getColumnDefinitions() {
-    	ColDefinition[] lColDefinitions = new ColDefinition[mCols.size()];
-    	return mCols.toArray(lColDefinitions);
-    }
-    
-    public Row[] getResults() {
-    	Row[] lRows = new Row[mRows.size()];
-    	return mRows.toArray(lRows);
-    }
-    
-    public void addRow(Row pRow) {
-    	mRows.add(pRow);
-    }
-    
-    public void addCol(ColDefinition pColDefinition) {
-    	mCols.add(pColDefinition);
-    }
-    
-    /**
-     * @see java.sql.ResultSet#absolute(int)
-     */
-    public boolean absolute(int row) throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#afterLast()
-     */
-    public void afterLast() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#beforeFirst()
-     */
-    public void beforeFirst() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#cancelRowUpdates()
-     */
-    public void cancelRowUpdates() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#clearWarnings()
-     */
-    public void clearWarnings() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#close()
-     */
-    public void close() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#deleteRow()
-     */
-    public void deleteRow() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#findColumn(java.lang.String)
-     */
-    public int findColumn(String columnName) throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#first()
-     */
-    public boolean first() throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getArray(int)
-     */
-    public Array getArray(int i) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getArray(java.lang.String)
-     */
-    public Array getArray(String colName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getAsciiStream(int)
-     */
-    public InputStream getAsciiStream(int columnIndex) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getAsciiStream(java.lang.String)
-     */
-    public InputStream getAsciiStream(String columnName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBigDecimal(int)
-     */
-    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBigDecimal(java.lang.String)
-     */
-    public BigDecimal getBigDecimal(String columnName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBigDecimal(int, int)
-     */
-    public BigDecimal getBigDecimal(int columnIndex, int scale)
-            throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int)
-     */
-    public BigDecimal getBigDecimal(String columnName, int scale)
-            throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBinaryStream(int)
-     */
-    public InputStream getBinaryStream(int columnIndex) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBinaryStream(java.lang.String)
-     */
-    public InputStream getBinaryStream(String columnName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBlob(int)
-     */
-    public Blob getBlob(int i) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBlob(java.lang.String)
-     */
-    public Blob getBlob(String colName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBoolean(int)
-     */
-    public boolean getBoolean(int columnIndex) throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBoolean(java.lang.String)
-     */
-    public boolean getBoolean(String columnName) throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getByte(int)
-     */
-    public byte getByte(int columnIndex) throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getByte(java.lang.String)
-     */
-    public byte getByte(String columnName) throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBytes(int)
-     */
-    public byte[] getBytes(int columnIndex) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getBytes(java.lang.String)
-     */
-    public byte[] getBytes(String columnName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getCharacterStream(int)
-     */
-    public Reader getCharacterStream(int columnIndex) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getCharacterStream(java.lang.String)
-     */
-    public Reader getCharacterStream(String columnName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getClob(int)
-     */
-    public Clob getClob(int i) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getClob(java.lang.String)
-     */
-    public Clob getClob(String colName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getConcurrency()
-     */
-    public int getConcurrency() throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getCursorName()
-     */
-    public String getCursorName() throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getDate(int)
-     */
-    public Date getDate(int columnIndex) throws SQLException {
-    	try {
-            return new java.sql.Date(this.currentRow.getDateValue(columnIndex-1).getTime());
-        } catch (TechnicalException e) {
-            log.error(e,e);
-            throw new SQLException(e.getMessage());
-        }
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getDate(java.lang.String)
-     */
-    public Date getDate(String columnName) throws SQLException {
-    	int columnIndex = this.getColumnIndex(columnName);
-    	return this.getDate(columnIndex);
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getDate(int, java.util.Calendar)
-     */
-    public Date getDate(int columnIndex, Calendar cal) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar)
-     */
-    public Date getDate(String columnName, Calendar cal) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getDouble(int)
-     */
-    public double getDouble(int columnIndex) throws SQLException {
-    	try {
-            return this.currentRow.getDoubleValue(columnIndex-1);
-        } catch (TechnicalException e) {
-            log.error(e,e);
-            throw new SQLException(e.getMessage());
-        }
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getDouble(java.lang.String)
-     */
-    public double getDouble(String columnName) throws SQLException {
-    	int columnIndex = this.getColumnIndex(columnName);
-    	return this.getDouble(columnIndex);
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getFetchDirection()
-     */
-    public int getFetchDirection() throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getFetchSize()
-     */
-    public int getFetchSize() throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getFloat(int)
-     */
-    public float getFloat(int columnIndex) throws SQLException {
-    	try {
-            return this.currentRow.getFloatValue(columnIndex-1);
-        } catch (TechnicalException e) {
-            log.error(e,e);
-            throw new SQLException(e.getMessage());
-        }
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getFloat(java.lang.String)
-     */
-    public float getFloat(String columnName) throws SQLException {
-    	int columnIndex = this.getColumnIndex(columnName);
-    	return this.getFloat(columnIndex);
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getInt(int)
-     */
-    public int getInt(int columnIndex) throws SQLException {
-    
-    	try {
-            return this.currentRow.getIntValue(columnIndex-1);
-        } catch (TechnicalException e) {
-            log.error(e,e);
-            throw new SQLException(e.getMessage());
-        }
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getInt(java.lang.String)
-     */
-    public int getInt(String columnName) throws SQLException {
-    	int columnIndex = this.getColumnIndex(columnName);
-    	return this.getInt(columnIndex);
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getLong(int)
-     */
-    public long getLong(int columnIndex) throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getLong(java.lang.String)
-     */
-    public long getLong(String columnName) throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getMetaData()
-     */
-    public ResultSetMetaData getMetaData() throws SQLException {
-        log.debug("SDEREsultSet.getMetaData");
-        return new ArcSDEResultSetMetaData(this.mCols);
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getObject(int)
-     */
-    public Object getObject(int columnIndex) throws SQLException {
-    	try {
-            return this.currentRow.getValue(columnIndex-1);
-        } catch (TechnicalException e) {
-            log.error(e,e);
-            throw new SQLException(e.getMessage());
-        }
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getObject(java.lang.String)
-     */
-    public Object getObject(String columnName) throws SQLException {
-    	int columnIndex = this.getColumnIndex(columnName);
-    	return this.getObject(columnIndex);
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getObject(int, java.util.Map)
-     */
-    public Object getObject(int i, Map<String, Class<?>> map)
-            throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map)
-     */
-    public Object getObject(String colName, Map<String, Class<?>> map)
-            throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getRef(int)
-     */
-    public Ref getRef(int i) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getRef(java.lang.String)
-     */
-    public Ref getRef(String colName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getRow()
-     */
-    public int getRow() throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getShort(int)
-     */
-    public short getShort(int columnIndex) throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getShort(java.lang.String)
-     */
-    public short getShort(String columnName) throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getStatement()
-     */
-    public Statement getStatement() throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getString(int)
-     */
-    public String getString(int columnIndex) throws SQLException {
-    
-    	try {
-            return this.currentRow.getStringValue(columnIndex-1);
-        } catch (TechnicalException e) {
-            log.error(e,e);
-            throw new SQLException(e.getMessage());
-        }
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getString(java.lang.String)
-     */
-    public String getString(String columnName) throws SQLException {
-    	int columnIndex = this.getColumnIndex(columnName);
-    	return this.getString(columnIndex);
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getTime(int)
-     */
-    public Time getTime(int columnIndex) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getTime(java.lang.String)
-     */
-    public Time getTime(String columnName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getTime(int, java.util.Calendar)
-     */
-    public Time getTime(int columnIndex, Calendar cal) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar)
-     */
-    public Time getTime(String columnName, Calendar cal) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getTimestamp(int)
-     */
-    public Timestamp getTimestamp(int columnIndex) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getTimestamp(java.lang.String)
-     */
-    public Timestamp getTimestamp(String columnName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
-     */
-    public Timestamp getTimestamp(int columnIndex, Calendar cal)
-            throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getTimestamp(java.lang.String,
-     *      java.util.Calendar)
-     */
-    public Timestamp getTimestamp(String columnName, Calendar cal)
-            throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getType()
-     */
-    public int getType() throws SQLException {
-    
-    	return 0;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getURL(int)
-     */
-    public URL getURL(int columnIndex) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getURL(java.lang.String)
-     */
-    public URL getURL(String columnName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getUnicodeStream(int)
-     */
-    public InputStream getUnicodeStream(int columnIndex) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getUnicodeStream(java.lang.String)
-     */
-    public InputStream getUnicodeStream(String columnName) throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#getWarnings()
-     */
-    public SQLWarning getWarnings() throws SQLException {
-    
-    	return null;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#insertRow()
-     */
-    public void insertRow() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#isAfterLast()
-     */
-    public boolean isAfterLast() throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#isBeforeFirst()
-     */
-    public boolean isBeforeFirst() throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#isFirst()
-     */
-    public boolean isFirst() throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#isLast()
-     */
-    public boolean isLast() throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#last()
-     */
-    public boolean last() throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#moveToCurrentRow()
-     */
-    public void moveToCurrentRow() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#moveToInsertRow()
-     */
-    public void moveToInsertRow() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#next()
-     */
-    public boolean next() throws SQLException {
-    	
-    	boolean next = this.mRows.size() > this.cursor;
-    	if (next){
-    		//log.debug("Zeile "+(cursor+1)+" von "+this.mRows.size()+" wird angesteuert.");
-    		this.currentRow = this.mRows.get(this.cursor);
-    		this.cursor++;
-    	}else{
-    		this.currentRow = null;
-    	}
-    	return next;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#previous()
-     */
-    public boolean previous() throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#refreshRow()
-     */
-    public void refreshRow() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#relative(int)
-     */
-    public boolean relative(int rows) throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#rowDeleted()
-     */
-    public boolean rowDeleted() throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#rowInserted()
-     */
-    public boolean rowInserted() throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#rowUpdated()
-     */
-    public boolean rowUpdated() throws SQLException {
-    
-    	return false;
-    }
-    
-    /**
-     * @see java.sql.ResultSet#setFetchDirection(int)
-     */
-    public void setFetchDirection(int direction) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#setFetchSize(int)
-     */
-    public void setFetchSize(int rows) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateArray(int, java.sql.Array)
-     */
-    public void updateArray(int columnIndex, Array x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateArray(java.lang.String, java.sql.Array)
-     */
-    public void updateArray(String columnName, Array x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int)
-     */
-    public void updateAsciiStream(int columnIndex, InputStream x, int length)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateAsciiStream(java.lang.String,
-     *      java.io.InputStream, int)
-     */
-    public void updateAsciiStream(String columnName, InputStream x, int length)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateBigDecimal(int, java.math.BigDecimal)
-     */
-    public void updateBigDecimal(int columnIndex, BigDecimal x)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateBigDecimal(java.lang.String,
-     *      java.math.BigDecimal)
-     */
-    public void updateBigDecimal(String columnName, BigDecimal x)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int)
-     */
-    public void updateBinaryStream(int columnIndex, InputStream x, int length)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateBinaryStream(java.lang.String,
-     *      java.io.InputStream, int)
-     */
-    public void updateBinaryStream(String columnName, InputStream x, int length)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateBlob(int, java.sql.Blob)
-     */
-    public void updateBlob(int columnIndex, Blob x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateBlob(java.lang.String, java.sql.Blob)
-     */
-    public void updateBlob(String columnName, Blob x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateBoolean(int, boolean)
-     */
-    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateBoolean(java.lang.String, boolean)
-     */
-    public void updateBoolean(String columnName, boolean x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateByte(int, byte)
-     */
-    public void updateByte(int columnIndex, byte x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateByte(java.lang.String, byte)
-     */
-    public void updateByte(String columnName, byte x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateBytes(int, byte[])
-     */
-    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateBytes(java.lang.String, byte[])
-     */
-    public void updateBytes(String columnName, byte[] x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int)
-     */
-    public void updateCharacterStream(int columnIndex, Reader x, int length)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateCharacterStream(java.lang.String,
-     *      java.io.Reader, int)
-     */
-    public void updateCharacterStream(String columnName, Reader reader,
-            int length) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateClob(int, java.sql.Clob)
-     */
-    public void updateClob(int columnIndex, Clob x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateClob(java.lang.String, java.sql.Clob)
-     */
-    public void updateClob(String columnName, Clob x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateDate(int, java.sql.Date)
-     */
-    public void updateDate(int columnIndex, Date x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateDate(java.lang.String, java.sql.Date)
-     */
-    public void updateDate(String columnName, Date x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateDouble(int, double)
-     */
-    public void updateDouble(int columnIndex, double x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateDouble(java.lang.String, double)
-     */
-    public void updateDouble(String columnName, double x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateFloat(int, float)
-     */
-    public void updateFloat(int columnIndex, float x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateFloat(java.lang.String, float)
-     */
-    public void updateFloat(String columnName, float x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateInt(int, int)
-     */
-    public void updateInt(int columnIndex, int x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateInt(java.lang.String, int)
-     */
-    public void updateInt(String columnName, int x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateLong(int, long)
-     */
-    public void updateLong(int columnIndex, long x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateLong(java.lang.String, long)
-     */
-    public void updateLong(String columnName, long x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateNull(int)
-     */
-    public void updateNull(int columnIndex) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateNull(java.lang.String)
-     */
-    public void updateNull(String columnName) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateObject(int, java.lang.Object)
-     */
-    public void updateObject(int columnIndex, Object x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object)
-     */
-    public void updateObject(String columnName, Object x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateObject(int, java.lang.Object, int)
-     */
-    public void updateObject(int columnIndex, Object x, int scale)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object,
-     *      int)
-     */
-    public void updateObject(String columnName, Object x, int scale)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateRef(int, java.sql.Ref)
-     */
-    public void updateRef(int columnIndex, Ref x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateRef(java.lang.String, java.sql.Ref)
-     */
-    public void updateRef(String columnName, Ref x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateRow()
-     */
-    public void updateRow() throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateShort(int, short)
-     */
-    public void updateShort(int columnIndex, short x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateShort(java.lang.String, short)
-     */
-    public void updateShort(String columnName, short x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateString(int, java.lang.String)
-     */
-    public void updateString(int columnIndex, String x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateString(java.lang.String, java.lang.String)
-     */
-    public void updateString(String columnName, String x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateTime(int, java.sql.Time)
-     */
-    public void updateTime(int columnIndex, Time x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateTime(java.lang.String, java.sql.Time)
-     */
-    public void updateTime(String columnName, Time x) throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateTimestamp(int, java.sql.Timestamp)
-     */
-    public void updateTimestamp(int columnIndex, Timestamp x)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#updateTimestamp(java.lang.String,
-     *      java.sql.Timestamp)
-     */
-    public void updateTimestamp(String columnName, Timestamp x)
-            throws SQLException {
-    }
-    
-    /**
-     * @see java.sql.ResultSet#wasNull()
-     */
-    public boolean wasNull() throws SQLException {
-    
-            return false;
-    }
-    
-    
-    private int getColumnIndex(String columnName) throws SQLException{
-    for (int i = 0 ; i < this.mCols.size();i++){
-        if(this.mCols.get(i).getName().equalsIgnoreCase(columnName)){
-            return i +1; // PLUS 1 da SQL-Cursor 1 basiert sind
-        }
-    }
-    throw new SQLException("Column "+columnName+" does not exist in ResulSet");
-    }
-
-    public int getHoldability() throws SQLException {
-        return 0;
-    }
-
-    public Reader getNCharacterStream(int arg0) throws SQLException {
-        return null;
-    }
-
-    public Reader getNCharacterStream(String arg0) throws SQLException {
-        return null;
-    }
-
-    public NClob getNClob(int arg0) throws SQLException {
-        return null;
-    }
-
-    public NClob getNClob(String arg0) throws SQLException {
-        return null;
-    }
-
-    public String getNString(int arg0) throws SQLException {
-        return null;
-    }
-
-    public String getNString(String arg0) throws SQLException {
-        return null;
-    }
-
-    public RowId getRowId(int arg0) throws SQLException {
-        
-        return null;
-    }
-
-    public RowId getRowId(String arg0) throws SQLException {
-        
-        return null;
-    }
-
-    public SQLXML getSQLXML(int arg0) throws SQLException {
-        
-        return null;
-    }
-
-    public SQLXML getSQLXML(String arg0) throws SQLException {
-        
-        return null;
-    }
-
-    public boolean isClosed() throws SQLException {
-        
-        return false;
-    }
-
-    public void updateAsciiStream(int arg0, InputStream arg1)
-                                                             throws SQLException {
-    }
-
-    public void updateAsciiStream(String arg0, InputStream arg1)
-                                                                throws SQLException {
-    }
-
-    public void updateAsciiStream(int arg0, InputStream arg1, long arg2)
-                                                                        throws SQLException {
-    }
-
-    public void updateAsciiStream(String arg0, InputStream arg1, long arg2)
-                                                                           throws SQLException {
-    }
-
-    public void updateBinaryStream(int arg0, InputStream arg1)
-                                                              throws SQLException {
-    }
-
-    public void updateBinaryStream(String arg0, InputStream arg1)
-                                                                 throws SQLException {
-    }
-
-    public void updateBinaryStream(int arg0, InputStream arg1, long arg2)
-                                                                         throws SQLException {
-    }
-
-    public void updateBinaryStream(String arg0, InputStream arg1, long arg2)
-                                                                            throws SQLException {
-    }
-
-    public void updateBlob(int arg0, InputStream arg1) throws SQLException {
-    }
-
-    public void updateBlob(String arg0, InputStream arg1) throws SQLException {
-    }
-
-    public void updateBlob(int arg0, InputStream arg1, long arg2)
-                                                                 throws SQLException {
-    }
-
-    public void updateBlob(String arg0, InputStream arg1, long arg2)
-                                                                    throws SQLException {
-    }
-
-    public void updateCharacterStream(int arg0, Reader arg1)
-                                                            throws SQLException {
-    }
-
-    public void updateCharacterStream(String arg0, Reader arg1)
-                                                               throws SQLException {
-    }
-
-    public void updateCharacterStream(int arg0, Reader arg1, long arg2)
-                                                                       throws SQLException {
-    }
-
-    public void updateCharacterStream(String arg0, Reader arg1, long arg2)
-                                                                          throws SQLException {
-    }
-
-    public void updateClob(int arg0, Reader arg1) throws SQLException {
-    }
-
-    public void updateClob(String arg0, Reader arg1) throws SQLException {
-    }
-
-    public void updateClob(int arg0, Reader arg1, long arg2)
-                                                            throws SQLException {
-    }
-
-    public void updateClob(String arg0, Reader arg1, long arg2)
-                                                               throws SQLException {
-    }
-
-    public void updateNCharacterStream(int arg0, Reader arg1)
-                                                             throws SQLException {
-    }
-
-    public void updateNCharacterStream(String arg0, Reader arg1)
-                                                                throws SQLException {
-    }
-
-    public void updateNCharacterStream(int arg0, Reader arg1, long arg2)
-                                                                        throws SQLException {
-    }
-
-    public void updateNCharacterStream(String arg0, Reader arg1, long arg2)
-                                                                           throws SQLException {
-    }
-
-    public void updateNClob(int arg0, NClob arg1) throws SQLException {
-    }
-
-    public void updateNClob(String arg0, NClob arg1) throws SQLException {
-    }
-
-    public void updateNClob(int arg0, Reader arg1) throws SQLException {
-    }
-
-    public void updateNClob(String arg0, Reader arg1) throws SQLException {
-    }
-
-    public void updateNClob(int arg0, Reader arg1, long arg2)
-                                                             throws SQLException {
-    }
-
-    public void updateNClob(String arg0, Reader arg1, long arg2)
-                                                                throws SQLException {
-    }
-
-    public void updateNString(int arg0, String arg1) throws SQLException {
-    }
-
-    public void updateNString(String arg0, String arg1) throws SQLException {
-    }
-
-    public void updateRowId(int arg0, RowId arg1) throws SQLException {
-    }
-
-    public void updateRowId(String arg0, RowId arg1) throws SQLException {
-    }
-
-    public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException {
-    }
-
-    public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException {
-    }
-
-    public boolean isWrapperFor(Class<?> arg0) throws SQLException {
-        
-        return false;
-    }
-
-    public <T> T unwrap(Class<T> arg0) throws SQLException {
-        
-        return null;
-    }
-
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import java.math.BigDecimal;
+
+import java.net.URL;
+
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.NClob;
+import java.sql.Ref;
+import java.sql.ResultSetMetaData;
+import java.sql.RowId;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.SQLXML;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+/**
+ * SDEResultSet is an Implementation of the Interface @see java.sql.resultSet
+ * It is an Wrapper between the resultsets whcih are produced using the ArcSDE
+ * and the Java-Interface for the Representation of ResultSets.
+ * @author blume
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class SDEResultSet extends ResultSet {
+
+   /**
+     * Default Logging instance
+     */
+    private static Logger log = Logger.getLogger(SDEResultSet.class);
+
+    private List<Row> mRows = Collections.synchronizedList(new ArrayList<Row>());
+    private List<ColDefinition> mCols = Collections.synchronizedList(new ArrayList<ColDefinition>());
+
+    private Row currentRow = null;
+    private int cursor = 0;
+
+    /**
+     * Constructor
+     */
+    public SDEResultSet() {
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getCount()
+     */
+    public int getCount() {
+        return mRows.size();
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getNumberOfColumns()
+     */
+    public int getNumberOfColumns() {
+        return mCols.size();
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getColumnDefinitions()
+     */
+    public ColDefinition[] getColumnDefinitions() {
+        ColDefinition[] lColDefinitions = new ColDefinition[mCols.size()];
+        return mCols.toArray(lColDefinitions);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.sde.datasources.ResultSet#getResults()
+     */
+    public Row[] getResults() {
+        Row[] lRows = new Row[mRows.size()];
+        return mRows.toArray(lRows);
+    }
+
+    /**
+     * Add an Row to the Resultset
+     * @param pRow The Row that should be added.
+     */
+    public void addRow(Row pRow) {
+        mRows.add(pRow);
+    }
+
+    /**
+     * Adds a Column to the Resultset.
+     * @param pColDefinition The Definition of the Column
+     */
+    public void addCol(ColDefinition pColDefinition) {
+        mCols.add(pColDefinition);
+    }
+
+    /**
+     * @see java.sql.ResultSet#absolute(int)
+     */
+    public boolean absolute(int row) throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#afterLast()
+     */
+    public void afterLast() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#beforeFirst()
+     */
+    public void beforeFirst() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#cancelRowUpdates()
+     */
+    public void cancelRowUpdates() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#clearWarnings()
+     */
+    public void clearWarnings() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#close()
+     */
+    public void close() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#deleteRow()
+     */
+    public void deleteRow() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#findColumn(java.lang.String)
+     */
+    public int findColumn(String columnName) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#first()
+     */
+    public boolean first() throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getArray(int)
+     */
+    public Array getArray(int i) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getArray(java.lang.String)
+     */
+    public Array getArray(String colName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getAsciiStream(int)
+     */
+    public InputStream getAsciiStream(int columnIndex) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getAsciiStream(java.lang.String)
+     */
+    public InputStream getAsciiStream(String columnName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBigDecimal(int)
+     */
+    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBigDecimal(java.lang.String)
+     */
+    public BigDecimal getBigDecimal(String columnName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBigDecimal(int, int)
+     */
+    public BigDecimal getBigDecimal(int columnIndex, int scale)
+            throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int)
+     */
+    public BigDecimal getBigDecimal(String columnName, int scale)
+            throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBinaryStream(int)
+     */
+    public InputStream getBinaryStream(int columnIndex) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBinaryStream(java.lang.String)
+     */
+    public InputStream getBinaryStream(String columnName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBlob(int)
+     */
+    public Blob getBlob(int i) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBlob(java.lang.String)
+     */
+    public Blob getBlob(String colName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBoolean(int)
+     */
+    public boolean getBoolean(int columnIndex) throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBoolean(java.lang.String)
+     */
+    public boolean getBoolean(String columnName) throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getByte(int)
+     */
+    public byte getByte(int columnIndex) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getByte(java.lang.String)
+     */
+    public byte getByte(String columnName) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBytes(int)
+     */
+    public byte[] getBytes(int columnIndex) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getBytes(java.lang.String)
+     */
+    public byte[] getBytes(String columnName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getCharacterStream(int)
+     */
+    public Reader getCharacterStream(int columnIndex) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getCharacterStream(java.lang.String)
+     */
+    public Reader getCharacterStream(String columnName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getClob(int)
+     */
+    public Clob getClob(int i) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getClob(java.lang.String)
+     */
+    public Clob getClob(String colName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getConcurrency()
+     */
+    public int getConcurrency() throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getCursorName()
+     */
+    public String getCursorName() throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getDate(int)
+     */
+    public Date getDate(int columnIndex) throws SQLException {
+        try {
+            return new java.sql.Date(this.currentRow.getDateValue(columnIndex-1).getTime());
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+
+    /**
+     * @see java.sql.ResultSet#getDate(java.lang.String)
+     */
+    public Date getDate(String columnName) throws SQLException {
+        int columnIndex = this.getColumnIndex(columnName);
+        return this.getDate(columnIndex);
+    }
+
+    /**
+     * @see java.sql.ResultSet#getDate(int, java.util.Calendar)
+     */
+    public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar)
+     */
+    public Date getDate(String columnName, Calendar cal) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getDouble(int)
+     */
+    public double getDouble(int columnIndex) throws SQLException {
+        try {
+            return this.currentRow.getDoubleValue(columnIndex-1);
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+
+    /**
+     * @see java.sql.ResultSet#getDouble(java.lang.String)
+     */
+    public double getDouble(String columnName) throws SQLException {
+        int columnIndex = this.getColumnIndex(columnName);
+        return this.getDouble(columnIndex);
+    }
+
+    /**
+     * @see java.sql.ResultSet#getFetchDirection()
+     */
+    public int getFetchDirection() throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getFetchSize()
+     */
+    public int getFetchSize() throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getFloat(int)
+     */
+    public float getFloat(int columnIndex) throws SQLException {
+        try {
+            return this.currentRow.getFloatValue(columnIndex-1);
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+
+    /**
+     * @see java.sql.ResultSet#getFloat(java.lang.String)
+     */
+    public float getFloat(String columnName) throws SQLException {
+        int columnIndex = this.getColumnIndex(columnName);
+        return this.getFloat(columnIndex);
+    }
+
+    /**
+     * @see java.sql.ResultSet#getInt(int)
+     */
+    public int getInt(int columnIndex) throws SQLException {
+
+        try {
+            return this.currentRow.getIntValue(columnIndex-1);
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+
+    /**
+     * @see java.sql.ResultSet#getInt(java.lang.String)
+     */
+    public int getInt(String columnName) throws SQLException {
+        int columnIndex = this.getColumnIndex(columnName);
+        return this.getInt(columnIndex);
+    }
+
+    /**
+     * @see java.sql.ResultSet#getLong(int)
+     */
+    public long getLong(int columnIndex) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getLong(java.lang.String)
+     */
+    public long getLong(String columnName) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getMetaData()
+     */
+    public ResultSetMetaData getMetaData() throws SQLException {
+        log.debug("SDEREsultSet.getMetaData");
+        return new ArcSDEResultSetMetaData(this.mCols);
+    }
+
+    /**
+     * @see java.sql.ResultSet#getObject(int)
+     */
+    public Object getObject(int columnIndex) throws SQLException {
+        try {
+            return this.currentRow.getValue(columnIndex-1);
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+
+    /**
+     * @see java.sql.ResultSet#getObject(java.lang.String)
+     */
+    public Object getObject(String columnName) throws SQLException {
+        int columnIndex = this.getColumnIndex(columnName);
+        return this.getObject(columnIndex);
+    }
+
+    /**
+     * @see java.sql.ResultSet#getObject(int, java.util.Map)
+     */
+    public Object getObject(int i, Map<String, Class<?>> map)
+            throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map)
+     */
+    public Object getObject(String colName, Map<String, Class<?>> map)
+            throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getRef(int)
+     */
+    public Ref getRef(int i) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getRef(java.lang.String)
+     */
+    public Ref getRef(String colName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getRow()
+     */
+    public int getRow() throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getShort(int)
+     */
+    public short getShort(int columnIndex) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getShort(java.lang.String)
+     */
+    public short getShort(String columnName) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getStatement()
+     */
+    public Statement getStatement() throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getString(int)
+     */
+    public String getString(int columnIndex) throws SQLException {
+
+        try {
+            return this.currentRow.getStringValue(columnIndex-1);
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+
+    /**
+     * @see java.sql.ResultSet#getString(java.lang.String)
+     */
+    public String getString(String columnName) throws SQLException {
+        int columnIndex = this.getColumnIndex(columnName);
+        return this.getString(columnIndex);
+    }
+
+    /**
+     * @see java.sql.ResultSet#getTime(int)
+     */
+    public Time getTime(int columnIndex) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getTime(java.lang.String)
+     */
+    public Time getTime(String columnName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getTime(int, java.util.Calendar)
+     */
+    public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar)
+     */
+    public Time getTime(String columnName, Calendar cal) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getTimestamp(int)
+     */
+    public Timestamp getTimestamp(int columnIndex) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getTimestamp(java.lang.String)
+     */
+    public Timestamp getTimestamp(String columnName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
+     */
+    public Timestamp getTimestamp(int columnIndex, Calendar cal)
+            throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getTimestamp(java.lang.String,
+     *      java.util.Calendar)
+     */
+    public Timestamp getTimestamp(String columnName, Calendar cal)
+            throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getType()
+     */
+    public int getType() throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getURL(int)
+     */
+    public URL getURL(int columnIndex) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getURL(java.lang.String)
+     */
+    public URL getURL(String columnName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getUnicodeStream(int)
+     */
+    public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getUnicodeStream(java.lang.String)
+     */
+    public InputStream getUnicodeStream(String columnName) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getWarnings()
+     */
+    public SQLWarning getWarnings() throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#insertRow()
+     */
+    public void insertRow() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#isAfterLast()
+     */
+    public boolean isAfterLast() throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#isBeforeFirst()
+     */
+    public boolean isBeforeFirst() throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#isFirst()
+     */
+    public boolean isFirst() throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#isLast()
+     */
+    public boolean isLast() throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#last()
+     */
+    public boolean last() throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#moveToCurrentRow()
+     */
+    public void moveToCurrentRow() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#moveToInsertRow()
+     */
+    public void moveToInsertRow() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#next()
+     */
+    public boolean next() throws SQLException {
+
+        boolean next = this.mRows.size() > this.cursor;
+        if (next){
+            //log.debug("Zeile "+(cursor+1)+" von "+this.mRows.size()+" wird angesteuert.");
+            this.currentRow = this.mRows.get(this.cursor);
+            this.cursor++;
+        }else{
+            this.currentRow = null;
+        }
+        return next;
+    }
+
+    /**
+     * @see java.sql.ResultSet#previous()
+     */
+    public boolean previous() throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#refreshRow()
+     */
+    public void refreshRow() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#relative(int)
+     */
+    public boolean relative(int rows) throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#rowDeleted()
+     */
+    public boolean rowDeleted() throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#rowInserted()
+     */
+    public boolean rowInserted() throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#rowUpdated()
+     */
+    public boolean rowUpdated() throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#setFetchDirection(int)
+     */
+    public void setFetchDirection(int direction) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#setFetchSize(int)
+     */
+    public void setFetchSize(int rows) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateArray(int, java.sql.Array)
+     */
+    public void updateArray(int columnIndex, Array x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateArray(java.lang.String, java.sql.Array)
+     */
+    public void updateArray(String columnName, Array x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int)
+     */
+    public void updateAsciiStream(int columnIndex, InputStream x, int length)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateAsciiStream(java.lang.String,
+     *      java.io.InputStream, int)
+     */
+    public void updateAsciiStream(String columnName, InputStream x, int length)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBigDecimal(int, java.math.BigDecimal)
+     */
+    public void updateBigDecimal(int columnIndex, BigDecimal x)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBigDecimal(java.lang.String,
+     *      java.math.BigDecimal)
+     */
+    public void updateBigDecimal(String columnName, BigDecimal x)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int)
+     */
+    public void updateBinaryStream(int columnIndex, InputStream x, int length)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBinaryStream(java.lang.String,
+     *      java.io.InputStream, int)
+     */
+    public void updateBinaryStream(String columnName, InputStream x, int length)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBlob(int, java.sql.Blob)
+     */
+    public void updateBlob(int columnIndex, Blob x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBlob(java.lang.String, java.sql.Blob)
+     */
+    public void updateBlob(String columnName, Blob x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBoolean(int, boolean)
+     */
+    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBoolean(java.lang.String, boolean)
+     */
+    public void updateBoolean(String columnName, boolean x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateByte(int, byte)
+     */
+    public void updateByte(int columnIndex, byte x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateByte(java.lang.String, byte)
+     */
+    public void updateByte(String columnName, byte x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBytes(int, byte[])
+     */
+    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBytes(java.lang.String, byte[])
+     */
+    public void updateBytes(String columnName, byte[] x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int)
+     */
+    public void updateCharacterStream(int columnIndex, Reader x, int length)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateCharacterStream(java.lang.String,
+     *      java.io.Reader, int)
+     */
+    public void updateCharacterStream(String columnName, Reader reader,
+            int length) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateClob(int, java.sql.Clob)
+     */
+    public void updateClob(int columnIndex, Clob x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateClob(java.lang.String, java.sql.Clob)
+     */
+    public void updateClob(String columnName, Clob x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateDate(int, java.sql.Date)
+     */
+    public void updateDate(int columnIndex, Date x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateDate(java.lang.String, java.sql.Date)
+     */
+    public void updateDate(String columnName, Date x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateDouble(int, double)
+     */
+    public void updateDouble(int columnIndex, double x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateDouble(java.lang.String, double)
+     */
+    public void updateDouble(String columnName, double x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateFloat(int, float)
+     */
+    public void updateFloat(int columnIndex, float x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateFloat(java.lang.String, float)
+     */
+    public void updateFloat(String columnName, float x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateInt(int, int)
+     */
+    public void updateInt(int columnIndex, int x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateInt(java.lang.String, int)
+     */
+    public void updateInt(String columnName, int x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateLong(int, long)
+     */
+    public void updateLong(int columnIndex, long x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateLong(java.lang.String, long)
+     */
+    public void updateLong(String columnName, long x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNull(int)
+     */
+    public void updateNull(int columnIndex) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNull(java.lang.String)
+     */
+    public void updateNull(String columnName) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateObject(int, java.lang.Object)
+     */
+    public void updateObject(int columnIndex, Object x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object)
+     */
+    public void updateObject(String columnName, Object x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateObject(int, java.lang.Object, int)
+     */
+    public void updateObject(int columnIndex, Object x, int scale)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object,
+     *      int)
+     */
+    public void updateObject(String columnName, Object x, int scale)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateRef(int, java.sql.Ref)
+     */
+    public void updateRef(int columnIndex, Ref x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateRef(java.lang.String, java.sql.Ref)
+     */
+    public void updateRef(String columnName, Ref x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateRow()
+     */
+    public void updateRow() throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateShort(int, short)
+     */
+    public void updateShort(int columnIndex, short x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateShort(java.lang.String, short)
+     */
+    public void updateShort(String columnName, short x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateString(int, java.lang.String)
+     */
+    public void updateString(int columnIndex, String x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateString(java.lang.String, java.lang.String)
+     */
+    public void updateString(String columnName, String x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateTime(int, java.sql.Time)
+     */
+    public void updateTime(int columnIndex, Time x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateTime(java.lang.String, java.sql.Time)
+     */
+    public void updateTime(String columnName, Time x) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateTimestamp(int, java.sql.Timestamp)
+     */
+    public void updateTimestamp(int columnIndex, Timestamp x)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateTimestamp(java.lang.String,
+     *      java.sql.Timestamp)
+     */
+    public void updateTimestamp(String columnName, Timestamp x)
+            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#wasNull()
+     */
+    public boolean wasNull() throws SQLException {
+
+            return false;
+    }
+
+    /**
+     * TODO: DOCUMENT ME
+     * @param columnName
+     * @return
+     * @throws SQLException
+     */
+    private int getColumnIndex(String columnName) throws SQLException{
+        for (int i = 0 ; i < this.mCols.size();i++){
+            if(this.mCols.get(i).getName().equalsIgnoreCase(columnName)){
+                return i +1; // PLUS 1 da SQL-Cursor 1 basiert sind
+            }
+        }
+        throw new SQLException("Column "+columnName+" does not exist in ResulSet");
+    }
+
+    /**
+     * @see java.sql.ResultSet#getHoldability()
+     */
+    public int getHoldability() throws SQLException {
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getNCharacterStream(int)
+     */
+    public Reader getNCharacterStream(int arg0) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getNCharacterStream(java.lang.String)
+     */
+    public Reader getNCharacterStream(String arg0) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getNClob(int)
+     */
+    public NClob getNClob(int arg0) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getNClob(java.lang.String)
+     */
+    public NClob getNClob(String arg0) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getNString(int)
+     */
+    public String getNString(int arg0) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getNString(java.lang.String)
+     */
+    public String getNString(String arg0) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getRowId(int)
+     */
+    public RowId getRowId(int arg0) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getRowId(java.lang.String)
+     */
+    public RowId getRowId(String arg0) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getSQLXML(int)
+     */
+    public SQLXML getSQLXML(int arg0) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#getSQLXML(java.lang.String)
+     */
+    public SQLXML getSQLXML(String arg0) throws SQLException {
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSet#isClosed()
+     */
+    public boolean isClosed() throws SQLException {
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream)
+     */
+    public void updateAsciiStream(int arg0, InputStream arg1)
+                                                             throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream)
+     */
+    public void updateAsciiStream(String arg0, InputStream arg1)
+                                                                throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, long)
+     */
+    public void updateAsciiStream(int arg0, InputStream arg1, long arg2)
+                                                                        throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateAsciiStream(java.lang.String, java.io.InputStream, long)
+     */
+    public void updateAsciiStream(String arg0, InputStream arg1, long arg2)
+                                                                           throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream)
+     */
+    public void updateBinaryStream(int arg0, InputStream arg1)
+                                                              throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream)
+     */
+    public void updateBinaryStream(String arg0, InputStream arg1)
+                                                                 throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, long)
+     */
+    public void updateBinaryStream(int arg0, InputStream arg1, long arg2)
+                                                                         throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBinaryStream(java.lang.String, java.io.InputStream, long)
+     */
+    public void updateBinaryStream(String arg0, InputStream arg1, long arg2)
+                                                                            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream)
+     */
+    public void updateBlob(int arg0, InputStream arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream)
+     */
+    public void updateBlob(String arg0, InputStream arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBlob(int, java.io.InputStream, long)
+     */
+    public void updateBlob(int arg0, InputStream arg1, long arg2)
+                                                                 throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateBlob(java.lang.String, java.io.InputStream, long)
+     */
+    public void updateBlob(String arg0, InputStream arg1, long arg2)
+                                                                    throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader)
+     */
+    public void updateCharacterStream(int arg0, Reader arg1)
+                                                            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader)
+     */
+    public void updateCharacterStream(String arg0, Reader arg1)
+                                                               throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, long)
+     */
+    public void updateCharacterStream(int arg0, Reader arg1, long arg2)
+                                                                       throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateCharacterStream(java.lang.String, java.io.Reader, long)
+     */
+    public void updateCharacterStream(String arg0, Reader arg1, long arg2)
+                                                                          throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateClob(int, java.io.Reader)
+     */
+    public void updateClob(int arg0, Reader arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader)
+     */
+    public void updateClob(String arg0, Reader arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateClob(int, java.io.Reader, long)
+     */
+    public void updateClob(int arg0, Reader arg1, long arg2)
+                                                            throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateClob(java.lang.String, java.io.Reader, long)
+     */
+    public void updateClob(String arg0, Reader arg1, long arg2)
+                                                               throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader)
+     */
+    public void updateNCharacterStream(int arg0, Reader arg1)
+                                                             throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader)
+     */
+    public void updateNCharacterStream(String arg0, Reader arg1)
+                                                                throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNCharacterStream(int, java.io.Reader, long)
+     */
+    public void updateNCharacterStream(int arg0, Reader arg1, long arg2)
+                                                                        throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNCharacterStream(java.lang.String, java.io.Reader, long)
+     */
+    public void updateNCharacterStream(String arg0, Reader arg1, long arg2)
+                                                                           throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNClob(int, java.sql.NClob)
+     */
+    public void updateNClob(int arg0, NClob arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNClob(java.lang.String, java.sql.NClob)
+     */
+    public void updateNClob(String arg0, NClob arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNClob(int, java.io.Reader)
+     */
+    public void updateNClob(int arg0, Reader arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNClob(java.lang.String, java.io.Reader)
+     */
+    public void updateNClob(String arg0, Reader arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNClob(int, java.io.Reader, long)
+     */
+    public void updateNClob(int arg0, Reader arg1, long arg2)
+                                                             throws SQLException {
+    }
+
+    public void updateNClob(String arg0, Reader arg1, long arg2)
+                                                                throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNString(int, java.lang.String)
+     */
+    public void updateNString(int arg0, String arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateNString(java.lang.String, java.lang.String)
+     */
+    public void updateNString(String arg0, String arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateRowId(int, java.sql.RowId)
+     */
+    public void updateRowId(int arg0, RowId arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateRowId(java.lang.String, java.sql.RowId)
+     */
+    public void updateRowId(String arg0, RowId arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateSQLXML(int, java.sql.SQLXML)
+     */
+    public void updateSQLXML(int arg0, SQLXML arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.ResultSet#updateSQLXML(java.lang.String, java.sql.SQLXML)
+     */
+    public void updateSQLXML(String arg0, SQLXML arg1) throws SQLException {
+    }
+
+    /**
+     * @see java.sql.Wrapper#isWrapperFor(java.lang.Class)
+     */
+    public boolean isWrapperFor(Class<?> arg0) throws SQLException {
+        return false;
+    }
+
+    /**
+     * @see java.sql.Wrapper#unwrap(java.lang.Class)
+     */
+    public <T> T unwrap(Class<T> arg0) throws SQLException {
+        return null;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Uncacheable.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources;
+
+/**
+ * This interface is a marker interface. It is used for objects that should
+ * not be cached.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public interface Uncacheable {
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/UncacheableSDEResultSet.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources;
+
+/**
+ * This <i>ResultSet</i> has no special tasks but implements <i>Uncacheable</i>
+ * to avoid this objects being cached.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class UncacheableSDEResultSet
+extends      SDEResultSet
+implements   Uncacheable
+{
+    /**
+     * Creates a new UncacheableSDResultSet object.
+     */
+    public UncacheableSDEResultSet() {
+
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,37 +1,59 @@
-/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
- * All rights reserved
- *
- * $Id: DatasourceException.java,v 1.2 2008/01/30 12:38:34 blume Exp $
- *
- * created by:      drewnak
- * created at :     21.11.2007
- * created at :     14:56:32
- *
- * modified by:     $Author: blume $
- * modified at:     $Date: 2008/01/30 12:38:34 $
- */
-package de.intevation.gnv.geobackend.sde.datasources.exception;
-
-/**
- * A Class for encapsulating implementation specific datasource exceptions.
- * This exception class can be used for all exceptions occuring in connection to "datasources actions".
- */
-public class DatasourceException extends Exception {
-
-    public DatasourceException() {
-        super();
-    }
-
-    public DatasourceException(String pMessage) {
-        super(pMessage);
-    }
-
-    public DatasourceException(String pMessage, Throwable pCause) {
-        super(pMessage, pCause);
-    }
-
-    public DatasourceException(Throwable pCause) {
-        super(pCause);
-    }
-
-}
\ No newline at end of file
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources.exception;
+
+/**
+ * A Class for encapsulating implementation specific datasource exceptions.
+ * This exception class can be used for all exceptions occuring in connection
+ * to "datasources actions".
+ *
+ * @author blume
+ * @author drewnak
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class DatasourceException extends Exception {
+
+    /**
+     * The UID of this Class.
+     */
+    private static final long serialVersionUID = 2593142889158383466L;
+
+    /**
+     * Constructor
+     */
+    public DatasourceException() {
+        super();
+    }
+
+    /**
+     * Constructor
+     * @param pMessage the Exceptionmessage
+     */
+    public DatasourceException(String pMessage) {
+        super(pMessage);
+    }
+
+    /**
+     * Constructor
+     * @param pMessage the Exceptionmessage
+     * @param pCause the Throwable which cause this exception
+     */
+    public DatasourceException(String pMessage, Throwable pCause) {
+        super(pMessage, pCause);
+    }
+
+    /**
+     * Constructor
+     * @param pCause the Throwable which cause this exception
+     */
+    public DatasourceException(Throwable pCause) {
+        super(pCause);
+    }
+
+}
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,79 +1,76 @@
-/**
- * Title:           TechnicalException, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/TechnicalException.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/TechnicalException.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     21.11.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: drewnak $
- * modified on:     $Date: 2008/08/18 14:50:33 $
- * Version:         $Revision: 1.2 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.sde.datasources.exception;
-
-import org.apache.log4j.Logger;
-
-/**
- * The class <code>TechnicalException</code> fulfills the following purposes:
- * <ol>
- * <li></li>
- * </ol>
- *
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 21.11.2007 08:12:08
- */
-public class TechnicalException extends Exception{
-
-    /**
-     * Default Logging instance
-     */
-    private static Logger sLogger = Logger.getLogger(TechnicalException.class);
-
-    /**
-     * Constructs a new exception with <code>null</code> as its detail message.
-     * The cause is not initialized, and may subsequently be initialized by a
-     * call to {@link #initCause}.
-     */
-    public TechnicalException() {
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message.  The
-     * cause is not initialized, and may subsequently be initialized by
-     * a call to {@link #initCause}.
-     *
-     * @param message the detail message. The detail message is saved for
-     *                later retrieval by the {@link #getMessage()} method.
-     */
-    public TechnicalException(String message) {
-        super(message);
-    }
-    public TechnicalException(Throwable pCause) {
-        super(pCause);
-    }
-
-    /**
-     * Constructs a new exception with the specified detail message and
-     * cause.  <p>Note that the detail message associated with
-     * <code>cause</code> is <i>not</i> automatically incorporated in
-     * this exception's detail message.
-     *
-     * @param message the detail message (which is saved for later retrieval
-     *                by the {@link #getMessage()} method).
-     * @param cause   the cause (which is saved for later retrieval by the
-     *                {@link #getCause()} method).  (A <tt>null</tt> value is
-     *                permitted, and indicates that the cause is nonexistent or
-     *                unknown.)
-     * @since 1.4
-     */
-    public TechnicalException(String message, Throwable cause) {
-        super(message, cause);
-    }
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.sde.datasources.exception;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>TechnicalException</code> fulfills the following purposes:
+ *
+ * @author blume
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class TechnicalException extends Exception{
+
+    /**
+     * The UID of this Class.
+     */
+    private static final long serialVersionUID = -5296559414323169553L;
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(TechnicalException.class);
+
+    /**
+     * Constructs a new exception with <code>null</code> as its detail message.
+     * The cause is not initialized, and may subsequently be initialized by a
+     * call to {@link #initCause}.
+     */
+    public TechnicalException() {
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message.  The
+     * cause is not initialized, and may subsequently be initialized by
+     * a call to {@link #initCause}.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public TechnicalException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructor
+     * @param pCause the Throwable which cause this exception
+     */
+    public TechnicalException(Throwable pCause) {
+        super(pCause);
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message and
+     * cause.  <p>Note that the detail message associated with
+     * <code>cause</code> is <i>not</i> automatically incorporated in
+     * this exception's detail message.
+     *
+     * @param message the detail message (which is saved for later retrieval
+     *                by the {@link #getMessage()} method).
+     * @param cause   the cause (which is saved for later retrieval by the
+     *                {@link #getCause()} method).  (A <tt>null</tt> value is
+     *                permitted, and indicates that the cause is nonexistent or
+     *                unknown.)
+     * @since 1.4
+     */
+    public TechnicalException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Package that contains Exceptionclasses for it's Parentpackage.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains Classes that Wrapps an ArcSDEConnection into a 
+<code>java.sql.Connection</code>.
+All other required Wrapper-Classes 
+(e.g Statements,ResultSet, ResultSetMetadata) 
+are also available in the package.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package and it's subpackages contains Classes for the DataAccess to
+the ArcSDE-Databasebackend.
+</body>
+</html>
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,128 +1,91 @@
-/**
- * Title:           DateUtisl, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/util/DateUtils.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/util/DateUtils.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     21.12.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: drewnak $
- * modified on:     $Date: 2008/08/18 14:50:33 $
- * Version:         $Revision: 1.2 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.geobackend.util;
-
-import org.apache.log4j.Logger;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-
-/**
- * The class <code>DateUtisl</code> fulfills the following purposes:
- * <ol>
- * <li></li>
- * </ol>
- *
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 21.12.2007 10:34:01
- */
-public class DateUtils {
-
-    /**
-     * Default Logging instance
-     */
-    private static Logger sLogger = Logger.getLogger(DateUtils.class);
-    private static boolean sDebug = sLogger.isDebugEnabled();
-
-    public static final String DATE_PATTERN = "yyyy.MM.dd HH:mm:ss";
-    public static final String DATE_PATTERN1 = "dd-MMM-yyyy HH:mm:ss";
-    public static final String TimeRangeFilterPattern = "yyyy-MM-dd'T'HH:mm:ssZ";
-    public static final String TimeRangeFilterFormPattern = "dd.MM.yyyy HH:mm";
-
-    public static String getPatternedDateSDF(Date pDate) {
-        SimpleDateFormat fmt = new SimpleDateFormat();
-        fmt.applyPattern(DATE_PATTERN);
-        return fmt.format(pDate);
-    }
-    
-    public static String getPatternedDate(Date pDate, String  sPattern) {
-//    	DateTimeZone.setDefault(DateTimeZone.UTC);
-//    	DateTime dtf = new DateTime (pDate);
-//    	String sStr = dtf.toString(sPattern);
-//      return sStr;
-    	 SimpleDateFormat fmt = new SimpleDateFormat();
-         fmt.applyPattern(sPattern);
-         return fmt.format(pDate);
-    }
-    
-    public static String getPatternedDateAmer(Date pDate) {
-    	
-    	String sStr = getPatternedDate(pDate, DATE_PATTERN);
-        return sStr;
-    }
-    
-    public static String getPatternedDateGerm(Date pDate) {
-    	
-    	String sStr = getPatternedDate(pDate, DATE_PATTERN1);
-        return sStr;
-    }
-    
-    public static String getPatternedDateTimeRangeFilter(Date pDate) {
-    	
-    	String sStr = getPatternedDate(pDate, TimeRangeFilterPattern);
-        return sStr;
-    }
-    
-    public static String getPatternedDateTimeRangeFilterForm(Date pDate) {
-    	
-    	String sStr = getPatternedDate(pDate, TimeRangeFilterFormPattern);
-        return sStr;
-    }
-    
-    public synchronized static Date getDateFromStringSDF (String sStr)throws Exception {
-    	SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
-		Date   date = (Date)formatter.parse(sStr);
-		return date;
-    }
-    
-    public  static Date getDateFromString (String sStr)throws Exception {
-    	
-		Date   date = getDateFromString (sStr, DATE_PATTERN1);
-	    return date;
-    }
-    
-    public  static Date getDateFromStringTimeRangeFilter (String sStr)throws Exception {
-    	
-		Date   date = getDateFromString (sStr, TimeRangeFilterPattern);
-	        	return date;
-    } 
-    
-    public  static Date getDateFromStringTimeRangeFilterForm (String sStr)throws Exception {
-    	
-		Date   date = getDateFromString (sStr, TimeRangeFilterFormPattern);
-    	return date;
-    } 
-    
-    public  static Date getDateFromString (String sStr, String sPattern)throws Exception {
-//    	DateTime dtf = null;
-//    	DateTimeZone.setDefault(DateTimeZone.UTC); 
-//    	
-//	    dtf = DateTimeFormat.forPattern(sPattern).parseDateTime(sStr);
-//    	
-//		Date   date = dtf.toDate();
-//    	
-//    	return date;
-    	SimpleDateFormat fmt = new SimpleDateFormat();
-        fmt.applyPattern(sPattern);
-        return fmt.parse(sStr);
-    } 
-    
-     
-}
+/**
+ * Title:           DateUtisl, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/util/DateUtils.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/util/DateUtils.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.12.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: drewnak $
+ * modified on:     $Date: 2008/08/18 14:50:33 $
+ * Version:         $Revision: 1.2 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.util;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>DateUtils</code> fulfills the following purposes:
+ * @author blume
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class DateUtils {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(DateUtils.class);
+
+    /**
+     * The Dateformat which will be used e.g for Querying the Database
+     */
+    public static final String DATE_PATTERN = "yyyy.MM.dd HH:mm:ss";
+
+    private static final String DATE_PATTERN1 = "dd-MMM-yyyy HH:mm:ss";
+
+    /**
+     * The Method returns a Date using the given pattern as a String
+     * @param pDate The Date which should be formatted
+     * @param sPattern The Pattern which should be used.
+     * @return the Date formatted a a String
+     */
+    public static String getPatternedDate(Date pDate, String  sPattern) {
+         SimpleDateFormat fmt = new SimpleDateFormat();
+         fmt.applyPattern(sPattern);
+         return fmt.format(pDate);
+    }
+
+    /**
+     * Returns the Date as a String formated using the
+     * <code>DateUtils.DATE_PATTERN</code> format-
+     * @param pDate the Date which should be formatted
+     * @return the given Data as a String
+     */
+    public static String getPatternedDateAmer(Date pDate) {
+        String sStr = getPatternedDate(pDate, DATE_PATTERN);
+        return sStr;
+    }
+
+    /**
+     * This method decodes a Datevalue from the given String useing the
+     * <code>DateUtils.DATE_PATTERN1</code> format-
+     * @param sStr The String which contains the encoded Datevalue
+     * @return the decoded Datevalue as an Date-object.
+     * @throws Exception throws all Expetion which occurs during the Process.
+     */
+    public static Date getDateFromString (String sStr)throws Exception {
+        Date   date = getDateFromString (sStr, DATE_PATTERN1);
+        return date;
+    }
+
+    /**
+     * Formats a given Date encoded as a String using the given Pattern
+     * into a Date Object.
+     * @param sStr The String with the encoded DateValue
+     * @param sPattern The pattern which should be used to decode the Date
+     * @return the given Datevalue as an Date-Object.
+     * @throws Exception throws all Expetion which occurs during the Process.
+     */
+    public static Date getDateFromString (String sStr,
+                                          String sPattern)throws Exception {
+        SimpleDateFormat fmt = new SimpleDateFormat();
+        fmt.applyPattern(sPattern);
+        return fmt.parse(sStr);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/RedundancyRemover.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.util;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public final class RedundancyRemover
+extends            LinkedHashMap
+{
+    /** ceil(1029 * 1.75) = 1801, which is prime
+     * -&gt; suitable for a hash map slot size.
+     */
+    public static final int DEFAULT_LOOKBACK =
+        Integer.getInteger(
+            "de.intevation.gnv.geobackend.util.RedundancyRemover.lookback",
+            1029);
+
+    private int maxCapacity;
+    private int removed;
+
+    public RedundancyRemover() {
+        this(DEFAULT_LOOKBACK);
+    }
+
+    public RedundancyRemover(int maxCapacity) {
+        super((int)Math.ceil(maxCapacity * 1.75f));
+        this.maxCapacity = maxCapacity;
+    }
+
+    protected boolean removeEldestEntry(Map.Entry eldest) {
+        return size() > maxCapacity;
+    }
+
+    public int numRemoved() {
+        return removed;
+    }
+
+    public Object filter(Object object) {
+        if (object == null) {
+            return object;
+        }
+        Object old = get(object);
+
+        if (old != null) {
+            if (old != object) { // count only identical
+                ++removed;
+            }
+            return old;
+        }
+        put(object, object);
+        return object;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/XMLUtils.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.util;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.log4j.Logger;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public final class XMLUtils {
+
+    private static Logger logger = Logger.getLogger(XMLUtils.class);
+
+
+    private XMLUtils() {
+    }
+
+
+    public static Object xpath(
+        Object           root,
+        String           query,
+        QName            returnType,
+        NamespaceContext namespaceContext
+    ) {
+        if (root == null) {
+            return null;
+        }
+
+        try {
+            XPath xpath = newXPath(namespaceContext);
+
+            if (xpath != null) {
+                return xpath.evaluate(query, root, returnType);
+            }
+        }
+        catch (XPathExpressionException xpee) {
+            logger.error(xpee.getLocalizedMessage(), xpee);
+        }
+
+        return null;
+    }
+
+
+    public static XPath newXPath(NamespaceContext namespaceContext) {
+        XPathFactory factory = XPathFactory.newInstance();
+        XPath         xpath  = factory.newXPath();
+
+        if (namespaceContext != null) {
+            xpath.setNamespaceContext(namespaceContext);
+        }
+
+        return xpath;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Package that contains utility-Classes for this Module
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/GroupBySample.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.base.query;
+
+import com.esri.sde.sdk.client.SDEPoint;
+import com.esri.sde.sdk.client.SeColumnDefinition;
+import com.esri.sde.sdk.client.SeConnection;
+import com.esri.sde.sdk.client.SeException;
+import com.esri.sde.sdk.client.SeFilter;
+import com.esri.sde.sdk.client.SeLayer;
+import com.esri.sde.sdk.client.SeQuery;
+import com.esri.sde.sdk.client.SeQueryInfo;
+import com.esri.sde.sdk.client.SeRow;
+import com.esri.sde.sdk.client.SeShape;
+import com.esri.sde.sdk.client.SeShapeFilter;
+import com.esri.sde.sdk.client.SeSqlConstruct;
+
+public class GroupBySample {
+
+
+    public void executeQuery(SeConnection con, String[] pLayername,
+                                   String pSpatialColumnName, String pWhere,
+                                   SDEPoint[] g, String[] pReturnFields, String byClause) {
+
+        try {
+            // get the layer for querying
+
+            SeShapeFilter[] filters  = null;
+            if (g != null){
+                SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName);
+                SeShape shape = new SeShape();
+                shape.setCoordRef(lLayer.getCoordRef());
+
+
+
+                shape.generatePolygon(g.length, 1, null, g);
+                SeShapeFilter filter = new SeShapeFilter(pLayername[0],
+                        pSpatialColumnName, shape, SeFilter.METHOD_AI);
+                filters = new SeShapeFilter[1];
+                filters[0] = filter;
+            }
+
+            SeQuery spatialQuery = null;
+            SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere);
+            spatialQuery = new SeQuery(con);
+
+            SeQueryInfo queryInfo = new SeQueryInfo();
+            queryInfo.setColumns(pReturnFields);
+
+            if (byClause != null){
+                queryInfo.setByClause(byClause);
+            }
+
+            queryInfo.setConstruct(sqlCons);
+            spatialQuery.prepareQueryInfo(queryInfo);
+
+            /*
+             * Set spatial constraints
+             */
+            if (filters != null){
+                spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false,
+                        filters);
+            }
+            spatialQuery.execute();
+
+            SeRow row;
+            int lCount;
+            for (lCount = 0; (row =spatialQuery.fetch()) != null; lCount++) {
+                // one time execution
+                if (lCount == 0) {
+                    // analyze cols of result set
+                    SeColumnDefinition[] lCols = row.getColumns();
+
+                }
+                short lNumCols = row.getNumColumns();
+
+                for (int i = 0; i < lNumCols; i++) {
+                    System.out.println(row.getObject(i));
+                }
+
+            }
+            spatialQuery.close();
+
+        } catch (Exception e){
+                e.printStackTrace();
+        }
+
+    }
+
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+
+        try {
+            String[] layerNames = new String[] { "median.meshpoint", "median.mesh" };
+            String spatialColumnName = "SHAPE";
+            String where = "median.meshpoint.meshid = median.mesh.meshid";
+            String[] returnFields = new String[] { "sourceid" };
+            String byClause = "group by sourceid";
+            SDEPoint[] g = new SDEPoint[5];
+            g[0] = new SDEPoint(52, 8);
+            g[1] = new SDEPoint(52, 9);
+            g[2] = new SDEPoint(53, 9);
+            g[3] = new SDEPoint(53, 8);
+            g[4] = new SDEPoint(52, 8);
+
+            String server = "";
+            String port = "";
+            String database = "";
+            String username = "";
+            String credentials = "";
+            SeConnection con = new SeConnection(server, port,
+                                                database, username,
+                                                credentials);
+            new GroupBySample().executeQuery(con, layerNames, spatialColumnName,
+                                             where, g, returnFields, byClause);
+
+
+        } catch (SeException e) {
+           e.printStackTrace();
+        }
+    }
+}
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,42 +1,52 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.geobackend.base.query;
 
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
+
+import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory;
+
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+
 import java.io.FileInputStream;
 import java.io.InputStream;
+
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Properties;
 
+import junit.framework.TestCase;
+
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Logger;
 
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.geobackend.base.ResultDescriptor;
-import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
-import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory;
-import de.intevation.gnv.geobackend.base.query.exception.QueryException;
-import junit.framework.TestCase;
-
 /**
  * TestCase for the QueryExecutor interface
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class QueryExecutorTestCase extends TestCase {
-    
-    
+
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = null;
-    
+
     static{
         BasicConfigurator.configure();
         log = Logger.getLogger(QueryExecutorTestCase.class);
     }
-    
+
     /**
      * Constructor
      * @param name
@@ -44,18 +54,18 @@
     public QueryExecutorTestCase(String name) {
         super(name);
     }
-    
-    
+
+
     public void  testSpatialQuery(){
             try {
-            
+
             this.testQuery(5, "spatial_query", null);
        } catch (QueryException e) {
             log.error(e,e);
             fail();
         }
     }
-    
+
     public void  testSpatialQueryWithoutIntersects(){
             try {
 //            this.testQuery(286, "spatial_query_without_intersects", null);
@@ -69,7 +79,7 @@
             fail();
         }
     }
-    
+
     public void testSpatialQueryWithInnerSelect(){
         try {
             this.testQuery(1998, "spatial_query_with_innerselect", null);
@@ -78,8 +88,8 @@
             fail();
         }
     }
-    
-    
+
+
     public void  testChooseFis(){
         try {
             this.testQuery(1, "choose_fis_query", null);
@@ -88,44 +98,44 @@
             fail();
         }
     }
-    
-    
+
+
     /**
      * Tests if the Databaseconnection can be established and
      * Data could be read from the Database
      */
     public void testQueryExecutor(){
-        
+
         try {
-            
+
             this.testQuery(6, "mesh", null);
-            
+
             this.testQuery(1, "mesh_id", new String[]{"5"});
-            
-            
-            
+
+
+
         } catch (QueryException e) {
             log.error(e,e);
             fail();
         }
     }
-    
+
     public void testTimeSeriesQueries(){
-        
+
         try{
             // Test zum initialisieren der umgebung
             this.testQuery(6, "mesh", null);
-            
-            
+
+
             this.testQuery(11, "timeseries_stations", new String[]{"4"});
             this.testQuery(11, "timeseries_stations_op", new String[]{"4"});
             this.testQuery(1, "timeseries_interval", new String[]{"500042 ", "54"});
-            
+
         } catch (QueryException e) {
             log.error(e,e);
             fail();
         }
-        
+
     }
 
     /**
@@ -159,7 +169,7 @@
 //        }
         log.debug("Query dauerte: "+(System.currentTimeMillis()-start) +"ms");
     }
-    
+
 
 
     /**
@@ -167,20 +177,20 @@
      */
     @Override
     protected void setUp() throws Exception {
-        
+
         super.setUp();
         InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties");
         Properties properties = new Properties();
         properties.load(inputStream);
-        
+
         ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
         cpf.initializeConnectionPool(properties);
-        
-        
+
+
         inputStream = new FileInputStream("src/test/ressources/QueryExecutorTestCase.properties");
         properties = new Properties();
         properties.load(inputStream);
-        
+
         QueryContainerFactory qcf = QueryContainerFactory.getInstance();
         qcf.initializeQueryContainer(properties);
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/ToCharSample.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.base.query;
+
+import com.esri.sde.sdk.client.SDEPoint;
+import com.esri.sde.sdk.client.SeColumnDefinition;
+import com.esri.sde.sdk.client.SeConnection;
+import com.esri.sde.sdk.client.SeException;
+import com.esri.sde.sdk.client.SeFilter;
+import com.esri.sde.sdk.client.SeLayer;
+import com.esri.sde.sdk.client.SeQuery;
+import com.esri.sde.sdk.client.SeQueryInfo;
+import com.esri.sde.sdk.client.SeRow;
+import com.esri.sde.sdk.client.SeShape;
+import com.esri.sde.sdk.client.SeShapeFilter;
+import com.esri.sde.sdk.client.SeSqlConstruct;
+
+public class ToCharSample {
+
+
+    public boolean executeQuery(SeConnection con, String[] pLayername,
+                                   String pSpatialColumnName, String pWhere,
+                                   SDEPoint[] g, String[] pReturnFields, String byClause) {
+
+        try {
+            // get the layer for querying
+
+            SeShapeFilter[] filters  = null;
+            if (g != null){
+                SeLayer lLayer = new SeLayer(con, pLayername[0], pSpatialColumnName);
+                SeShape shape = new SeShape();
+                shape.setCoordRef(lLayer.getCoordRef());
+
+
+
+                shape.generatePolygon(g.length, 1, null, g);
+                SeShapeFilter filter = new SeShapeFilter(pLayername[0],
+                        pSpatialColumnName, shape, SeFilter.METHOD_AI);
+                filters = new SeShapeFilter[1];
+                filters[0] = filter;
+            }
+
+            SeQuery spatialQuery = null;
+            SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername, pWhere);
+            spatialQuery = new SeQuery(con);
+
+            SeQueryInfo queryInfo = new SeQueryInfo();
+            queryInfo.setColumns(pReturnFields);
+
+            if (byClause != null){
+                queryInfo.setByClause(byClause);
+            }
+
+            queryInfo.setConstruct(sqlCons);
+            spatialQuery.prepareQueryInfo(queryInfo);
+
+            /*
+             * Set spatial constraints
+             */
+            if (filters != null){
+                spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false,
+                        filters);
+            }
+            spatialQuery.execute();
+
+            SeRow row;
+            int lCount;
+            for (lCount = 0; (row =spatialQuery.fetch()) != null; lCount++) {
+                // one time execution
+                if (lCount == 0) {
+                    // analyze cols of result set
+                    SeColumnDefinition[] lCols = row.getColumns();
+
+                }
+                short lNumCols = row.getNumColumns();
+
+                for (int i = 0; i < lNumCols; i++) {
+                    System.out.println(row.getObject(i));
+                }
+
+            }
+            spatialQuery.close();
+            return true;
+        } catch (Exception e){
+                e.printStackTrace();
+                return false;
+        }
+
+    }
+
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) {
+
+        try {
+
+            String[] layerNames = new String[] { "MEDIAN.TRACK" };
+            String spatialColumnName = "SHAPE";
+            String where = "MEDIAN.TRACK.CRUISEID = 47";
+            String[] returnFields = new String[] { "MEDIAN.TRACK.TRACKID KEY",
+                                                   "to_char(STARTDATE,'DD.MM.YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD.MM.YYYY HH24:MI') || ' - '|| NAME VALUE",
+                                                   "NAME" };
+            String byClause = "ORDER BY STARTDATE, ENDDATE, NAME";
+            SDEPoint[] g = new SDEPoint[5];
+            g[0] = new SDEPoint(52, 8);
+            g[1] = new SDEPoint(52, 9);
+            g[2] = new SDEPoint(53, 9);
+            g[3] = new SDEPoint(53, 8);
+            g[4] = new SDEPoint(52, 8);
+
+            String server = "";
+            String port = "";
+            String database = "";
+            String username = "";
+            String credentials = "";
+
+            SeConnection con = new SeConnection(server, port,
+                                                database, username,
+                                                credentials);
+            boolean success = new ToCharSample().executeQuery(con, layerNames, spatialColumnName,
+                                             where, g, returnFields, byClause);
+
+            if (success){
+                System.out.println("Terminated successful.");
+            }else{
+                System.out.println("Terminated with an Exception.");
+            }
+        } catch (SeException e) {
+           e.printStackTrace();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/cache/CacheCleanerTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.geobackend.base.query.cache;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Logger;
+
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
+import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory;
+
+public class CacheCleanerTestCase extends TestCase {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = null;
+
+    static{
+        BasicConfigurator.configure();
+        log = Logger.getLogger(CacheCleanerTestCase.class);
+    }
+
+    public void testCachCleaner(){
+        log.debug("CacheCleanerTestCase.testCachCleaner");
+        CacheCleaner cc = new CacheCleaner();
+        boolean success = cc.test();
+        if (!success){
+            log.error("TestCase failed.");
+            fail();
+        }
+    }
+
+    /**
+     * @see junit.framework.TestCase#setUp()
+     */
+    @Override
+    protected void setUp() throws Exception {
+
+        super.setUp();
+        InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties");
+        Properties properties = new Properties();
+        properties.load(inputStream);
+
+        ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
+        cpf.initializeConnectionPool(properties);
+
+
+        inputStream = new FileInputStream("src/test/ressources/QueryExecutorTestCase.properties");
+        properties = new Properties();
+        properties.load(inputStream);
+
+        QueryContainerFactory qcf = QueryContainerFactory.getInstance();
+        qcf.initializeQueryContainer(properties);
+    }
+}
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,28 +1,40 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.geobackend.sde.datasources;
 
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool;
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
+
+import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
+
+import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory;
+
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+
 import java.sql.Connection;
+import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+
 import java.util.Properties;
-import java.sql.ResultSet;
 
 import junit.framework.TestCase;
 
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Logger;
 
-import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool;
-import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
-import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
-import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory;
-
 /**
  * TestCase for the usage of the ArcSDEConnectionPool.
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class ArcSDEConnectionPoolTestCase extends TestCase {
@@ -31,26 +43,26 @@
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = null;
-    
+
     static {
         BasicConfigurator.configure();
         log = Logger.getLogger(ArcSDEPoolableObjectFactory.class);
     }
     /**
-     * 
+     *
      */
     public ArcSDEConnectionPoolTestCase() {
         super();
     }
-    
+
     /**
-     * 
+     *
      * @param name
      */
     public ArcSDEConnectionPoolTestCase(String name) {
         super(name);
     }
-    
+
     /**
      * Test if the ArcSDEConnectionPool can be established
      * and if a Request could be done.
@@ -61,18 +73,18 @@
             InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties");
             Properties properties = new Properties();
             properties.load(inputStream);
-            
+
             ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
             cpf.initializeConnectionPool(properties);
-            
+
             assertTrue(cpf.isInitialized());
             log.debug("ConnectionPoolFactory ist initialisiert.");
-            
+
             ConnectionPool cp = cpf.getConnectionPool();
             assertNotNull(cp);
-            log.debug("ConnectionPool ist initialisiert.");			
-            
-            Connection connection = null; 
+            log.debug("ConnectionPool ist initialisiert.");
+
+            Connection connection = null;
             try{
                 try {
                     connection = cp.getConnection("N/N");
@@ -82,20 +94,20 @@
                     log.error("Es traten Probleme bei der Verbinung zur Datenbank auf.");
                     fail();
                 }
-                
-                
+
+
                 try {
                     Statement stmt = connection.createStatement();
                     ResultSet rs = stmt.executeQuery("Select MESHID, NAME from MEDIAN.MESH");
-                    
+
                     while (rs.next()){
                         log.debug(rs.getInt(1));
                         log.debug(rs.getString(2));
-                        
+
                         log.debug(rs.getInt("MESHID"));
                         log.debug(rs.getString("NAME"));
                     }
-                    
+
                 } catch (SQLException e) {
                     log.error(e,e);
                 }
--- a/geo-backend/src/test/ressources/QueryExecutorTestCase.properties	Fri Sep 28 12:13:47 2012 +0200
+++ b/geo-backend/src/test/ressources/QueryExecutorTestCase.properties	Fri Sep 28 12:15:18 2012 +0200
@@ -96,3 +96,9 @@
                       (SELECT st_astext(SHAPE) FROM MEDIAN.FEATUREAREA WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND FEATURECODE = 41 )\
                       ) \
      order by M.NAME
+test_regionfilter = SELECT M.OBJECTID KEY, M.NAME VALUE FROM MEDIAN.MESHPOINT, MEDIAN.MESH M WHERE M.SOURCEID IN (2) AND M.MESHID = MEDIAN.MESHPOINT.MESHID AND INTERSECTS(SHAPE, (SELECT st_astext(SHAPE) FROM MEDIAN.FEATUREAREA WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND FEATURECODE = ? )) order by M.NAME
+
+
+updated_tables = SELECT FULLTABLENAME \
+    FROM MEDIAN.LASTUPDATED \
+    WHERE LASTUPDATE >= to_date('?', 'YYYY.MM.DD HH24:MI:SS')
--- a/gnv-artifacts/ChangeLog	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/ChangeLog	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,5468 @@
+2012-03-12  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/test/java/de/intevation/gnv/artifacts/TestCallContext.java,
+	  src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java,
+	  src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java,
+	  src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshParallelArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileArtifact.java,
+	  src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java,
+	  src/main/java/de/intevation/gnv/layer/LayerArtifact.java,
+	  pom.xml: Made it compile again with an updated ArtifactDatabase.
+
+2011-03-14	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/**/*.java: Changed imports to fit new positions of XMLUtils and Config:
+	  $ find -name \*.java | xargs sed -i \
+	    -e 's/import de\.intevation\.artifactdatabase\.Config/import de.intevation.artifacts.common.utils.Config/' \
+		-e 's/import de\.intevation\.artifactdatabase\.XMLUtils/import de.intevation.artifacts.common.utils.XMLUtils/'
+	  
+2010-11-04  Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* contrib/palette2polygonVM.xsl,
+	  contrib/visualize-transitions.xsl: Added author names.
+
+2010-11-02  Ingo Weinzierl <ingo@intevation.de>
+
+	* contrib/palette2polygonVM.xsl,
+	  contrib/palette2qgis.xsl,
+	  contrib/visualize-transitions.xsl,
+	  doc/schema/externalinterface_schema.sql,
+	  doc/schema/externalinterface_testdata.sql,
+	  doc/conf/maptemplates/caps.xml,
+	  src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestSuite.java,
+	  src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/TestCallContext.java,
+	  src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java,
+	  src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java,
+	  src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/ressource/RessourceFactoryTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/util/DistanceCalculatorTestCase.java,
+	  src/test/java/de/intevation/gnv/artifacts/util/ShapeFileWriterTestCase.java,
+	  src/main/java/de/intevation/gnv/artifacts/APP.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/product/Product.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/PreSettingArtifact.java,
+	  src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/MetaDataServiceException.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Parameter.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Layer.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/MapService.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java,
+	  src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java,
+	  src/main/java/de/intevation/gnv/state/OutputState.java,
+	  src/main/java/de/intevation/gnv/state/DefaultInputValue.java,
+	  src/main/java/de/intevation/gnv/state/OutputMode.java,
+	  src/main/java/de/intevation/gnv/state/StateFactory.java,
+	  src/main/java/de/intevation/gnv/state/exception/StateException.java,
+	  src/main/java/de/intevation/gnv/state/cache/ThematicDataCacheCleaner.java,
+	  src/main/java/de/intevation/gnv/state/cache/QueryObject.java,
+	  src/main/java/de/intevation/gnv/state/MeasurementState.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java,
+	  src/main/java/de/intevation/gnv/state/AutoResumeState.java,
+	  src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java,
+	  src/main/java/de/intevation/gnv/state/DefaultExportMode.java,
+	  src/main/java/de/intevation/gnv/state/layer/LayerMetaData.java,
+	  src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java,
+	  src/main/java/de/intevation/gnv/state/InputValue.java,
+	  src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java,
+	  src/main/java/de/intevation/gnv/state/SingleInputState.java,
+	  src/main/java/de/intevation/gnv/state/SwitchModeState.java,
+	  src/main/java/de/intevation/gnv/state/DefaultOutputMode.java,
+	  src/main/java/de/intevation/gnv/state/ExtendedInputData.java,
+	  src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java,
+	  src/main/java/de/intevation/gnv/state/State.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionParallelOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java,
+	  src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileMeshVectorOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/DefaultState.java,
+	  src/main/java/de/intevation/gnv/state/ExportMode.java,
+	  src/main/java/de/intevation/gnv/state/MinMaxDateState.java,
+	  src/main/java/de/intevation/gnv/state/InputData.java,
+	  src/main/java/de/intevation/gnv/state/MinMaxState.java,
+	  src/main/java/de/intevation/gnv/state/describedata/NamedArrayList.java,
+	  src/main/java/de/intevation/gnv/state/describedata/ExtendedKeyValueData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/NamedCollection.java,
+	  src/main/java/de/intevation/gnv/state/describedata/MinMaxDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/DefaultKeyValueDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/DefaultMinMaxDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/SingleValueDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/DescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/DefaultSingleValueDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/KeyValueDescibeData.java,
+	  src/main/java/de/intevation/gnv/state/OutputStateBase.java,
+	  src/main/java/de/intevation/gnv/state/DefaultInputData.java,
+	  src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java,
+	  src/main/java/de/intevation/gnv/math/ConstantFunction.java,
+	  src/main/java/de/intevation/gnv/math/ConstantXYDepth.java,
+	  src/main/java/de/intevation/gnv/math/LinearMetrics.java,
+	  src/main/java/de/intevation/gnv/math/QueriedXYDepth.java,
+	  src/main/java/de/intevation/gnv/math/L1Comparator.java,
+	  src/main/java/de/intevation/gnv/math/HeightValue.java,
+	  src/main/java/de/intevation/gnv/math/Metrics.java,
+	  src/main/java/de/intevation/gnv/math/IJKey.java,
+	  src/main/java/de/intevation/gnv/math/LinearToMap.java,
+	  src/main/java/de/intevation/gnv/math/Interpolation2D.java,
+	  src/main/java/de/intevation/gnv/math/XYColumn.java,
+	  src/main/java/de/intevation/gnv/math/Interpolation3D.java,
+	  src/main/java/de/intevation/gnv/math/Point2d.java,
+	  src/main/java/de/intevation/gnv/math/AreaInterpolation.java,
+	  src/main/java/de/intevation/gnv/math/LinearFunction.java,
+	  src/main/java/de/intevation/gnv/math/Interpolator.java,
+	  src/main/java/de/intevation/gnv/math/GridCell.java,
+	  src/main/java/de/intevation/gnv/math/XYDepth.java,
+	  src/main/java/de/intevation/gnv/math/AttributedXYColumns.java,
+	  src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java,
+	  src/main/java/de/intevation/gnv/statistics/StatisticSet.java,
+	  src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/Statistic.java,
+	  src/main/java/de/intevation/gnv/statistics/TimeseriesVectorStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/HorizontalProfileVectorStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/VerticalProfileVectorStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/Statistics.java,
+	  src/main/java/de/intevation/gnv/statistics/VectorStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/exception/StatisticsException.java,
+	  src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java,
+	  src/main/java/de/intevation/gnv/transition/DefaultTransition.java,
+	  src/main/java/de/intevation/gnv/transition/TransitionFactory.java,
+	  src/main/java/de/intevation/gnv/transition/TransitionBase.java,
+	  src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java,
+	  src/main/java/de/intevation/gnv/transition/Transition.java,
+	  src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java,
+	  src/main/java/de/intevation/gnv/histogram/HistogramHelper.java,
+	  src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshParallelArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshCrossArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileInstantaneousPointArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileMeshArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileInstantaneousPointArtifact.java,
+	  src/main/java/de/intevation/gnv/raster/Raster.java,
+	  src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java,
+	  src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java,
+	  src/main/java/de/intevation/gnv/raster/AbstractProducer.java,
+	  src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java,
+	  src/main/java/de/intevation/gnv/raster/RasterToPPM.java,
+	  src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java,
+	  src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java,
+	  src/main/java/de/intevation/gnv/raster/Filter.java,
+	  src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java,
+	  src/main/java/de/intevation/gnv/raster/KernelFilter.java,
+	  src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java,
+	  src/main/java/de/intevation/gnv/raster/PaletteManager.java,
+	  src/main/java/de/intevation/gnv/raster/Vectorizer.java,
+	  src/main/java/de/intevation/gnv/raster/Palette.java,
+	  src/main/java/de/intevation/gnv/raster/IsoProducer.java,
+	  src/main/java/de/intevation/gnv/utils/FileUtils.java,
+	  src/main/java/de/intevation/gnv/utils/IndexBuffer.java,
+	  src/main/java/de/intevation/gnv/utils/DistanceCalculator.java,
+	  src/main/java/de/intevation/gnv/utils/InputValidator.java,
+	  src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java,
+	  src/main/java/de/intevation/gnv/utils/ExclusiveExec.java,
+	  src/main/java/de/intevation/gnv/utils/exception/ValidationException.java,
+	  src/main/java/de/intevation/gnv/utils/MetaWriter.java,
+	  src/main/java/de/intevation/gnv/utils/MapfileGenerator.java,
+	  src/main/java/de/intevation/gnv/utils/WKTUtils.java,
+	  src/main/java/de/intevation/gnv/utils/StringUtils.java,
+	  src/main/java/de/intevation/gnv/utils/Pair.java,
+	  src/main/java/de/intevation/gnv/utils/VectorDataProcessor.java,
+	  src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalProfileVectorChart.java,
+	  src/main/java/de/intevation/gnv/chart/Chart.java,
+	  src/main/java/de/intevation/gnv/chart/DefaultHistogram.java,
+	  src/main/java/de/intevation/gnv/chart/XMLChartTheme.java,
+	  src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java,
+	  src/main/java/de/intevation/gnv/chart/exception/TechnicalChartException.java,
+	  src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java,
+	  src/main/java/de/intevation/gnv/chart/TimeSeriesVectorChart.java,
+	  src/main/java/de/intevation/gnv/chart/HorizontalProfileVectorChart.java,
+	  src/main/java/de/intevation/gnv/chart/AbstractHistogram.java,
+	  src/main/java/de/intevation/gnv/chart/ChartLabels.java,
+	  src/main/java/de/intevation/gnv/chart/AbstractChart.java,
+	  src/main/java/de/intevation/gnv/chart/AdvancedHistogramDataset.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java,
+	  src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java,
+	  src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java,
+	  src/main/java/de/intevation/gnv/exports/Export.java,
+	  src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java,
+	  src/main/java/de/intevation/gnv/exports/ChartExportHelper.java,
+	  src/main/java/de/intevation/gnv/exports/SimpleOdvDataCollector.java,
+	  src/main/java/de/intevation/gnv/exports/DefaultDataCollector.java,
+	  src/main/java/de/intevation/gnv/exports/DefaultProfile.java,
+	  src/main/java/de/intevation/gnv/exports/DefaultExport.java,
+	  src/main/java/de/intevation/gnv/exports/ODVExport.java,
+	  src/main/java/de/intevation/gnv/exports/StringArrayKey.java,
+	  src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java,
+	  src/main/java/de/intevation/gnv/wms/LayerInfo.java,
+	  src/main/java/de/intevation/gnv/timeseries/TimeSeriesMeshArtifact.java,
+	  src/main/java/de/intevation/gnv/timeseries/gap/TimeGap.java,
+	  src/main/java/de/intevation/gnv/timeseries/gap/DefaultTimeGap.java,
+	  src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java,
+	  src/main/java/de/intevation/gnv/layer/LayerArtifact.java,
+	  src/main/java/de/intevation/gnv/jfreechart/LevelOrderIndices.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java,
+	  src/main/java/de/intevation/gnv/jfreechart/CompactXYItems.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonSeriesLabelGenerator.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java,
+	  bin/run.sh: Added license header to each these files.
+
+	* LGPL.txt: Added license file of the GNU LGPL v2.1
+
+2010-06-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	RELEASE 1.1
+
+	* ChangeLog, Changes, NEWS: Summarized changes.
+
+2010-06-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue320
+
+	* src/main/java/de/intevation/gnv/chart/AdvancedHistogramDataset.java: The
+	  minimum number of bins in an histogram is set to 1. If the user has chosen
+	  a value for the class width that results in number < 1, the bin number is
+	  set to 1.
+
+2010-06-29  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Write missing bbox into meta file while WMS publishing - the missing bbox
+	  prevented the map from initializing properly and it wasn't displayed in
+	  the gui.
+
+2010-06-29  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue315, Issue314
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java: All
+	  generated wms layers will now have a prefix 'GNV_'. On this way, we can
+	  ensure that the name of wms layers never start with a digit. This is
+	  necessary to prevent the mapserver from generating invalid xml while
+	  creating a GetFeatureInfo response (mapserver generates xml elements from
+	  layer names - xml nodes may not start with a digit!).
+
+2010-06-29  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue318
+
+	* doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml: Transition
+	  bugfix: Given points from mapviewer call are now taken into account as
+	  well.
+
+2010-06-29  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue286
+
+	* src/main/java/de/intevation/gnv/utils/InputValidator.java: Added a buffer
+	  of 1 second for the valid time range. The valid values that are returnd
+	  from database differ in milliseconds. Example: the lower time returned
+	  from database is 00:00:00.650, the gui will display 00:00:00. This caused
+	  an error because the data given by the user was 650 ms under the lower
+	  bound. With a 1 second range, the lower bound is moved to 23:59:59.650, so
+	  that the time given by the user is in the valid range.
+
+2010-06-29  Tim Englich  <tim.englich@intevation.de>
+
+	  Issue318
+
+	* doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml: 
+	  Removed duplicate xmlns:xlink definition.
+
+2010-06-29  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue316
+
+	* src/main/java/de/intevation/gnv/chart/DefaultHistogram.java: Set the
+	  specified locale in the constructor which is used to localize the axes.
+
+	* src/main/java/de/intevation/gnv/chart/AbstractHistogram.java: Adjust the
+	  localization of x and y axes corresponding the specified locale.
+
+2010-06-29  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue318
+
+	* doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml: Added
+	  transition chain for the external mapviewer call.
+
+2010-06-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue284
+
+	* doc/conf/queries.properties: Added missing column MESHID to chart data
+	  query for product 'Horizontales Schnittprofil'. This column is required
+	  by the csv export of this product.
+
+2010-06-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue233
+
+	* src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Fixed
+	  the range calculation for y-axes if there is only a single datapoint
+	  existing in the chart.
+
+2010-06-28  Tim Englich  <tim.englich@intevation.de>
+
+	  Issue283: 
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (getRequestedLayerMetadata): 
+	  Bugfix: Now geometries of the generated layers will also be clipped if a 
+	  polygon served by the mv-gnv-interface should be used.
+
+2010-06-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue281
+
+	* src/main/java/de/intevation/gnv/state/MeasurementState.java: Fixed an
+	  ArrayIndexOutOfBounds exception that occured while initializing the
+	  ParameterMatrix.
+
+2010-06-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue230
+
+	* doc/conf/queries.properties: Removed multiplication of depth value with
+	  factor -1 for odv queries on vertical profiles.
+
+2010-06-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue300
+
+	* doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml: Fixed
+	  broken transition. The transition chain ended after choosing a subarea;
+	  now it leads to the coordinate selection.
+
+2010-06-15  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE299v
+
+	* doc/conf/products/horizontalprofile/conf_mesh.xml: 
+	  Bugfix: Change multiselect to false for the Parameter-State of 
+	  vector-values. It is not possible to render more than one Parameter if
+	  vector-values are used.
+
+2010-06-15  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE299
+
+	* doc/conf/products/verticalprofile/conf_mesh.xml: 
+	  Bugfix: Change multiselect to false for the Parameter-State of 
+	  vector-values. It is not possible to render more than one Parameter if
+	  vector-values are used.
+
+2010-06-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages.properties: 
+	  Fixed typo. Scalar Values will now be written capitalized.
+
+2010-06-15  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE297
+
+	* src/main/resources/lang/artifactMessages*.properties: 
+	  Added localized exceptionmessage for MinMaxState.
+
+	* src/main/java/de/intevation/gnv/state/MinMaxState.java (feed): 
+	  Localized exceptionmessage which will be displayed in the GUI of the GNV
+	  Web-Client.
+
+2010-06-14  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* pom.xml: Write svn revision to MANIFEST file while creating jar archive.
+
+2010-06-14  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue250 - Adjusted subtitle of 'Achsenparalleles Vertikalprofil'
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionParallelOutputState.java:
+	  Adapted the subtitle of charts from type 'Achsenparalleles
+	  Vertikalprofil'.
+
+2010-06-14  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml: Renamed
+	  parameter 'coordinate' to 'mesh_coordinate', because the strings shown in
+	  the gui depend on the parameter names. 'mesh_coordinate' matches
+	  "Geographische Position (z.B. 56n30 6e20)" in the german resource bundle.
+	  "Koordinate" has been displayed before this change has taken place.
+
+2010-06-12  Ingo Weinzierl <ingo_weinzierl@web.de>
+
+	* doc/conf/products/horizontalprofile/conf_mesh_parallel.xml: Configuration
+	  for the new product 'Achsenparalleler Vertikalschnitt'.
+
+	* doc/conf/queries.properties: A new sql statement to query all points of a
+	  given axis of a mesh.
+
+	* doc/conf/conf.xml: Added the new product to fis 'Modeldaten'.
+
+	* src/main/resources/lang/artifactMessages.properties,
+	  src/main/resources/lang/artifactMessages_de_DE.properties,
+	  src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages_de.properties: Added a name for
+	  the new product 'Achsenparalleler Vertikalschnitt'.
+
+	  TODO: Find an english name for this product!
+
+2010-06-12  Ingo Weinzierl <ingo_weinzierl@web.de>
+
+	* src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshParallelArtifact.java:
+	  A new artifact that is used for the product 'Achsenparalleler
+	  Vertikalschnitt'.
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  The determination of the linestring that is used in the interpolation is
+	  outsourced to an own method. This makes it possible to be overriden by
+	  subclasses.
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionParallelOutputState.java:
+	  Inherits of VerticalCrossSectionOutputState. It overrides the linestring
+	  determination. In this product, no linestring is given by user input but
+	  an axis of the mesh is selected. The linestring is made up by the point of
+	  this axis.
+
+2010-06-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue286 - Input validation of time ranges
+
+	* src/main/java/de/intevation/gnv/utils/InputValidator.java: Removed the
+	  epsilon that has been used to compare time values. Now, we just compare
+	  the seconds of a time value pair - background: datetime objects differ in
+	  milliseconds.
+
+2010-06-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue290 - Centering of pdf exports
+
+	* src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: PDF
+	  exports of histograms are centered now.
+
+2010-06-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue290 - Centering of pdf exports
+
+	* src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: PDF
+	  exports of charts are centered now.
+
+2010-06-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/VerticalProfileVectorChart.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java: Improved
+	  data initialization and range calculation. Gap detection will be entered,
+	  if start and end position are valid indices for the array that contains
+	  the data. The x and y range for each axis is improved.
+
+2010-06-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_timeseriespoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml: Limited
+	  parameterization so that just a single vector can be selected at the same
+	  time.
+
+2010-06-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java:
+	  Overide method getHistograms(.) to create histograms for
+	  verticalprofiles that contain the components of vectorial parameters.
+
+2010-06-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java:
+	  Overide method getHistograms(.) to create histograms for
+	  horizontalprofiles that contain the components of vectorial parameters.
+
+2010-06-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java:
+	  Override method getHistograms(.) of TimeSeriesOutputState to create
+	  histograms that contain the components of vectorial parameters. This
+	  method doesn't have many tasks but calls getHistograms(.) of
+	  VectorDataProcessor.
+
+	* src/main/java/de/intevation/gnv/utils/VectorDataProcessor.java: The real
+	  implementation of getHistograms(.) for creating histograms that contain 
+	  the components of vectorial parameters. This place was chosen to make it
+	  possible to use this method in all vector output states (because multiple
+	  inheritance is not available in Java).
+
+	* src/main/java/de/intevation/gnv/histogram/HistogramHelper.java:
+	  A new method to prepare the data for histograms that contain the
+	  components of vectorial parameters.
+
+2010-06-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Seperated the histogram creation into an own method. This enables
+	  subclasses to override the histogram creation. Moved the method
+	  createHistogramLabels(.) to HistogramHelper.
+
+	* src/main/java/de/intevation/gnv/histogram/HistogramHelper.java:
+	  New method to create histogram labels (moved from TimeSeriesOutputState).
+
+2010-06-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/statistics/VerticalProfileVectorStatistics.java:
+	  This class created statistics for vertical proifles with vectorial
+	  parameters.
+
+	* src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java:
+	  Added a new method that returns an instance of
+	  VerticalProfileVectorStatistics.
+
+2010-06-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/statistics/HorizontalProfileVectorStatistics.java:
+	  This is a class to create statistics for horizontal profiles with
+	  vectorial parameters.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java:
+	  Added a new method to return an instance of
+	  HorizontalProfileVectorStatistics.
+
+	* src/main/java/de/intevation/gnv/statistics/TimeseriesVectorStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/VectorStatistics.java: Added a
+	  method to clean the statistics for the next vector component.
+
+2010-06-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/statistics/VectorStatistics.java: This is
+	  an abstract base class for statistics of vectorial parameters. There are
+	  two methods that need to be overriden by subclasses.
+
+	* src/main/java/de/intevation/gnv/statistics/TimeseriesVectorStatistics.java:
+	  A concrete statistics class for timeseries statistics of vectorial
+	  parameters.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java:
+	  Added a new method that returns an instance of TimeseriesVectorStatistics
+	  to create a statistic for this product type.
+
+2010-06-08  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java:
+	  Added odv support for horizontal profiles using vector data.
+
+2010-06-08  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/horizontalprofile/conf_mesh.xml: Added the transitions
+	  for horizontal profiles on meshes that make use of vector data.
+
+2010-06-08  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java:
+	  A new output state for horizontal profiles using vector data.
+
+	* src/main/java/de/intevation/gnv/chart/HorizontalProfileVectorChart.java: A
+	  new horizontal profile chart type using vector data.
+
+2010-06-07  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml: Added
+	  transitions for working with vertical profiles that contain vector data.
+
+2010-06-07  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileMeshVectorOutputState.java:
+	  A new output state for verticalprofiles on meshes that contain vector
+	  data.
+
+2010-06-07  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/utils/VectorDataProcessor.java: The
+	  columns used for the final ResultDescriptor are no longer configured here
+	  - they need to be configured in the output states of each product. The
+	  VectorDataProcessor is called with the data collection and these columns
+	  now (so the method signature of process(.) changed).
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java:
+	  Configured ResultDescriptor columns here and adapted method call of
+	  VectorDataProcessor.process(.).
+
+	* src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java:
+	  This output state is used while working vector data on verticalprofiles.
+	  Before a chart is generated by this state, the vector data are converted
+	  using VectorDataProcessor.
+
+	* src/main/java/de/intevation/gnv/chart/VerticalProfileVectorChart.java: A
+	  new chart type used for verticalprofiles with vector data.
+
+	* doc/conf/queries.properties: A parameter of an sql statement got a name.
+
+2010-06-07  Tim Englich  <tim.englich@intevation.de>
+
+	  Added functionality to publish the the mbr of the generated layer to
+	  the client.
+	* src/main/java/de/intevation/gnv/utils/MetaWriter.java (insertMbr): 
+	  Added function to add an box-element to the mapserver-fragmet of the 
+	  Metafile
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java, 
+	  src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Calculate the box and write it into the metafile using the insertMbr-method 
+	  of MetaWriter to publish the mbr of the data which was fetched during the 
+	  request to the client.
+
+2010-06-07  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/conf.xml: 
+	  Revert wrong Commit Revision 1163.
+
+2010-06-07  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/maptemplates/horizontalcrosssection_*.vm, 
+	  doc/conf/maptemplates/layer_polygon.vm, 
+	  doc/conf/maptemplates/layer_point.vm, 
+	  doc/conf/maptemplates/layer_linestring.vm: 
+	  Added Configuration Elements TEMPLATE, DUMP, TOLERANCE and 
+	  METADATA/gml_include_items to enable GetFeatureInforRequests using gml
+	  as INFO_FORMAT for products of type layer.
+
+2010-06-07  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/maptemplates/mapfile.vm: 
+	  Added MAXSIZE to the mapfiletemplate so that it is possible to render the
+	  layer in the fullscreenmode of a mapclient which will request images that 
+	  size are greater than 2048 Pixel.
+
+2010-06-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/timeseries/conf_mesh.xml: Added vector support for
+	  timeseries points on meshes.
+
+2010-06-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java: The
+	  ehcache CacheManager and the MBeanServer of the JVM are connected so that
+	  the statistics of the cache is available as MBean in JConsole.
+
+2010-06-03  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Removed needless imports.
+
+2010-06-03  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/sql-cache.xml: SQL-cache configuration.
+
+	* doc/conf/conf.xml: Added a new section to the geo-backend section to
+	  configure, enable/disable the sql-cache. The sql-cache is activated in
+	  the default configuration.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Removed the initialization of geo-backend related objects (as ArcSDE
+	  connection settings, queries). This work is done in the geo-backend
+	  itself, now. At this place, a new geo-backend Configuration object is
+	  created and its init(.) method is called.
+
+2010-06-02  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Remove
+	  cached elements of each state that is visited while stepping back to a
+	  previous state.
+
+2010-06-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Do not
+	  call endOfLife of the current state before advancing to the next state.
+	  This would make it impossible to use the cache.
+
+2010-06-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Remove existing
+	  elements from cache that belong to an outdated state if its enfOfLife(.)
+	  is called. It was necessary to adapt the signature of getHash(.) for this
+	  - removed the parameter uuid - because endOfLife is called without any
+	  information about the current uuid. The uuid has not been used in
+	  getHash() anyway.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java,
+	  src/main/java/de/intevation/gnv/state/OutputStateBase.java: Adapted the
+	  signature of getHash() regarding the changes in the implementing class
+	  StateBase.
+
+2010-05-31  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added queries for TimeSeriesPoints using vectorvalues for verticalprofiles.
+
+2010-05-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue291
+
+	* src/main/java/de/intevation/gnv/exports/ODVExport.java: Fixed the
+	  aggregation of parameters.
+
+2010-05-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue198
+
+	* src/main/java/de/intevation/gnv/utils/MetaWriter.java: Product 'Layer' and 
+	  'Horizontalschnitt' use the same code to write meta files. To create a
+	  meta file, it is now necessary to use four methods:
+	  - initMeta(): creates a new xml document and inserts the root node 'meta'
+	  - insertAbstractMeta(.): adds meta information into the meta file
+	  - insertLayer(.): adds layer specific information into the meta file
+	  - writeMetaFile(.): writes the meta information file to disk.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java: Make
+	  use of the new methods of MetaWriter. Both classes use the same methods
+	  now!
+
+	* doc/conf/queries.properties: Fetch the layername from database while
+	  requesting wms data.
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerMetaData.java: Added the
+	  title of a layer. The title is used while creating the meta information
+	  file for wms layers.
+
+	* doc/conf/maptemplates/horizontalcrosssection_salinity.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm,
+	  doc/conf/maptemplates/layer_linestring.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_flow-velocity.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_flow-velocity_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-levels.vm,
+	  doc/conf/maptemplates/layer_polygon.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-temperature.vm,
+	  doc/conf/maptemplates/layer_point.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-levels_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-temperature_isolines.vm:
+	  Adjusted the templates regarding the changes in meta file. Each parameter
+	  that is necessary in these templates is contained in the LayerInfo object.
+	  So there is no need to concatenate parameters as it was the case before
+	  these changes. Furthermore, there is a new section that contains the title
+	  of a layer - the title is adjustable by the user.
+
+2010-05-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: Fixed a
+	  bug while exporting charts and histograms to pdf. Charts/histograms that
+	  are larger than the pdf page have been cut. The reason was a usage of
+	  wrong values when creating the graphics area for the charts/histograms.
+
+2010-05-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue288
+
+	* src/main/java/de/intevation/gnv/chart/DefaultHistogram.java: Use
+	  AdvancedHistogramDataset as dataset for histograms instead of JFreeChart's
+	  HistogramDataset. Adjusted the calculation of bin width and number of bins
+	  for this.
+
+	* src/main/java/de/intevation/gnv/chart/AdvancedHistogramDataset.java: This
+	  class is mainly a copy of JFreeChart's class HistogramDataset. The
+	  difference between these two classes is, that AdvancedHistogramDataset
+	  takes an argument for setting the bin width as well as an argument to
+	  adjust the number of bins - HistogramDataset just takes the number of
+	  bins. The reason why AdvancedHistogramDataset doesn't inherit from
+	  HistogramDataset is, that basic attributes of that class have private
+	  access.
+
+2010-05-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue289
+
+	* src/main/java/de/intevation/gnv/chart/DefaultHistogram.java: Values
+	  specifying the bin width or the number of bins are inserted into this
+	  histogram as double values - no longer as i18n strings. So the complete
+	  parsing code is removed.
+
+2010-05-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue290 - PDF format of histograms depends on histograms' apsect ratio.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Removed the boolean parameter to adjust the page format when calling the
+	  pdf export method of a histogram.
+
+	* src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: The format
+	  of a histogram depends on its width and height. Width and height depends
+	  on user input or the default size (600x400).
+
+2010-05-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue290 - PDF format depends on the chart's aspect ratio.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Removed reading the system property "export.pdf.landscape" to adjust the
+	  page format of a pdf.
+
+	* src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: The page
+	  format of a pdf now depends on the chart's aspect ratio. If width > height
+	  the format will be landscape, otherwise the format will be portrait.
+
+2010-05-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue286
+
+	* src/main/java/de/intevation/gnv/utils/InputValidator.java: Introduced an
+	  epsilon environment to be more tolerant while comparing date objects. The
+	  value of the current epsilon is 750ms.
+
+2010-05-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue290
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Added chart width and chart height as new parameters for the pdf creation.
+
+	* src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: Don't use
+	  the maximum size of a pdf page to draw the chart but use the parameter
+	  chart width and chart height. Scale the chart down if its size and/or
+	  height exceed the maximum size of the pdf page - the original aspect
+	  ratio keeps alive.
+
+2010-05-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue287
+
+	* src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java:
+	  Corrected the distance calculation of a 'Horizontal Profil' and adjusted
+	  the gap detection according to these changes.
+
+2010-05-24  Ingo Weinzierl <ingo_weinzierl@web.de>
+
+	  Issue290
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  The size of an svg export depends on the size chosen by the user (or the
+	  default size if the user did not change the size) - it is not fixed
+	  anymore.
+
+2010-05-21  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added queries for meshes using vectorvalues for "Horizontales Schnittprofil"
+
+2010-05-21  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added queries for meshes using vectorvalues for horizontalprofiles.
+
+2010-05-21  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added queries for meshes using vectorvalues for verticalprofiles.
+
+2010-05-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue269
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java:
+	  Improved the directory handling for wms requests (directories are created
+	  if there is no directory existing for the shapefiles; the content of
+	  directories is deleted if the directory is existing). The shapefiles are
+	  always generated again as well if there is an directory existing and it
+	  contains files - we cannot know if these files are shapefiles that have
+	  been created by our application.
+
+2010-05-21  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added queries for Meshes using Vectorvalues for TimeSeries.
+
+2010-05-21  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Integrated View MEDIAN.TIMESERIESFULLVECTORVALUE in queries for fetching 
+	  the data for Charts and ODV-Export on TimeSeriesPoints using vetcor data.
+
+2010-05-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue27 - Implemented odv export for vector data of timeseriespoints.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java:
+	  Implemented the odv export for vector data on timeseriespoints.Therefore,
+	  the getData(.) method for processing vector data has been removed. The
+	  processing needs to take place after getData(.) fetched the data from
+	  database, because it's not necessary to process vector data used for an
+	  odv export (which is fetched via getData(.) as well).
+
+2010-05-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue27 - Vector data support for timeseriespoints finished.
+
+	* doc/conf/products/timeseries/conf_timeseriespoint.xml: Adjusted the
+	  relevant OutputState for timeseries with components of vector data.
+	
+	* src/main/java/de/intevation/gnv/utils/VectorDataProcessor.java: A helper
+	  class that converts vector data into a useful container for our chart
+	  classes. Our chart classes just use one single data value of each Result
+	  object - but there is a data value for each component of a vector. So we
+	  need to split Result object into many Result objects - one for each vector
+	  component.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java:
+	  Inherits from TimeSeriesOutputStates. Currently, the only reason for this
+	  class is to instantiate TimeSeriesVectorChart objects instead of
+	  TimeSeriesChart objects.
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesVectorChart.java: This
+	  chart type inherits from TimeSeriesChart. The only difference between
+	  these two types is the way how to add datasets and how to create names for
+	  series - most of the code is equal.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Timegap definitions have protected access now.
+
+2010-05-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/timeseries/conf_timeseriespoint.xml: Added the vector
+	  value path.
+
+2010-05-18  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue27 - First step to provide vector values.
+
+	* doc/conf/products/timeseries/conf_timeseriespoint.xml: Added a further
+	  step to choose between vector or scalar values.
+
+	  TODO: Configure the parameterization path for working with vector values.
+
+	* src/main/java/de/intevation/gnv/state/SwitchModeState.java: A new state
+	  that allows users to choose between scalar or vector values.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/state/MeasurementState.java,
+	  src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java,
+	  src/main/java/de/intevation/gnv/state/SingleInputState.java: Adjusted
+	  method signature of getDescriptionForInputData(.) - added the CallContext
+	  as further parameter that is necessary to retrieve the current locale.
+
+	* src/main/resources/lang/artifactMessages.properties,
+	  src/main/resources/lang/artifactMessages_de_DE.properties,
+	  src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages_de.properties: Added labels for
+	  the user interface.
+
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added queries for TimeSeriesPoints on Vectorvalues for TimeSeries.
+
+2010-05-17  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/cache/package.html,
+	  src/main/java/de/intevation/gnv/state/cache/QueryObject.java: 
+	  Add more JavaDocs.
+
+2010-05-10  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/timeseries/timegap_definition.xml: 
+	  Added Documentation for the definition of gaps in TimeSeries on 
+	  TimeSeriesPoints. Also added the reference to the Place where the 
+	  definitions are taken.
+
+2010-05-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue260 (Implemented an odv export for 'Horizontales Schnittprofil')
+
+	* doc/conf/products/horizontalprofile/conf_mesh_cross.xml: Added odv as
+	  further export format of product type 'Horizontales Schnittprofil'.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Implemented an odv exporter for this product type.
+
+	* src/main/java/de/intevation/gnv/exports/StringArrayKey.java: Added a
+	  getKey() method to be able to retrieve the key of such objects.
+
+2010-05-07  Hans Plum <hans@intevation.de>
+
+	* doc/conf/queries.properties:
+	Added a comment after implementing the admin tables for cache cleaner
+
+2010-05-06  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* contrib/mapserv,
+	  contrib/gnv-wms: Renamed mapserv to gnv-wms relating to the configuration
+	  changes in rev1068.
+
+2010-05-06  Hans Plum <hans@intevation.de>
+
+	* doc/conf/conf.xml:
+	Adapted path to gnv-wrapper after changing it upstream.
+
+2010-05-06  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue264 & Issue268 (Removed bugs in the caching mechanism)
+
+	* src/main/java/de/intevation/gnv/state/DefaultInputData.java: Implemented
+	  hashCode() and equals(.) method. The hashCode() method is used while
+	  creating hashes for caching elements (see StateBase).
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Improved hash
+	  creation. The hashes are used as keys for the caching mechanism. The key
+	  contains the uuid of the current artifact, the state id and a hash code
+	  created by InputData elements. User input is stored in a TreeMap instead
+	  of a HashMap, because the elements in a TreeMap are sorted. This is very
+	  import for us, because we need a defined order to create equal hashes if
+	  the input data elements, uuid and state id are equal.
+
+	* src/main/java/de/intevation/gnv/state/MeasurementState.java: Replaced the
+	  HashMap to store user input with a TreeMap which elements are sorted.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Added some more debug output that shows the usage of the cache.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Removed a critical bug that avoided using this product type if no cache
+	  have been initialized.
+
+	* src/main/java/de/intevation/gnv/state/OutputStateBase.java: Adjusted
+	  getHash(.) method call.
+
+2010-05-04  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/conf.xml: 
+	  Do some Documentation of the Artifact-Database.
+
+2010-05-04  Tim Englich  <tim.englich@intevation.de>
+	* src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java (appendSelectProducts): 
+	  BUGFIX: Added NULL-Check to Variable products to prevent NPEs if
+	  no Products are configured to the FIS.
+	* src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java (parseProductFactories): 
+	  BUGFIX: Trim Classname to prevent ClassNotFound-Exceptions if the 
+	  Configuration contains whitespaces in the XML-Element which configures the
+	  Artifact.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/maptemplates/layer_polygon.vm: Do not use point symbols to draw
+	  polygons.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	RELEASE 1.0
+
+	* NEWS, Changes: Summarized changes.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue260
+
+	* doc/conf/products/horizontalprofile/conf_mesh_cross.xml: Deactivated odv
+	  export for 'Horizontale Schnittprofile'.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/maptemplates/mapfile.vm: Defined a point symbol.
+
+	* doc/conf/maptemplates/layer_linestring.vm,
+	  doc/conf/maptemplates/layer_polygon.vm: Use point symbol for lines with a
+	  yellow color.
+
+	* doc/conf/maptemplates/layer_point.vm: Use point symbol with a yellow
+	  color.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/cache/ThematicDataCacheCleaner.java,
+	  src/main/java/de/intevation/gnv/state/layer/LayerMetaData.java,
+	  src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java,
+	  src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/Statistic.java,
+	  src/main/java/de/intevation/gnv/statistics/Statistics.java,
+	  src/main/java/de/intevation/gnv/utils/MetaWriter.java,
+	  src/main/java/de/intevation/gnv/chart/ChartLabels.java,
+	  src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java:
+	  Removed trailing whitespace.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java:
+	  Removed duplicated and unused imports.
+
+2010-04-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/conf.xml: Replaced the path to the artifact database with a
+	  relative path since the artifact-server is able to read relative pathes
+	  for the database configuration.
+
+2010-04-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/conf.xml: Changed the default directory of the artifact database.
+
+2010-04-27  Tim Englich  <tim.englich@intevation.de>
+
+	* contrib/visualize-transitions.xsl: 
+	  Added XSL-Transformation to create an Graphic for the TransitionModels of
+	  the Configuration.
+
+2010-04-27  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/conf.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_timeseriespoint.xml,
+	  doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml:
+	  Added missing Namespace declarations to Configurationfiles.
+
+2010-04-27  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE262
+
+	* doc/conf/products/horizontalprofile/conf_mesh_cross.xml: 
+	  Renamed StateIds because they were similar to the StateIds of
+	  the product Horrizontal Profile.
+	  This was done to prevent possible trouble using the Cachemechanism
+	  which use the StateId as part of the Key.
+
+2010-04-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue218 & Issue220
+
+	* doc/conf/conf.xml: Removed duplicated mapfile path configurations and
+	  replaced absolute path definitions with relative ones.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Changed XPath expression regarding the changes in conf.xml.
+
+2010-04-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue6
+
+	* doc/conf/log.conf: Removed, because this file is not used.
+
+2010-04-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue246 (Added missing units to the legend text.)
+
+	* contrib/palette2polygonVM.xsl: Use description attribute from palette xml
+	  file to create the legend text instead of from/to attributes.
+
+	* doc/conf/maptemplates/flow-velocity_polygons.class.vm,
+	  doc/conf/maptemplates/water-temperature_polygons.class.vm,
+	  doc/conf/maptemplates/salinity_polygons.class.vm: Added units to the
+	  legend text.
+
+2010-04-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue251
+
+	* src/main/java/de/intevation/gnv/state/SingleInputState.java: Override feed
+	  method for input validation.
+
+	* src/main/java/de/intevation/gnv/utils/InputValidator.java: New case: an
+	  empty string is invalid.
+
+2010-04-26  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE252
+
+	* doc/conf/queries.properties: 
+	  Modified Query for selecting metadata for creating ZipFiles or publish 
+	  Layer as WMS so that it is possible to handle more than one Layer in one
+	  request.
+	* doc/conf/products/layer/conf.xml: 
+	  Modified workflow so that it is possible to select more than one Layer
+	  to download them as Shapefile or publish them as WMS.
+	* src/main/java/de/intevation/gnv/utils/MetaWriter.java 
+	(writeLayerMeta), (writeLayerMeta), writeMetaFile): 
+	  modified Methods so that it is possible to generate a Metafile containing 
+	  more than one Layer in it.
+	* src/main/java/de/intevation/gnv/state/layer/LayerMetaData.java: 
+	  Added Beanclass for temporal storing the Metadata which is required to 
+	  generate a Shapafile or an WMS-Layer.
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java: 
+	  Modified the workflow so that it is possible to export multiple Layer
+	  in one Zip-File or publish multiple Layers in one WMS.
+
+2010-04-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue235
+
+	* doc/conf/conf.xml: Adapted the MapServer path in the configuration to call
+	  the wrapper that exports the mapfile path (see below).
+
+2010-04-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue220
+
+	* contrib/mapserv: Added a very simple wrapper script to export the
+	  mapfile path for MapServer.
+
+2010-04-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Inherit from HorizontalProfileMeshOutputState - both are used on meshes.
+	  Subtitle creation for charts is the same here
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshOutputState.java:
+	  Add newline strings after each point in the chart subtitle.
+
+2010-04-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue138
+
+	* doc/conf/products/horizontalprofile/conf_mesh.xml: Splitted the
+	  outputstates of horizontalprofiles into meshes and non-meshes to handle
+	  the chart subtitle creation.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java:
+	  Outputstates for horizontal profiles.
+
+2010-04-23  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (getWMS): 
+	  Fixed Bug Renaming Layer. Now the Title is set and the correct method 
+	  is called.
+
+	* src/main/java/de/intevation/gnv/utils/MetaWriter.java (writeLayerMeta): 
+	  Put Node Title into XML-Fragment of an Layer so that it is
+	  possible to change the name of an Layer.
+
+	* doc/conf/maptemplates/layer_polygon.vm, 
+	  doc/conf/maptemplates/layer_point.vm, 
+	  doc/conf/maptemplates/layer_linestring.vm: 
+	  Modified Templates so that the Name of an layer is fetched from the Title 
+	  of the Layerbean. This is the same way as used in any other Templates.
+
+2010-04-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue217
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Added the cell width of the interpolation to the constructor call of the
+	  odv export.
+
+	* src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java:
+	  Corrected the depth calculation.
+
+2010-04-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue228
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  The presentation of values contained in the statistic are language
+	  specific, now.
+
+2010-04-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue217
+
+	* src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java: The
+	  first column (cruise) in an odv export is filled with a static "GNVExport"
+	  string. The second column (station) is filled with a generated string
+	  "Station" concartinated with the index of the current coordinate
+	  (e.g. "Station_1"). Both columns are written to odv only if the coordinate
+	  changes - otherwise these strings are replaced by tabs.
+
+2010-04-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue233
+
+	* src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java: Expand
+	  the range of the range axis (y-axis) manually if there is only one data
+	  point or more data points with the same value.
+
+2010-04-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue243
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Added an y-axis label for histogram creation.
+
+	* src/main/resources/lang/artifactMessages.properties,
+	  src/main/resources/lang/artifactMessages_de_DE.properties,
+	  src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages_de.properties: Added the string
+	  used as y-axis label in histograms.
+
+2010-04-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue231
+
+	* doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh_cross.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml,
+	  doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: Switched
+	  histogram parameter type 'binwidth' from integer to double.
+
+2010-04-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue229
+	  JFreeChart needs at least a lower and a different upper bounds to
+	  calculate the range of the domain axis automatically.
+
+	* src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java: Override
+	  method that adjusts the range of domain and range axes.
+
+	* src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java:
+	  Override method that adjusts the range of domain and range axes. If there
+	  are more changes to be done in the future, caused by inheritance from
+	  VerticalProfileChart, we should stop that and derive this class from
+	  AbstractXYLineChart!
+
+2010-04-20  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java (initializeCache): 
+	  Initialize the CacheCline after the initialization of the ThematicDataCache.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java (setHash): 
+	  Integrate an '#' as separator in the Hashvalue of an State to separate the
+	  StateId unambiguously. This is required because a StateId can be a 
+	  Substring of an other StateId.
+
+	* src/main/java/de/intevation/gnv/state/cache/QueryObject.java: 
+	  Bean for representing all database-Queries which are used for fetching
+	  Data which is stoted in the ThematicDataCache.
+
+	* src/main/java/de/intevation/gnv/state/cache/ThematicDataCacheCleaner.java: 
+	  Specific CacheCleaner for cleaning the ThematicData-Cache. It extend the 
+	  CacheCleaner of the geo-backand and has the same configuration 
+	  possibilities.
+
+2010-04-20  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added Query for the CacheCleaner that it use to determin which Tables has 
+	  been updated.
+
+2010-04-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Removed a TODO from code -> TODO already implemented.
+
+2010-04-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue163: Workaround improved.
+
+	* src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java:
+	  Removed the bottom and left space between data area and plot border and
+	  set a padding of 10px between each border of the whole area (containing
+	  plot area, legend, chart title, etc).
+
+2010-04-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue163: Workaround implemented.
+
+	* src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java:
+	  Added a gap between data area and the plot border to avoid an amount of 
+	  cut axes labels (small labels aren't cut anymore, large labels will still
+	  be cut).
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java: Added some
+	  necessary methods to set the first domain and range axis.
+
+2010-04-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue235
+
+	* doc/conf/maptemplates/mapfile.vm: Added a metadata section into the 
+	  mapfile template.
+
+	* src/main/java/de/intevation/gnv/utils/MapfileGenerator.java: Read the URL
+	  of the MapServer from configuration and feed the template with this
+	  information. The URL is used in the metadata section for filling the 'wms
+	  onlineresource' field.
+
+2010-04-19	Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue152
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java:
+	  Added a date formatter for parsing dates from internal data objects.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Added the time interval of timeseries charts into the subtitle of this
+	  charts.
+
+2010-04-19	Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue226
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Iterate through former states when searching for an input collections -
+	  searching in the current state is not enough because it stores the current
+	  input values only.
+
+2010-04-19	Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue217
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml: Added odv as
+	  possible export format.
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Collect the necessary data for an odv export and trigger
+	  VerticalCrossODVExport that writes this data as odv to an output stream.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java: Store
+	  coordinates for each colum in a class variable.
+
+	* src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java:
+	  Write data used in 'Profilschnitten' to an odv file.
+
+	  TODO: The implementation is not finished yet. There are no cruises and
+	  stations for 'Profilschnitte', so we need to clarify if this columns can
+	  be skipped.
+
+2010-04-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/*.java:
+	  Using unix line endings only.
+
+2010-04-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	 * src/main/java/de/intevation/gnv/**/*.java:
+	   Removed trailing whitespace.
+
+2010-04-16  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE232
+
+	* doc/conf/meshwidth.xml: 
+	  Added missing Meshes to the Configuration and added more detailed 
+	  descriptions to the entries so they can be refred  easier to the Meshes in 
+	  the System.
+	
+2010-04-16  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE200
+
+	* doc/conf/queries.properties: 
+	  Modified Query for selecting available Layer for product Layer.
+	  The table has an Column named Items which contains the Number of Items
+	  that are in the Layer. Only Layer which are not empty should be
+	  displayed.
+
+2010-04-15  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue175
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java: Read
+	  percentage that defines the gap size in charts from system property
+	  "chart.gap.percentage". The default value is 5 (percent) if this property 
+	  is not existing.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java (createODV),
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java (createODV):
+	  Extract ODV-Generation into its own method that it is possible to override
+	  it in subclasses.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java (getWMS): 
+	  Bugfix: Put some Code that is responsible for Synchonization into the 
+	  final-block to prevent that the lock is not released.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/layer/conf.xml, 
+	  src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java : 
+	  Integrated the possibility to change the Title of an Layer in Product Layer.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java: 
+	  Removed obsolet SuppressWarnings-Annotations.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Layer.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/MapService.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Parameter.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/package.html: 
+	  Added more Javadoc.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/transition/package.html,
+	  src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java,
+	  src/main/java/de/intevation/gnv/transition/TransitionFactory.java,
+	  src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java: 
+	  Added more Javadoc.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/transition/package.html: 
+	  Added more Javadoc.
+	
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java,
+	  src/main/java/de/intevation/gnv/state/MinMaxDateState.java,
+	  src/main/java/de/intevation/gnv/state/MinMaxState.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java,
+	  src/main/java/de/intevation/gnv/state/OutputStateBase.java,
+	  src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java,
+	  src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java : 
+	  Removed obsolet SuppressWarnings-Annotations.
+
+2010-04-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/layer/package.html: 
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java :
+	  Added more Javadoc.
+	  Removed obsolet TODO-Flags.
+
+2010-04-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java: 
+	* src/main/java/de/intevation/gnv/artifacts/services/MetaDataServiceException.java (MetaDataServiceException): 
+	* src/main/java/de/intevation/gnv/artifacts/services/package.html:
+	  Added more Javadoc.
+
+2010-04-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/layer/package.html,
+	  src/main/java/de/intevation/gnv/layer/LayerArtifact.java: 
+	  Added more Javadoc.
+
+2010-04-12  Tim Englich  <tim.englich@intevation.de>
+	
+	* src/main/java/de/intevation/gnv/state/OutputStateBase.java (putInputData): 
+	  BUGFIX: Chartresults where stored in Cache using null-Value as Key.
+	  This happend because the setHash-method was not called in Method 
+	  putInputData of this Class.
+	  This causes that the Data was fetched every time from the Database when 
+	  out was called and twice during the intialisationprocess of the State.
+
+2010-04-12  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/fis/product/package.html,
+	  src/main/java/de/intevation/gnv/artifacts/fis/package.html,
+	  src/main/java/de/intevation/gnv/artifacts/cache/package.html,
+	  src/main/java/de/intevation/gnv/artifacts/context/package.html,
+	  src/main/java/de/intevation/gnv/artifacts/ressource/package.html,
+	  src/main/java/de/intevation/gnv/artifacts/package.html,
+	  src/main/java/de/intevation/gnv/state/exception/package.html,
+	  src/main/java/de/intevation/gnv/state/package.html,
+	  src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/package.html,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/package.html,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/package.html,
+	  src/main/java/de/intevation/gnv/state/profile/vertical/package.html,
+	  src/main/java/de/intevation/gnv/state/timeseries/package.html,
+	  src/main/java/de/intevation/gnv/state/describedata/package.html,
+	  src/main/java/de/intevation/gnv/statistics/exception/package.html,
+	  src/main/java/de/intevation/gnv/statistics/package.html,
+	  src/main/java/de/intevation/gnv/histogram/package.html,
+	  src/main/java/de/intevation/gnv/profile/horizontalcrosssection/package.html,
+	  src/main/java/de/intevation/gnv/profile/verticalcrosssection/package.html,
+	  src/main/java/de/intevation/gnv/profile/horizontal/package.html,
+	  src/main/java/de/intevation/gnv/profile/vertical/package.html,
+	  src/main/java/de/intevation/gnv/utils/exception/package.html,
+	  src/main/java/de/intevation/gnv/utils/package.html,
+	  src/main/java/de/intevation/gnv/chart/exception/package.html
+	  src/main/java/de/intevation/gnv/chart/package.html,
+	  src/main/java/de/intevation/gnv/exports/package.html,
+	  src/main/java/de/intevation/gnv/wms/package.html,
+	  src/main/java/de/intevation/gnv/timeseries/gap/package.html,
+	  src/main/java/de/intevation/gnv/timeseries/package.html,
+	  src/main/java/de/intevation/gnv/jfreechart/package.html: Added package
+	  descriptions for the different packages.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java,
+	  src/main/java/de/intevation/gnv/chart/ChartLabels.java: Added missing
+	  class descriptions.
+
+2010-04-12  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE 215 msg1189
+
+	* src/main/java/de/intevation/gnv/exports/ODVExport.java (writeData): 
+	  Switched Values between columns yyyy-mm-dd hh:mm and time_ISO8601 and 
+	  manipulate the Values that they are in the correct Format.
+	  This is nessessary because of the definitions of Timeseries in ODV-Exports.
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java (getStartTime): 
+	  Modified Format of the TimeStamp of the Starttime of TimeSeries in that 
+	  case that it does not contains the values for the seconds.
+
+2010-04-12  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java,
+	  src/main/java/de/intevation/gnv/state/DefaultInputValue.java,
+	  src/main/java/de/intevation/gnv/state/SingleInputState.java,
+	  src/main/java/de/intevation/gnv/state/StateFactory.java,
+	  src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/state/MeasurementState.java,
+	  src/main/java/de/intevation/gnv/state/InputData.java,
+	  src/main/java/de/intevation/gnv/state/MinMaxState.java,
+	  src/main/java/de/intevation/gnv/state/DefaultExportMode.java,
+	  src/main/java/de/intevation/gnv/state/OutputStateBase.java,
+	  src/main/java/de/intevation/gnv/state/DefaultInputData.java,
+	  src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java,
+	  src/main/java/de/intevation/gnv/math/AreaInterpolation.java,
+	  src/main/java/de/intevation/gnv/math/GridCell.java,
+	  src/main/java/de/intevation/gnv/transition/Transition.java,
+	  src/main/java/de/intevation/gnv/utils/ExclusiveExec.java,
+	  src/main/java/de/intevation/gnv/chart/DefaultHistogram.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java,
+	  src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java,
+	  src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java,
+	  src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java,
+	  src/main/java/de/intevation/gnv/exports/ChartExportHelper.java,
+	  src/main/java/de/intevation/gnv/exports/DefaultExport.java,
+	  src/main/java/de/intevation/gnv/exports/ODVExport.java,
+	  src/main/java/de/intevation/gnv/jfreechart/LevelOrderIndices.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java,
+	  src/main/java/de/intevation/gnv/jfreechart/CompactXYItems.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java: Removed
+	  JavaDoc compiler warnings caused by broken references and fields without
+	  content.
+
+2010-04-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/statistics/StatisticSet.java,
+	  src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java,
+	  src/main/java/de/intevation/gnv/statistics/Statistic.java,
+	  src/main/java/de/intevation/gnv/statistics/Statistics.java,
+	  src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java: Added
+	  more Javadoc.
+
+2010-04-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/exception/StateException.java,
+	  src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java,
+	  src/main/java/de/intevation/gnv/transition/DefaultTransition.java,
+	  src/main/java/de/intevation/gnv/transition/TransitionFactory.java,
+	  src/main/java/de/intevation/gnv/transition/TransitionBase.java,
+	  src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java,
+	  src/main/java/de/intevation/gnv/transition/Transition.java,
+	  src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java:
+	  Added Javadoc.
+
+2010-04-09  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE 215 msg1170
+
+	* src/main/java/de/intevation/gnv/exports/ODVExport.java : 
+	  Modified ODV-Export that it is possible to integrate an Timestamp which
+	  identifies a TimeSeries.
+	  The additional Column will only be integrated if the given Timestamp has 
+	  an value and is not null.
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java (getStartTime): 
+	  Integrated Method for lookup the Starttimevalue of an TimeSeries to use it
+	  in ODV-Exports. If no Startdate is stored (e.g. if this Methos is called
+	  by an verticalProfileOutputstate) null will be returned an put into the 
+	  ODV-Export.
+	* doc/conf/products/timeseries/conf_mesh.xml: 
+	  Added valuename for the Timeinterval to fetch the Starttime of an TimeSeries 
+	  from the inputData to integrate it into the ODV-Export.
+
+2010-04-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java:
+	  Added more Javadoc.
+
+2010-04-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/timeseries/TimeSeriesMeshArtifact.java,
+	  src/main/java/de/intevation/gnv/timeseries/gap/TimeGap.java,
+	  src/main/java/de/intevation/gnv/timeseries/gap/DefaultTimeGap.java,
+	  src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java: Added
+	  more Javadoc.
+
+2010-04-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/describedata/NamedArrayList.java,
+	  src/main/java/de/intevation/gnv/state/describedata/NamedCollection.java,
+	  src/main/java/de/intevation/gnv/state/describedata/ExtendedKeyValueData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/MinMaxDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/DefaultKeyValueDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/DefaultMinMaxDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/SingleValueDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/DescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/DefaultSingleValueDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/KeyValueDescibeData.java:
+	  More Javadoc.
+
+2010-04-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java,
+	  src/main/java/de/intevation/gnv/math/package.html,
+	  src/main/java/de/intevation/gnv/math/AreaInterpolation.java,
+	  src/main/java/de/intevation/gnv/math/AttributedXYColumns.java,
+	  src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java:
+	  Finished the javadoc of the math package.
+
+2010-04-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/ConstantFunction.java,
+	  src/main/java/de/intevation/gnv/math/L1Comparator.java,
+	  src/main/java/de/intevation/gnv/math/HeightValue.java,
+	  src/main/java/de/intevation/gnv/math/Interpolation2D.java,
+	  src/main/java/de/intevation/gnv/math/XYColumn.java,
+	  src/main/java/de/intevation/gnv/math/LinearFunction.java,
+	  src/main/java/de/intevation/gnv/math/GridCell.java,
+	  src/main/java/de/intevation/gnv/math/AttributedXYColumns.java:
+	  Added more javadoc.
+
+	* src/main/java/de/intevation/gnv/utils/FileUtils.java,
+	  src/main/java/de/intevation/gnv/utils/MetaWriter.java,
+	  src/main/java/de/intevation/gnv/utils/DistanceCalculator.java,
+	  src/main/java/de/intevation/gnv/utils/MapfileGenerator.java,
+	  src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java,
+	  src/main/java/de/intevation/gnv/utils/Pair.java:
+	  Removed trailing whitespace
+
+2010-04-08  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/utils/FileUtils.java,
+	  src/main/java/de/intevation/gnv/utils/DistanceCalculator.java,
+	  src/main/java/de/intevation/gnv/utils/InputValidator.java,
+	  src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java,
+	  src/main/java/de/intevation/gnv/utils/ExclusiveExec.java,
+	  src/main/java/de/intevation/gnv/utils/MetaWriter.java,
+	  src/main/java/de/intevation/gnv/utils/MapfileGenerator.java,
+	  src/main/java/de/intevation/gnv/utils/WKTUtils.java,
+	  src/main/java/de/intevation/gnv/utils/StringUtils.java,
+	  src/main/java/de/intevation/gnv/utils/Pair.java,
+	  src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java: Added Javadoc.
+
+	* src/main/java/de/intevation/gnv/utils/ArtifactFactoryUtilities.java:
+	  Removed.
+
+2010-04-08	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Removed trailing whitespace.
+
+	* src/main/java/de/intevation/gnv/math/ConstantXYDepth.java,
+	  src/main/java/de/intevation/gnv/math/LinearMetrics.java,
+	  src/main/java/de/intevation/gnv/math/QueriedXYDepth.java,
+	  src/main/java/de/intevation/gnv/math/L1Comparator.java,
+	  src/main/java/de/intevation/gnv/math/Metrics.java,
+	  src/main/java/de/intevation/gnv/math/LinearToMap.java,
+	  src/main/java/de/intevation/gnv/math/LinearFunction.java,
+	  src/main/java/de/intevation/gnv/math/Interpolator.java:
+	  Added more javadoc.
+
+2010-04-08  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Added Javadoc.
+
+2010-04-07	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/*.java:
+	  Removed trailing whitespace.
+
+2010-04-07	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java,
+	  src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java,
+	  src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java,
+	  src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java,
+	  src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java,
+	  src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java,
+	  src/main/java/de/intevation/gnv/raster/IsoProducer.java:
+	  Finished Javadoc of the raster package.
+
+2010-04-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/*.java: More javadoc.
+
+2010-04-06  Tim Englich  <tim.englich@intevation.de>
+
+	ISSUE215: Rows will not be merged to one Single Row if their values are identical.
+
+	* src/main/java/de/intevation/gnv/exports/ODVExport.java (writeData): 
+	  Replaced the StringArray using as Key against the new Class StringArrayKey.
+	  This was nessesarry tp detect Rows with same Values joining them to one
+	  Row.
+	* src/main/java/de/intevation/gnv/exports/StringArrayKey.java (StringArrayKey): 
+	  Added new Class for representing the Key of an StringArray not using the 
+	  Hash of the Array but using the hash of the values which are stored in 
+	  the Array.
+
+2010-04-06  Tim Englich  <tim.englich@intevation.de>
+	  ISSUE213: Wrong Geometrytype used for the generation of an Layer with 
+	            Multipolygon-Geometries
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (getWMS): 
+	  Integrated lookup of the Geometrytypes using a separat SQL-Statement.
+	  Also added a separat Function for determining the Defaulttemplate for the 
+	  Mapfile-Generation.
+	* src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java (writeDataToFile): 
+	  Changed Methodsignature. Now it's possible to put the Geometrytype which 
+	  is required to generate the Layer and not use the Geometrytype of the 
+	  first Geometry of the Resultvalues.
+	  This was nessessary because we can have several kinds of geometrytypes
+	  (e.g. MultiPolygons and Polygons) in one Layer. In that case we have to 
+	  use the Multi* (e.g. MultiPolygon) as Geometrytype.
+	* doc/conf/queries.properties: 
+	  Added Query for determining the geometryType of a Layer.
+
+2010-04-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/*.java: Fixed vim modeline.
+
+	* src/main/java/de/intevation/gnv/math/L1Comparator.java: Moved
+	  L1 code here.
+
+	* src/main/java/de/intevation/gnv/math/Point2d.java: Removed dead
+	  inverse L1 code. Added Javadoc.
+
+	* src/main/java/de/intevation/gnv/math/IJKey.java: Added Javadoc.
+
+2010-04-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/test/java/de/intevation/gnv/artifacts/TestCallContext.java,
+	  src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java:
+	  Fix to let the test mockups implement their interfaces.
+
+2010-03-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/jfreechart/LevelOrderIndices.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java,
+	  src/main/java/de/intevation/gnv/jfreechart/CompactXYItems.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonSeriesLabelGenerator.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java,
+	  src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java: Added
+	  JavaDoc.
+
+2010-03-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/exports/Export.java,
+	  src/main/java/de/intevation/gnv/exports/ChartExportHelper.java,
+	  src/main/java/de/intevation/gnv/exports/ODVExport.java: Repaired JavaDoc.
+
+2010-03-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/Chart.java,
+	  src/main/java/de/intevation/gnv/chart/XMLChartTheme.java,
+	  src/main/java/de/intevation/gnv/chart/exception/TechnicalChartException.java:
+	  Added missing vim control comments.
+
+2010-03-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/fis/product/Product.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/MetaDataServiceException.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Parameter.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Layer.java,
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/MapService.java,
+	  src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java:
+	  Added and repaired JavaDoc.
+
+2010-03-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java: Added
+	  and repaired JavaDoc.
+
+2010-03-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/PreSettingArtifact.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java: Added
+	  JavaDoc for this package.
+
+2010-03-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/XMLChartTheme.java,
+	  src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java,
+	  src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java,
+	  src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java,
+	  src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Corrected
+	  JavaDoc errors.
+
+2010-03-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue214
+
+	* src/main/java/de/intevation/gnv/utils/InputValidator.java: Added code for
+	  validating polygons and linestrings. The input type needs to be 'polygon'
+	  or 'linestring'.
+
+	* doc/conf/products/horizontalcrosssection/conf_mesh.xml: Changed the input
+	  type of the wkt string from 'string' to 'polygon'.
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml: Changed the input
+	  type of the wkt string from 'string' to 'linestring'.
+
+2010-03-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/ExtendedInputData.java: Added a
+	  method splitParameter() to retrieve the parameter ids as array (analog to 
+	  splitValue() in DefaultInputData).
+	
+2010-03-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue210 (First work for saving relation between selected measurement and
+	  the parameter it belongs to completed)
+
+	* src/main/java/de/intevation/gnv/state/DefaultInputData.java: Added a
+	  further constructor and changed the visibility of the separator character
+	  used by this class to public.
+
+	* src/main/java/de/intevation/gnv/state/ExtendedInputData.java: This class
+	  enhances DefaultInputData and has a further field storing a string
+	  parameter. This is necessary to save the information about the
+	  relation between selected measurement and the parameter it belongs to.
+
+	* src/main/java/de/intevation/gnv/state/MeasurementState.java: Little
+	  changes in the data of the describe document. The value for the checkboxes
+	  are composed of the measurement id and the parameter id separated by a
+	  semicolon. Furthermore the incoming document of a feed call is parsed in
+	  this class to save the relation between selected measurement and the
+	  parameter it belongs to. ExtendedInputData class is used as storage.
+
+	* src/main/java/de/intevation/gnv/utils/InputValidator.java: Changed the
+	  method signatures of all methods to static for using it without
+	  instantiating an object of this class.
+
+2010-03-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue212 (Improved input validation)
+
+	* src/main/java/de/intevation/gnv/state/MinMaxDateState.java: Improved date
+	  input validation. The chosen date needs to be in range between upper and
+	  lower date, otherwise an error message is displayed and the user needs to
+	  correct his choice.
+
+	* src/main/java/de/intevation/gnv/utils/InputValidator.java: Added a new
+	  method to validate a given date being in range between an upper and a
+	  lower date bound.
+
+	* src/main/resources/lang/artifactMessages.properties,
+	  src/main/resources/lang/artifactMessages_de_DE.properties,
+	  src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages_de.propertie: Added error
+	  messages for failures while date validation.
+
+2010-03-29  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue192
+
+	* src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Added an
+	  offset of 15px between the right data area and the right axis. Long axes
+	  labels near the right border aren't cut on this way.
+
+2010-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/package.html: New
+	  Added package description with text 'DOCUMENT ME!'.
+
+2010-03-29  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Each TimeSeriesArtifacts stores information about its TimeGapDefinitions,
+	  otherwise we are not able to continue with an artifact after a restart of
+	  the artifact server.
+
+	  TODO: The information about TimeGapDefinitions are equal for each type of
+	  artifacts. It would be better to store these definitions on a central
+	  place (i.e. see ChartTheme configuration).
+	
+	* src/main/java/de/intevation/gnv/timeseries/gap/TimeGap.java: Implements
+	  Serializable.
+
+2010-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/*.java:
+	  Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
+
+	  find -name \*.java | \
+	  xargs sed -i \
+	  -e 's/@author[ ]\+\([^(<]\+\)[<(]\([^>)]\+\)[>)]/@author <a href="mailto:\2">\1<\/a>/g' \
+	  -e 's@[ ]\+</a>@</a>@g'
+
+2010-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/*.java,
+	  src/main/java/de/intevation/gnv/**/*.java: 
+	  Ordered imports. Removed needless imports. Removed empty headers.
+
+2010-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/test/java/de/intevation/gnv/**/*.java,
+	  src/main/java/de/intevation/gnv/**/*.java: 
+	  Removed trailing whitespace.
+	  find -name \*.java | xargs sed -i 's/[ \t]\+$//
+
+2010-03-26  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added Query for fetching the Series and Instantaneouspoints of Series using 
+	  an WKT as the Geometryvalue or using the Values set by the Regionfilter 
+	  to define the Region of Interest.
+
+	* doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: 
+	  Modified the Workflow for Verticalprofiles on Instantaneouspoints so 
+	  that the Inputvalues of the Mapviewer-Interface take effect. E.g. 
+	  The Regionfilter will not be displaied if an Polygon was send by the 
+	  Mapviewer. Also integrated the Regionfilter to the Workflow.
+
+2010-03-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue164
+
+	* src/main/java/de/intevation/gnv/utils/ExclusiveExec.java: New. This class
+	  can be used to synchronize threads with a given key. To use this
+	  synchronization, you just have to do something like the following:
+	    UniqueKey token = ExclusiveExec.INSTANCE.acquire(key);
+	    // your code to be synchronized
+	    ExclusiveExec.INSTANCE.release(token);
+	  A thread needs to wait if there is already a thread with the given key 
+	  which has acquired a token. Threads with a different key don't need to 
+	  wait for this thread.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Synchronize shapefile writing of artifacts which have the same uuid.
+
+	* src/main/java/de/intevation/gnv/utils/FileUtils.java: Added a function to
+	  delete the content of a directory.
+
+2010-03-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue211 (Applied patch)
+
+	* src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Removed
+	  race-condition when trying to access the index of the next line color used
+	  in chart.
+
+2010-03-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/utils/MetaWriter.java: Avoid danger to get
+	  a NullPointerException if no time to live is served by CallContext.
+
+2010-03-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue197
+
+	* src/main/java/de/intevation/gnv/utils/MetaWriter.java: Fetch time to live
+	  of an artifact from CallContext and put it into meta document.
+
+2010-03-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/exports/Export.java,
+	  src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java,
+	  src/main/java/de/intevation/gnv/exports/ChartExportHelper.java,
+	  src/main/java/de/intevation/gnv/exports/SimpleOdvDataCollector.java,
+	  src/main/java/de/intevation/gnv/exports/DefaultDataCollector.java,
+	  src/main/java/de/intevation/gnv/exports/DefaultProfile.java,
+	  src/main/java/de/intevation/gnv/exports/DefaultExport.java,
+	  src/main/java/de/intevation/gnv/exports/ODVExport.java: Added javadoc and
+	  turned javadoc author tag into a 'mailto' form.
+
+2010-03-24  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/histogram/HistogramHelper.java: Removed a
+	  method which was commented out, added javadocs and turned javadoc author
+	  tag into a 'mailto' form.
+
+2010-03-24  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/layer/LayerArtifact.java: Removed empty
+	  comment lines at the beginning of the class and turned javadoc author tag
+	  into a form which displays a mailto link in html.
+
+2010-03-24  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/wms/LayerInfo.java: Added javadoc in wms
+	  package.
+
+2010-03-24  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/Chart.java,
+	  src/main/java/de/intevation/gnv/chart/DefaultHistogram.java,
+	  src/main/java/de/intevation/gnv/chart/XMLChartTheme.java,
+	  src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java,
+	  src/main/java/de/intevation/gnv/chart/exception/TechnicalChartException.java,
+	  src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java,
+	  src/main/java/de/intevation/gnv/chart/AbstractHistogram.java,
+	  src/main/java/de/intevation/gnv/chart/ChartLabels.java,
+	  src/main/java/de/intevation/gnv/chart/AbstractChart.java,
+	  src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java,
+	  src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java,
+	  src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java: Added
+	  and repaired javadoc in chart package.
+
+	* src/main/java/de/intevation/gnv/chart/Insets.java,
+	  src/main/java/de/intevation/gnv/chart/ChartStyle.java: Removed these
+	  classes, because they aren't used anymore.
+
+2010-03-23  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_feed.xml,
+	  src/test/ressources/timeseries_mesh/timeseries_step_08_feed.xml:
+	  Switched to valid Timestamps to enable testing ODV-Output.
+
+2010-03-23  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/exports/ODVExport.java: 
+	  Added new Export-Class which will generate the special ODV-Format.
+	  This one is required because we have to switch the Format from a Rowbased
+	  Representation to a Columnbased.
+	  This meas that for each Parameter which was requested two additonal Columns,
+	  one for the Parametervalue and one for the Quality, has to be added to the 
+	  Export. This differs to the "normal" CSV-Export.
+	
+	* src/main/java/de/intevation/gnv/exports/DefaultExport.java (collector): 
+	  Switched Member from private to protected to make it available from 
+	  extending Classes.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: 
+	  Modified the Colums and the Column-headers and Columns-names for the ODV-Export
+	  that all required Data is put into the Document in the right order and the 
+	  right nameing.
+	  Switche to the NEW ODVExport-Class to use it for all ODV-Exports.
+
+	* doc/conf/queries.properties: 
+	  Modified the Queries for the ODV-Export that all required Informations are 
+	  fetched from the Database.
+
+2010-03-22  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_feed.xml,
+	  src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_feed.xml:
+	  Switched to valid Timestamps to enable testing CSV-Output.
+
+2010-03-22  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java (feed):
+	  Bugfix: The Description of an InputData-Object will now only be fetched if
+	  the Name of the data of the Current State is equal to the Name of the 
+	  InputData-Object. This Fix prevent some Exceptions that happen if the 
+	  Query need som Inputdata which was not set at that moment.
+
+2010-03-22  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE 122
+
+	* src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java: 
+	  Added all required Columns for the CSV-Export. Integrated own 
+	  Columnspecifications for the different Kinds of Profiles (TimeSeriesPoints,
+	  Mesh, InstantaneousPoint).
+
+	* doc/conf/queries.properties: 
+	  Manipulated the Queries for fetching the Data for generating the CSV-Output
+	  for all kinds of Vertical- and Horizontalprofiles in that way that now all 
+	  required Columns were included.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java: 
+	  Removed deprecated TODO-Flags.
+
+2010-03-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue209
+
+	* doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_flow-velocity_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-levels_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-temperature_isolines.vm:
+	  Improved the template configuration for the given changes in rev814.
+	
+	* src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java: Moved the
+	  settings of the format used to write floating point numbers into the
+	  shapefile description column into a static block of this class to avoid
+	  doing this each time converting a double value to a description.
+
+2010-03-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue209
+
+	* src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java: Added a
+	  further column in the isolines shapefile to store a description for each
+	  line. This description column contains the double value with three maximum
+	  fraction digits. This is a workaround to adjust the rendering of double 
+	  values which cannot be adjusted in MapServer at the moment. MapServer
+	  would display all fraction digits contained in the shapefile causing very
+	  long labels.
+
+2010-03-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue208 (Added a cleanup mechanism to do some things before exporting an
+	  artifact)
+
+	* src/main/java/de/intevation/gnv/state/State.java: Added a cleanup method
+	  to remove special data stored at this state while processing an 
+	  'out'-target.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Default
+	  implementation of this cleanup method - nothing is done here so far.
+	  Override this method in states which should remove data before being
+	  exported.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Overrides this cleanup method to remove the current shapefile path.
+
+	* src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java:
+	  Call cleanup method of the current state if the cleanup method of this
+	  artifact itself is called.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/horizontalprofile/conf_mesh_cross.xml: 
+	  Modified the Workflow for "Horizontales Schnittprofil" so that the Inputvalues 
+	  of the Mapviewer-Interface take effect. E.g. The Regionfilter will not be 
+	  displaied if an Polygon was send by the Mapviewer. Also the Input of an 
+	  LineString will be skipped if a LineString was send by the MapViewer.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/resources/lang/artifactMessages_de*.properties: 
+	  Added new German resources for fis_marinefeatures according to msg1067
+	  of Issue2005.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java: 
+	  Added Support of Layers which are Joined from two Tables.
+	  Only the Columns of the first Table will be inserted to prevent Namecollisions
+	  of Attributenames.
+	
+	* doc/conf/queries.properties: 
+	  Added full qualified Columnname to prevent Namecolliosions in SQL-Statement 
+	  for querying  Layer-Data if two Tables are Joined to one Layer.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/resources/lang/artifactMessages*.properties: 
+	  Added Ressources for new FIS Marine Features.
+	
+	* doc/conf/conf.xml:
+	
+	  ISSUE 205
+	
+	  Integrated FIS Marine Features with Product Layer into the System.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  
+	  ISSUE92
+	  
+	  Integrated Column BAND for Query of Layers which belong to a FIS.
+	  The Displayname of an Layer is now TITLE - LAYER_NAME - BAND
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml: 
+	  Modified the Workflow of the verticalcrosssection that the Geometry is now
+	  copied to the Inpuvalues if it comes from the Mapviewer-Interfacecall.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/horizontalcrosssection/conf_mesh.xml: 
+	  Modified the Workflow for Horizontalcrosssections so that the Inputvalues 
+	  of the Mapviewer-Interface take effect. E.g. The Regionfilter will not be 
+	  displaied if an Polygon was send by the Mapviewer. Also the Input of an 
+	  Polygon will be skipped if a Polygon was send by the MapViewer.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/horizontalprofile/conf_mesh.xml: 
+	  Modified the Workflow for Horizontalprofiles so that the Inputvalues 
+	  of the Mapviewer-Interface take effect. E.g. The Regionfilter will not be 
+	  displaied if an Polygon was send by the Mapviewer. Also the Input of an 
+	  Point will be skipped if a Point was send by the MapViewer.
+
+2010-03-16  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml: 
+	  Modified the Workflow so that the Inputvalues of the Mapviewer-Interface 
+	  take effect. E.g. The Regionfilter will not be displaied if an Polygon
+	  was send by the Mapviewer. Also the Input of an LineString will be skipped 
+	  if a LineString was send by the MapViewer.
+
+2010-03-16  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Bugfixes: Fixed the Query for Parameters in Timeseries and 
+	  VerticalProfiles in Meshes. Now all Parts of an Mesh will be used and not 
+	  only the last one.
+
+2010-03-16  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml: 
+	  Modified the Workflow for Verticalprofiles and Timeseries on Meshes in 
+	  that case that the Inputvalues of the Mapviewer-Interface take effect. 
+	  E.g. The Regionfilter will not be displaied if an Polygon was send by 
+	  the Mapviewer.
+
+2010-03-16  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java: 
+	  Added an new State wich will handle the Display of Coordinatevalues and 
+	  fetch given Inputparameters from the Presettings and copy them to 
+	  the InputValues.
+	  This new Class is necessary because we can have Pointobjects given in 
+	  the Presettings which should be used to fetch all MeshPoints within a 
+	  given Distance aroud the Coordinate and display its Coordindatevalues.
+
+2010-03-16  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/utils/InputValidator.java (getPointValue):
+	  Integrated handling of WKT-Strings for Points to extract Points from
+	  a given Inputstring.
+
+2010-03-16  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java (generateFilterValuesFromInputData): 
+	  Improvement: Values of Type Geometry which are Points will be 
+	  prepared as Regions for DB-Query.
+
+2010-03-16  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue199
+
+	* src/main/java/de/intevation/gnv/state/MeasurementState.java: Changed the
+	  describe document creation a bit. The describe document will now have a
+	  section for measurement/parameter with each parameter in an own
+	  xform:select node which contains different xform:item nodes for each 
+	  measurement for this parameter.
+
+2010-03-16  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/layer/conf.xml: 
+	  Modified the Workflow so that the Inputvalues of the Mapviewer-Interface 
+	  take effect. E.g. The Regionfilter will not be displaied if an Polygon
+	  was send by the Mapviewer.
+
+2010-03-16  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (fetchData): 
+	  BugFix: Fixed NPE using the Presettings-Object without given Presettings.
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/verticalprofile/conf_timeseriespoint.xml: 
+	  Modified the Workflow so that the Inputvalues of the Mapviewer-Interface 
+	  take effect. E.g. The Regionfilter will not be displaied if an Polygon
+	  was send by the Mapviewer. 
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added Query for fetching the TimeSeriespoint using an WKT as the 
+	  Geometryvalue to define the Region of Interest.
+
+	* doc/conf/products/timeseries/conf_timeseriespoint.xml: 
+	  Modified the Workflow so that the Inputvalues of the Mapviewer-Interface 
+	  take effect. E.g. The Regionfilter will not be displaied if an Polygon
+	  was send by the Mapviewer. 
+
+2010-03-15  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue120
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: New method
+	  implemented which searches for a specific parameter by its name in the 
+	  current state and in all parent states. Null is returned if no parameter 
+	  could be found with this name, otherwise the InputData object.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java:
+	  Display that point in chart subtitle which have been entered by the user.
+
+	* src/main/java/de/intevation/gnv/utils/WKTUtils.java:	Added a new method
+	  to transform a Point object to a user-friendly formatted string.
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/verticalprofile/conf_timeseriespoint.xml: 
+	  Modified the Workflow so that the Inputvalues of the Mapviewer-Interface 
+	  take effect. E.g. The Regionfilter will not be displaied if an Polygon
+	  was send by the Mapviewer. 
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added Query for fetching the TimeSeriespoint using an WKT as the 
+	  Geometryvalue to define the Region of Interest.
+
+	* doc/conf/products/timeseries/conf_timeseriespoint.xml: 
+	  Modified the Workflow so that the Inputvalues of the Mapviewer-Interface 
+	  take effect. E.g. The Regionfilter will not be displaied if an Polygon
+	  was send by the Mapviewer. 
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties:
+	  Integrated and modified Queries for Timeseries on Meshes.
+
+	* doc/conf/products/timeseries/conf_mesh.xml: 
+	  Modified the Workflow so that the Inputvalues of the Mapviewer-interface 
+	  take effect. E.g. The regionfilter will not be displaied if an  Polygon
+	  was send by the Mapviewer. Also the State for typing an Point will be 
+	  skipped an the Geometry of the Mapviewercall will be used.
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java: 
+	  Revoke Changes of r771. The Switch if the QueryId is null has several 
+	  Effects which causes NPEs in other Parts of this Module.
+	  So I removed the Changes of r771 and override the effected Methods in 
+	  DefaultAutoResumeState.
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java:
+	  Integrated the handling of AutoResumeStates into the initialization 
+	  Process of an Artifact. After an Initialization of an Artifact it will be 
+	  proved if the Current State is an AutoResumeState. If it is the next valid 
+	  state in the sequence will be set to the current State.
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java, 
+	  src/main/java/de/intevation/gnv/state/AutoResumeState.java: 
+	  Added new Interface and its DefaultImplementation to the Project.
+	  This Interface will mark States which can be handled automatically without 
+	  any interaction from the User.
+	  So it is possible to fork a Sequence e.g. by given Constructorparameters 
+	  of an Artifact. 
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java (feed):
+	  Bugfix: We have States which don't have tor Query Data from a Database 
+	  for its Description. So now the Description will only be determined if a
+	  Query was configured to this State.
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java (setup):
+	  Bugfix: Corrected C&P-Error in the Setup-Method of the PreSettingsTransferState
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/utils/InputValidator.java (isInputValid): 
+	  Added Objecttype Geometry for the Validation of Inputdata. Geometry will 
+	  be validated in the same way as Pointobjects.
+
+2010-03-15  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue198
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Read the layer title which might have been adjusted by the user and store
+	  it in the CallContext object to be available in MetaWriter.
+
+	* src/main/java/de/intevation/gnv/utils/MetaWriter.java: Write the layer 
+	  title stored in the CallContext object into meta.xml file.
+
+	* src/main/java/de/intevation/gnv/wms/LayerInfo.java: Added a further
+	  attribute named 'title' to adjust the layer name.
+
+	* src/main/java/de/intevation/gnv/utils/MapfileGenerator.java: Read layer
+	  title from meta.xml file. The uuid is used as layer title if no title is 
+	  given.
+
+	* doc/conf/products/horizontalcrosssection/conf_mesh.xml: Added a string
+	  input parameter in wms output mode to adjust a wms layer's title.
+
+	* doc/conf/maptemplates/horizontalcrosssection_salinity.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_flow-velocity.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_flow-velocity_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-levels.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-levels_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-temperature.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-temperature_isolines.vm:
+	  Read title attribute from LayerInfo object for filling the layer name in 
+	  template files. The title can be adjusted by the user himself, but the 
+	  shapefiles are stored in the path {shapefile_path}/{uuid}/xxx.shp.
+
+2010-03-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (fetchData): 
+	  Integrated lookup of the Geometry which was put to the Artifact during 
+	  the Instantiation (e.g. was send from the MapViewer to the GNV).
+
+2010-03-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (fetchColumns): 
+	  Integrated an Method for fetching all required Columns for an given Layer 
+	  and put them into the Query witch will load the Layerdata from the 
+	  Database.
+
+	* doc/conf/products/layer/conf.xml: 
+	  Added an Configuration-Element to determine the Query which should be used 
+	  to Query the Columns of a choosen Layer.
+
+	* doc/conf/queries.properties: 
+	  Manipulated the Queries for fetching the Layerdata in that way that it is 
+	  possible to put the requested-Columns into it using the ?-Syntax.
+
+2010-03-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java (writeDataToFile): 
+	  Added generic Export for all Columns which are in an ResultValue.
+	  The first Column must be the Geometryvalue. all other Columns will be added
+	  to the Shapefile using the defined Attribute-Class.
+
+2010-03-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue201
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Use a better key - hash served by getHash() from StateBase - to put
+	  chart results into cache.
+
+2010-03-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/timeseries/conf_timeseriespoint.xml: Use MinMaxDateState
+	  to handle date input instead of MinMaxState.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java: Added
+	  EXCEPTION_NO_INPUT key used for a lookup in resource bundles.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java
+	  src/main/java/de/intevation/gnv/state/OutputStateBase.java
+	  src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/state/MinMaxState.java,
+	  src/main/java/de/intevation/gnv/state/State.java: Return localized
+	  error messages as xml documents if something failed while feeding the 
+	  current artifact/state. These error messages are used to be displayed in
+	  the user interface. There are two different error messages at the moment -
+	  for general error messages related to server errors and a message invalid
+	  user input. The difference between these messages is their location in the
+	  xml document. Each message type is created with a separate method in
+	  ArtifactXMLUtilities (createExceptionReport() and createInputException()).
+	  The intention to separate these message types is to display them on
+	  different places in the user interface.
+
+	* src/main/java/de/intevation/gnv/state/MinMaxDateState.java: New state to
+	  handle date input.
+
+	* src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java: Converted
+	  some class methods into static methods and added a new method to create an
+	  xml document which contains an error message for invalid user input.
+
+	* src/main/resources/lang/artifactMessages.properties,
+	  src/main/resources/lang/artifactMessages_de_DE.properties,
+	  src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages_de.properties: Added text for 
+	  error messages.
+
+2010-03-09  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Modified the Query for the lookup of the Tablename and the Whereclaus to
+	  a choosen Layer. Now also the Templateid containing the Mapservice-ID and 
+	  the Layer-Id was added to the Query.
+	
+	* src/main/java/de/intevation/gnv/utils/MapfileGenerator.java (templateExists): 
+	  Add a method which will return if a given Template exists.
+	  this could be used for determining if a specialized Template for a Layer 
+	  is given or the Default one should be used.
+	
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (getWMS): 
+	  Integrate lookup for MapFileTemplate for the different Layer.
+	  If a special Template should be used it must be storde according to the 
+	  following Syntax in the Folder which contain all other Mapfile-Templates.
+	  
+	  layer_{ID_MAPSERVICE}_${ID_LAYER}  e.g. layer_BSH_IMS_CONTIS_Resources_2
+	  
+	  If there is no Template matching the given Name the Defaulttemplates
+	  layer_point,
+	  layer_polygon or
+	  layer_linestring 
+	  will be used.
+
+2010-03-09  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (out): 
+	  Integrated ExceptionHandling if no Data was found for the given Layer.
+	  If no data couuld be retrieved from the Database an XMl-Exceptionreport 
+	  will be generated which must be analized by the Clients.
+
+2010-03-08  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue186
+
+	* src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: Adjusted
+	  signature of method to store min/max ranges in x and y direction in
+	  charts.
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java: Adjusted
+	  method call to signature which has been changed in AbstractXYLineChart.
+
+	* src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java: Added
+	  some empty methods which overrides methods from parent which should not be
+	  called on this class.
+
+	* src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java: Added
+	  methods to store vertical min/max ranges in charts. After adding a new
+	  series to this chart, we call prepareRangeAxis() to add an offset (5
+	  percent) between values and chart border.
+
+2010-03-08  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/maptemplates/layer*.vm: 
+	  Added some basetemplates for Lines, Points and Polygons that will be used 
+	  if an WMS-layer of the Product Layer will be created.
+	
+	* src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java (writeDataToFile): 
+	  Changed Method in taht way that it now will return the geometrytype of 
+	  this Layer instead of an boolean-value.
+	  Null will determine that an Exception occured during the 
+	  Shapefilegeneration.
+	
+	* src/main/java/de/intevation/gnv/utils/MetaWriter.java (writeLayerMeta): 
+	  Added a new Method for writing the Metadatafile for WMS published by 
+	  the Product Layer.
+	  Done som Refactoring work for reusing som Code-Snippets.
+	
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (getWMS): 
+	  Added the Basic-Support for publishing an WMS-Layer.
+	  The Lookup of the Attributes which has to be put into the Shapefile and 
+	  the lookup of the Template which schould be used to symbolize the Layer 
+	  has to be implemented. 
+
+2010-03-08  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue195
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Use InputData stored at the current state to create chart titles.
+
+2010-03-08  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue189
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Changed insufficient key to store results for chart generation in cache.
+	  Use 'getHash()' method for this now, which have been implemented while
+	  refactoring the cache mechanism.
+
+2010-03-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java,
+	  src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/state/MeasurementState.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Cleaned up imports.
+
+2010-03-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+	
+	* doc/conf/conf.xml: Set ttl to a better value. It has been set to 2min by
+	  mistaken while working on mapfile generation.
+
+2010-03-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue185
+
+	* src/main/java/de/intevation/gnv/state/MeasurementState.java: Added missing
+	  parameter name in describe document.
+
+2010-03-05  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added some more Queries which are required to serve the Requests of the 
+	  Product Layer.
+	
+	* doc/conf/conf.xml: 
+	  Changed the Sourceid of the FIS Contis because of Changes in the Database.
+	
+	* doc/conf/products/layer/conf.xml: 
+	  Completed the Configuration for the Product Layer.
+	  Added more Configurationdetails to the OutputStates.
+	* src/main/resources/lang/artifactMessages*.properties:
+	  Added the required ressources for the Product Layer and the FIS Contis and 
+	  Nauthis into the Propertiesfiles.
+	
+	* src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java (writeDataToFile): 
+	  Added an Method for writing g an Shapefile using an Collection of Results.
+	  this Method must be extended that it could use the Result-object in an 
+	  generic Way.
+	  At this Moment it is only be Possible to write the Geometry into the 
+	  Shapefile if it is given at the first Position of an Result.
+	  All other Attributevalues will be ignored and not written into the Shapefile.
+	
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java: 
+	  Added Support for writing Shapefiles and Export them as an Zipfile.
+
+2010-03-05  Tim Englich  <tim.englich@intevation.de>
+	* doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: 
+	  ISSUE 191: Pdf, svg and png are now available.
+
+2010-03-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/conf.xml: Added a section to configure MapServer relevant stuff.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Store mapserver path in CallContext object to have access everywhere we
+	  have a CallContext object (avoids reading config.xml all the time we want
+	  to write mapfile).
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java:
+	  Added key to store MapServer information into CallContext and fetch it
+	  from it.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Removed code to write meta information files (sourced out to MetaWriter).
+	  This has been done with the intend to write meta information of CONTIS and
+	  NAUTHIS using that class as well.
+
+	* src/main/java/de/intevation/gnv/utils/MetaWriter.java: Helper class to
+	  write meta information files used for mapfile generation. Write general
+	  information about our wms service (MapServer) into meta information file.
+	  This is used to give the user information about the place where he can
+	  find the wms service and his generated wms layer.
+
+2010-03-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/maptemplates/flow-velocity_polygons.class.vm,
+	  doc/conf/maptemplates/water-levels_polygons.class.vm,
+	  doc/conf/maptemplates/water-temperature_polygons.class.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_flow-velocity.vm,
+	  doc/conf/maptemplates/flow-velocity_isolines.class.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_flow-velocity_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-levels.vm,
+	  doc/conf/maptemplates/water-levels_isolines.class.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-temperature.vm,
+	  doc/conf/maptemplates/water-temperature_isolines.class.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-levels_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_water-temperature_isolines.vm:
+	  Added template files for water-levels, water-temperature and
+	  flow-velocity.
+
+2010-03-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue171
+
+	* src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java: Changed
+	  the way to calculate the current distance from startpoint. We do not
+	  calculate the distance between the current point and the last point and
+	  add this value to a variable storing the total distance anymore, but
+	  we take the distance between the current point and the start point. On
+	  this way, we do not need a variable to store the total distance, because
+	  current point - first point == total distance. And there is no
+	  impreciseness in gaps of different layers (see issue171 for this).
+
+2010-03-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java: Added
+	  some more debug information for gap detection on grids.
+
+	* src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java: Added
+	  some more debug information for gap detection on grids.
+
+2010-03-03  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java: Log important
+	  values used for gap detection if debug level is enabled.
+
+2010-03-03  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue146
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Removed workaround to send a fake document if statistic is requested,
+	  which is not available for this product type.
+
+2010-03-03  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Trigger pdf creation for histograms when an 'out' call arrives with output
+	  mode 'histogram' and export mode 'pdf'.
+
+	* src/main/java/de/intevation/gnv/exports/ChartExportHelper.java:
+	  Implemented a method to export histograms as multipage pdf file.
+
+	* doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh_cross.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml,
+	  doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: Added pdf
+	  support for histogram charts.
+
+2010-03-02  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/OutputStateBase.java: Added an xpath
+	  expression for export modes.
+	
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Refactoring of 'out' to be able to add pdf and svg exports to histogram. 
+	  Now, there are just four output modes left (chart, histogram, csv, odv). 
+	  Export modes (pdf, svg, img) are part of these output modes.
+	  Implemented svg export for histogram charts.
+	
+	* src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: Helper
+	  method to export histograms as svg via output stream.
+
+	* doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_timeseriespoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh_cross.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml,
+	  doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: Added svg
+	  as export mode to histogram output in configuration files.
+
+2010-03-02  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue180
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java:
+	  Removed CallMeta object from state which should not be serialized.
+	  Implemented a little workarround to save localized strings on this state.
+
+2010-03-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue182
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Display the selected
+	  value if there is no description available. WKT-strings will be displayed
+	  in the static ui part again.
+
+2010-03-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue179
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Removed
+	  code former used to append product select box.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Just use all parent
+	  states to render the static part of the user interfact - not the current
+	  state itself!
+
+2010-03-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Removed
+	  methods which aren't used anymore (used before changing the caching
+	  mechanism).
+
+2010-02-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/timeseries/conf_timeseriespoint.xml: Changed the
+	  configured state class from DefaultState to MeasurementState.
+
+	* doc/conf/queries.properties: Select parameterid from db as well, when
+	  fetching all measurement ids.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Improved the way of
+	  searching for descriptions in selected values (used in describe document).
+
+	* src/main/java/de/intevation/gnv/state/MeasurementState.java: New state
+	  object to create a describe document which can be used to render a 
+	  measurement-parameter-matrix.
+
+	* src/main/java/de/intevation/gnv/state/InputData.java,
+	  src/main/java/de/intevation/gnv/state/DefaultInputData.java: Added a new
+	  method to fetch a description by key.
+	
+	* src/main/java/de/intevation/gnv/state/describedata/ExtendedKeyValueData.java:
+	  This class extends DefaultKeyValueDescibeData. It is used by
+	  MeasurementState to create a mapping between measurements and parameters. 
+	  Each key/value-pair has an extra attribute storing its parameter value.
+
+2010-02-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_timeseriespoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh_cross.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml,
+	  doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: Adapted
+	  configuration. Pdf, svg, image exports got an own section in the
+	  outputmodes node. Exports belong to an output mode, now. There are no
+	  outputmodes 'pdf', 'svg', 'png' existing anymore.
+
+2010-02-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Changed the way of using cache to store verticalcrosssection chart data.
+	  Now, this type of chart is working without cache, as well.
+
+2010-02-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/OutputStateBase.java: Changed the
+	  way of using the cache to store chart / histogram data. Now, output modes
+	  'chart' and 'histogram' are working without cache.
+
+2010-02-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Better exception handling while cache configuration. The cache is not
+	  initialized, if no cache is configured in conf.xml. There would have been
+	  an exception without having a cache section in conf.xml. Now, it's
+	  possible to use GNV without using a cache.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Changed logger name
+	  from irritating 'GNVArtifactBase' to 'StateBase'.
+
+2010-02-24  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Store request parameter in a map and put that map into other
+	  classes/methods instead of putting each request parameter into an own
+	  variable.
+
+	* src/main/java/de/intevation/gnv/chart/DefaultHistogram.java: Implemented
+	  logic to adjust number of bins in histogram charts. The user is able to
+	  choose between the number of bins or the size of a single bin.
+
+2010-02-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* contrib/palette2polygonVM.xsl: New. XSLT transformation to transform a
+	  palette file into a style definition template used for mapfile creation.
+	  Usage:
+
+	  $ xsltproc contrib/palette2polygonVM.xsl  \
+	    doc/conf/palette/water-temperature.xml  \
+		> water-temperature.vm
+
+2010-02-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Removed a bug in pdf and svg creation. No data were drawn into chart.
+
+2010-02-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/timeseries/conf_timeseriespoint.xml,
+	  doc/conf/products/timeseries/conf_mesh.xml: Added an export mode section
+	  in output modes and added an export mode 'pdf' for showcase. This work is
+	  necessary to split up output modes (chart, histogram, ...) from export 
+	  modes (pdf, svg, png, ...). GUI components are now able to distinguish
+	  between these modes and render each mode in an own section.
+
+	* src/main/java/de/intevation/gnv/state/OutputStateBase.java: Read export
+	  modes from configuration node.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Write
+	  export modes into describe document.
+
+	* src/main/java/de/intevation/gnv/state/DefaultOutputMode.java,
+	  src/main/java/de/intevation/gnv/state/OutputMode.java: Added export modes
+	  as java.util.List. 'getExportModes()' will deliver this list.
+
+	* src/main/java/de/intevation/gnv/state/DefaultExportMode.java,
+	  src/main/java/de/intevation/gnv/state/ExportMode.java: Object storing
+	  necessary information for export mode.
+
+2010-02-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/conf.xml: Restructured configuration of shapfile and template
+	  directories. Moved map-generator part into gnv section.
+	  Moved shapefile-directory configuration to an own section and removed
+	  duplicated shapefile-directory config from map-generator.
+
+	* src/main/java/de/intevation/gnv/utils/MapfileGenerator.java: Adjusted
+	  xpath expressions regarding the changes in conf.xml. MapfileGenerator got
+	  some instance variables to store information about mapfile location,
+	  velocity log file and shapefile and template directories. This avoids
+	  reading conf.xml every single time while updating the mapfile.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Adjusted xpath expression regaring the changes of shapefile-directory in
+	  conf.xml.
+
+2010-02-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	*  doc/conf/conf.xml: Added path for velocity logfile.
+
+	* doc/conf/maptemplates/horizontalcrosssection_salinity.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm: Removed
+	  absolute path in style includes.
+
+	* src/main/java/de/intevation/gnv/utils/MapfileGenerator.java: Improved
+	  velocity configuration regarding absolute pathes and logfile. 
+
+2010-02-21	Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Fixed file handle leak when writing meta data.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/state/MinMaxState.java,
+	  src/main/java/de/intevation/gnv/utils/MapfileGenerator.java,
+	  src/main/java/de/intevation/gnv/chart/DefaultHistogram.java,
+	  src/main/java/de/intevation/gnv/chart/AbstractHistogram.java,
+	  src/main/java/de/intevation/gnv/exports/ChartExportHelper.java:
+	  Clean up imports.
+
+2010-02-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Write a meta information file after shapefile writing is finished. These 
+	  meta information are used to map the type of shapefiles to a specific 
+	  template and fill these layer-templates with data.
+
+	* src/main/java/de/intevation/gnv/wms/LayerInfo.java: Class for storing meta
+	  information for mapfile creation.
+	
+	* src/main/java/de/intevation/gnv/utils/MapfileGenerator.java: Implemented
+	  method stubs. The MapfileGenerator starts searching for meta information 
+	  in filesystem after update() is called. These information are used to to 
+	  fill templates for the supported layers and a mapfile will be created out
+	  of this.
+
+	  TODO: Configure Velocity.
+
+	* pom.xml: Added Apache Velocity 1.6.1 for templating mapfiles.
+
+	* doc/conf/conf.xml: Adapted a section to configure necessary directories
+	  and filenames for mapfile generation.
+	
+	* doc/conf/maptemplates/mapfile.vm: Base template for mapfile. All required
+	  layers will be included into this template.
+
+	* doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm,
+	  doc/conf/maptemplates/horizontalcrosssection_salinity.vm,
+	  doc/conf/maptemplates/salinity_isolines.class.vm,
+	  doc/conf/maptemplates/salinity_polygons.class.vm: Template support for 
+	  salinity in horizontal crosssection wms.
+
+2010-02-17  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/conf.xml: Added configuration section for writing mapfiles.
+
+	* src/main/java/de/intevation/gnv/utils/MapfileGenerator.java: Singleton 
+	  generator for writing mapfiles. It runs in an own thread and has an 
+	  'update' method which triggers the generator to search the filesystem for 
+	  shapefiles and meta information and update mapfiles out of these 
+	  information. A 'main' method can be invoked to update the mapfile without
+	  an running artifact server.
+
+	  TODO: Implement method stubs.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Call MapfileGenerator when writing or removing shapefiles (endOfLife).
+
+2010-02-15  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_timeseriespoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh_cross.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml,
+	  doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: Added
+	  histogram as output mode.
+	
+	* doc/conf/charttemplate.xml: Added color of bars in histograms.
+
+2010-02-15  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Added code path to create and return histograms.
+
+	* src/main/java/de/intevation/gnv/chart/AbstractHistogram.java,
+	  src/main/java/de/intevation/gnv/chart/DefaultHistogram.java: New. Classes
+	  for creating histograms. Each histogram contains exactly one parameter.
+
+	* src/main/java/de/intevation/gnv/chart/XMLChartTheme.java: Added parsing
+	  of histogram bar color.
+
+	* src/main/java/de/intevation/gnv/exports/ChartExportHelper.java: Added a
+	  new funcion to copy all histograms into a single image and send it to
+	  output stream.
+
+	* src/main/java/de/intevation/gnv/histogram/HistogramHelper.java: New. Added
+	  helper function to split the result collections for each parameter and for 
+	  each measurement into pieces.
+
+2010-02-12  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Integrated Queries for the Product Layer.
+
+	* doc/conf/conf.xml: 
+	  Integrated the new FIS Nauthis and Contis and the required Link to the
+	  Configuration for the new Product Layer.
+
+	* doc/conf/products/layer/conf.xml: 
+	  Added Configuration for the new Product Layer.
+	* src/main/java/de/intevation/gnv/state/OutputStateBase.java (getData): 
+	  Changed Methodsignature from private to protected ro make it available
+	  for extended Classes.
+
+	* src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java (LayerOutputState): 
+	  Added new State for generating the Output for the Product Layer.
+	  This Class is not jet completly implemented and will not return any
+	  result at this Moment.
+
+	* src/main/java/de/intevation/gnv/layer/LayerArtifact.java: 
+	  Added new Artifactclass for the Product Layer.
+
+2010-02-12  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/InputData.java,
+	  src/main/java/de/intevation/gnv/state/DefaultInputData.java: Descriptions
+	  of values are stored in an array, because one InputData object can contain
+	  many data.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Get a description
+	  for each input parameter and use an array to store all descriptions in an
+	  InputData object. Result of this is, that all user selected parameters are
+	  displayed and charts are well drawn again.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Split up data values stored in InputData objects in search mechanism for
+	  specific parameters and put them all as KeyValueDescibeData objects into a
+	  collection.
+
+2010-02-12  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Removed
+	  useless method calls which removed elements from cache, because each state
+	  puts its own elements into cache - not in one big piece.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Adapted 'reset'
+	  method. It removes the former user selection for this state, only.
+
+2010-02-12  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/timeseries/conf_mesh.xml: 
+	  Added new Transitions so that the State for entering a CoordinateValue will 
+	  only be shown if no Point was inserted during the Instantiation of an Artifact.
+	  (MapViewer-Interface)
+	  The could be used in the FIS Modeldata using the Product TimeSeries. You also have
+	  to use a Region in the RegionFilter.
+
+2010-02-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java: 
+	  This new State ist Implemented for the Case that Values of the PreSettings 
+	  has to be used instead of InputValues. This States will look into the 
+	  Presettings and put Values identified by the configurable Names into the 
+	  InputData-Collection.
+	  For the Configuration you can insert the following XML-Element into the 
+	  Configuration of a State.
+	  <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/>
+	
+	* src/main/java/de/intevation/gnv/state/StateBase.java (getPreSettings),
+	  src/main/java/de/intevation/gnv/state/State.java (getPreSettings): 
+	  Added a getter-method for the PreSettings that are set at the State.
+	  Using this way e.g the PresettingsValueCompareTransition can reach the 
+	  Settings an can evaluate them.
+	  
+	* src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java (operator): 
+	  This transition will have a look at the Values which where ste during the 
+	  instantiation of an Artifact. If a defined Value is given an the Value is 
+	  Equal to the configured Value using the configured Operator the Transition 
+	  to the configured State could be used. Otherwise the Transition could not
+	  be used.
+
+2010-02-11  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Replaced method call which removes non selected parameters from parameter
+	  list. At this time, there are only selected parameters in the list, so
+	  there is no need to clean it. The result: Charts are drawn.
+
+2010-02-11  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Declared method as
+	  'protected' to be allowed to use it in derived classes.
+
+	* src/main/java/de/intevation/gnv/state/OutputStateBase.java: Changed the
+	  key to store into cache and restore data from it. Added a workarround to
+	  find min and max value fields in InputData.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Adapted the search mechanism for specific parameter collections. This is
+	  required, because the the former mechanism searched in the big cache blob
+	  - which doesn't exist anymore.
+
+	  TODO: Repair chart generation. Although there are results existing for
+	  chart generation, no chart in drawn.
+
+2010-02-11  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Improved hash
+	  creation of each state. The hash is created using the uuid, state-id and
+	  the hash code of the input data required for the sql statement.
+
+2010-02-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Append description
+	  to InputData objects and use it while creating the describe document. The
+	  description is displayed in the static GUI part. A nice side effect of
+	  this is, that the subarea selection re-appears in the static GUI part.
+	  Even if no subarea has been selected. Furthermore, removed some methods 
+	  which became useless after refactoring the caching and rendering
+	  mechanism.
+
+	* src/main/java/de/intevation/gnv/state/MinMaxState.java: Adapted method
+	  signature regarding changes in upper class.
+
+2010-02-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+	
+	* src/main/java/de/intevation/gnv/state/State.java: New method 'feed' in
+	  this interface. It should be used to feed this state with new data 
+	  selected by the user.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Use new
+	  method 'feed' instead of 'putInputData' to feed the state with new data.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java,
+	  src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java,
+	  src/main/java/de/intevation/gnv/state/SingleInputState.java: Method
+	  'purifyResult' just cleans values from database and returns it. DO NOT
+	  put these results into cache at this place!
+	
+	* src/main/java/de/intevation/gnv/state/InputData.java,
+	  src/main/java/de/intevation/gnv/state/DefaultInputData.java: Some new
+	  methods to store objects in such an InputData object. Objects are used to
+	  store MinMaxDescribeData objects for example. And further new methods to
+	  store a description for each InputData object. This is used to render the
+	  static GUI part. Until now, this object stored the id's of the
+	  selected parameter, only - which are useless to show in GUI. The
+	  description should be the string shown in the GUI, later.
+
+	* src/main/java/de/intevation/gnv/state/MinMaxState.java: This type of state
+	  overrides 'feed' and 'appendToStaticNode'. 'feed' takes user input and
+	  parses min and max values from it (used for time periods for example).
+	  'appendToStaticNode' will append these fields to the static GUI part.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Removed the big
+	  cache blob and parted it into pieces. Each state will now put its
+	  database data into cache. In this way, we are able to reuse these data
+	  when the user steps back in history. Data, inserted by the user, will be
+	  stored via 'feed'. Special input fields like multi selection or ranges
+	  need to override this method to parse the input data and store them in
+	  special objects.
+
+	  TODOs:
+		- The output modes are based on this big cache blob and search for
+		  parameterid, measurementid and dateid in it.
+		  TimeSeriesOutputState.getCollection() needs to be adapted!
+
+2010-02-09  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java (addParameter),
+	  src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java (addParameter): 
+	  Added the possibility to add Parameters to an existing FIS.
+	  
+	* src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java (getFIS): 
+	  Added the support of the usecase that one FIS can be identified by different
+	  MapServices. In that case the parameters will be merged into the existing 
+	  FIS.
+
+2010-02-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Do not query the
+	  cache / database for rendering the static part of the describe document -
+	  just take the input data stored at each state.
+
+	  TODOs:
+		- Store 'description' of each chosen value. At the moment we are able to
+		  render an id of value, only.
+		- Take care of input elements with multi selection.
+		- The subarea node disappears if we don't select any.
+
+2010-02-09  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/conf.xml: 
+	  Switched the usage of DummyMetaDataService to MetaDataService because
+	  the Service is now able to work properly.
+	* doc/conf/queries.properties: 
+	  Added the required SQL-Statements for fetching the Metadata from the 
+	  Database.
+	* src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java:
+	  Added the Database-Lookup of FIS and Parameters.
+	  Now the Metadata will be looked up using the specified Databaseschema as
+	  defined in doc/schema/externalinterface_schema.sql
+	* src/main/java/de/intevation/gnv/artifacts/services/DummyMetaDataService.java 
+	  Removed Dummyservice because it is not required any more.
+
+2010-02-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue170
+	
+	* pom.xml: Changed log4j version to 1.2.14 (later version
+	  causes errors and breaks maven build process).
+
+2010-02-05  Tim Englich  <tim.englich@intevation.de>
+
+	* pom.xml: 
+	  Changed from ArcSDE version 9.2.5 to Version 9.3
+	  You have to Install the required Libraries as described in
+	  https://bsh-intern.intevation.de/Mavenbuildprozess
+	  
+2010-02-05  Tim Englich  <tim.englich@intevation.de>
+	* doc/schema/externalinterface_testdata.sql: 
+	  Changed the Testdata for layerhasparameter according to the the changes of 
+	  the Tablestructure.
+	* doc/schema/externalinterface_schema.sql: 
+	  Changed id_layer Column in Table layerhasparameter from literal to number.
+	  And added Column Layername to this Table.
+	  This is nessessary because the Identifcation of an Layer is not the name 
+	  but the ID.
+
+2010-02-05  Tim Englich  <tim.englich@intevation.de>
+	* doc/conf/products/horizontalcrosssection/conf_mesh.xml: 
+	  ISSUE167
+	  Fixed Bug in Konfiguration. Now Regionfilters can be used without running 
+	  in an Exception.
+
+2010-02-02  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/products/horizontalcrosssection/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh_cross.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_timeseriespoint.xml,
+	  doc/conf/products/verticalcrosssection/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_instantaneouspoint.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml: 
+	  Added the possibility to use the Informations (PreSettings) which are
+	  send using the MapViewer-Interface in all States which are responsible to
+	  manage the choice of Parameters during the Workflows of GNV-Artifacts.
+
+2010-02-02  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/DefaultInputData.java (splitValue),
+	  src/main/java/de/intevation/gnv/state/InputData.java (splitValue): 
+	  Added Method which spilts the Values using the same Separator which is
+	  used to concart the Values.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: 
+	  Added the usage of the Presettings during the Loading of the Data
+	  which is nessesary to describe the current State.
+	  If Values are given in the Presettings which are identified by the 
+	  name wwhich is specified in the Configurationelement presettings-name
+	  only the Intersection of the fetched Objects and the PresettingsObjects 
+	  are used.
+
+	* src/main/java/de/intevation/gnv/state/State.java (setPreSettings): 
+	  Added new Method setPreSettings to be Able to put the Presettings from the 
+	  current Artifact to the different States.
+
+	* src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java (setup): 
+	  The Method Setup now extracts the given PreSettingsparameter from the 
+	  XML-Document and put them to the ProductArtifacts which are instantiated in 
+	  the advance()-Method using the Methods of the PreSettingArtifact-Interface.
+
+	* src/main/java/de/intevation/gnv/artifacts/PreSettingArtifact.java (setPreSettings): 
+	  New interfacedefinition. Artifacts which are implementing this Interface 
+	  are able to exchange the given Presettings using the given getter and 
+	  setter methods of this Interface.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: 
+	  The GNVArtifactBase now implements the Interface PreSettingsArtifacts.
+	  So it is able to manage Data which is set during the construction of an 
+	  new ArtifactInstance.
+	  It also put the PreSettings-data to the different States. So that they are 
+	  able to use it during their livecycle.
+
+2010-02-01  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/conf.xml: 
+	  Added the Configuration-node for the MetaDataService into the Configuration
+	  of the GNV-Artifact-Restserver.
+	  At tis Moment it is only useful to use the DummyMetaDataService.
+
+	* src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java: 
+	  Defaultimplementation of the Interface Layer.
+	* src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Layer.java: 
+	  Interfacedefinition for Objects that represents Layer and GroupLayer that 
+	  where parsed from the XML-Document which was sent to the MetaDataService
+
+	* src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java: 
+	  Defaultimplementation of the Interface MapService.
+	* src/main/java/de/intevation/gnv/artifacts/services/requestobjects/MapService.java: 
+	  Interfacedefinition for Objects that represents Mapservices that where 
+	  parsed from the XML-Document which was sent to the MetaDataService.
+	
+	* src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java: 
+	  Defaultimplementation of the Interface Parameter.
+	* src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Parameter.java:
+	  Interfacedefinition for representing an Parameter which belongs to an FIS.
+
+	* src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java: 
+	  Defaultimplementation of the Interface FIS.
+	* src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java: 
+	  Interfacedefinition for representing an FIS which will be used as an 
+	  ResultValue of the MetaDataService-Processing.
+
+	* src/main/java/de/intevation/gnv/artifacts/services/MetaDataServiceException.java: 
+	  Exceptionclass for classifiing Exception which occurs during the processing
+	  of an MetaDataService-Call.
+
+	* src/main/java/de/intevation/gnv/artifacts/services/DummyMetaDataService.java: 
+	  DummyClass of an MetaDataService. This Class can be use to simulate an 
+	  MetaDataService-Call until the required Metadata for the prossessing are
+	  available in the Database-Backend.
+	  This Class only returns the given Mapservices as an FIS and the Layer 
+	  as an Parameter to a given FIS.
+
+	* src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java: 
+	  This Class is an Implementation of the de.intevation.artifacts.Service 
+	  Interface. This Service should provide Informations which FIS are available 
+	  for given Mapservices an which FIS are intersecting a given Region
+	  These Informations are required according to definition of the MapViewer
+	  Interface.
+	  
+2010-02-01  Tim Englich  <tim.englich@intevation.de>
+	
+	* src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java (createArtifactWithFactory): 
+	  Fixed Compilance-Errors triggered by Interface-Modifications in the 
+	  Artifact-Module.
+
+	* src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java (testArtifact):
+	  Refactored Artifact-Instantiation using the new createArtifact()-Method of the super-Class.
+
+	* src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java (createArtifact)
+	  Added Method for instantiating an new Artifact using the given Artifactfactory.
+	  Also fixed the Compilance-Errors triggered by Interface-Modifications in the 
+	  Artifact-Module.
+
+2010-02-01  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java (setup),
+	  src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshArtifact.java (setup), 
+	  src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileArtifact.java (setup),
+	  src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java (setup), 
+	  src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileArtifact.java (setup),
+	  src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java (setup),
+	  src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java (createArtifact),
+	  src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java (setup): 
+	  Changed Method signatures because of Interfacemodifications in the 
+	  Artifact-Module. Now it is possible to retrieve the XML-Document which was
+	  send by an Client during the create-Call. So it is possible to get further
+	  Informations which could be used during the livecycle of an Artifact.
+	
+
+2010-01-31  Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java,
+	  doc/conf/conf.xml: Added configuration for extrapolation in "Horizontalschnitte".
+
+	  Use gnv/horizontal-cross-section/extrapolation/@rounds with 
+	  integer rounds > 0 to turn extrapolation on (default: 0).
+	  Rounds is a number of successive point extrapolations which means that 
+	  the grid is successively filled with missing points based on prior rounds. 
+	  The larger 'rounds' get more gaps are filled synthetic generated points.
+
+	  Set this to 2 to get good results for the model data FIS.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Foward configuration to area interpolation.
+
+	* src/main/java/de/intevation/gnv/math/AreaInterpolation.java: 
+	  Foward configuration to GridCell.
+
+	* src/main/java/de/intevation/gnv/math/Point2d.java: Added method to extrapolate
+	  point along a line spanned by two points.
+	  Calculate Inverse Distance Weighting (IDW) for a given set of points on
+	  z components. Added method to check if set of points are near a given
+	  point.
+
+	* src/main/java/de/intevation/gnv/math/GridCell.java: Before building the
+	  i/j cells the grid is filled with synthetic generated points. The 
+	  position is estimated from the neighboring points. The parameter values
+	  are calculated by IDW. Some care is taken to avoid invalid grid topologies.
+
+	  TODO: Implement this for the "Profillschnitt" too to keep the inner
+	  symmetry.
+
+2010-01-29  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java (testArtifact),
+	* src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java (testArtifact),
+	* src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java (testArtifact),
+	* src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java (testArtifact):
+	  Increases the number of steps that has to be done for the different products plus one.
+	  
+	* src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_out_statistics.xml,
+	  src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_out_odv.xml,
+	  src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_out_csv.xml,
+	  src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_out_chart.xml,
+	  src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_feed.xml,
+	  src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_advance.xml,
+	  src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_feed.xml,
+	  src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_advance.xml,
+	  src/test/ressources/verticalprofile_mesh/verticalprofile_step_09_advance.xml:
+	  Added Advance and Feed-Document for the State Year.
+	  Changed the Advance to the State Year.
+	  Moves the Last state to *11*.xml Documents.
+	
+	* src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_out_odv.xml,
+	  src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_out_csv.xml,
+	  src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_out_chart.xml,
+	  src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_feed.xml,
+	  src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_advance.xml,
+	  src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_06_feed.xml,
+	  src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_06_advance.xml,
+	  src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_05_advance.xml:
+	  Added Advance and Feed-Document for the State Year.
+	  Changed the Advance to the State Year.
+	  Moves the Last state to *07*.xml Documents.
+	
+	* src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_out_statistics.xml,
+	  src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_out_odv.xml,
+	  src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_out_csv.xml,
+	  src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_out_chart.xml,
+	  src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_advance.xml,
+	  src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_feed.xml,
+	  src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_advance.xml,
+	  src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_09_advance.xml:
+	  Added Advance and Feed-Document for the State Year.
+	  Changed the Advance to the State Year.
+	  Moves the Last state to *11*.xml Documents.
+	
+	* src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_08_out_zip.xml,
+	  src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_08_out_wms.xml,
+	  src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_08_feed.xml,
+	  src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_08_advance.xml,
+	  src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_07_feed.xml,
+	  src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_07_advance.xml,
+	  src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_06_advance.xml: 
+	  Added Advance and Feed-Document for the State Year.
+	  Changed the Advance to the State Year.
+	  Moves the Last state to *08*.xml Documents.
+
+2010-01-27  Hans Plum <hans@intevation.de>
+
+	RELEASE 0.4
+
+	* Changes, NEWS, ChangeLog: Summarized activities
+
+2010-01-27  Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* Changes: Reordered items a bit
+
+2010-01-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue164
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Applied patch of SLT to remove shape files and directories of out-dated
+	  artifacts. Therefor we need to store the artifact after an 'out' operation 
+	  - which is actually a read only operation - explicitly into the artifact
+	  database to keep the directory path.
+
+2010-01-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Calculate results after reaching the final state and store them in cache.
+	  This avoids long latencies for chart creation or exports.
+
+2010-01-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue158
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Replaced old way to create ChartLabel objects with a method call
+	  'createChartLabels()'.
+
+2010-01-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java:
+	  Set white border (border arround drawing area) as default for 
+	  'Profilschnitte'.
+
+2010-01-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Calculate results after reaching the final state and store them in cache.
+	  This avoids long latencies for chart creation or exports.
+
+2010-01-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue162
+
+	* doc/conf/products/horizontalcrosssection/conf_mesh.xml,
+	  doc/conf/queries.properties: Adapted transition model. Splitted date
+	  selection of 'Horizontalschnitte' into two steps.
+
+2010-01-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml: Removed csv export
+	  from product 'Profilschnitt'.
+
+2010-01-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java: Fixed an
+	  ArrayIndexOutOfBounds-exception which occured if there are less than two
+	  data points.
+
+2010-01-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue161
+
+	* doc/conf/products/verticalprofile/conf_mesh.xml: Adapted transition model.
+	  Splitted date selection into two steps.
+
+2010-01-25	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	Fix/Workaround for gnv/issue159
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Deactivated the index buffer by default because applying it gives to
+	  less data points in some circumstances. When processing the 
+	  "horizontalen Schnittprofile", the "Profilschnitte" and the
+	  "Horizontalschnitte" the whole set of mesh cells for
+	  the given parameters are retrieved. This results in much
+	  more traffic from database (~ 10x) but seems not to be much slower.
+	  The memory consumption increases accordingly.
+
+	  To turn the index buffer on again use the boolean system properties:
+
+		  "gnv.horizontal.profile.mesh.cross.index.buffer"
+		  "gnv.vertical.cross.section.index.buffer"
+		  "gnv.horizontal.profile.mesh.cross.index.buffer"
+
+	* src/main/java/de/intevation/gnv/math/Interpolation2D.java: Because much
+	  more data is processed a more sophisticated point culling strategy is
+	  implemented now. 
+	  
+	  If the number of points are higher than a given threshold (system property 
+	  "gnv.interpolation2d.cull.point.threshold", default: 1000) a culling is 
+	  performed. Two cases:
+
+	  a) given a path P ("horizontales Schnittprofil", "Profilschnitt")
+	     Calculates a bounding box B for P and continues with (b).
+
+	  b) a bounding box B ("Horizontalschnitt", and above after (a))
+	     Calculates a bounding box C for the input points. If the
+		 area of B is greater than 80% of the area of C no culling is
+		 performed. Else B is extended by 10% in each direction.
+		 If the new area of B is smaller than 10% of the area of C
+		 B is adjusted to have at least 10% the size of C.
+
+	  All input points that are not inside B are culled. Afterwards the
+	  i/j grid cell units are created and pushed into a spatial index
+	  as described below.
+
+2010-01-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue157
+
+	* src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java:
+	  Added method to adjust background color of this chart.
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Set white background as all other charts have.
+	  
+2010-01-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue160
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java: Copied a
+	  method from JFreeChart and adapted date formats.
+
+2010-01-25	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/arcsdeconnectionpool.properties: Set serverRoundtripInterval
+	  to 5 seconds and serverInactiveInterval to 5 minutes.
+
+2010-01-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml,
+	  doc/conf/queries.properties: Splitted date selection into two steps - year
+	  and concreate date in this year. Removed useless option to 
+	  disable/enable data points of chart and export output, because points 
+	  make no sense in such products.
+
+2010-01-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/horizontalprofile/conf_mesh_cross.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml: Added new state for
+	  splitting the date selection into two parts - selection of year and
+	  selection of a concrete date of this year.
+
+	* doc/conf/queries.properties: Added new sql statement for querying years
+	  and adapted statement to query concrete dates.
+
+2010-01-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue156
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_timeseriespoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh_cross.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml,
+	  doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: Added some
+	  parameter (width, height, and shapes) to output modes svg and pdf. Now,
+	  these parameter will have an effect on svg and pdf exports.
+
+2010-01-24	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Added attribute "fill-color" to
+	  /artifact-database/gnv/vertical-cross-section/ground/ configure
+	  the color of the seabed polygon.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java:
+	  Adjusted column depth to the deepest interpolated position to
+	  prevent gaps.
+
+	* src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java:
+	  Add ground polygon to the chart.
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java:
+	  New. Contains code to create the ground polygon.
+
+	* src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java,
+	  src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java:
+	  Handle temporary vertices more efficiently.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Added configuration to set the color of the seabed polygon.
+
+	* src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java:
+	  Handle the seabad polygon color.
+
+2010-01-24	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* contrib/palette2qgis.xsl: Cosmetic cleanups.
+
+2010-01-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Fixed bug when accessing i and j columns of SQL dataset. This
+	  prevented gap detection in "horizontale Schnittprofile" from working.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation2D.java:
+	  "horizontale Schnittprofile" are now using the grid cell mechanism
+	  too. This should fix all remaining problems to solve gnv/issue153.
+	  The culling of too much points is controlled with the system property
+	  "gnv.interpolation2d.cull.point.threshold" with the same semantics 
+	  as in 'Profilschnitt' and 'Horizontalschnitt'.
+	  The spatial buffer size estimation code is removed because it is 
+	  not needed any longer.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java: Moved some
+	  code to Interpolation2D.
+
+	* src/main/java/de/intevation/gnv/math/GridCell.java: Added some
+	  debug information about the number of found cells.
+
+	* src/main/java/de/intevation/gnv/utils/WKTUtils.java:
+	  Cleanup imports.
+
+2010-01-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java:
+	  Apply same logic about the number of points to "Profilschnitte"
+	  too. If there are more "gnv.interpolation3d.cull.point.threshold"
+	  points they are culled against a 5% extended bounding box around
+	  the path. Default threshold: 1000.
+
+2010-01-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/AreaInterpolation.java:
+	  - The lastest refactoring removed the evaluation of the
+	    depth. Now its back in again. 
+
+	  - If the number of incoming points is greater than
+	    a given threshold (default: 1000) than the bounding box
+		of the interpolation is extend about 5% for a test
+		if the points are in this area. Points outside this
+	    area are culled because its unlikely that they have
+		any influence on the result. Use the system property
+		"gnv.areainterpolation.cull.point.threshold" to modify
+		the threshold value.
+
+	* src/main/java/de/intevation/gnv/math/GridCell.java: When
+	  build the interpolation areas the points are culled against
+	  extented bounding box.
+
+2010-01-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* contrib/palette2qgis.xsl: New. XSLT transformation to turn a
+	  palette XML file into a style definition suitable to be used
+	  in QGIS. Tested with QGIS 1.4.0-Enceladus. Usage:
+
+	  $ xsltproc contrib/palette2qgis.xsl       \
+	    doc/conf/palette/water-temperature.xml  \
+		> water-temperature.qml
+
+	  Do similar to process salinity.xml et al.
+
+	  When you've loaded the "Horizontalschnitt" polygon layer 
+	  in QGIS, class it via the "CLASS" attribute, load the
+	  according style and apply it. Voila!
+	  
+2010-01-22	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java:
+	  Make "Profilschnitte" work the same way like "Horzontalschnitte"
+	  again.
+
+2010-01-22	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/GridCell.java: New.
+	  A 4-tupel of neighbored points in the mesh. It is valid
+	  to interpolate in this area.
+
+	* src/main/java/de/intevation/gnv/math/AreaInterpolation.java:
+	  The algorithm how neighbored points in the mesh are determined
+	  has changed. Now all incoming points are tiled into GridCells.
+	  If there are gaps in i,j the corresponding tile is omited.
+	  These tiles are stored in an R tree. To lookup a point in
+	  world coordinates the spatial index is queried. If no result
+	  is found the point is ignore as a gap. If a fitting grid cell
+	  is found the interpolation in done between the four points
+	  of that cell is performed. Special gap checking is not needed any 
+	  longer. This fixes gnv/issue153 because there are no assumptions
+	  about axis aligned points any more.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation2D.java: Used
+	  euclid distance to estimate spatial buffer size. TODO: Remove
+	  this code when adjusting the "Profilschnitte" to the same logic
+	  as used in "Horzontalschnitte" now.
+
+	* src/main/java/de/intevation/gnv/math/LinearFunction.java: Added
+	  author's email.
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java: 
+	  Cleanup imports.
+
+2010-01-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Removed
+	  debug output which has been checked in by mistake.
+
+2010-01-22  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/meshwidth.xml: 
+	  Added Description of the sense of the different Attributes.
+	  
+2010-01-22  Tim Englich  <tim.englich@intevation.de>
+
+	  Issue93
+
+	* doc/conf/meshwidth.xml: 
+	  Added file for the global Configuration of MeshWidths to the Project.
+	  This file has to be edited if the mean Distance between two MeshPoints has
+	  changed or a new Mesh will be introduced.
+	  
+	* doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_mesh.xml, 
+	  doc/conf/products/horizontalprofile/conf_mesh.xml:
+	  Added Elemet with Link to the MeshWidth-Document to Configurations 
+	  for CoordinateSelectionStates.
+	  
+	* src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java : 
+	  Added the possibility to configure the different width of the Meshes.
+
+2010-01-22  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java (serviceNamesAndDescriptions),(process):
+	  Fixed Compiler-Error after adding further Methods to the Interface ArtifactDatabase.
+
+2010-01-22  Tim Englich  <tim.englich@intevation.de>
+	* src/test/java/de/intevation/gnv/artifacts/util/ShapeFileWriterTestCase.java (testMultiLineStringWriter): 
+	  Fixed Compiler-Error after changes in the Method-Signature.
+
+2010-01-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java:
+	  Repaired  revision. Removed try-catch of a never thrown exception.
+
+2010-01-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue136 & Issue137
+
+	* src/main/resources/lang/artifactMessages.properties,
+	  src/main/resources/lang/artifactMessages_de_DE.properties,
+	  src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages_de.properties: Added templates
+	  to format coordinates to a human readable output.
+
+	* src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java,
+	  src/main/java/de/intevation/gnv/utils/WKTUtils.java: Moved function to
+	  format coordinates from wkt string to human readalbe output to WKTUtils.
+	  Modified the method: Read template out of the i18n files and use a Java
+	  MessageFormatter to fill this template with string objects. A result of 
+	  this is a proper encoding (issue137).
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java:
+	  Use the method described above to format coordinate output and display
+	  this as chart subtitle (issue136). 
+
+2010-01-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue100
+
+	* src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java: If there
+	  are more than one axis, each dataset is mapped to its own dataset after
+	  adding it to the plot (one dataset for each parameter). In this way, we
+	  get a well scaled axis for each parameter which is independent from other
+	  axes (see range of salinity and air-pressure for example).
+
+2010-01-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+	
+	  Issue152
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java: Removed date
+	  formatting from timeseries charts. Set locale of DateAxis instead to
+	  localize chart axis. Advantage: JFreeChart defines intervals of axis
+	  labels automatically.
+
+2010-01-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Trigger the calculation when the state is initialized.
+
+2010-01-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue129
+
+	* src/main/resources/lang/artifactMessages.properties,
+	  src/main/resources/lang/artifactMessages_de_DE.properties,
+	  src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages_de.properties: Renamed I-axis to
+	  'West-East-axis' and J-axis to 'North-South-axis'.
+
+2010-01-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue105 The option to enable/disable data points in charts is now 
+	  available in gui.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Parse optional chart parameter 'points' to adjust rendering of shapes.
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_timeseriespoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh_cross.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml,
+	  doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: Added an
+	  option to enable/disable data points in charts.
+
+2010-01-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Set number of per axis samples to 1024
+	  because generation of "Horizontalschnitte" is much faster
+	  now (60x).
+
+	* src/main/java/de/intevation/gnv/math/Interpolation2D.java:
+	  Added some kind of outlier test when guessing the buffer size
+	  of the spatial index. The speed problem arose from the fact
+	  that to much points are assumed to be neighbors of a given
+	  point. Long distances which differ more than 40% from the 
+	  standard derivation are assumed to be outliers.
+
+	* src/main/java/de/intevation/gnv/math/AreaInterpolation.java: Uses
+	  the outlier aware buffer size guessing now.
+
+	* src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java,
+	  src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java:
+	  Removed needless imports.
+
+2010-01-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue148
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_mesh.xml,
+	  doc/conf/products/timeseries/conf_timeseriespoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh.xml,
+	  doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml,
+	  doc/conf/products/horizontalprofile/conf_mesh_cross.xml,
+	  doc/conf/products/verticalprofile/conf_mesh.xml,
+	  doc/conf/products/verticalprofile/conf_timeseriespoint.xml,
+	  doc/conf/products/verticalprofile/conf_instantaneouspoint.xml: Removed
+	  mistakes in description and mimetype of svg export nodes.
+
+2010-01-20	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java,
+	  src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java:
+	  Clip against given polygon. BTW: Geotools has problems with
+	  writing clipped polygons in packed 2-tuple form, too. Therefore
+	  polygons are also stores in the packed 3-tuple form. :-/
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Forward clipping polygon to isoline and polygon generator.
+
+2010-01-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* trunk/pom.xml: Upgraded Geotools to 2.5.8
+
+	* trunk/src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java:
+	  Ported to Geotools 2.5.8 API. Write parameter id, date and layer
+	  to shape files, too.
+
+	* trunk/src/main/java/de/intevation/gnv/math/AreaInterpolation.java:
+	  Flip upside down again because its not necessary.
+
+	* trunk/src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java:
+	  XXX: There is a Geotools bug when writing multi lines strings
+	  to shape files when the internal data representation are 
+	  packed 2-tuples. 2-tuples are enough in our use case but we
+	  use 3-tuples for multi line line strings. multi polygons work
+	  fine with 2-tuples.
+	  Removed needless bug output.
+	
+	* src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java:
+	  Use packed 3-tuples as the internal representation.
+
+	* src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Removed needless imports.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java: Write polygons and lines strings to shape files.
+	  
+2010-01-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/AreaInterpolation.java:
+	  Removed import to make it compilable again.
+
+2010-01-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue142
+
+	* src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java: Fixed an issue
+	  in timeseries chart caused by parameters with no value. Paid attention on
+	  array length.
+
+2010-01-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/RasterToPPM.java: New.
+	  Class to write rasters with palettes to portable pixmaps.
+	  Handy to debug raster outputs.
+
+	* src/main/java/de/intevation/gnv/raster/Raster.java: Added
+	  getValues() to access the backing data.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Read parameter from input data correctly.
+
+	* src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java: Walk
+	  rings of polygons in reversed order to produce correct JTS polygons.
+	  Its not entierly clear why this is necessary.
+
+	* src/main/java/de/intevation/gnv/math/AreaInterpolation.java: Clipp the
+	  input points against an buffered version of the bounding box of
+	  the given polygon to reduce the number of data. TODO: figure out why
+	  upside down rendering in necessary.
+
+2010-01-19  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/schema/externalinterface_testdata.sql,
+	  doc/schema/externalinterface_schema.sql: 
+	  Do some Bugfixes after testing the Schema and Testdata against an Oracle 10.2 DBMS.
+
+2010-01-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/State.java,
+	  src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java,
+	  src/main/java/de/intevation/gnv/state/OutputStateBase.java: Changed some
+	  method signatures. Use CallContext objects in some methods of the State 
+	  interface instead of CallMeta objects, which are a subset of CallContext.
+	
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Adapted
+	  method calls on State objects to the changes in the interface.
+
+2010-01-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Sourced creation of a ChartLabel object out to an own method which can be
+	  overwritten in subclasses to adjust the labels in each chart type.
+	
+	* src/main/java/de/intevation/gnv/chart/ChartLabels.java: Added string for
+	  labeling y axis and a parameter used in 'Profilschnitten'.
+
+	* src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java: Read
+	  labels from ChartLabel object and set chart and axes titles according to
+	  these labels.
+	
+	* src/main/resources/lang/artifactMessages.properties,
+	  src/main/resources/lang/artifactMessages_de_DE.properties,
+	  src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages_de.properties: Added labels for
+	  x and y axes of 'Profilschnitt' charts.
+
+2010-01-18  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java: Add an
+	  attribute 'fis' to the fis select node. If this attribute is found in
+	  XSLT, a link to step back and select a new fis will be created.
+
+2010-01-18  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/schema/externalinterface_schema.sql: 
+	  Added Comments and further Informations.
+	
+2010-01-18  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/schema/externalinterface_testdata.sql: 
+	  Added Testdata to demonstrate how the different Tables has to be filled.
+
+	* doc/schema/externalinterface_schema.sql: 
+	  Added Schema for the DB-Schemaextention for providing the Data that is 
+	  required for the external Interface to the Mapviewer
+	
+
+2010-01-18  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java:
+	  Implements a single method to append the selected fis to ui's static part.
+
+	* src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Inherit
+	  from GNVDefaultArtifact to append the selected fis to static part of the
+	  describe document.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Do not create static
+	  and dynamic nodes of the user interface any longer - fetch these nodes via
+	  xpath expression. The creation of these nodes takes place in the artifact
+	  itself.
+
+	* src/main/resources/lang/artifactMessages.properties,
+	  src/main/resources/lang/artifactMessages_de_DE.properties,
+	  src/main/resources/lang/artifactMessages_en.properties,
+	  src/main/resources/lang/artifactMessages_de.propertie: Added label for
+	  fis.
+
+2010-01-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* ChangeLog: Fixed indention.
+
+2010-01-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_07_out_chart.xml,
+	  src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_07_out_odv.xml,
+	  src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_07_out_csv.xml: 
+	  Removed Files, because they are not required any more.
+	* src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_07_out_zip.xml: 
+	  Added new RequestFile for calling for retrieving a Zip-File from the Server.
+	* src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_07_out_wms.xml: 
+	  Added new RequestFile for calling for an WMS-Result.
+	* src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_04_feed.xml: 
+	   Added Polygon as WKT into the feed-Request.
+
+2010-01-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java (TestArtifactDatabase): 
+	  New: Added an Testimplementation of the ArtifactDatabase to the Tests to use it inside the
+	  TestCallcontext to prevent NPEs during the Testzenarios.
+	  
+	* src/test/java/de/intevation/gnv/artifacts/TestCallContext.java (TestCallContext): 
+	  Added Artifactfactory to the Methodsignature of the Context to use it inside the Context.
+	  Added the Method getDatabase to resolve Compilationerrors.
+	  
+	* src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java (testArtifact),
+	  src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java (createCallContext): 
+	  Changed Methodsignature of createCallContext. Add the Artifactfactory to use it for creating
+	  the CallContext.
+	  
+2010-01-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java:
+	  New. Helper to convert the internal palette indices
+	  to the explicit configured external ones.
+
+	* src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java:
+	  Store the JTS geometries too.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Generate JTS multi polygons for parameter regions and multi line strings
+	  for iso lines. TODO: Clip against incoming polygon.
+
+2010-01-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/Palette.java:
+	  load <range> attribute "index" as external index. This
+	  is useful to match color classes with external sources.
+	  If no explicit index is given the order of ranges is
+	  used as external index.
+
+	* doc/conf/palette/flow-velocity.xml,
+	  doc/conf/palette/water-levels.xml,
+	  doc/conf/palette/salinity.xml,
+	  doc/conf/palette/water-temperature.xml: Set explicit
+	  external color class indices.
+
+	* doc/conf/conf.xml: Set ground interpolation of "Horizontalschnitte" 
+	  to bilinear.
+
+2010-01-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Reduced number of "Horizontalschnitt"
+	  samples to 256 because its much too slow with higher resolutions.
+	  This has to be improved.
+
+	* doc/conf/queries.properties: Use point data to generate
+	  "Horizontalschnitte". Added parameter id and date to results.
+
+	* src/main/java/de/intevation/gnv/utils/WKTUtils.java: Made
+	  reading to points more fault tolerant.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Call the area interpolation.
+
+	* src/main/java/de/intevation/gnv/math/AreaInterpolation.java:
+	  Fixed bug with calculating points inside bounding box of polygon.
+
+2010-01-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/State.java: Added
+	  support for end of life.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Implemented
+	  end of life trivial.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java:
+	  call end of life when leaving state.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Used XMLUtils.toStream() instead of own tranformer code. Removed
+	  dead code.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Implemented end of life. Remove shapefile directory from
+	  file system belonging to concrete artifact.
+	  Implemented download as ZIP file. Offer some link for
+	  WMS integration. TODO: implement the real WMS publishing here.
+
+2010-01-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/products/horizontalcrosssection/conf_mesh.xml:
+	  Only offer WMS layers and download ZIPs in output state.
+
+	* src/main/java/de/intevation/gnv/utils/FileUtils.java:
+	  New. Helper class to recursively delete files and directories
+	  and create ZIP archives from files and directories.
+
+	* src/main/java/de/intevation/gnv/utils/WKTUtils.java: Simpilied
+	  signature of worldEnvelopeCoordinatesToIndex().
+
+	* src/main/java/de/intevation/gnv/state/OutputState.java: Cleanup
+	  imports. Made source more readable.
+
+	* src/main/java/de/intevation/gnv/state/OutputStateBase.java:
+	  Cleanup imports. Made source more readable. Moved some
+	  XPath stuff from TimeSeriesOutputState up into this base class.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Move some XPath stuff into base class. Made source more readable.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Directly inherit from OutputStateBase now to break the implicit
+	  constraints (chart styles, statisctics, etc.) of the 
+	  TimeSeriesOutputStates which not hold for this kind of state.
+	  XXX: Added Workaround to circumvent gnv-intern/issue146
+
+	* src/main/java/de/intevation/gnv/math/AttributedXYColumns.java: Added
+	  e-mail addresses for authors. Made querying for attributes more
+	  robust.
+
+	* src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java:
+	  New. Data carrier for the "Horizontalschnitte". Used for generation
+	  of results and caching
+
+2010-01-15	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/fis/product/Product.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java,
+	  src/main/java/de/intevation/gnv/math/AreaInterpolation.java:
+	  Cleaned up imports.
+
+2010-01-15  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Added support to step back to the point where the user is able to choose
+	  the product of a FIS.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java:
+	  Cleaned up factories regarding their tasks. GNVArtifactFactory creates
+	  concrete products. GNVProductArtifactFactory handles all FIS and knows 
+	  the products of a FIS.
+
+	* src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java: Removed,
+	  because it is not used anymore.
+
+	* src/main/java/de/intevation/gnv/artifacts/fis/product/Product.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java:
+	  A Product does no longer save its factory but the name of its factory as
+	  string.
+
+	* src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java:
+	  This artifact will no longer read the config file to get information about
+	  the products of a fis.  The products are set via setter method out of the
+	  ArtifactFactory where this artifact is build.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Added the
+	  possibility to step back to the point where the user can choose a product.
+	  If the target of advance is 'product' we fetch the
+	  GNVProductArtifactFactory from ArtifactDatabase and create a new
+	  SelectProductArtifact, put it into the ProxyArtifact and clean up the ugly
+	  cache.
+
+	* doc/conf/conf.xml: Create top level FIS artifacts with
+	  GNVProductArtifactFactory instead of GNVArtifactFactory.
+
+2010-01-15  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/arcsdeconnectionpool.properties: 
+	  Added the Property serverRoundtripInterval to the Configuration an 
+	  set its Value to 15 Minutes.
+
+2010-01-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java (testArtifact): 
+	  Added new Step for querying the Years where measurements has been done into the 
+	  Testcase.
+	
+	* src/test/ressources/verticalprofile/verticalprofile_step_07_out_statistics.xml,
+	  src/test/ressources/verticalprofile/verticalprofile_step_07_out_odv.xml,
+	  src/test/ressources/verticalprofile/verticalprofile_step_07_out_csv.xml,
+	  src/test/ressources/verticalprofile/verticalprofile_step_07_out_chart.xml,
+	  src/test/ressources/verticalprofile/verticalprofile_step_07_feed.xml,
+	  src/test/ressources/verticalprofile/verticalprofile_step_07_advance.xml,
+	  src/test/ressources/verticalprofile/verticalprofile_step_06_feed.xml,
+	  src/test/ressources/verticalprofile/verticalprofile_step_06_advance.xml,
+	  src/test/ressources/verticalprofile/verticalprofile_step_05_feed.xml,
+	  src/test/ressources/verticalprofile/verticalprofile_step_04_advance.xml,
+	  src/test/ressources/verticalprofile/verticalprofile_step_05_advance.xml: 
+	  Added State-Ressource for the new step Year and modified the other Ressource-Files
+	  so that the new Step is queued in the right direction.
+
+2010-01-13  Ingo Weinzierl <ingo_weinzierl@web.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/fis/FISSelectArtifact.java,
+	  src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java:
+	  Renamed FISSelectArtifact to SelectProductArtifact which fits better,
+	  because the intent of this artifact is to choose a product - not a FIS.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java,
+	  src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java:
+	  Replaced FISSelectArtifact with SelectProductArtifact.
+
+2010-01-13	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/test/java/de/intevation/gnv/artifacts/util/ShapeFileWriterTestCase.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Removed needless imports.
+
+	* src/main/java/de/intevation/gnv/math/AreaInterpolation.java: New. Interpolates
+	  area for a given bounding box, taking gaps and DEM into account.
+	  Not very fast. Use bilinear interpolation to match the "Profilschnitt".
+	  Possible TODOs: 
+	  - speed up by assuming the grid is not sparse.
+	  - use higher interpolation methods.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Added configuration for ground interpolation.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Add helper functions to access configuration.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation2D.java: Simplified Code.
+
+	* src/main/java/de/intevation/gnv/math/L1Comparator.java: add setReference()
+	  method.
+
+2010-01-13  Ingo Weinzierl <ingo_weinzierl@web.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: 'advance'
+	  method will now consider old states. We reset input data of target state
+	  and clean cache from 'future data' before steping back to previous
+	  states.
+
+	  TODO: Refactor caching mechanism which should take care of different 
+	  states' hash values to be able to use the cache more efficiently.
+
+	* src/main/java/de/intevation/gnv/state/State.java: Added method to return
+	  map which stores input data of the current state.
+
+	* src/main/java/de/intevation/gnv/state/describedata/MinMaxDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/SingleValueDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/KeyValueDescibeData.java
+	  src/main/java/de/intevation/gnv/state/describedata/DefaultSingleValueDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/DefaultMinMaxDescribeData.java,
+	  src/main/java/de/intevation/gnv/state/describedata/DefaultKeyValueDescribeData.java:
+	  Add current state's name when initializing new objects of these classes.
+	  The name of a state is added as attribute to a node when creating the 
+	  describe-document. The xsl transformer will read this attribute and create
+	  a link which allows the user to step back to previous states.
+	
+	* src/main/java/de/intevation/gnv/state/SingleInputState.java,
+	  src/main/java/de/intevation/gnv/state/MinMaxState.java,
+	  src/main/java/de/intevation/gnv/state/StateBase.java:
+	  - Add state name when creating objects to store input data.
+	  - Use XMLUtils.ElementCreator to write namespace aware xml elements.
+	  - Add state names as attributes to xform elements.
+	  - Append old states to list of reachable targets in describe-document.
+	  - Remove data from cache which belong to future states after stepping
+	    back to a previous state.
+	  - Remove input data of current state after stepping back.
+
+2010-01-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java,
+	  src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Added configuration od file system directory of generate "Horizontalschnitt"
+	  shape files.
+
+2010-01-12	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/utils/WKTUtils.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Code cleanup
+
+2010-01-12  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/SingleInputState.java,
+	  src/main/java/de/intevation/gnv/state/MinMaxState.java,
+	  src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java:
+	  Data, describing the user interface, is stored in a list instead of a
+	  collection, now. This makes it easier to remove the last element if we
+	  advance back.
+
+	* src/main/java/de/intevation/gnv/state/State.java,
+	  src/main/java/de/intevation/gnv/state/StateBase.java: Added a 'reset'
+	  method to clear data which has been inserted before returning to an old
+	  state. This is called when we try to advance into the past.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java: Now, it's
+	  possible to advance to an earlier state. The 'advance' method first
+	  searches for a given target name in the list of reachable targets. If no
+	  future target has been found, the method looks for an old state with this
+	  target name. The last option is to return to the initial step for choosing
+	  the FIS, if the target name is 'start'.
+
+2010-01-12  Tim Englich  <tim.englich@intevation.de>
+
+	* doc/conf/queries.properties: 
+	  Added Query for Years in VerticalProfiles in TimeSeriesPoints.
+	  Modified the Query for Dates in VerticalProfiles in TimeSeriesPoints.
+	
+	* doc/conf/products/verticalprofile/conf_timeseriespoint.xml: 
+	  Added State for choosing the year and than it will only display
+	  the Dates which are within the coosen year.
+	  
+	* src/main/resources/lang/artifactMessages*.properties:
+	  Added Ressource for diaplaying year. 
+
+2010-01-12  Tim Englich  <tim.englich@intevation.de>
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java (configureHorizontalCrossSection): 
+	  Added the Method to load the Configurationsettings for horizontal-cross-sections
+	  from the global Configuartion and put it into the Context.
+	  
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java: 
+	  Added static variables to define the Keys used for horizontal-cross-sections
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java (getChartResult): 
+	  Integrated the Possibility to determin the required Snipped of an Mesh
+	  using the ij-Index determined by the given Polygon.
+	  Added the process-method which must still be implemented.
+
+	* src/main/java/de/intevation/gnv/utils/WKTUtils.java (worldEnvelopeCoordinatesToIndex): 
+	  Added worldEnvelopeCoordinatesToIndex-Method for determining the ij-Coodinates
+	  for a given Envelope.
+	  Some refactoring-Work done for reuse some existing Code of this Class.
+
+	* doc/conf/conf.xml: 
+	  Added the Configuration-Node for horizontal-cross-sections in this
+	  File.
+
+	* doc/conf/products/horizontalcrosssection/conf_mesh.xml: 
+	  Added ij-Query Node  to OutputState to make the Querystring
+	  available to this Product.
+
+2010-01-12  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Use XMLUtils to read evaluate xpath expressions. Adapted xpath
+	  expressions regarding namespace and prefix.
+
+2010-01-11  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java (readDocument): 
+	  Set NameSpaceAware to true to get the Unittests work again.
+	  The Out-Calls doesn't work yet!!!
+	
+
+2010-01-11	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* pom.xml: Introduced dependency to GeoTools 2.4.5 (maybe a bit too old)
+	  Needed to write traced polygons and line strings to shape files.
+
+	* src/main/java/de/intevation/gnv/utils/Pair.java: New
+	  simple pair tuple for type safety.
+
+	* src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java:
+	  New. Writes multi polygons and multi line strings to
+	  shapefiles. Writing the multi polygons works. 
+
+	  !! Writing the multi line strings fails!
+	  !! Its not clear by now if its a geotool bug or a
+	  !! misunderstanding of the API. The polygon and
+	  !! the line string export are coded symmetrically
+	  !! but the line string export complains about invalid 
+	  !! FIDs states.
+
+	* src/main/java/de/intevation/gnv/raster/AbstractProducer.java:
+	  New. Abstract base class for multi line string/polygons producers
+	  as backends of the vectorizer.
+
+	* src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java:
+	  Inherits from AbstractProducer now.
+
+	* src/main/java/de/intevation/gnv/raster/IsoProducer.java:
+	  New. Common base class for the iso line producers, inherits
+	  from AbstractProducer.
+
+	* src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java:
+	  Moved some code to new base class IsoProducer.
+
+	* src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java:
+	  New. Little helper class to demultiplex many ring handlers on
+	  one single vectorizer.
+
+	* src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java:
+	  The implemented AttributeGenerator interface is defined in IsoProducer
+	  now.
+
+	* src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java:
+	  New. Traces regions directly to JTS multi polygons.
+
+	* src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java:
+	  New. Traces iso lines directly to JTS multi line strings.
+
+	* src/main/java/de/intevation/gnv/math/QueriedXYDepth.java,
+	  src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java: 
+	  Removed needless imports.
+
+2010-01-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifacts/fis/FISSelectArtifact.java:
+	  Artifact used for the initial steps when no product is chosen.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java: Factory
+	  to create artifacts. It is used to put a new FISSelectArtifact into the 
+	  ProxyArtifact for the initial steps when no product is  chosen.
+
+	* doc/conf/conf.xml: Use the ProxyArtifact instead of FISArtifact and
+	  GNVArtifactFactory to create it.
+
+	* src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java:
+	  - Defined XPath expressions at the top of the class instead of directly in
+	    code.
+	  - Use XMLUtils.ElementCreator to create new namespace aware nodes and
+	    attributes.
+	  - Defined 'describe' method to create user interface for initial steps.
+
+	* src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileArtifact.java,
+	  src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileArtifact.java,
+	  src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java:
+	  Moved 'describe' methods which had no special code to super class.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Use
+	  XMLUtils.ElementCreator to create new elements in xml documents.
+
+2010-01-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Added configuration for vertical cross 
+	  section ground interpolation.
+
+	* src/main/java/de/intevation/gnv/math/QueriedXYDepth.java: Uses configured
+	  interpolation method now.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Read configuration for vertical cross section ground interpolation.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java:
+	  Added key and default for vertical cross section ground interpolation.
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Forwards vertical cross section ground interpolation to QueriedXYDepth.
+
+2010-01-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Prevent NPE if no results are produced by vertical cross sections.
+
+	* src/main/java/de/intevation/gnv/math/QueriedXYDepth.java: Replaced
+	  envelope checking by direct coordinate checking in tile cache.
+	  Store the last used tile explicitly to save it from being collected
+	  by the garbage collector.
+
+2010-01-08  Tim Englich  <tim.englich@intevation.de>
+
+	Issue 137
+
+	* src/main/java/de/intevation/gnv/utils/InputValidator.java (getPointValue),
+	  src/main/java/de/intevation/gnv/timeseries/gap/DefaultTimeGap.java (key),
+	  src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java (getStatisticsGenerator), 
+	  src/main/java/de/intevation/gnv/state/StateBase.java (extractKVP),
+	  src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java (prepareInputData4RegionDBQuery),
+	  src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java (advance):
+	  Removed Encodingerrors from listed Files. All Files are now UTF-8 compliant.
+	
+2010-01-08  Tim Englich  <tim.englich@intevation.de>
+	* src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestSuite.java (suite): 
+	  Added a Testsuit for executing all Testcases at once.
+	
+	* src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_feed.xml,
+	  src/test/ressources/timeseries_mesh/timeseries_step_08_feed.xml,
+	  src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_feed.xml: 
+	  Changed the feeded Datevalues because the Values in the Database
+	  have changed. TODO: Does it have an effect on the IDs?
+	
+	* src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_03_advance.xml,
+	  src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java (testArtifact): 
+	  Switched Testcase to the new Condition that an LineString has to be entered.
+	
+	* src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_*.xml, 
+	  src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java (testArtifact):
+	  Switched Testcase to the new Condition that an Polygon has to be entered. 
+
+2010-01-08  Tim Englich  <tim.englich@intevation.de>
+	
+	* src/main/resources/lang/artifactMessages.properties: 
+	  Added Ressources for the GUI for visualizing the Inputstate for
+	  Polygons.
+	
+	* doc/conf/products/horizontalcrosssection/conf_mesh.xml: 
+	  Added State for the possibility to enter a Polygon which should clip
+	  the data that will be visualized.
+	
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java (getChart): 
+	  Integrated the access to the Polygon which should be used to trim the Data which 
+	  should be visualized.
+
+2010-01-05	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/QueriedXYDepth.java:
+	  - Simplified code
+	  - Search tile cache in reversed order because its more likely
+	    that last loaded tile is used more than once.
+	  - Stores cached tiles under soft references to prevent the
+	    possible case to flood the memory with hires tiles.
+
+2010-01-05  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/QueriedXYDepth.java (depth): 
+	  Added the usage of the new RasterObject integrated in the geo-backend.
+	  Now the Performance is much better accessing the depth to an coordinate.
+
+2010-01-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java: Declared
+	  method to create a new xforms element as static to be able to use it
+	  without instantiating an object of this class.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java: Splitted code pathes
+	  of static and dynamic nodes. Static nodes contain the selected value
+	  only instead of transfering the complete stack of possible values again.
+
+2010-01-04  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java (process): 
+	  Changed the XYDepth-Interface-Implementation to QueriedXYDepth
+
+	* doc/conf/queries.properties: 
+	  Added the Query for Rasterdataaccess.
+
+	* src/main/java/de/intevation/gnv/math/QueriedXYDepth.java (QueriedXYDepth): 
+	  Added Implementation of the XYDepth-Interface for Querying the height
+	  of an Position using the geo-backend interface.
+	  It is only nessesary to add a Query with the id rasterQuery to the query-Properties.
+
+2010-01-04	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/statistics/Statistics.java:
+	  Changed interface to allow general object results as
+	  input for statistic calculation. This is needed because
+	  the vertical cross section produces no SQL like resultsets.
+
+	* src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java:
+	  New. Added common base class for different kind of statistics.
+	  TODO: Move more common code into this class.
+
+	* src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java:
+	  New. Statistics for vertical cross sections. Does nothing
+	  by now.
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Creates a VerticalCrossSectionStatistics object as statistics
+	  generator now.
+
+	* src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java:
+	  Inherits from AbstractStatistics now. Some code moved to new
+	  base class.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Cleaned up the usage of statistics.
+
+2010-01-04	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java:
+	  Fixed problem with running to max depth on every column.
+
+2010-01-04	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Fix class cast exception to enable PDF export of
+	  vertical cross section charts.
+
+	* ChangeLog: Typo fixes.
+
+2010-01-04	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java:
+	  Uses ValueAxis.valueToJava2D() to transform data values into chart
+	  space. This is slower than doing it via the Java2D matrix stack
+	  but its more the JFreeChart way and prevents transforming of
+	  graphical attributes too. TODO: Speed this up again!
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java:
+	  Forward plot to polygon renderer to make domain and range
+	  axis accessible.
+
+	* src/main/java/de/intevation/gnv/math/XYColumn.java: Moved code a bit.
+
+2010-01-04	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonSeriesLabelGenerator.java:
+	  New. Interface to generate labels for polygon series.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java:
+	  Added logic to generate and render labels of polygons.
+	  The implemented layout algorithm is greedy. For all
+	  polygons with labels the label is placed on the center of
+	  the ring, which center in terms of the indices of the vertices.
+	  If the bounding box of the label intersects the bounding box
+	  of a an already placed one alternative places are tried. 
+	  In level order positions at 1/4, 3/4, 1/8, 3/8, 5/8, 7/8 and 
+	  so on are evaluated for non intersections with former placed labels.
+	  This terminates if a free place is found or all index positions
+	  are exhausted. If no free position is found the label is omitted.
+
+	  The visual result is okay but could be improved by a more clever
+	  algorithm e.g. tension reduction in the graph of labels.
+
+	  TODO: Improve clipping against chart borders.
+
+	* src/main/java/de/intevation/gnv/jfreechart/LevelOrderIndices.java:
+	  New. Little helper class to generate the level order index
+	  traversal used in the label layout. Placed in the jfreechart
+	  package to keep it clean from gnv dependencies.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java:
+	  Added some methods to access the domain and range axis and
+	  there edge position. Mainly C&P from JFreeCahrts XYPlot
+	  to ease the coordinate transformation between Java2D and
+	  the value spaces of the chart. Call the label generation
+	  of the polygon renderer.
+
+	* src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java:
+	  Added an implementation of PolygonSeriesLabelGenerator to
+	  generate localized labels for the iso lines.
+	  
+2010-01-03	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java:
+	  Only add colors to scale which are in the chart.
+
+	* src/main/java/de/intevation/gnv/raster/Palette.java: Added
+	  getter for 'color' field of palette entry.
+
+2010-01-03	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Generate iso line classes according gnv-issues/issue108:
+
+	  - If there are more than nine colors used in the chart
+	    only the borders of the regions are traced.
+	  - If there are less than ten colors each color region
+	    is devided into two sub regions.
+	  - If there are less than five colors each color region
+	    is devided into five sub regions.
+
+	  Generate attribute per iso line class with the parameter value
+	  of the iso line.
+
+	* src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java:
+	  Renamed inner interface from LabelGenerator to AttributeGenerator to
+	  reflect the fact that the concrete label generation is a matter
+	  of i18n too. The concrete label generation should be done when 
+	  the final chart is going to be created. TODO: Add
+	  a JFreeChart style label generator to PolygonRenderer
+
+	* src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java:
+	  New. Implements the AttributeGenerator interface. It takes
+	  the indices of the neighboring regions, uses these values
+	  to look into the iso palette and averages the parameter values
+	  at the touching borders. This should help in cases where 
+	  two regions are neighbored in the chart which are not neighbored
+	  in the palette which may happen by quantification artifacts.
+
+	* src/main/java/de/intevation/gnv/raster/Palette.java: Added
+	  getters to 'from' and 'to' fields.
+
+	* src/main/java/de/intevation/gnv/math/XYColumn.java: Fixed
+	  another silly bug with adding values at surface and ground.
+
+	* ChangeLog: Typo fixes
+
+2010-01-01	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Generate iso lines by dividing palette ranges in two
+	  parts each and trace them. This shows that the ideas described
+	  by K. Jancke in gnv-issues/issue108 are probably not the
+	  right way to go. Applying this strategy there would be
+	  locally too many isolines if there is a steep gradient. 
+	  On the other hand large areas are splitted in too less sections
+	  by too less iso lines. A better way may be a splitting with
+	  a look at the areas and shapes of the regions. Large, round 
+	  regions need more splits. Long, thin regions need less.
+
+	* src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java:
+	  Stabilized iso line hashing a bit. Added line width to
+	  give iso lines a more appealing presentation in the chart.
+	  The according value is stored in "line.width".
+
+	* src/main/java/de/intevation/gnv/raster/Vectorizer.java: Fixed silly
+	  bug when simplifying lines. This prevented iso lines 
+	  from rendering.
+
+	* src/main/java/de/intevation/gnv/raster/Palette.java: Fixed index issue
+	  when generating a divided palette.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java:
+	  Do not crash with NPE any more when not having any series.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java:
+	  Added method to add a whole collection of series. Useful to add
+	  iso lines to dataset.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java:
+	  Set the "line.width" attribute when rendering lines.
+
+2010-01-01	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Deactivated gauss filter because
+	  it blurs no data areas too.  Moreover gauss filtering does not 
+	  seem to be necessary at all. Possible TODO: Mask the no data
+	  areas while filtering.
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Added generation of polygon data suitable for PolygonPlot.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  Some hacks to display the new Chart. XXX: This class is
+	  a real mess ... but I've said that before.
+
+	* src/main/java/de/intevation/gnv/chart/Chart.java: Made it
+	  serializable.
+
+	* src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java:
+	  New. Chart for vertical cross sections. Mainly a copy of
+	  Ingo's prototype implementation. TODO: parameter based i18n.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java: Code
+	  simplification. Made it Serializable to be cachable persistently.
+	
+	* src/main/java/de/intevation/gnv/math/AttributedXYColumns.java:
+	  Added fields for the interpolation and the generated PolygonDataset.
+	  Its used as the data carrying object in cache now.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java:
+	  Removed println debug code.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java:
+	  Added a little hack to draw the polygons of the interpolation.
+	  The values are in y-direction all below zero (depth is given
+	  by negative values) so the drawing is mirrored along y axis.
+	  This special behavior is determined by the position of data 
+	  bounding box. At first I suspected a ccw issue here but some
+	  initial tests falsified this hypothesis. We need to have a
+	  deeper look at this but till than it works.
+
+	* ChangeLog: Fixed some typos.
+
+2009-12-30	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Fixed defect XML
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Use configuration to generate JFreeChart compatible polygons.
+
+	* src/main/java/de/intevation/gnv/raster/PaletteManager.java:
+	  Add method to access base palette.
+
+	* src/main/java/de/intevation/gnv/raster/Vectorizer.java:
+	  Added logging and new constructor.
+
+	* src/main/java/de/intevation/gnv/math/ConstantXYDepth.java:
+	  "Simulates" DEM with a constant depth.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation2D.java:
+	  Fixed bug with construction of buffer size.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java:
+	  Some clean ups. New method to calculate max depth.
+
+	* src/main/java/de/intevation/gnv/math/XYColumn.java:
+	  Fixed bug with extrapolation.
+
+2009-12-30	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Added section gnv/vertical-cross-section
+	  to configure the "Profilschnitte".
+	  <samples width="..." height="..."/> configures the size of
+	  the sample area. Defaults to 1024x768.
+	  <filters><filter>...</filter></filters> configures the
+	  list of post processing filters applied to the sample area 
+	  after the interpolation is done. Defaults to empty list.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java:
+	  Added keys for vertical cross section samples and filters.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Parse the configuration for the new parameters.
+
+2009-12-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Added a gnv/horizontal-cross-section-profile
+	  section to configure the "horizontalen Schnittprofile".
+	  <samples number=".."/> gives the number of samples the
+	  interpolation track is divided into. Defaults to 250
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java:
+	  The names of the keys for fetching informations from the 
+	  configuration context are stored here now instead of the factory.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Removed the lookup keys. Configure the "horizontalen Schnittprofile".
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Fetch number of samples from config now instead of no longer supported
+	  system property.
+
+	* src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java:
+	  The key from chart template config is now in GNVArtifactContext, too.
+
+2009-12-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Moved chart template and palette config
+	  into new section 'gnv'.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  Adjusted to new 'gnv' section in config.
+	  Stores chat template under 'gnv.chart.template' and palettes
+	  under 'gnv.color.palettes'.
+	  Added authors.
+
+	* src/main/java/de/intevation/gnv/utils/StringUtils.java: Fixed
+	  index out of bounds issue.
+
+2009-12-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/Filter.java: New.
+	  General filter mechanism raster in -> raster out. Useful
+	  to chain processing. The Filter.Factory takes an 
+	  DOM element to configure itself.
+
+	* src/main/java/de/intevation/gnv/raster/KernelFilter.java:
+	  New. Implements raster filters based on kernel folding. Has
+	  an inner class GaussFactory which acts as a factory to create 
+	  Gauss filters. The attributes "sigma" and "radius" are read
+	  from the configuring DOM element to set up the parameters
+	  of the kernel.
+
+2009-12-28	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java,
+	  src/main/java/de/intevation/gnv/utils/WKTUtils.java: Refactored most 
+	  silly code like inefficent access to input data and redundant 
+	  WKT line string parsing.
+
+	* src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java,
+	  src/main/java/de/intevation/gnv/math/XYColumn.java:
+	  Removed needless imports.
+
+2009-12-28	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/OutputStateBase.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java:
+	  Bring CallContext down to the chart generation. This is necessary to
+	  access the configuration. BTW: this a much cleaner way than
+	  the omnipresent singletons all around in the code!
+
+	  Observation: All the stuff derived from OutputStateBase is coded very messy 
+	  ... even if your demands are not high about aesthetic :-/
+
+	* src/main/java/de/intevation/gnv/utils/StringUtils.java: New.
+	  Some functions to ease working with strings.
+
+2009-12-28	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/PaletteManager.java: New.
+	  Used to manage several levels of palette subdivsions derived from
+	  base palette. Contains name and description of palette, too.
+	  
+	* src/main/java/de/intevation/gnv/raster/Palette.java: Removed
+	  palette description because it is hold by the PaletteManager now.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  The palettes are not stored under the name of the palette any longer.
+	  Instead the new attribute 'parameter-id' is splitted (comma separated)
+	  into integers which are use as keys now. The values are PaletteManagers.
+	  This should ease the access to an adequate PaletteManager when
+	  generating a chart for a certain parameter.
+
+	* doc/conf/conf.xml: Added the 'parameter-ids' for the four palettes.
+	  The values are extracted from the gdiintern wiki.
+
+	  !!! This have to be in sync with the database parameter ids !!!
+
+2009-12-27	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java:
+	  New. Vectorizer rings callback which produces iso lines in
+	  form of PolygonSeries. These series can be added to PolygonDatasets.
+	  If a IsoPolygonSeriesProducer.LabelGenerator is given
+	  each of the series has an attribute "label" which could be used
+	  to label text on the plot. TODO: Add label rendering to plot.
+
+	  Iso line generation is a bit more sophisticated than pure
+	  region tracing. Along a border of a region there could
+	  be more than one type of neighborhood. This is due to quantification
+	  errors introduced by the fact that steep value gradients
+	  are sampled to less points. The only ways out would be an
+	  increase of the sample resolution or an other algorithm
+	  working directly on the interpolated floating point samples.
+
+	* src/main/java/de/intevation/gnv/raster/Vectorizer.java: Made
+	  line simplification work with open polygons, too.
+
+	* src/main/java/de/intevation/gnv/math/IJKey.java: Added method
+	  to sort (i, j) in place.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java:
+	  Do not close line shapes because iso lines are not closed shapes
+	  in general.
+
+	* src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java:
+	  Added author. Some reformatting.
+
+2009-12-26	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java:
+	  New. Vectorizer rings callback which produces PolygonDatasets suitable
+	  to be fed into PolygonPlot.
+
+	* src/main/java/de/intevation/gnv/raster/Vectorizer.java: 
+	  Forward height to rings callback.
+	  Made simplification of chains an option (default: true).
+	  This should be turn off if generating iso lines.
+	  Made edges hashable (handy to find neighbored edges in
+	  iso line scanning).
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java:
+	  Added default constructor. Generate unique comparable long id
+	  in thos constructor.
+	  Added method to add a single ring.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java:
+	  Added constructor to construct with a collection of polygon
+	  series.
+
+2009-12-25	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/Palette.java: Added
+	  method subdive(N) to Palette class which creates a new
+	  palette in which each interval is splitted into N
+	  equal sized intervals. Infinity sized intervals are not
+	  splitted. This is useful to fulfill the conditions of
+	  gnv/issue108.
+
+2009-12-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/Interpolation2D.java: 
+	  Use local variable debug instead of asking log.isDebugEnabled() 
+	  more than once.
+
+	* src/main/java/de/intevation/gnv/math/XYColumn.java: extrapolate
+	  with boundary values.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation3D.java:
+	  Implements a 3D interpolation called 'Profilschnitt' along a 
+	  track similiar to the 'Horizontaler Schnittprofil' which takes 
+	  all k layers into account. 
+
+	  At the interpolated (x, y) points columns of parameter values 
+	  from surface to ground are interpolated. To do so the four 
+	  next neighbor of that columns are figured out. Four
+	  cubic splines are fitted through these parameter values 
+	  of these neighbors. Now its possible to continuous eval
+	  the parameter on each. Every entry in the interpolated column
+	  is interpolated bilinear from the four cubic spline interpolated
+	  neighbor values at the respective depth.
+
+	  The result is stored into a double valued raster. NaN values
+	  indicate interpolation gaps.
+
+2009-12-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/XYColumn.java: Added a method
+	  prepare() which generates an continues interpolator for the
+	  given z values. if only one value is given a constant function
+	  is assumed. If the larger z-value is below zero the
+	  next lower value is supplemented at zero. Symmetrically 
+	  if the lowest z-value is above the depth at the given point
+	  the lowest value is repeated at depth. This should guarantee
+	  that the gradient is vansihing towards the surface and the
+	  bottom of the ocean.
+
+	  If after the supplementation there are less than three points
+	  a linear interpolation is performed. If there are more than three
+	  points a higher degree interpolation is used instead. This defaults
+	  to a cubic spline interpolation. Overwrite the getInterpolator()
+	  function to replace this behavior.
+	  
+	* src/main/java/de/intevation/gnv/math/ConstantFunction.java: New.
+	  Constant function used in interpolation.
+
+	* src/main/java/de/intevation/gnv/math/LinearFunction.java: Added
+	  an inner class Univariate which fits into the interpolation
+	  framework.
+
+	* src/main/java/de/intevation/gnv/math/HeightValue.java: Sort
+	  z-Values in descending order because we are below zero.
+
+	* src/main/java/de/intevation/gnv/math/XYDepth.java: New. Interface
+	  to figure out the depth (negative values below surface) for
+	  a given coordinate. TODO: Implement this by query the DEM grid
+	  of the ocean.
+
+	* src/main/java/de/intevation/gnv/math/AttributedXYColumns.java: Added
+	  authors.
+
+2009-12-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  When preprocessing database data only dissemble WKT points if we
+	  have to.
+	  Read z values as double value now.
+	  Commented out CSV export because it takes the database data
+	  as data which is not correct here. TODO: We need to implement some output 
+	  based on the interpolated data.
+	  Added some type safety to better match the 2D code.
+
+	* src/main/java/de/intevation/gnv/math/AttributedXYColumns.java: Stores
+	  XYColumns in ArrayList for better reused of the 2D code.
+
+	* src/main/java/de/intevation/gnv/math/XYColumn.java: Removed toArray()
+	  method because its not needed any longer.
+
+2009-12-23	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/XYColumn.java: Extends from
+	  Point2d now to make some of the code (x/y sorting, envelope, etc.)
+	  reusable in 3D from 2D code.
+
+	* src/main/java/de/intevation/gnv/math/IJKey.java: New: The (i, j) hashing
+	  is now moved to this class because of the new inheritance of XYColumn.
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java: 
+	  Adjusted the (i, j) hashing. 
+
+	* src/main/java/de/intevation/gnv/math/Point2d.java: Added a new constructor
+	  to make it easier to extend from it.
+
+	* src/main/java/de/intevation/gnv/math/Interpolation2D.java: Made the buffer
+	  extend calculation a static method to be reusable in 3D case.
+
+2009-12-22	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Load salinity palette correctly.
+
+2009-12-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java:
+	  Preprocessing of data used for interpolation.
+
+	* src/main/java/de/intevation/gnv/math/AttributedXYColumns.java: Data
+	  wrapper. Contains preprocessed data used for interpolation and some
+	  metadata used for chart creation.
+
+	* src/main/java/de/intevation/gnv/math/XYColumn.java,
+	  src/main/java/de/intevation/gnv/math/HeightValue.java: Made them
+	  serializable and added hashCode() and equals() to XYColumn to use it as
+	  key in HashMaps.
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java,
+	  src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java,
+	  src/main/java/de/intevation/gnv/state/OutputStateBase.java: Changed some 
+	  method signatures.
+
+	* src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java:
+	  Improved error handling. Return empty statistic set if there are no input
+	  data.
+
+2009-12-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml: Adjusted
+	  configuration for verticalcrosssection ('Profilschnitt') products.
+
+	* doc/conf/queries.properties: Adjusted sql query for chart generation of 
+	  verticalcrosssection products.
+
+	* src/main/java/de/intevation/gnv/state/StateBase.java,
+	  src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java: Code
+	  refactoring and better error handling.
+
+2009-12-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/math/HeightValue.java,
+	  src/main/java/de/intevation/gnv/math/XYColumn.java: Added model classes to
+	  store information for interpolation.
+
+2009-12-22	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/conf.xml: Added config section for palettes.
+
+	* src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java:
+	  load palettes at start up.
+	  They are stored in a hash map under the key 'color.palettes'. The keys of
+	  the map are the names from the configuration, the values are 
+	  de.intevation.gnv.raster.Palette objects.
+	  Put configuration of chart template into own method.
+
+	* src/main/java/de/intevation/gnv/raster/Palette.java: Added a palette
+	  description.
+
+2009-12-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Ignore invalid interpolations correctly.
+
+2009-12-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/raster/Raster.java: New. Models 2D double 
+	  rasters. Has some support for filtering with gauss kernels, building
+	  iso classes, etc.
+
+	* src/main/java/de/intevation/gnv/raster/Palette.java: New. Maps double
+	  values to integer indices and colors.
+
+	* src/main/java/de/intevation/gnv/raster/Vectorizer.java: New. Simple
+	  vectorizer which traces regions in integer rasters.
+
+	* pom.xml: Added dependency to GNU Trove 2.1.1 which is needed by the
+	  vectorizer.
+
+2009-12-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/utils/WKTUtils.java,
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Moved some methods back to old place.
+
+2009-12-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	Added Ingo Weinzierl's special JFreeChart classes.
+
+	* src/main/java/de/intevation/gnv/jfreechart: New package.
+	  Should contain general JFreeChart stuff.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java: New.
+	  New type of plot to display multi-polygons with holes.
+
+	* src/main/java/de/intevation/gnv/jfreechart/CompactXYItems.java: New.
+	  Basic vertex data model: a ring of a polygon. ccw = shell, cw = hole.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java: New.
+	  Attributes a set of rings with key/value pairs.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java: New
+	  List of PolygonSeries which makes it a multi-polygon.
+
+	* src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java: New
+	  A renderer to draw PolygonDatasets into a PolygonPlot.
+	
+2009-12-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* doc/conf/products/verticalcrosssection/conf_mesh.xml: Prepared states and
+	  transitions of verticalcrosssection (german 'Profilschnitt').
+
+2009-12-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+a
+	* src/main/java/de/intevation/gnv/utils/WKTUtils.java
+	  src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Outsourcing of some methods to prepare results for chart creation.
+
+2009-12-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* doc/conf/palette/flow-velocity.xml:
+	  color palette for flow velocity "Fliessgeschwindigkeit".
+	* doc/conf/palette/water-levels.xml:
+	  color palette for water levels "Wasserstaende".
+	* doc/conf/palette/salinity.xml:
+	  color palette for salinity "Salzgehalt".
+	* doc/conf/palette/water-temperature.xml:
+	  color palette for water temperature "Wassertemperatur".
+
+2009-12-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java:
+	  Added some code to prevent needless null inserts if interpolating 
+	  over large gaps.
+
+2009-12-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java:
+	  Removed warning, which told the user that gap detection is not implemented
+	  yet.
+
+2009-12-21  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java,
+	  src/main/java/de/intevation/gnv/math/Interpolation2D.java: Add 'null'
+	  values for gap detection to result collection instead of omitting them.
+	  
+	* src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java,
+	  src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.jav:
+	  Handle null values - don't throw an exception.
+
 2009-12-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	RELEASE 0.3
@@ -47,7 +5512,7 @@
 
 2009-12-17  Hans Plum <hans@intevation.de>
 
-	Issue 129: Release 0.2: Verbesserung der Übersetzungen
+	Issue 129: Release 0.2: Verbesserung der �bersetzungen
 
 	* src/main/resources/lang/artifactMessages_de_DE.properties,
 	src/main/resources/lang/artifactMessages_de.properties:
--- a/gnv-artifacts/Changes	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/Changes	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,164 @@
+2010-06-30  RELEASE 1.1
+
+    NEW:
+
+        * New product: 'Achsenparalleles Vertikalprofil'
+        * Support for products with vectorial parameters (#27)
+        * Integrated configuration section for sql-cache
+        * Statistics of ehcaches are available as MBean using JConsole
+        * N-Step back history for the parameterization
+        * ODV export for product 'Horizontales Schnittprofil' (#260)
+        * MANIFEST contains svn buildnumbers
+
+    FIXES:
+
+        * Corrected chart titles (#138, #120)
+        * Fixed defect range calculation for chart axes (#233)
+        * Corrected distance calculation in product 'Horizontalprofil' (#287)
+        * Fixed bin width calculation in histograms (#288)
+        * Changing width/height of charts ended in Stacktace (#294)
+        * Multi layer selection for product 'Layer' (#252)
+        * Renaming a layer just changes its title (#198),
+        * WMS layers now have a prefix 'GNV_' (#315, #314)
+        * Disabled multi selection for vectorial parameter (#299)
+        * Fixed broken transition chain of 'Achsenparalleler
+          Vertikalprofil' (#300, #318, #154)
+        * Fixed ODV export that created invalid odv files (#291)
+        * Added missing column for csv export for product 'Horizontales
+          Schnittprofil' (#284)
+        * Depths have negative values in odv exports (#230)
+        * Keep aspect ratio in PDF/SVG exports (#290)
+        * Fixed hash creation for caching elements (#264, #268)
+        * Further JavaDoc (#274)
+        * Fixed discrepancy in parameter matrix between parameter values and
+          description (#281)
+        * Fixed broken geometry clipping (#283)
+        * Fixed user input validation (#286, #289)
+        * Exception handling improvements (#188, #251, #265, #18, #269, #266)
+
+
+2010-04-28  RELEASE 1.0
+
+    NEW:
+
+        * Support for renaming wms layers (#198)
+
+        * Support for Contis, Nauthis and Marine Features (#92, #205)
+
+        * Support for exporting/importing artifacts (#208)
+          Before an artifact is exported, the cleanup() method is called to do
+          relevant things before an export.
+
+        * Improved the matrix for parameter-measurement selection. The user can
+          choose between different depths only without relation to a specific
+          parameter (#210)
+
+        * ODV export of a 'Profilschnitt' is possible now (#217)
+
+        * The MapServer can be called without explicitly declaration of the
+          mapfile path (#235, #220). A wrapper script is used - located in the 
+          cgi directory of apache - to export the mapfile path.
+
+        * The transition model can be plotted as pdf or svg (#262) with the help
+          of an xsl sheet contained in the contrib directory.
+
+        * Added a template mechanism for 'Layer' product. A default layer is
+          used if there is no specific template for a layer.
+
+        * Support for MapViewer call. A MapViewer call feeds an artifact
+          initially with parameters that are used if the artifact reaches states
+          which require these parameters. These states are called
+          AutoResumeStates and leads the artifact to the next state immediately.
+
+
+    Fixed:
+
+        * Date changes have no effect on wms output (#201)
+        * The subtitle of a horizontalprofile chart contains its beginning
+          coordinate (#120)
+        * Limit rendering of floating point numbers to 3 decimals in
+          MapServer (#209)
+        * Improvements respective to csv exports (#122)
+        * Improvements respective to odv exports (#215)
+        * Display the the time to live of an artifact / wms layer in gui (#197)
+        * Avoid race-conditions while chart creation (#211)
+        * Remove shapefile directories if an artifact reaches its end of
+          life (#164)
+        * Avoid cut axes labels with a gap between data area and chart
+          border (#192, #163)
+        * Wrong time intervals inserted by a user don't cause NPE anymore (#212)
+        * User inserted wkt string are validated (#214, #251)
+        * The geometry type used for wms publishing is fetched from database (#213)
+        * Improved gap detection in timeseries charts (#175)
+        * Selection of layer without items not possible anymore (#200)
+        * Improved chart creation for product type SST (#232)
+        * Added the station name to the subtitle of timeseries charts (#226)
+        * Added the timeinterval to the subtitle of timeseries charts (#152)
+        * Calculate the x-range of verticalprofile charts correct (#229)
+        * Calculate the y-range of horizontalprofile charts correct (#233)
+        * The width of a class in histograms can be specified by a floating
+          point number (#231)
+        * Added label for y-axes in histograms (#243)
+        * 'Profilschnitte' can be exported as png-image (#216)
+        * I18N support for statistic output (#228)
+        * Improved subtitles of horizontalprofile charts (#138)
+        * Removed a duplicated path to the mapfile in the configuration (#220)
+        * The layer selection in the product 'Layer' is no longer limited to
+          a single layer (#252)
+        * Added missing units into class templates that are displayed when
+          calling WMS GetLegendGraphic operation on 'Horizontalschnitten' (#246)
+        * The Restlet server uses the same log4j configuration as the rest of 
+          the application (#6)
+        * Files used by artifact-database and cache are written to an own
+          directory - no longer into the conf directory (#218)
+
+
+2010-03-08  RELEASE 0.5
+
+
+2010-01-27  RELEASE 0.4
+
+    New:
+
+    * Added entire infrastructure for interpolation pipeline:
+        * Rasterizers on a configurable grid resolution (x and y).
+        * Vectorizer producing geoemetries from rasterized data
+          (introducting dependency to GNU Trove 2.2.1)
+        * Color palette handling
+        * Support for using DEM (seabed) in interpolation
+        * helper script for converting color palettes to 
+          QGIS 1.4 styling format
+
+    * Diagrams:
+
+        * 'Profilschnitte'     (via JFreeChart compatible Vectorizer output)
+        * 'Horizontalschnitte' (via JTS compatible Vectorizer output)
+           * Multi-polygons:    Classes determined by palette values
+           * Multi-linestrings: Iso lines determined with rules of #108
+    
+        * Support for 2D diagrams with multi-polygons (with shells and holes)
+          and multi-linestrings (essentially what is called "Simple Feature")
+        * Improved labeling (heading, subheading) of all diagrams
+
+    * Added support for ProxyArtifact to support access to history of states
+    * Added support for writing Shapefiles with GeoTools (introducing
+      dependency to GeoTools 3.5.8)
+
+    Fixed:
+
+    * Generation of vertical profiles failed on Marnet (#142)
+    * Using correct MIME-type for SVG-Export in configuration (#148)
+    * Enabling/Disabling points in GUI (#105)
+    * Reanming values for selcting the direction of an axis (#129)
+    * Adapting granularity for labels for timeseries (#152)
+    * adapting range of values for data series with identical name
+      and different time ranges (#136/137)i
+    * Corrected interpolation based on horizontal cross-section (#153)
+    * Enabling/Disabling points in diagrams with PDF export (#156)
+    * Harmonized background color in 2D diagrams (#157)
+    * Adding label for axis for 2D diagrams (#158)
+
+
 2009-12-17  RELEASE 0.3
 
     New:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/LGPL.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
--- a/gnv-artifacts/NEWS	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/NEWS	Fri Sep 28 12:15:18 2012 +0200
@@ -1,9 +1,127 @@
+2010-06-30  RELEASE 1.1
+
+    * Integration of a new product 'Achsenparalleles Vertikalprofil'
+
+    * Support for vectorial parameters
+
+    * Configuration supports the usage of an sql-cache
+
+    * Evaluable cache statistics
+
+    * Parameterization supports an N-Step-Back history
+
+
+2010-04-28  RELEASE 1.0
+
+    NEW:
+
+        * Support for renaming wms layers
+
+        * Support for Contis, Nauthis and Marine Features
+
+        * Support for saving/loading existing artifacts (e.g. for saving/loading
+          the current parametrization)
+
+        * Improved the matrix for parameter-measurement selection. The user can
+          choose between different depths only without relation to a specific
+          parameter (#210)
+
+        * Support for odv exports on 'Profilschnitten' (#217)
+
+        * The MapServer can be called without explicitly declaration of the
+          mapfile path (#235, #220)
+
+        * The configuration of the transition model can be plotted as svg or
+          pdf (#262)
+
+        * Improved shapefile writing in 'Layer' product - write each column
+          retrieved by database into shapefile.
+
+        * Improved the input validation. More specific error messages are
+        * displayed if the validation fails.
+
+        * Support for an initial parameterization via MapViewer call.
+
+
+
+2010-03-08  RELEASE 0.5
+
+
+2010-01-27  RELEASE 0.4
+    
+    Processing:
+    * Added central support for the entire interpolation infrastructure
+    with a lot of configuration capabilities:
+      * rasterizing input data sets
+      * calculating interpolation paying attention to different boundary
+      conditions: Less than 3 point, extrapolating to the ground, water
+      surface, ...
+      * tracing isolines
+      * clipping geometries
+      * exporting interpolated polygons and isolines
+      * rendering of 2D-diagrams and export of Shapefiles
+      
+      for "Horizontales Schnittprofil", Vertical- and Horizontal Cross
+    Section. Made parts of the interpolation configurable like
+    resolution of interpolation raster; color palettes.
+
+    * Optimizing of runtime of interpolations
+
+    * Diagramm specific:
+        * Made color paletts configurable for rendering Vertical-Cross
+        Sections. Added helper script to convert same palettes to QGIS (at
+        least version 1.4 supported) styling format
+
+        * Support for 2D diagrams with multipolygons with holes and shells
+
+        * Made color of seabed configurable for vertical cross-sections
+
+        * Added special renderer for labeling isolines in dense areas 
+        in order to avoid overlaps
+
+
+    * Dependency to GUI generation:
+        * Splitting date selections in a 2 step transition: year, exact
+        point of time as required in the webclient
+
+
+        * Cleaning up internal model of steps to correspond to internal
+        objects in cache
+
+
+        * Add support for a wizard-based model of states in order to support
+        a 1-step back history in a first step; preparation for
+        multistep-history done.
+
+
+    * Configuration:
+        * Configuration: Enhanced configuration for connection testing of
+        SDE. So fare, now stable for reusing connections.
+
+        * Configurability of Mesh-Width per data model
+
+    * Others:
+        * Added support for exporting shapefiles and integrating into
+        artefact-lifecycle in order to remove files/directories after
+        end-of-life
+
+        * Support for a MapViewer interfaced based on a database-based
+        configuration
+
+        * Added support for raster data to taking into account sea
+        topography
+
+
 2009-12-17  RELEASE 0.3
 
     * PDF export
+
     * SVG export
+
     * Chart Templating
+
     * 'Horizontale Schnittprofile'
+
     * various i18n fixes
 
 2009-11-13  RELEASE 0.2
--- a/gnv-artifacts/bin/run.sh	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/bin/run.sh	Fri Sep 28 12:15:18 2012 +0200
@@ -1,5 +1,11 @@
 #!/bin/bash
 
+# Copyright (c) 2010 by Intevation GmbH\
+#
+# This program is free software under the LGPL (>=v2.1)\
+# Read the file LGPL.txt coming with the software for details\
+# or visit http://www.gnu.org/licenses/ if it does not exist.\
+
 DIR=`dirname $0`/..
 CLASSPATH=
 for l in `find -name \*.jar -print`; do
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/contrib/gnv-wms	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,3 @@
+#!/bin/sh
+export MS_MAPFILE=/opt/artifacts/mapfiles/mapfile.map
+./mapserv-gp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/contrib/palette2polygonVM.xsl	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+
+ Author: Ingo Weinzierl (ingo.weinzierl@intevation.de)
+-->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+    <xsl:output
+        method="text" version="1.0" encoding="UTF-8" omit-xml-declaration="no" />
+
+    <xsl:template match="*">
+        <xsl:apply-templates />
+    </xsl:template>
+
+    <xsl:template match="range">
+        CLASS
+            NAME "<xsl:value-of select="./@description" />"
+            EXPRESSION ("[CLASS]"="<xsl:value-of select ="./@index" />")
+            STYLE
+                COLOR "<xsl:value-of select="./@rgb" />"
+            END
+        END
+    </xsl:template>
+
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/contrib/palette2qgis.xsl	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <!--
+    palette2qgis.xsl
+    ================
+
+    Copyright (c) 2010 by Intevation GmbH
+
+    This program is free software under the LGPL (>=v2.1)
+    Read the file LGPL.txt coming with the software for details
+    or visit http://www.gnu.org/licenses/ if it does not exist.
+
+    Transforms palette XML files into QGIS style files. Useful
+    to display "Horizontalschnitte" with the right colors.
+
+    Tested with Quantum GIS 1.4.0-Enceladus.
+
+    usage: xsltproc palette2qgis.xsl palette.xml > style.qml
+
+    Author: Sascha L. Teichmann (sascha.teichmann@intevation.de)
+    -->
+  <xsl:output
+       method="xml"
+       doctype-system="PUBLIC 'http://mrcc.com/qgis.dtd' 'SYSTEM'"/>
+
+  <xsl:template name="hex2number">
+    <xsl:param name="hex"/>
+    <xsl:choose>
+        <xsl:when test="string-length($hex) &lt; 1">
+            <xsl:value-of select="0"/>
+        </xsl:when>
+        <xsl:otherwise>
+            <xsl:variable
+                name="x" 
+                select="translate(substring($hex, string-length($hex), 1), 'ABCDEF', 'abcdef')"/>
+            <xsl:variable name="last">
+              <xsl:choose>
+                <xsl:when test="$x = 'a'">10</xsl:when>
+                <xsl:when test="$x = 'b'">11</xsl:when>
+                <xsl:when test="$x = 'c'">12</xsl:when>
+                <xsl:when test="$x = 'd'">13</xsl:when>
+                <xsl:when test="$x = 'e'">14</xsl:when>
+                <xsl:when test="$x = 'f'">15</xsl:when>
+                <xsl:otherwise>
+                  <xsl:value-of select="$x"/>
+                </xsl:otherwise>
+              </xsl:choose>
+            </xsl:variable>
+            <xsl:variable name="rest">
+              <xsl:call-template name="hex2number">
+                 <xsl:with-param
+                      name="hex"
+                      select="substring($hex, 1, string-length($hex)-1)"/>
+              </xsl:call-template>
+            </xsl:variable>
+            <xsl:value-of select="number($last) + 16*$rest"/>
+        </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template match="/ranges/range">
+    <symbol>
+      <lowervalue><xsl:value-of select="@index"/></lowervalue>
+      <uppervalue><xsl:value-of select="@index"/></uppervalue>
+      <label><xsl:value-of select="@description"/></label>
+      <pointsymbol>hard:circle</pointsymbol>
+      <pointsize>2</pointsize>
+      <pointsizeunits>pixels</pointsizeunits>
+      <rotationclassificationfieldname/>
+      <scaleclassificationfieldname/>
+      <symbolfieldname/>
+      <outlinecolor red="0" blue="0" green="0"/>
+      <outlinestyle>NoPen</outlinestyle>
+      <outlinewidth>0.26</outlinewidth>
+      <xsl:variable name="rgb">
+        <xsl:call-template name="hex2number">
+          <xsl:with-param name="hex" select="substring(@rgb, 2)"/>
+        </xsl:call-template>
+      </xsl:variable>
+      <xsl:variable name="red" select="floor(($rgb div (256*256)) mod 256)"/>
+      <xsl:variable name="green" select="floor(($rgb div 256) mod 256)"/>
+      <xsl:variable name="blue" select="floor($rgb mod 256)"/>
+      <fillcolor red="{$red}" blue="{$blue}" green="{$green}"/>
+      <fillpattern>SolidPattern</fillpattern>
+      <texturepath null="1"/>
+    </symbol>
+  </xsl:template>
+  <xsl:template match="/">
+    <qgis version="1.4.0-Enceladus" minimumScale="1" maximumScale="1e+08" minLabelScale="1" maxLabelScale="1e+08" hasScaleBasedVisibilityFlag="0" scaleBasedLabelVisibilityFlag="0">
+      <transparencyLevelInt>255</transparencyLevelInt>
+      <classificationattribute>CLASS</classificationattribute>
+      <symbol>
+        <lowervalue null="1"/>
+        <uppervalue null="1"/>
+        <label>Andere</label>
+        <pointsymbol>hard:circle</pointsymbol>
+        <pointsize>2</pointsize>
+        <pointsizeunits>pixels</pointsizeunits>
+        <rotationclassificationfieldname/>
+        <scaleclassificationfieldname/>
+        <symbolfieldname/>
+        <outlinecolor red="0" blue="0" green="0"/>
+        <outlinestyle>DashDotDotLine</outlinestyle>
+        <outlinewidth>0.26</outlinewidth>
+        <fillcolor red="59" blue="81" green="179"/>
+        <fillpattern>SolidPattern</fillpattern>
+        <texturepath null="1"/>
+      </symbol>
+      <uniquevalue>
+        <classificationfield>CLASS</classificationfield>
+        <xsl:apply-templates/>
+      </uniquevalue>
+      <edittypes>
+        <edittype type="0" name="CLASS"/>
+        <edittype type="0" name="DATE"/>
+        <edittype type="0" name="LAYER"/>
+        <edittype type="0" name="PARAMETER"/>
+      </edittypes>
+      <editform/>
+      <editforminit/>
+      <displayfield>PARAMETER</displayfield>
+      <label>0</label>
+      <attributeactions/>
+      <labelattributes>
+        <label fieldname="" text="Beschriftung"/>
+        <family fieldname="" name="Sans Serif"/>
+        <size fieldname="" units="pt" value="12"/>
+        <bold fieldname="" on="0"/>
+        <italic fieldname="" on="0"/>
+        <underline fieldname="" on="0"/>
+        <color fieldname="" red="0" blue="0" green="0"/>
+        <x fieldname=""/>
+        <y fieldname=""/>
+        <offset x="0" y="0" units="pt" yfieldname="" xfieldname=""/>
+        <angle fieldname="" value="0" auto="0"/>
+        <alignment fieldname="" value="center"/>
+        <buffercolor fieldname="" red="255" blue="255" green="255"/>
+        <buffersize fieldname="" units="pt" value="1"/>
+        <bufferenabled fieldname="" on=""/>
+        <multilineenabled fieldname="" on=""/>
+      </labelattributes>
+    </qgis>
+  </xsl:template>
+  <xsl:template match="text()"/>
+</xsl:stylesheet>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/contrib/visualize-transitions.xsl	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+
+ Author: Sascha L. Teichmann (sascha.teichmann@intevation.de)
+-->
+
+<xsl:stylesheet 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xlink="http://www.w3.org/1999/xlink"
+    version="1.0">
+
+    <xsl:output method="text" encoding="UTF-8"/>
+
+    <xsl:param name="base-dir">.</xsl:param>
+
+    <xsl:template match="/">
+        <xsl:text>digraph transition_model {&#xa;</xsl:text>
+        <xsl:apply-templates />
+        <xsl:text>}&#xa;</xsl:text>
+    </xsl:template>
+
+    <xsl:template match="artifact">
+        <xsl:choose>
+            <xsl:when test="@xlink:href != ''">
+                <!-- handle external artifacts -->
+                <xsl:variable name="path">
+                    <xsl:call-template name="string-replace-all">
+                    <xsl:with-param name="text" select="@xlink:href" />
+                    <xsl:with-param name="replace">${artifacts.config.dir}</xsl:with-param>
+                    <xsl:with-param name="by" select="$base-dir" />
+                    </xsl:call-template>
+                </xsl:variable>
+                <xsl:for-each select="document($path)">
+                    <xsl:apply-templates select="/artifact"/>
+                </xsl:for-each>
+            </xsl:when>
+            <xsl:otherwise>
+                <!-- handle internal artifacts -->
+                <xsl:text>subgraph </xsl:text><xsl:value-of select="@name"/>
+                <xsl:text> {&#xa;</xsl:text>
+                <xsl:text>    label = "Artefakt: </xsl:text>
+                <xsl:value-of select="@name"/>
+                <xsl:text>";&#xa;</xsl:text>
+                <xsl:apply-templates mode="inside-artifact" select="./states/state"/>
+                <xsl:apply-templates mode="inside-artifact" select="./states/transition"/>
+                <xsl:text>}&#xa;</xsl:text>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <xsl:template match="state" mode="inside-artifact">
+        <xsl:text>    </xsl:text>
+        <xsl:value-of select="@id"/>
+        <xsl:text disable-output-escaping="yes"
+        > [ shape = "record" label=&lt;&lt;table border="0" cellborder="0" cellpadding="3"&gt;
+        &lt;tr&gt;&lt;td align="center" colspan="2" bgcolor="black"&gt;&lt;font color="white"&gt;</xsl:text>
+        <xsl:value-of select="@id"/>
+        <xsl:text disable-output-escaping="yes"
+        >&lt;/font&gt;&lt;/td&gt;&lt;/tr&gt;</xsl:text>
+            <xsl:apply-templates mode="inside-artifact" select="./inputvalues"/>
+        <xsl:text disable-output-escaping="yes"
+        >&lt;/table&gt;&gt;]</xsl:text>
+        <xsl:text>;&#xa;</xsl:text>
+    </xsl:template>
+
+    <xsl:template match="inputvalue" mode="inside-artifact">
+        <xsl:text disable-output-escaping="yes"
+        >&lt;tr&gt;&lt;td align="right"&gt;</xsl:text>
+        <xsl:value-of select="@name"/>
+        <xsl:text disable-output-escaping="yes"
+        >&lt;/td&gt;&lt;td align="left"&gt;</xsl:text>
+        <xsl:value-of select="@type"/>
+        <xsl:text disable-output-escaping="yes"
+        >&lt;/td&gt;&lt;/tr&gt;</xsl:text>
+    </xsl:template>
+
+    <xsl:template match="transition" mode="inside-artifact">
+        <xsl:text>    </xsl:text>
+        <xsl:value-of select="from/@state"/>
+        <xsl:text disable-output-escaping="yes"> -&gt; </xsl:text>
+        <xsl:value-of select="to/@state"/>
+        <xsl:apply-templates mode="inside-artifact"/>
+        <xsl:text>;&#xa;</xsl:text>
+    </xsl:template>
+
+    <xsl:template match="condition" mode="inside-artifact">
+        <xsl:text> [ label="</xsl:text>
+        <xsl:value-of select="@inputvalue"/>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="@operator"/>
+        <xsl:text> </xsl:text>
+        <xsl:value-of select="@value"/>
+        <xsl:text>" ]</xsl:text>
+    </xsl:template>
+
+    <xsl:template match="text()" mode="inside-artifact"/>
+    <xsl:template match="text()"/>
+
+     <xsl:template name="string-replace-all">
+        <xsl:param name="text" />
+        <xsl:param name="replace" />
+        <xsl:param name="by" />
+        <xsl:choose>
+          <xsl:when test="contains($text, $replace)">
+            <xsl:value-of select="substring-before($text,$replace)" />
+            <xsl:value-of select="$by" />
+            <xsl:call-template name="string-replace-all">
+              <xsl:with-param name="text"
+                  select="substring-after($text,$replace)" />
+              <xsl:with-param name="replace" select="$replace" />
+              <xsl:with-param name="by" select="$by" />
+            </xsl:call-template>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$text" />
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:template>
+    
+</xsl:stylesheet>
+
--- a/gnv-artifacts/doc/conf/arcsdeconnectionpool.properties	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/arcsdeconnectionpool.properties	Fri Sep 28 12:15:18 2012 +0200
@@ -11,6 +11,8 @@
 #                if it is Valid
 # timeBetweenEvictionRunsMillis : Time in Milliseconds which is allowed
 #                                 to reused a returned Connection.
+# serverRoundtripInterval : The Timea ArcSDE-Connection must nor be used until 
+#                           the Connection will test if it is valid.
 # server: The URL of the Server where the Database is reachable.
 # username: The Username which should be used to Connect to the Databackend.
 # credentials: The Credentials to the given username
@@ -24,8 +26,10 @@
 testOnReturn=false
 testWhileIdle=false
 timeBetweenEvictionRunsMillis=360000
+serverRoundtripInterval=5
+serverInactiveInterval=300
 server=localhost
 username=gast
 credentials=gast
 port=22119
-database=esri_sde
\ No newline at end of file
+database=esri_sde
--- a/gnv-artifacts/doc/conf/charttemplate.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/charttemplate.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -77,4 +77,10 @@
             <color value="0x000000" />
         </ticklabel>
     </axis>
+    <!-- ======================== histogram ===================!-->
+    <histogram>
+        <bar>
+            <color value="#00416B" />
+        </bar>
+    </histogram>
 </theme>
--- a/gnv-artifacts/doc/conf/conf.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/conf.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,40 +1,56 @@
 <artifact-database>
+    <export-secret>BLABLABLBALBLABL</export-secret>
     <factories>
         <context-factory>de.intevation.gnv.artifacts.context.GNVArtifactContextFactory</context-factory>
         <artifact-factories>
+            <!-- All Artifactfactories which are available in this Database. 
+                 Each Artifactfactory represents one FIS. -->
             <artifact-factory name="fis_marnet" description="Factory to create an artifact to be used with the FIS Marnet"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_imis" description="Factory to create an artifact to be used with the FIS IMIS"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_staun" description="Factory to create an artifact to be used with the FIS STAUN"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_modeldata" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_eisklimatologie" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_icestations" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_sst" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_delphin" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_thermosalinograph" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_chemusurvey" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_gts" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_bsh_ctd" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_bsh_xbt" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_seacat" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_seastate" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
             <artifact-factory name="fis_currentmeter" description="Factory to create an artifact to be used with the FIS Modeldata"  
-                              ttl="3600000" artifact="de.intevation.gnv.artifacts.fis.FISArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
+            <artifact-factory name="fis_nauthis" description="Factory to create an artifact to be used with the FIS Nauthis"  
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
+            <artifact-factory name="fis_contis" description="Factory to create an artifact to be used with the FIS Conthis"  
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
+            <artifact-factory name="fis_marinefeatures" description="Factory to create an artifact to be used with the FIS Conthis"  
+                              ttl="3600000" artifact="de.intevation.artifactdatabase.ProxyArtifact">de.intevation.gnv.artifacts.GNVProductArtifactFactory</artifact-factory>
         </artifact-factories>
+        <service-factories>
+            <!-- The Servicefactory which is responsible to handle MV-GNV-Interface-Calls -->
+            <service-factory
+                name="metadata"
+                service="de.intevation.gnv.artifacts.services.MetaDataService"
+                description="This is the Service for getting Metadata from the GNV-Artuifact-Services">de.intevation.artifactdatabase.DefaultServiceFactory</service-factory>
+        </service-factories>
     </factories>
     
     <!--  Artifacts which represent one FIS. Each FIS can have several Products 
@@ -45,7 +61,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeries" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="4"/>
                         <parameter name="fisname" value="fis_marnet"/>
@@ -53,7 +69,7 @@
                 </product>
                  <product name= "verticalProfile">
                     <artifact-factory name="verticalProfile" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="4"/>
                         <parameter name="fisname" value="fis_marnet"/>
@@ -66,7 +82,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeries" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="30"/>
                         <parameter name="fisname" value="fis_seacat"/>
@@ -79,7 +95,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeries" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="33"/>
                         <parameter name="fisname" value="fis_currentmeter"/>
@@ -92,7 +108,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeries" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="20"/>
                         <parameter name="fisname" value="fis_seastate"/>
@@ -105,7 +121,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeries" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="18"/>
                         <parameter name="fisname" value="fis_imis"/>
@@ -113,7 +129,7 @@
                 </product>
                 <product name= "verticalProfile">
                     <artifact-factory name="verticalProfile" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="18"/>
                         <parameter name="fisname" value="fis_imis"/>
@@ -126,7 +142,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeries" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="17"/>
                         <parameter name="fisname" value="fis_staun"/>
@@ -134,7 +150,7 @@
                 </product>
                 <product name= "verticalProfile">
                     <artifact-factory name="verticalProfile" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="17"/>
                         <parameter name="fisname" value="fis_staun"/>
@@ -147,7 +163,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeriesMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                          <parameter name="sourceid" value="2"/>
                          <parameter name="fisname" value="fis_modeldata"/>
@@ -155,7 +171,7 @@
                 </product>
                 <product name= "verticalProfile">
                     <artifact-factory name="verticalProfileMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="2"/>
                         <parameter name="fisname" value="fis_modeldata"/>
@@ -163,7 +179,7 @@
                 </product>
                 <product name= "horizontalProfile">
                     <artifact-factory name="horizontalProfilehorizontalProfileMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="2"/>
                         <parameter name="fisname" value="fis_modeldata"/>
@@ -171,7 +187,7 @@
                 </product>
                  <product name= "horizontalProfileCross">
                     <artifact-factory name="horizontalProfilehorizontalProfileMeshCross" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileMeshCrossArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileMeshCrossArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="2"/>
                         <parameter name="fisname" value="fis_modeldata"/>
@@ -179,7 +195,15 @@
                 </product>
                  <product name= "verticalcrosssection">
                     <artifact-factory name="verticalCrossSectionMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.verticalcrosssection.VerticalCrossSectionMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.verticalcrosssection.VerticalCrossSectionMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
+                    <parameters>
+                        <parameter name="sourceid" value="2"/>
+                        <parameter name="fisname" value="fis_modeldata"/>
+                    </parameters>
+                </product>
+                <product name= "verticalcrosssectionparallel">
+                    <artifact-factory name="verticalCrossSectionMeshParallel" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
+                             ttl="300000" artifact="de.intevation.gnv.profile.verticalcrosssection.VerticalCrossSectionMeshParallelArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="2"/>
                         <parameter name="fisname" value="fis_modeldata"/>
@@ -187,7 +211,7 @@
                 </product>
                 <product name= "horizontalCrossSection">
                     <artifact-factory name="horizontalCrossSectionMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.horizontalcrosssection.HorizontalCrossSectionMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.horizontalcrosssection.HorizontalCrossSectionMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="2"/>
                         <parameter name="fisname" value="fis_modeldata"/>
@@ -200,7 +224,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeriesMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                          <parameter name="sourceid" value="38"/>
                          <parameter name="fisname" value="fis_eisklimatologie"/>
@@ -208,7 +232,7 @@
                 </product>
                 <product name= "horizontalProfile">
                     <artifact-factory name="horizontalProfilehorizontalProfileMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="38"/>
                         <parameter name="fisname" value="fis_eisklimatologie"/>
@@ -216,7 +240,7 @@
                 </product>
                 <product name= "horizontalCrossSection">
                     <artifact-factory name="horizontalCrossSectionMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.horizontalcrosssection.HorizontalCrossSectionMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.horizontalcrosssection.HorizontalCrossSectionMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="38"/>
                         <parameter name="fisname" value="fis_eisklimatologie"/>
@@ -229,7 +253,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeries" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="38"/>
                         <parameter name="fisname" value="fis_icestations"/>
@@ -242,7 +266,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeriesMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                              ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                          <parameter name="sourceid" value="39"/>
                          <parameter name="sourceid" value="40"/>
@@ -253,7 +277,7 @@
                 </product>
                 <product name= "horizontalProfile">
                     <artifact-factory name="horizontalProfilehorizontalProfileMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                          <parameter name="sourceid" value="39"/>
                          <parameter name="sourceid" value="40"/>
@@ -264,7 +288,7 @@
                 </product>
                  <product name= "horizontalCrossSection">
                     <artifact-factory name="horizontalCrossSectionMesh" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.horizontalcrosssection.HorizontalCrossSectionMeshArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.horizontalcrosssection.HorizontalCrossSectionMeshArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="39"/>
                          <parameter name="sourceid" value="40"/>
@@ -280,7 +304,7 @@
             <products>
                 <product name= "horizontalProfile">
                     <artifact-factory name="horizontalProfileInstantaneousPoint" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileInstantaneousPointArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileInstantaneousPointArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="34"/>
                         <parameter name="fisname" value="fis_delphin"/>
@@ -294,7 +318,7 @@
             <products>
                 <product name= "horizontalProfile">
                     <artifact-factory name="horizontalProfileInstantaneousPoint" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileInstantaneousPointArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileInstantaneousPointArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="35"/>
                         <parameter name="fisname" value="fis_thermosalinograph"/>
@@ -308,7 +332,7 @@
             <products>
                 <product name= "horizontalProfile">
                     <artifact-factory name="horizontalProfileInstantaneousPoint" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileInstantaneousPointArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.horizontal.HorizontalProfileInstantaneousPointArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="37"/>
                         <parameter name="fisname" value="fis_chemusurvey"/>
@@ -322,7 +346,7 @@
             <products>
                 <product name= "timeSeries">
                     <artifact-factory name="timeSeries" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.timeseries.TimeSeriesArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="5"/>
                         <parameter name="fisname" value="fis_gts"/>
@@ -330,7 +354,7 @@
                 </product>
                 <product name= "verticalProfile">
                     <artifact-factory name="verticalProfileInstantaneousPoint" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileInstantaneousPointArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileInstantaneousPointArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="5"/>
                         <parameter name="fisname" value="fis_gts"/>
@@ -343,7 +367,7 @@
             <products>
                 <product name= "verticalProfile">
                     <artifact-factory name="verticalProfileInstantaneousPoint" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileInstantaneousPointArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileInstantaneousPointArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="32"/>
                         <parameter name="fisname" value="fis_bsh_ctd"/>
@@ -356,7 +380,7 @@
             <products>
                 <product name= "verticalProfile">
                     <artifact-factory name="verticalProfileInstantaneousPoint" description="Artiefactfactory for Instantiating the Artifact for the FIS Modeldata"  
-                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileInstantaneousPointArtifact">de.intevation.artifactdatabase.DefaultArtifactFactory</artifact-factory>
+                             ttl="300000" artifact="de.intevation.gnv.profile.vertical.VerticalProfileInstantaneousPointArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
                     <parameters>
                         <parameter name="sourceid" value="36"/>
                         <parameter name="fisname" value="fis_bsh_xbt"/>
@@ -365,32 +389,155 @@
             </products>
         </artifact>
         
+        <artifact name="fis_contis">
+            <products>
+                <product name= "layer">
+                    <artifact-factory name="layer" description="Artiefactfactory for Instantiating the Artifact for the Product Layer"
+                             ttl="300000" artifact="de.intevation.gnv.layer.LayerArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
+                    <parameters>
+                        <parameter name="sourceid" value="contis%"/>
+                        <parameter name="fisname" value="fis_contis"/>
+                    </parameters>
+                </product>
+            </products>
+        </artifact>
+        
+        <artifact name="fis_nauthis">
+            <products>
+                <product name= "layer">
+                    <artifact-factory name="layer" description="Artiefactfactory for Instantiating the Artifact for the Product Layer"
+                             ttl="300000" artifact="de.intevation.gnv.layer.LayerArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
+                    <parameters>
+                        <parameter name="sourceid" value="S57%"/>
+                        <parameter name="fisname" value="fis_nauthis"/>
+                    </parameters>
+                </product>
+            </products>
+        </artifact>
+        
+        <artifact name="fis_marinefeatures">
+            <products>
+                <product name= "layer">
+                    <artifact-factory name="layer" description="Artiefactfactory for Instantiating the Artifact for the Product Layer"
+                             ttl="300000" artifact="de.intevation.gnv.layer.LayerArtifact">de.intevation.gnv.artifacts.GNVArtifactFactory</artifact-factory>
+                    <parameters>
+                        <parameter name="sourceid" value="median%"/>
+                        <parameter name="fisname" value="fis_marinefeatures"/>
+                    </parameters>
+                </product>
+            </products>
+        </artifact>
+        
+        
+        
         <!--  Product specific Artifacts which are referenced by the Artifacts
               of the FIS above.
               The product-Artifacts can be configured here or can be referenced
               using an xlink:href-Attribute. -->
-              
-        <artifact name="timeSeries" xlink:href="${artifacts.config.dir}/products/timeseries/conf_timeseriespoint.xml" />
-        <artifact name="timeSeriesMesh" xlink:href="${artifacts.config.dir}/products/timeseries/conf_mesh.xml" />
-        
-        <artifact name="verticalProfile" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_timeseriespoint.xml" />
-        <artifact name="verticalProfileMesh" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_mesh.xml" />
-        <artifact name="verticalProfileInstantaneousPoint" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_instantaneouspoint.xml" />
+        <artifact name="timeSeries" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/timeseries/conf_timeseriespoint.xml" />
+        <artifact name="timeSeriesMesh" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/timeseries/conf_mesh.xml" />
         
-        <artifact name="horizontalProfileMesh" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_mesh.xml" />
-        <artifact name="horizontalProfileMeshCross" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_mesh_cross.xml" />
-        <artifact name="horizontalProfileInstantaneousPoint" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_instantaneouspoint.xml" />
+        <artifact name="verticalProfile" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_timeseriespoint.xml" />
+        <artifact name="verticalProfileMesh" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_mesh.xml" />
+        <artifact name="verticalProfileInstantaneousPoint" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/verticalprofile/conf_instantaneouspoint.xml" />
         
-        <artifact name="verticalCrossSectionMesh" xlink:href="${artifacts.config.dir}/products/verticalcrosssection/conf_mesh.xml" />
+        <artifact name="horizontalProfileMesh" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_mesh.xml" />
+        <artifact name="horizontalProfileMeshCross" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_mesh_cross.xml" />
+        <artifact name="horizontalProfileInstantaneousPoint" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/horizontalprofile/conf_instantaneouspoint.xml" />
         
-        <artifact name="horizontalCrossSectionMesh" xlink:href="${artifacts.config.dir}/products/horizontalcrosssection/conf_mesh.xml" />
+        <artifact name="verticalCrossSectionMesh" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/verticalcrosssection/conf_mesh.xml" />
+        
+        <artifact name="verticalCrossSectionMeshParallel" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/verticalcrosssection/conf_mesh_parallel.xml" />
+        
+        <artifact name="horizontalCrossSectionMesh" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/horizontalcrosssection/conf_mesh.xml" />
+        
+        <artifact name="layer" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/layer/conf.xml" />
     </artifacts>
+    <gnv>
+        <!-- This section configures special parameters 
+             of the GNV artifacts. -->
+        <charttemplate>
+            <!--    This section configures the path to the template used to create
+                    charts. -->
+            <configuration>${artifacts.config.dir}/charttemplate.xml</configuration>
+        </charttemplate>
+        <palettes>
+            <!-- This section configures the palettes used in 2D diagrams. -->
+            <palette name="flow-velocity" 
+                     parameter-ids="11"
+                     description="Palette for flow velocity"
+                     file="${artifacts.config.dir}/palette/flow-velocity.xml"/>
+            <palette name="salinity"
+                     parameter-ids="2"
+                     description="Palette for salinity"
+                     file="${artifacts.config.dir}/palette/salinity.xml"/>
+            <palette name="water-levels"
+                     parameter-ids="35"
+                     description="Palette for water levels"
+                     file="${artifacts.config.dir}/palette/water-levels.xml"/>
+            <palette name="water-temperature"
+                     parameter-ids="1"
+                     description="Palette for water temperature"
+                     file="${artifacts.config.dir}/palette/water-temperature.xml"/>
+        </palettes>
+
+        <horizontal-cross-section-profile>
+            <!-- This section configures the "horizontales Schnittprofil" -->
+            <samples number="200"/>
+        </horizontal-cross-section-profile>
+
+        <horizontal-cross-section>
+            <!-- This section configures the HorizontalCrossSection ("Horizontalschnitt") -->
+            <samples number="1024"/>
+            <extrapolation rounds="0"/>
+            <ground interpolation="bilinear" />
+        </horizontal-cross-section>
+
+        <vertical-cross-section>
+            <!-- This section configures the "Profilschnitt" -->
+            <samples width="1024" height="768"/>
+            <ground interpolation="bilinear" fill-color="#6d7067"/>
+            <!--
+            <filters>
+                <filter factory="de.intevation.gnv.raster.KernelFilter$GaussFactory" 
+                        sigma="1"
+                        radius="5"/>
+            </filters>
+            -->
+        </vertical-cross-section>
+
+        <!-- The target directory for shapefiles -->
+        <shapefile-directory path="${artifacts.config.dir}/../shapefiles/" />
+
+        <!-- In this section the required Configuration for mapfile generation is
+             given. -->
+        <map-generator>
+            <mapfile path="${artifacts.config.dir}/../mapfiles/mapfile.map" />
+            <templates>
+                <path>${artifacts.config.dir}/maptemplates</path>
+                <maptemplate>mapfile.vm</maptemplate>
+            </templates>
+        </map-generator>
+    </gnv>
+
+    <mapserver>
+       <!-- This Section configures the required Informations to provide the 
+            WMS-Exports -->
+        <server path="http://$YOURSERVER/cgi-bin/gnv-wms" />
+    </mapserver>
+
+    <velocity>
+        <!-- This Section configures all required settings for velocity. -->
+        <logfile path="/var/log/artifacts/velocity.log" />
+    </velocity>
+
     <ehcache>
         <!--  In this Section the Path to Configurationfile for the EHCache,
               which is unsed to store the Results of the Artifacts ,
               is given.-->
         <configuration>${artifacts.config.dir}/ehcache.xml</configuration>
     </ehcache>
+
     <geo-backend>
         <!--  In this Section the required Configuration for the geo-backend is
               given. It is possible to configue the Path of the  ConnectionPool-
@@ -398,6 +545,9 @@
               Queries of the System are stored. -->
         <backend-configuration>${artifacts.config.dir}/arcsdeconnectionpool.properties</backend-configuration>
         <query-configuration>${artifacts.config.dir}/queries.properties</query-configuration>
+        <cache enabled="true">
+            <configuration>${artifacts.config.dir}/sql-cache.xml</configuration>
+        </cache>
     </geo-backend>
     <rest-server>
         <!--  at this Point it is possible to Change the Port the ArtifactDatabase will bind to.-->
@@ -406,18 +556,16 @@
     </rest-server>
     <!-- garbage collection of outdated artifacts -->
     <cleaner>
-        <sleep-time>900000</sleep-time>
+        <sleep-time>60000</sleep-time>
     </cleaner>
     <database>
+        <!-- This Section configures the Settings for connecting to the 
+             Artifact-Database instance. e.g. SQLite -->
         <user>SA</user>
         <password></password>
-        <!--url>jdbc:h2:src/test/ressources/artifacts.db</url>
-        <driver>org.h2.Driver</driver> 
+        <url>jdbc:h2:${artifacts.config.dir}/../artifactdb/artifacts.db</url>
+        <!--driver>org.h2.Driver</driver> 
         <sql></sql> -->
     </database>
-    <charttemplate>
-        <!--    This section configures the path to the template used to create
-                charts. -->
-        <configuration>${artifacts.config.dir}/charttemplate.xml</configuration>
-    </charttemplate>
+
 </artifact-database>
--- a/gnv-artifacts/doc/conf/log.conf	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-.level=FINEST
-handlers=java.util.logging.ConsoleHandler
-java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
-java.util.logging.FileHandler.pattern=rest-%u-%g.log
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/flow-velocity_isolines.class.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,20 @@
+        CLASS
+            NAME "DEFAULT"
+            LABEL
+                TYPE TRUETYPE
+                FONT FreeSans
+                SIZE 10
+                MAXSIZE 10
+                MINSIZE 7
+                COLOR 0 0 0
+                MINDISTANCE 250
+                ANGLE AUTO
+                POSITION CC
+                MINFEATURESIZE AUTO
+                OUTLINECOLOR 255 255 255
+                PARTIALS False
+            END
+            STYLE
+                COLOR "#000000"
+            END
+        END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/flow-velocity_polygons.class.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,109 @@
+
+  
+        CLASS
+            NAME "<   0.025 [m/s]"
+            EXPRESSION ("[CLASS]"="0")
+            STYLE
+                COLOR "#38a800"
+            END
+        END
+    
+  
+        CLASS
+            NAME "0.025 - 0.05 [m/s]"
+            EXPRESSION ("[CLASS]"="1")
+            STYLE
+                COLOR "#56b800"
+            END
+        END
+    
+  
+        CLASS
+            NAME "0.05 - 0.1 [m/s]"
+            EXPRESSION ("[CLASS]"="2")
+            STYLE
+                COLOR "#74c700"
+            END
+        END
+    
+  
+        CLASS
+            NAME "0.1 - 0.3 [m/s]"
+            EXPRESSION ("[CLASS]"="3")
+            STYLE
+                COLOR "#96d600"
+            END
+        END
+    
+  
+        CLASS
+            NAME "0.3 - 0.5 [m/s]"
+            EXPRESSION ("[CLASS]"="4")
+            STYLE
+                COLOR "#bfe600"
+            END
+        END
+    
+  
+        CLASS
+            NAME "0.5 - 0.7 [m/s]"
+            EXPRESSION ("[CLASS]"="5")
+            STYLE
+                COLOR "#e9f500"
+            END
+        END
+    
+  
+        CLASS
+            NAME "0.7 - 0.9 [m/s]"
+            EXPRESSION ("[CLASS]"="6")
+            STYLE
+                COLOR "#ffea00"
+            END
+        END
+    
+  
+        CLASS
+            NAME "0.9 - 1.1 [m/s]"
+            EXPRESSION ("[CLASS]"="7")
+            STYLE
+                COLOR "#ffbb00"
+            END
+        END
+    
+  
+        CLASS
+            NAME "1.1 - 1.3 [m/s]"
+            EXPRESSION ("[CLASS]"="8")
+            STYLE
+                COLOR "#ff8c00"
+            END
+        END
+    
+  
+        CLASS
+            NAME "1.3 - 1.5 [m/s]"
+            EXPRESSION ("[CLASS]"="9")
+            STYLE
+                COLOR "#ff5e00"
+            END
+        END
+    
+  
+        CLASS
+            NAME "1.5 - 1.7 [m/s]"
+            EXPRESSION ("[CLASS]"="10")
+            STYLE
+                COLOR "#ff2f00"
+            END
+        END
+    
+  
+        CLASS
+            NAME "> 1.7 [m/s]"
+            EXPRESSION ("[CLASS]"="11")
+            STYLE
+                COLOR "#ff0000"
+            END
+        END
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_flow-velocity.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,15 @@
+LAYER
+    NAME "$info.getName()"
+    TYPE $info.getType()
+    DATA "${info.getData()}"
+    STATUS $info.getStatus()
+    TEMPLATE     map.html
+    DUMP TRUE
+    
+    METADATA
+        "wms_title" "$info.getTitle()"
+        "gml_include_items" "all"
+    END
+
+    #include("flow-velocity_polygons.class.vm")
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_flow-velocity_isolines.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,17 @@
+LAYER
+    NAME "$info.getName()"
+    DATA "$info.getData()"
+    TYPE $info.getType()
+    STATUS $info.getStatus()
+    LABELITEM DESC
+    TEMPLATE     map.html
+    TOLERANCE 10
+    DUMP TRUE
+
+    METADATA
+        "wms_title" "$info.getTitle()"
+        "gml_include_items" "all"
+    END
+
+    #include("flow-velocity_isolines.class.vm")
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_salinity.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,15 @@
+LAYER
+    NAME "$info.getName()"
+    TYPE $info.getType()
+    DATA "$info.getData()"
+    STATUS $info.getStatus()
+    TEMPLATE     map.html
+    DUMP TRUE
+
+    METADATA
+        "wms_title" "$info.getTitle()"
+        "gml_include_items" "all"
+    END
+
+    #include("salinity_polygons.class.vm")
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_salinity_isolines.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,17 @@
+LAYER
+    NAME "$info.getName()"
+    DATA "$info.getData()"
+    TYPE $info.getType()
+    STATUS $info.getStatus()
+    LABELITEM DESC
+    TEMPLATE     map.html
+    TOLERANCE 10
+    DUMP TRUE
+
+    METADATA
+        "wms_title" "$info.getTitle()"
+        "gml_include_items" "all"
+    END
+
+    #include("salinity_isolines.class.vm")
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-levels.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,15 @@
+LAYER
+    NAME "$info.getName()"
+    TYPE $info.getType()
+    DATA "$info.getData()"
+    STATUS $info.getStatus()
+    TEMPLATE     map.html
+    DUMP TRUE
+
+    METADATA
+        "wms_title" "$info.getTitle()"
+        "gml_include_items" "all"
+    END
+
+    #include("water-levels_polygons.class.vm")
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-levels_isolines.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,17 @@
+LAYER
+    NAME "$info.getName()"
+    DATA "$info.getData()"
+    TYPE $info.getType()
+    STATUS $info.getStatus()
+    LABELITEM DESC
+    TEMPLATE     map.html
+    TOLERANCE 10
+    DUMP TRUE
+
+    METADATA
+        "wms_title" "$info.getTitle()"
+        "gml_include_items" "all"
+    END
+
+    #include("water-levels_isolines.class.vm")
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-temperature.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,15 @@
+LAYER
+    NAME "$info.getName()"
+    TYPE $info.getType()
+    DATA "$info.getData()"
+    STATUS $info.getStatus()
+    TEMPLATE     map.html
+    DUMP TRUE
+
+    METADATA
+        "wms_title" "$info.getTitle()"
+        "gml_include_items" "all"
+    END
+
+    #include("water-temperature_polygons.class.vm")
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/horizontalcrosssection_water-temperature_isolines.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,17 @@
+LAYER
+    NAME "$info.getName()"
+    DATA "$info.getData()"
+    TYPE $info.getType()
+    STATUS $info.getStatus()
+    LABELITEM DESC
+    TEMPLATE     map.html
+    TOLERANCE 10
+    DUMP TRUE
+
+    METADATA
+        "wms_title" "$info.getTitle()"
+        "gml_include_items" "all"
+    END
+
+    #include("water-temperature_isolines.class.vm")
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/layer_linestring.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,23 @@
+LAYER
+    NAME "$info.getName()"
+    TYPE $info.getType()
+    DATA "$info.getData()"
+    STATUS $info.getStatus()
+    TEMPLATE     map.html
+    TOLERANCE 10
+    DUMP TRUE
+
+    METADATA
+        "wms_title" "$info.getTitle()"
+        "gml_include_items" "all"
+    END
+
+    CLASS
+        NAME "Layer"
+        STYLE
+            SYMBOl 'point'
+            SIZE 5
+            COLOR "#FFFF00"
+        END
+    END
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/layer_point.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,23 @@
+LAYER
+    NAME "$info.getName()"
+    TYPE $info.getType()
+    DATA "$info.getData()"
+    STATUS $info.getStatus()
+    TEMPLATE     map.html
+    TOLERANCE 10
+    DUMP TRUE
+
+    METADATA
+        "wms_title" "$info.getTitle()"
+        "gml_include_items" "all"
+    END
+
+    CLASS
+        NAME "Layer"
+        STYLE
+            SYMBOL 'point'
+            SIZE 7
+            COLOR "#FFFF00"
+        END
+    END
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/layer_polygon.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,20 @@
+LAYER
+    NAME "$info.getName()"
+    TYPE $info.getType()
+    DATA "$info.getData()"
+    STATUS $info.getStatus()
+    TEMPLATE     map.html
+    DUMP TRUE
+
+    METADATA
+        "wms_title" "$info.getTitle()"
+         "gml_include_items" "all"
+    END
+
+    CLASS
+        NAME "Layer"
+        STYLE
+            COLOR "#FFFF00"
+        END
+    END
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/mapfile.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,48 @@
+MAP
+    NAME "GNV-Map"
+    STATUS ON
+    SIZE 600 400
+    MAXSIZE 4000
+    EXTENT -1 53 11 58
+    UNITS DD
+    SHAPEPATH "../shapefiles"
+    FONTSET "fontset.txt"
+    IMAGECOLOR 255 255 255
+    PROJECTION
+        "init=epsg:4326"
+    END
+
+    WEB
+      METADATA
+        "wms_title"             "GNV Web Map Service"
+        "wms_onlineresource"    "$MAPSERVERURL"
+        "wms_accessconstraints" "none"
+        "wms_fees"              "none"
+        "wms_addresstype"       "postal"
+        "wms_address"           "Any Street"
+        "wms_city"              "Any City"
+        "wms_stateorprovince"   "Any state"
+        "wms_postcode"          "My Postalcode"
+        "wms_country"           "Any Country"
+        "wms_contactperson"     "Any Person"
+        "wms_contactorganization" "Any Orga"
+        "wms_contactelectronicmailaddress" "any-email@example.com"
+        "wms_contactvoicetelephone" "Any's telephone number"
+        "wms_srs" "EPSG:4326 EPSG:32631 EPSG:32632 EPSG:32633"
+        "wms_feature_info_mime_type" "text/html"
+      END
+    END
+
+    SYMBOL
+        NAME 'point'
+        TYPE ELLIPSE
+        POINTS
+            1 1
+        END
+        FILLED TRUE
+    END
+
+    ## Don't change the following lines.
+    $LAYERS
+
+END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/salinity_isolines.class.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,20 @@
+        CLASS
+            NAME "DEFAULT"
+            LABEL
+                TYPE TRUETYPE
+                FONT FreeSans
+                SIZE 10
+                MAXSIZE 10
+                MINSIZE 7
+                COLOR 0 0 0
+                MINDISTANCE 250
+                ANGLE AUTO
+                POSITION CC
+                MINFEATURESIZE AUTO
+                OUTLINECOLOR 255 255 255
+                PARTIALS False
+            END
+            STYLE
+                COLOR "#000000"
+            END
+        END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/salinity_polygons.class.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,281 @@
+
+  
+        CLASS
+            
+            NAME "< 2.0 [pSal]"
+            EXPRESSION ("[CLASS]"="0")
+            STYLE
+                COLOR "#02db00"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "2.0 - 3.0 [pSal]"
+            EXPRESSION ("[CLASS]"="1")
+            STYLE
+                COLOR "#01e600"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "3.0 - 4.0 [pSal]"
+            EXPRESSION ("[CLASS]"="2")
+            STYLE
+                COLOR "#02f200"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "4.0 - 5.0 [pSal]"
+            EXPRESSION ("[CLASS]"="3")
+            STYLE
+                COLOR "#00ff00"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "5.0 - 6.0 [pSal]"
+            EXPRESSION ("[CLASS]"="4")
+            STYLE
+                COLOR "#23fd22"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "6.0 - 7.0 [pSal]"
+            EXPRESSION ("[CLASS]"="5")
+            STYLE
+                COLOR "#47fe46"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "7.0 - 8.0 [pSal]"
+            EXPRESSION ("[CLASS]"="6")
+            STYLE
+                COLOR "#5afd59"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "8.0 - 9.0 [pSal]"
+            EXPRESSION ("[CLASS]"="7")
+            STYLE
+                COLOR "#6ffe6e"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "9.0 - 10.0 [pSal]"
+            EXPRESSION ("[CLASS]"="8")
+            STYLE
+                COLOR "#89fd88"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "10.0 - 12.0 [pSal]"
+            EXPRESSION ("[CLASS]"="9")
+            STYLE
+                COLOR "#a5fea4"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "12.0 - 14.0 [pSal]"
+            EXPRESSION ("[CLASS]"="10")
+            STYLE
+                COLOR "#b3feb3"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "14.0 - 16.0 [pSal]"
+            EXPRESSION ("[CLASS]"="11")
+            STYLE
+                COLOR "#c2fec2"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "16.0 - 18.0 [pSal]"
+            EXPRESSION ("[CLASS]"="12")
+            STYLE
+                COLOR "#e0fee0"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "18.0 - 20.0 [pSal]"
+            EXPRESSION ("[CLASS]"="13")
+            STYLE
+                COLOR "#ffffff"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "20.0 - 24.0 [pSal]"
+            EXPRESSION ("[CLASS]"="14")
+            STYLE
+                COLOR "#fef5ef"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "24.0 - 28.0 [pSal]"
+            EXPRESSION ("[CLASS]"="15")
+            STYLE
+                COLOR "#feede0"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "28.0 - 30.0 [pSal]"
+            EXPRESSION ("[CLASS]"="16")
+            STYLE
+                COLOR "#fee5d1"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "30.0 - 32.0 [pSal]"
+            EXPRESSION ("[CLASS]"="17")
+            STYLE
+                COLOR "#fdd8ba"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "32.0 - 34.0 [pSal]"
+            EXPRESSION ("[CLASS]"="18")
+            STYLE
+                COLOR "#fecca4"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "34.0 - 34.5 [pSal]"
+            EXPRESSION ("[CLASS]"="19")
+            STYLE
+                COLOR "#fdbe8b"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "34.5 - 35.0 [pSal]"
+            EXPRESSION ("[CLASS]"="20")
+            STYLE
+                COLOR "#feb073"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "35.0 - 35.2 [pSal]"
+            EXPRESSION ("[CLASS]"="21")
+            STYLE
+                COLOR "#fda35b"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "35.2 - 35.4 [pSal]"
+            EXPRESSION ("[CLASS]"="22")
+            STYLE
+                COLOR "#fe9846"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "35.4 - 35.6 [pSal]"
+            EXPRESSION ("[CLASS]"="23")
+            STYLE
+                COLOR "#fd8422"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "35.6 - 35.8 [pSal]"
+            EXPRESSION ("[CLASS]"="24")
+            STYLE
+                COLOR "#fe7100"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "35.8 - 36.0 [pSal]"
+            EXPRESSION ("[CLASS]"="25")
+            STYLE
+                COLOR "#fe6900"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "36.0 - 37.0 [pSal]"
+            EXPRESSION ("[CLASS]"="26")
+            STYLE
+                COLOR "#fe6100"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "> 37.0 [pSal]"
+            EXPRESSION ("[CLASS]"="27")
+            STYLE
+                COLOR "#fe5900"
+            END
+        END
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/water-levels_isolines.class.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,20 @@
+        CLASS
+            NAME "DEFAULT"
+            LABEL
+                TYPE TRUETYPE
+                FONT FreeSans
+                SIZE 10
+                MAXSIZE 10
+                MINSIZE 7
+                COLOR 0 0 0
+                MINDISTANCE 250
+                ANGLE AUTO
+                POSITION CC
+                MINFEATURESIZE AUTO
+                OUTLINECOLOR 255 255 255
+                PARTIALS False
+            END
+            STYLE
+                COLOR "#000000"
+            END
+        END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/water-levels_polygons.class.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,217 @@
+
+  
+        CLASS
+            NAME "-inf - 5"
+            EXPRESSION ("[CLASS]"="0")
+            STYLE
+                COLOR "#870087"
+            END
+        END
+    
+  
+        CLASS
+            NAME "-5.0 - -4.5"
+            EXPRESSION ("[CLASS]"="1")
+            STYLE
+                COLOR "#c700c7"
+            END
+        END
+    
+  
+        CLASS
+            NAME "-4.5 - -4.0"
+            EXPRESSION ("[CLASS]"="2")
+            STYLE
+                COLOR "#ff00ff"
+            END
+        END
+    
+  
+        CLASS
+            NAME "-4.0 - -3.5"
+            EXPRESSION ("[CLASS]"="3")
+            STYLE
+                COLOR "#bb00ff"
+            END
+        END
+    
+  
+        CLASS
+            NAME "-3.5 - -3.0"
+            EXPRESSION ("[CLASS]"="4")
+            STYLE
+                COLOR "#7700ff"
+            END
+        END
+    
+  
+        CLASS
+            NAME "-3.0 - -2.5"
+            EXPRESSION ("[CLASS]"="5")
+            STYLE
+                COLOR "#0000ff"
+            END
+        END
+    
+  
+        CLASS
+            NAME "-2.5 - -2.0"
+            EXPRESSION ("[CLASS]"="6")
+            STYLE
+                COLOR "#0000e8"
+            END
+        END
+    
+  
+        CLASS
+            NAME "-2.0 - -1.5"
+            EXPRESSION ("[CLASS]"="7")
+            STYLE
+                COLOR "#0082d9"
+            END
+        END
+    
+  
+        CLASS
+            NAME "-1.5 - -1.0"
+            EXPRESSION ("[CLASS]"="8")
+            STYLE
+                COLOR "#00b2ff"
+            END
+        END
+    
+  
+        CLASS
+            NAME "-1.0 - -0.5"
+            EXPRESSION ("[CLASS]"="9")
+            STYLE
+                COLOR "#00ddff"
+            END
+        END
+    
+  
+        CLASS
+            NAME "-0.5 - 0.0"
+            EXPRESSION ("[CLASS]"="10")
+            STYLE
+                COLOR "#00ffff"
+            END
+        END
+    
+  
+        CLASS
+            NAME "0.0 - 0.5"
+            EXPRESSION ("[CLASS]"="11")
+            STYLE
+                COLOR "#49d1cd"
+            END
+        END
+    
+  
+        CLASS
+            NAME "0.5 - 1.0"
+            EXPRESSION ("[CLASS]"="12")
+            STYLE
+                COLOR "#20b0a9"
+            END
+        END
+    
+  
+        CLASS
+            NAME "1.0 - 1.5"
+            EXPRESSION ("[CLASS]"="13")
+            STYLE
+                COLOR "#14c76d"
+            END
+        END
+    
+  
+        CLASS
+            NAME "1.5 - 2.0"
+            EXPRESSION ("[CLASS]"="14")
+            STYLE
+                COLOR "#09e03b"
+            END
+        END
+    
+  
+        CLASS
+            NAME "2.0 - 2.5"
+            EXPRESSION ("[CLASS]"="15")
+            STYLE
+                COLOR "#00ff1a"
+            END
+        END
+    
+  
+        CLASS
+            NAME "2.5 - 3.0"
+            EXPRESSION ("[CLASS]"="16")
+            STYLE
+                COLOR "#aeff00"
+            END
+        END
+    
+  
+        CLASS
+            NAME "3.0 - 3.5"
+            EXPRESSION ("[CLASS]"="17")
+            STYLE
+                COLOR "#f2ff00"
+            END
+        END
+    
+  
+        CLASS
+            NAME "3.5 - 4.0"
+            EXPRESSION ("[CLASS]"="18")
+            STYLE
+                COLOR "#ffc800"
+            END
+        END
+    
+  
+        CLASS
+            NAME "4.0 - 4.5"
+            EXPRESSION ("[CLASS]"="19")
+            STYLE
+                COLOR "#ff8800"
+            END
+        END
+    
+  
+        CLASS
+            NAME "4.5 - 5.0"
+            EXPRESSION ("[CLASS]"="20")
+            STYLE
+                COLOR "#ff4400"
+            END
+        END
+    
+  
+        CLASS
+            NAME "5.0 - 5.5"
+            EXPRESSION ("[CLASS]"="21")
+            STYLE
+                COLOR "#ff0000"
+            END
+        END
+    
+  
+        CLASS
+            NAME "5.5 - 6.0"
+            EXPRESSION ("[CLASS]"="22")
+            STYLE
+                COLOR "#c70000"
+            END
+        END
+    
+  
+        CLASS
+            NAME "6.0 - inf"
+            EXPRESSION ("[CLASS]"="23")
+            STYLE
+                COLOR "#870000"
+            END
+        END
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/water-temperature_isolines.class.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,20 @@
+        CLASS
+            NAME "DEFAULT"
+            LABEL
+                TYPE TRUETYPE
+                FONT FreeSans
+                SIZE 10
+                MAXSIZE 10
+                MINSIZE 7
+                COLOR 0 0 0
+                MINDISTANCE 250
+                ANGLE AUTO
+                POSITION CC
+                MINFEATURESIZE AUTO
+                OUTLINECOLOR 255 255 255
+                PARTIALS False
+            END
+            STYLE
+                COLOR "#000000"
+            END
+        END
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/maptemplates/water-temperature_polygons.class.vm	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,281 @@
+
+  
+        CLASS
+            
+            NAME "< -1 [degC]"
+            EXPRESSION ("[CLASS]"="0")
+            STYLE
+                COLOR "#ff33ff"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "-1 - 0 [degC]"
+            EXPRESSION ("[CLASS]"="1")
+            STYLE
+                COLOR "#ff98ff"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "0 - 1 [degC]"
+            EXPRESSION ("[CLASS]"="2")
+            STYLE
+                COLOR "#3300cc"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "1 - 2 [degC]"
+            EXPRESSION ("[CLASS]"="3")
+            STYLE
+                COLOR "#3366ff"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "2 - 3 [degC]"
+            EXPRESSION ("[CLASS]"="4")
+            STYLE
+                COLOR "#3399ff"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "3 - 4 [degC]"
+            EXPRESSION ("[CLASS]"="5")
+            STYLE
+                COLOR "#33ccff"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "4 - 5 [degC]"
+            EXPRESSION ("[CLASS]"="6")
+            STYLE
+                COLOR "#33ffff"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "5 - 6 [degC]"
+            EXPRESSION ("[CLASS]"="7")
+            STYLE
+                COLOR "#007800"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "6 - 7 [degC]"
+            EXPRESSION ("[CLASS]"="8")
+            STYLE
+                COLOR "#009900"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "7 - 8 [degC]"
+            EXPRESSION ("[CLASS]"="9")
+            STYLE
+                COLOR "#00ba00"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "8 - 9 [degC]"
+            EXPRESSION ("[CLASS]"="10")
+            STYLE
+                COLOR "#00de00"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "9 - 10 [degC]"
+            EXPRESSION ("[CLASS]"="11")
+            STYLE
+                COLOR "#00ff00"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "10 - 11 [degC]"
+            EXPRESSION ("[CLASS]"="12")
+            STYLE
+                COLOR "#ffff33"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "11 - 12 [degC]"
+            EXPRESSION ("[CLASS]"="13")
+            STYLE
+                COLOR "#ffee33"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "12 - 13 [degC]"
+            EXPRESSION ("[CLASS]"="14")
+            STYLE
+                COLOR "#ffdd33"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "13 - 14 [degC]"
+            EXPRESSION ("[CLASS]"="15")
+            STYLE
+                COLOR "#ffcc33"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "14 - 15 [degC]"
+            EXPRESSION ("[CLASS]"="16")
+            STYLE
+                COLOR "#ffbb33"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "15 - 16 [degC]"
+            EXPRESSION ("[CLASS]"="17")
+            STYLE
+                COLOR "#ffaa00"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "16 - 17 [degC]"
+            EXPRESSION ("[CLASS]"="18")
+            STYLE
+                COLOR "#ff9900"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "17 - 18 [degC]"
+            EXPRESSION ("[CLASS]"="19")
+            STYLE
+                COLOR "#ff7700"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "18 - 19 [degC]"
+            EXPRESSION ("[CLASS]"="20")
+            STYLE
+                COLOR "#ff0000"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "19 - 20 [degC]"
+            EXPRESSION ("[CLASS]"="21")
+            STYLE
+                COLOR "#ed0000"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "20 - 21 [degC]"
+            EXPRESSION ("[CLASS]"="22")
+            STYLE
+                COLOR "#cc0000"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "21 - 22 [degC]"
+            EXPRESSION ("[CLASS]"="23")
+            STYLE
+                COLOR "#ba0000"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "22 - 23 [degC]"
+            EXPRESSION ("[CLASS]"="24")
+            STYLE
+                COLOR "#ab0000"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "23 - 24 [degC]"
+            EXPRESSION ("[CLASS]"="25")
+            STYLE
+                COLOR "#990000"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "24 - 25 [degC]"
+            EXPRESSION ("[CLASS]"="26")
+            STYLE
+                COLOR "#870000"
+            END
+        END
+    
+  
+        CLASS
+            
+            NAME "> 25 [degC]"
+            EXPRESSION ("[CLASS]"="27")
+            STYLE
+                COLOR "#ab0089"
+            END
+        END
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/meshwidth.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mesh-widths>
+    <!-- 
+        id = ID des Meshes in der Datenbank
+        width = Durchschnittlicher Abstand zwischen zwei Netzpunkten in Grad
+     -->
+    <mesh id="1" width="0.03" description="Modelldaten Küstenmodell"/>
+    <mesh id="3" width="0.15" description="Modelldaten Nord- und Ostseemodel"/>
+    <mesh id="4" width="0.03" description="Modelldaten Küstenmodell Tagesmittel"/>
+    <mesh id="5" width="0.16" description="Modelldaten Nord-Ostseemodell Tagesmittel"/>
+
+    <mesh id="641" width="0.30" description="Eisdaten"/>
+
+    <mesh id="2"   width="0.30" description="SST-Karte woechentliche Nordseetemperaturen"/>
+    <mesh id="321" width="0.30" description="SST-Karte woechentliche Ostseetemperaturen"/>
+    <mesh id="961" width="0.30" description="SST-Karte monatliche Nordseetemperaturen"/>
+    <mesh id="962" width="0.30" description="SST-Karte monatliche Ostseetemperaturen"/>
+</mesh-widths>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/palette/flow-velocity.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ranges>
+  <range index="0"  from="-inf"  to="0.025" rgb="#38a800" description="&lt; 0.025"/>
+  <range index="1"  from="0.025" to="0.05"  rgb="#56b800" description="0.025 - 0.05"/>
+  <range index="2"  from="0.05"  to="0.1"   rgb="#74c700" description="0.05 - 0.1"/>
+  <range index="3"  from="0.1"   to="0.3"   rgb="#96d600" description="0.1 - 0.3"/>
+  <range index="4"  from="0.3"   to="0.5"   rgb="#bfe600" description="0.3 - 0.5"/>
+  <range index="5"  from="0.5"   to="0.7"   rgb="#e9f500" description="0.5 - 0.7"/>
+  <range index="6"  from="0.7"   to="0.9"   rgb="#ffea00" description="0.7 - 0.9"/>
+  <range index="7"  from="0.9"   to="1.1"   rgb="#ffbb00" description="0.9 - 1.1"/>
+  <range index="8"  from="1.1"   to="1.3"   rgb="#ff8c00" description="1.1 - 1.3"/>
+  <range index="9"  from="1.3"   to="1.5"   rgb="#ff5e00" description="1.3 - 1.5"/>
+  <range index="10" from="1.5"   to="1.7"   rgb="#ff2f00" description="1.5 - 1.7"/>
+  <range index="11" from="1.7"   to="inf"   rgb="#ff0000" description="&gt; 1.7"/>
+</ranges>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/palette/salinity.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ranges>
+  <range index="0"  from="-inf" to="2.0"  rgb="#02db00" description="&lt; 2.0"/>
+  <range index="1"  from="2.0"  to="3.0"  rgb="#01e600" description="2.0 - 3.0"/>
+  <range index="2"  from="3.0"  to="4.0"  rgb="#02f200" description="3.0 - 4.0"/>
+  <range index="3"  from="4.0"  to="5.0"  rgb="#00ff00" description="4.0 - 5.0"/>
+  <range index="4"  from="5.0"  to="6.0"  rgb="#23fd22" description="5.0 - 6.0"/>
+  <range index="5"  from="6.0"  to="7.0"  rgb="#47fe46" description="6.0 - 7.0"/>
+  <range index="6"  from="7.0"  to="8.0"  rgb="#5afd59" description="7.0 - 8.0"/>
+  <range index="7"  from="8.0"  to="9.0"  rgb="#6ffe6e" description="8.0 - 9.0"/>
+  <range index="8"  from="9.0"  to="10.0" rgb="#89fd88" description="9.0 - 10.0"/>
+  <range index="9"  from="10.0" to="12.0" rgb="#a5fea4" description="10.0 - 12.0"/>
+  <range index="10" from="12.0" to="14.0" rgb="#b3feb3" description="12.0 - 14.0"/>
+  <range index="11" from="14.0" to="16.0" rgb="#c2fec2" description="14.0 - 16.0"/>
+  <range index="12" from="16.0" to="18.0" rgb="#e0fee0" description="16.0 - 18.0"/>
+  <range index="13" from="18.0" to="20.0" rgb="#ffffff" description="18.0 - 20.0"/>
+  <range index="14" from="20.0" to="24.0" rgb="#fef5ef" description="20.0 - 24.0"/>
+  <range index="15" from="24.0" to="28.0" rgb="#feede0" description="24.0 - 28.0"/>
+  <range index="16" from="28.0" to="30.0" rgb="#fee5d1" description="28.0 - 30.0"/>
+  <range index="17" from="30.0" to="32.0" rgb="#fdd8ba" description="30.0 - 32.0"/>
+  <range index="18" from="32.0" to="34.0" rgb="#fecca4" description="32.0 - 34.0"/>
+  <range index="19" from="34.0" to="34.5" rgb="#fdbe8b" description="34.0 - 34.5"/>
+  <range index="20" from="34.5" to="35.0" rgb="#feb073" description="34.5 - 35.0"/>
+  <range index="21" from="35.0" to="35.2" rgb="#fda35b" description="35.0 - 35.2"/>
+  <range index="22" from="35.2" to="35.4" rgb="#fe9846" description="35.2 - 35.4"/>
+  <range index="23" from="35.4" to="35.6" rgb="#fd8422" description="35.4 - 35.6"/>
+  <range index="24" from="35.6" to="35.8" rgb="#fe7100" description="35.6 - 35.8"/>
+  <range index="25" from="35.8" to="36.0" rgb="#fe6900" description="35.8 - 36.0"/>
+  <range index="26" from="36.0" to="37.0" rgb="#fe6100" description="36.0 - 37.0"/>
+  <range index="27" from="37.0" to="inf"  rgb="#fe5900" description="&gt; 37.0"/>
+</ranges>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/palette/water-levels.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ranges>
+  <range index="0"  from="-inf" to="5"    rgb="#870087" description="&lt; 5"/>
+  <range index="1"  from="-5.0" to="-4.5" rgb="#c700c7" description="-5.0 - -4.5"/>
+  <range index="2"  from="-4.5" to="-4.0" rgb="#ff00ff" description="-4.5 - -4.0"/>
+  <range index="3"  from="-4.0" to="-3.5" rgb="#bb00ff" description="-4.0 - -3.5"/>
+  <range index="4"  from="-3.5" to="-3.0" rgb="#7700ff" description="-3.5 - -3.0"/>
+  <range index="5"  from="-3.0" to="-2.5" rgb="#0000ff" description="-3.0 - -2.5"/>
+  <range index="6"  from="-2.5" to="-2.0" rgb="#0000e8" description="-2.5 - -2.0"/>
+  <range index="7"  from="-2.0" to="-1.5" rgb="#0082d9" description="-2.0 - -1.5"/>
+  <range index="8"  from="-1.5" to="-1.0" rgb="#00b2ff" description="-1.5 - -1.0"/>
+  <range index="9"  from="-1.0" to="-0.5" rgb="#00ddff" description="-1.0 - -0.5"/>
+  <range index="10" from="-0.5" to="0.0"  rgb="#00ffff" description="-0.5 - 0.0"/>
+  <range index="11" from="0.0"  to="0.5"  rgb="#49d1cd" description="0.0 - 0.5"/>
+  <range index="12" from="0.5"  to="1.0"  rgb="#20b0a9" description="0.5 - 1.0"/>
+  <range index="13" from="1.0"  to="1.5"  rgb="#14c76d" description="1.0 - 1.5"/>
+  <range index="14" from="1.5"  to="2.0"  rgb="#09e03b" description="1.5 - 2.0"/>
+  <range index="15" from="2.0"  to="2.5"  rgb="#00ff1a" description="2.0 - 2.5"/>
+  <range index="16" from="2.5"  to="3.0"  rgb="#aeff00" description="2.5 - 3.0"/>
+  <range index="17" from="3.0"  to="3.5"  rgb="#f2ff00" description="3.0 - 3.5"/>
+  <range index="18" from="3.5"  to="4.0"  rgb="#ffc800" description="3.5 - 4.0"/>
+  <range index="19" from="4.0"  to="4.5"  rgb="#ff8800" description="4.0 - 4.5"/>
+  <range index="20" from="4.5"  to="5.0"  rgb="#ff4400" description="4.5 - 5.0"/>
+  <range index="21" from="5.0"  to="5.5"  rgb="#ff0000" description="5.0 - 5.5"/>
+  <range index="22" from="5.5"  to="6.0"  rgb="#c70000" description="5.5 - 6.0"/>
+  <range index="23" from="6.0"  to="inf"  rgb="#870000" description="&gt; 6.0"/>
+</ranges>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/palette/water-temperature.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<ranges>
+  <range index="0"  from="-inf" to="-1"  rgb="#ff33ff" description="&lt; -1"/>
+  <range index="1"  from="-1"   to="0"   rgb="#ff98ff" description="-1 - 0"/>
+  <range index="2"  from="0"    to="1"   rgb="#3300cc" description="0 - 1"/>
+  <range index="3"  from="1"    to="2"   rgb="#3366ff" description="1 - 2"/>
+  <range index="4"  from="2"    to="3"   rgb="#3399ff" description="2 - 3"/>
+  <range index="5"  from="3"    to="4"   rgb="#33ccff" description="3 - 4"/>
+  <range index="6"  from="4"    to="5"   rgb="#33ffff" description="4 - 5"/>
+  <range index="7"  from="5"    to="6"   rgb="#007800" description="5 - 6"/>
+  <range index="8"  from="6"    to="7"   rgb="#009900" description="6 - 7"/>
+  <range index="9"  from="7"    to="8"   rgb="#00ba00" description="7 - 8"/>
+  <range index="10" from="8"    to="9"   rgb="#00de00" description="8 - 9"/>
+  <range index="11" from="9"    to="10"  rgb="#00ff00" description="9 - 10"/>
+  <range index="12" from="10"   to="11"  rgb="#ffff33" description="10 - 11"/>
+  <range index="13" from="11"   to="12"  rgb="#ffee33" description="11 - 12"/>
+  <range index="14" from="12"   to="13"  rgb="#ffdd33" description="12 - 13"/>
+  <range index="15" from="13"   to="14"  rgb="#ffcc33" description="13 - 14"/>
+  <range index="16" from="14"   to="15"  rgb="#ffbb33" description="14 - 15"/>
+  <range index="17" from="15"   to="16"  rgb="#ffaa00" description="15 - 16"/>
+  <range index="18" from="16"   to="17"  rgb="#ff9900" description="16 - 17"/>
+  <range index="19" from="17"   to="18"  rgb="#ff7700" description="17 - 18"/>
+  <range index="20" from="18"   to="19"  rgb="#ff0000" description="18 - 19"/>
+  <range index="21" from="19"   to="20"  rgb="#ed0000" description="19 - 20"/>
+  <range index="22" from="20"   to="21"  rgb="#cc0000" description="20 - 21"/>
+  <range index="23" from="21"   to="22"  rgb="#ba0000" description="21 - 22"/>
+  <range index="24" from="22"   to="23"  rgb="#ab0000" description="22 - 23"/>
+  <range index="25" from="23"   to="24"  rgb="#990000" description="23 - 24"/>
+  <range index="26" from="24"   to="25"  rgb="#870000" description="24 - 25"/>
+  <range index="27" from="25"   to="inf" rgb="#ab0089" description="&gt; 25"/>
+</ranges>
--- a/gnv-artifacts/doc/conf/products/horizontalcrosssection/conf_mesh.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/horizontalcrosssection/conf_mesh.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,7 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="horizontalCrossSectionMesh">
     <states>
-        <state id="horizontalcrosssection_area" description="horizontalcrosssection_area_one" state="de.intevation.gnv.state.DefaultState">
+        <state id="horizontalcrosssection_mesh_mapviewerswitch" description="horizontalcrosssection_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalcrosssection_mesh_mapviewerswitch"/>
+            <to state="horizontalcrosssection_mesh_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalcrosssection_mesh_mapviewerswitch"/>
+            <to state="horizontalcrosssection_mesh_with_wkt"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+        
+        <state id="horizontalcrosssection_mesh_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState">
+            <queryID>verticalprofile_mesh_with_wkt</queryID>
+            <dataname>meshid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_polygon"/>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_polygon" type="String" multiselect="false" usedinquery="1"/>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+       
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="horizontalcrosssection_mesh_with_wkt"/>
+            <to state="horizontalcrosssection_meshpoint_depth"/>
+        </transition>
+    
+        <state id="horizontalcrosssection_mesh_area" description="horizontalcrosssection_mesh_area_one" state="de.intevation.gnv.state.DefaultState">
             <queryID>area_filter</queryID>
             <dataname>areaid</dataname>
             <data-multiselect>false</data-multiselect>
@@ -14,17 +53,17 @@
         </state>
         
         <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
-            <from state="horizontalcrosssection_area"/>
-            <to state="horizontalcrosssection_subarea"/>
+            <from state="horizontalcrosssection_mesh_area"/>
+            <to state="horizontalcrosssection_mesh_subarea"/>
             <condition inputvalue="areaid" value="n/n" operator="notequal"/>
         </transition>
         <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
-            <from state="horizontalcrosssection_area"/>
+            <from state="horizontalcrosssection_mesh_area"/>
             <to state="horizontalcrosssection_mesh_without_geom"/>
             <condition inputvalue="areaid" value="n/n" operator="equal"/>
         </transition>
         
-        <state id="horizontalcrosssection_subarea" description="horizontalcrosssection_area_one" state="de.intevation.gnv.state.DefaultState">
+        <state id="horizontalcrosssection_mesh_subarea" description="horizontalcrosssection_mesh_area_one" state="de.intevation.gnv.state.DefaultState">
             <queryID>subarea_filter</queryID>
             <dataname>subareaid</dataname>
             <data-multiselect>false</data-multiselect>
@@ -37,7 +76,7 @@
         </state>
         
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
-            <from state="horizontalcrosssection_subarea"/>
+            <from state="horizontalcrosssection_mesh_subarea"/>
             <to state="horizontalcrosssection_mesh"/>
         </transition>
         
@@ -53,9 +92,16 @@
             </inputvalues>
         </state>
         
-        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
             <from state="horizontalcrosssection_mesh_without_geom"/>
-            <to state="horizontalcrosssection_meshpoint_depth"/>
+            <to state="verticalcrosssection_mesh_polygon"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalcrosssection_mesh_without_geom"/>
+            <to state="horizontalcrosssection_meshpoint_depth_presettings"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
         </transition>
         
         <state id="horizontalcrosssection_mesh" description="horizontalcrosssection_mesh" state="de.intevation.gnv.state.DefaultState">
@@ -63,18 +109,58 @@
             <dataname>meshid</dataname>
             <data-multiselect>false</data-multiselect>
             <inputvalues>
-                <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="0"/>
                 <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="1"/>
                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
             </inputvalues>
         </state>
         
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalcrosssection_mesh"/>
+            <to state="verticalcrosssection_mesh_polygon"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalcrosssection_mesh"/>
+            <to state="horizontalcrosssection_meshpoint_depth_presettings"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+        
+        <state id="verticalcrosssection_mesh_polygon" description="verticalcrosssection_mesh_polygon" state="de.intevation.gnv.state.SingleInputState">
+           <dataname>mesh_polygon</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+                <inputvalue name="meshid" type="Integer" multiselect="false"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_polygon" type="Polygon" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+        </state>
+        
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
-            <from state="horizontalcrosssection_mesh"/>
+            <from state="verticalcrosssection_mesh_polygon"/>
             <to state="horizontalcrosssection_meshpoint_depth"/>
         </transition>
         
+        <state id="horizontalcrosssection_meshpoint_depth_presettings" description="horizontalcrosssection_meshpoint_depth" state="de.intevation.gnv.state.PreSettingsTransferState">
+            <queryID>horizontalcrosssection_meshpoint_depth</queryID>
+            <dataname>depthid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_polygon"/>
+            <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_polygon" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="horizontalcrosssection_meshpoint_depth_presettings"/>
+            <to state="horizontalcrosssection_meshpoint_parameter"/>
+        </transition>
+        
         <state id="horizontalcrosssection_meshpoint_depth" description="horizontalcrosssection_meshpoint_depth" state="de.intevation.gnv.state.DefaultState">
             <queryID>horizontalcrosssection_meshpoint_depth</queryID>
             <dataname>depthid</dataname>
@@ -83,6 +169,7 @@
                  <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
                  <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                  <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_polygon" type="String" multiselect="false" usedinquery="0"/>
             </inputvalues>
         </state>
         
@@ -94,17 +181,38 @@
         <state id="horizontalcrosssection_meshpoint_parameter" description="horizontalcrosssection_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState">
             <queryID>verticalprofile_mesh_parameter</queryID>
             <dataname>parameterid</dataname>
+            <presettings-name>parameter</presettings-name>
             <data-multiselect>false</data-multiselect>
             <inputvalues>
                  <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
                  <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/>
                  <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                  <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0" />
+                 <inputvalue name="mesh_polygon" type="String" multiselect="false" usedinquery="0"/>
             </inputvalues>
         </state>
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="horizontalcrosssection_meshpoint_parameter"/>
+            <to state="horizontalcrosssection_mesh_year"/>
+        </transition>
+        
+        <state id="horizontalcrosssection_mesh_year" description="horizontalcrosssection_mesh_year" state="de.intevation.gnv.state.DefaultState">
+           <queryID>horizontalcrosssection_mesh_year</queryID>
+           <dataname>yearid</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/>
+               <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="1" />
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0" />
+               <inputvalue name="mesh_polygon" type="String" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+        </state>
         
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
-            <from state="horizontalcrosssection_meshpoint_parameter"/>
+            <from state="horizontalcrosssection_mesh_year"/>
             <to state="horizontalcrosssection_mesh_date"/>
         </transition>
         
@@ -117,7 +225,9 @@
                <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/>
                <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="1" />
                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1" />
                <inputvalue name="dateid" type="Date" multiselect="false" usedinquery="0" />
+               <inputvalue name="mesh_polygon" type="String" multiselect="false" usedinquery="0"/>
            </inputvalues>
         </state>
         
@@ -128,6 +238,7 @@
         
         <state id="horizontalcrosssection_mesh_calculate_results" description="horizontalcrosssection_mesh_calculate_results" state="de.intevation.gnv.state.profile.horizontalcrosssection.HorizontalCrossSectionMeshOutputState">
             <queryID>horizontalcrosssection_mesh_data</queryID>
+            <queryID-ijk>horizontalprofile_meshpoint_cross_ij</queryID-ijk>
             <queryID-odv>horizontalcrosssection_mesh_odv_data</queryID-odv>
             <inputvalues>
                 <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="1" />
@@ -135,6 +246,7 @@
                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
                 <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="1"/>
                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_polygon" type="String" multiselect="false" usedinquery="0"/>
             </inputvalues>
             <value-names>
                 <value-name name="feature" value="meshid"></value-name>
@@ -142,16 +254,12 @@
                 <value-name name="measurement" value="depthid"></value-name>
             </value-names>
             <outputsModes>
-                <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
+                <outputsMode name="zip" description="Export als ZIP-Archiv" mime-type="application/zip"/>
+                <outputsMode name="wms" description="WMS-Layer bereitstellen" mime-type="text/url">
                     <parameters>
-                        <inputvalue name="width" type="Integer" value="600"/>
-                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="title" type="String" value="Layer Title"/>
                     </parameters>
                 </outputsMode>
-                <outputsMode name="pdf" description="PDF-Export der Daten" mime-type="application/pdf"/>
-                <outputsMode name="svg" description="PDF-Export der Daten" mime-type="image/svg+xml"/>
-                <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
-                <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
             </outputsModes>
         </state>
         
--- a/gnv-artifacts/doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/horizontalprofile/conf_instantaneouspoint.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,26 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="horizontalProfileInstantaneousPoint">
    <states>
+        <state id="horizontalprofile_instantaneouspoint_mapviewerswitch" description="horizontalprofile_instantaneouspoint_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_instantaneouspoint_mapviewerswitch"/>
+            <to state="horizontalprofile_instantaneouspoint_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_instantaneouspoint_mapviewerswitch"/>
+            <to state="horizontalprofile_instantaneouspoint_vehicle_with_wkt"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
         <state id="horizontalprofile_instantaneouspoint_area" description="horizontalprofile_instantaneouspoint_area" state="de.intevation.gnv.state.DefaultState">
             <queryID>area_filter</queryID>
             <dataname>areaid</dataname>
@@ -41,6 +61,61 @@
            <to state="horizontalprofile_instantaneouspoint_vehicle"/>
        </transition>
         
+       <!-- Anfang Sonderfall Ablaufsteuerung mit Anwendung der Geometrie aus der Mapviewer-Schnittstelle -->
+       <state id="horizontalprofile_instantaneouspoint_vehicle_with_wkt" description="horizontalprofile_instantaneouspoint_vehicle_with_wkt" state="de.intevation.gnv.state.PreSettingsTransferState">
+           <queryID>horizontalprofile_instantaneouspoint_vehicle_with_wkt</queryID>
+           <dataname>vehicleid</dataname>
+           <data-multiselect>false</data-multiselect>
+           <presettings-transfer presetting="geometry" inputvalue="wktid"/>
+           <inputvalues>
+               <inputvalue name="sourceid" type="Integer" multiselect="false"/>
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/>
+               <inputvalue name="vehicleid" type="Integer" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+       
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_instantaneouspoint_vehicle_with_wkt"/>
+           <to state="horizontalprofile_instantaneouspoint_cruise_with_wkt"/>
+       </transition>
+       
+       <state id="horizontalprofile_instantaneouspoint_cruise_with_wkt" description="horizontalprofile_instantaneouspoint_cruise_with_wkt" state="de.intevation.gnv.state.DefaultState">
+           <queryID>horizontalprofile_instantaneouspoint_cruise_with_wkt</queryID>
+           <dataname>cruiseid</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+               <inputvalue name="sourceid" type="Integer" multiselect="false"/>
+               <inputvalue name="vehicleid" type="Integer" multiselect="false"/>
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/>
+               <inputvalue name="cruiseid" type="Integer" multiselect="false" usedinquery="0" />
+           </inputvalues>
+       </state>
+       
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_instantaneouspoint_cruise_with_wkt"/>
+           <to state="horizontalprofile_instantaneouspoint_track_with_wkt"/>
+       </transition>
+       
+       <state id="horizontalprofile_instantaneouspoint_track_with_wkt" description="horizontalprofile_instantaneouspoint_track_with_wkt" state="de.intevation.gnv.state.DefaultState">
+           <queryID>horizontalprofile_instantaneouspoint_track_with_wkt</queryID>
+           <dataname>trackid</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+               <inputvalue name="cruiseid" type="Integer" multiselect="false" usedinquery="1" />
+               <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/>
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="trackid" type="Integer" multiselect="false" usedinquery="0" />
+           </inputvalues>
+       </state>
+       
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_instantaneouspoint_track_with_wkt"/>
+           <to state="horizontalprofile_instantaneouspoint_surveyinfo"/>
+       </transition>
+       <!-- Ende Sonderfall Ablaufsteuerung mit Anwendung der Geometrie aus der Mapviewer-Schnittstelle -->
+        
         <!-- Anfang Sonderfall Ablaufsteuerung mit Anwendung des Gebietsfilters  -->
        <state id="horizontalprofile_instantaneouspoint_vehicle" description="horizontalprofile_instantaneouspoint_vehicle" state="de.intevation.gnv.state.DefaultState">
            <queryID>horizontalprofile_instantaneouspoint_vehicle_with_area</queryID>
@@ -167,6 +242,7 @@
        <state id="horizontalprofile_instantaneouspoint_parameter" description="horizontalprofile_instantaneouspoint_parameter" state="de.intevation.gnv.state.DefaultState">
            <queryID>horizontalprofile_instantaneouspoint_parameter</queryID>
            <dataname>parameterid</dataname>
+           <presettings-name>parameter</presettings-name>
            <data-multiselect>true</data-multiselect>
            <inputvalues>
                <inputvalue name="cruiseid" type="Integer" multiselect="false" usedinquery="0" />
@@ -222,10 +298,27 @@
                    <parameters>
                        <inputvalue name="width" type="Integer" value="600"/>
                        <inputvalue name="height" type="Integer" value="400"/>
+                       <inputvalue name="points" type="Boolean" value="false"/>
                    </parameters>
+                   <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
                </outputsMode>
-               <outputsMode name="pdf" description="PDF-Export der Daten" mime-type="application/pdf"/>
-               <outputsMode name="svg" description="PDF-Export der Daten" mime-type="image/svg+xml"/>
+                <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
                <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
                <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
                <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
--- a/gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,45 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="horizontalProfileMesh">
   <states>
+         <state id="horizontalprofile_mesh_mapviewerswitch" description="horizontalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh_mapviewerswitch"/>
+            <to state="horizontalprofile_mesh_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh_mapviewerswitch"/>
+            <to state="horizontalprofile_mesh_with_wkt"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+        
+        <state id="horizontalprofile_mesh_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState">
+            <queryID>verticalprofile_mesh_with_wkt</queryID>
+            <dataname>meshid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_polygon"/>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_polygon" type="Geometry" multiselect="false" usedinquery="1"/>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+       
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="horizontalprofile_mesh_with_wkt"/>
+            <to state="horizontalprofile_mesh_point_presettings"/>
+        </transition>
+        
         <state id="horizontalprofile_mesh_area" description="horizontalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultState">
                <queryID>area_filter</queryID>
                <dataname>areaid</dataname>
@@ -51,11 +90,18 @@
                   <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
               </inputvalues>
          </state>
-          
-         <transition transition="de.intevation.gnv.transition.DefaultTransition">
-             <from state="horizontalprofile_mesh_without_geom"/>
-             <to state="horizontalprofile_mesh_coordinate"/>
-         </transition>
+         
+         <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh_without_geom"/>
+            <to state="horizontalprofile_mesh_coordinate"/>
+            <condition inputvalue="geometry" value="POINT" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh_without_geom"/>
+            <to state="horizontalprofile_mesh_point_presettings"/>
+            <condition inputvalue="geometry" value="POINT" operator="equal"/>
+        </transition>
           
         <state id="horizontalprofile_mesh" description="horizontalprofile_mesh" state="de.intevation.gnv.state.DefaultState">
            <queryID>verticalprofile_mesh_with_area</queryID>
@@ -69,10 +115,17 @@
            </inputvalues>
        </state>
        
-       <transition transition="de.intevation.gnv.transition.DefaultTransition">
-           <from state="horizontalprofile_mesh"/>
-           <to state="horizontalprofile_mesh_coordinate"/>
-       </transition>
+       <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh"/>
+            <to state="horizontalprofile_mesh_coordinate"/>
+            <condition inputvalue="geometry" value="POINT" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh"/>
+            <to state="horizontalprofile_mesh_point_presettings"/>
+            <condition inputvalue="geometry" value="POINT" operator="equal"/>
+        </transition>
        
        <state id="horizontalprofile_mesh_coordinate" description="horizontalprofile_mesh_coordinate" state="de.intevation.gnv.state.SingleInputState">
            <dataname>mesh_coordinate</dataname>
@@ -99,6 +152,7 @@
                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
            </inputvalues>
+           <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/>
        </state>
        
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
@@ -106,6 +160,25 @@
            <to state="horizontalprofile_mesh_axis"/>
        </transition>
        
+       <state id="horizontalprofile_mesh_point_presettings" description="horizontalprofile_meshpoint" state="de.intevation.gnv.state.PreSettingsTransferCoordinateSelectionState">
+            <queryID>verticalprofile_mesh_point</queryID>
+            <dataname>mesh_point</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/>
+            <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false"/>
+                 <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+            <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/>
+        </state>
+       
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_mesh_point_presettings"/>
+           <to state="horizontalprofile_mesh_axis"/>
+       </transition>
+
        <state id="horizontalprofile_mesh_axis" description="horizontalprofile_mesh_point" state="de.intevation.gnv.state.profile.horizontal.NorthSouthEastWestState">
           <dataname>axisid</dataname>
            <data-multiselect>false</data-multiselect>
@@ -116,15 +189,40 @@
                 <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
            </inputvalues>
        </state>
-       
+
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
            <from state="horizontalprofile_mesh_axis"/>
-           <to state="horizontalprofile_meshpoint_parameter"/>
+           <to state="horizontalprofile_meshpoint_vector_scalar"/>
        </transition>
-       
+
+       <state id="horizontalprofile_meshpoint_vector_scalar" description="horizontalprofile_meshpoint_vector_scalar" state="de.intevation.gnv.state.SwitchModeState">
+           <dataname>vectorscalar</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="vectorscalar" type="String" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+
+       <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="horizontalprofile_meshpoint_vector_scalar"/>
+            <to state="horizontalprofile_meshpoint_parameter"/>
+            <condition inputvalue="vectorscalar" value="scalar" operator="equal"/>
+         </transition>
+
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="horizontalprofile_meshpoint_vector_scalar"/>
+            <to state="horizontalprofile_meshpoint_parameter_vector"/>
+            <condition inputvalue="vectorscalar" value="vector" operator="equal"/>
+         </transition>
+
        <state id="horizontalprofile_meshpoint_parameter" description="horizontalprofile_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState">
            <queryID>verticalprofile_mesh_parameter</queryID>
            <dataname>parameterid</dataname>
+           <presettings-name>parameter</presettings-name>
            <data-multiselect>true</data-multiselect>
            <inputvalues>
                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
@@ -134,12 +232,31 @@
                 <inputvalue name="parameterid" type="Integer" multiselect="true" useinquery="0"/>
            </inputvalues>
        </state>
-       
+
+       <state id="horizontalprofile_meshpoint_parameter_vector" description="horizontalprofile_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState">
+           <queryID>verticalprofile_mesh_parameter_vector</queryID>
+           <dataname>parameterid</dataname>
+           <presettings-name>parameter</presettings-name>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true" useinquery="0"/>
+           </inputvalues>
+       </state>
+
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
            <from state="horizontalprofile_meshpoint_parameter"/>
            <to state="horizontalprofile_meshpoint_depth"/>
        </transition>
-       
+
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_meshpoint_parameter_vector"/>
+           <to state="horizontalprofile_meshpoint_depth_vector"/>
+       </transition>
+
         <state id="horizontalprofile_meshpoint_depth" description="horizontalprofile_meshpoint_depth" state="de.intevation.gnv.state.DefaultState">
            <queryID>horizontalprofile_meshpoint_depth</queryID>
            <dataname>depthid</dataname>
@@ -153,12 +270,71 @@
                 <inputvalue name="depthid" type="Integer" multiselect="true"  usedinquery="0"/>
            </inputvalues>
        </state>
-       
+
+       <state id="horizontalprofile_meshpoint_depth_vector" description="horizontalprofile_meshpoint_depth" state="de.intevation.gnv.state.DefaultState">
+           <queryID>horizontalprofile_meshpoint_depth</queryID>
+           <dataname>depthid</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="2"/>
+                <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true" useinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="depthid" type="Integer" multiselect="false"  usedinquery="0"/>
+           </inputvalues>
+       </state>
+
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
            <from state="horizontalprofile_meshpoint_depth"/>
+           <to state="horizontalprofile_mesh_year"/>
+       </transition>
+
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_meshpoint_depth_vector"/>
+           <to state="horizontalprofile_mesh_year_vector"/>
+       </transition>
+
+        <state id="horizontalprofile_mesh_year" description="horizontalprofile_mesh_year" state="de.intevation.gnv.state.DefaultState">
+           <queryID>verticalprofile_mesh_year</queryID>
+           <dataname>yearid</dataname>
+           <data-multiselect>true</data-multiselect>
+           <inputvalues>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+               <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+               <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="1"/>
+               <inputvalue name="depthid" type="Integer" multiselect="true"  usedinquery="0"/>
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/>
+           </inputvalues>
+       </state>
+
+       <state id="horizontalprofile_mesh_year_vector" description="horizontalprofile_mesh_year" state="de.intevation.gnv.state.DefaultState">
+           <queryID>verticalprofile_mesh_year_vector</queryID>
+           <dataname>yearid</dataname>
+           <data-multiselect>true</data-multiselect>
+           <inputvalues>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+               <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+               <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="1"/>
+               <inputvalue name="depthid" type="Integer" multiselect="true"  usedinquery="0"/>
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/>
+           </inputvalues>
+       </state>
+
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_mesh_year"/>
            <to state="horizontalprofile_mesh_date"/>
        </transition>
-       
+
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_mesh_year_vector"/>
+           <to state="horizontalprofile_mesh_date_vector"/>
+       </transition>
+
        <state id="horizontalprofile_mesh_date" description="horizontalprofile_mesh_date" state="de.intevation.gnv.state.DefaultState">
            <queryID>verticalprofile_mesh_date</queryID>
            <dataname>dateid</dataname>
@@ -170,16 +346,39 @@
                <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="1"/>
                <inputvalue name="depthid" type="Integer" multiselect="true"  usedinquery="0"/>
                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/>
                <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0"/>
            </inputvalues>
        </state>
-       
+
+       <state id="horizontalprofile_mesh_date_vector" description="horizontalprofile_mesh_date" state="de.intevation.gnv.state.DefaultState">
+           <queryID>verticalprofile_mesh_date_vector</queryID>
+           <dataname>dateid</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+               <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+               <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="1"/>
+               <inputvalue name="depthid" type="Integer" multiselect="true"  usedinquery="0"/>
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/>
+               <inputvalue name="dateid" type="Date" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
            <from state="horizontalprofile_mesh_date"/>
            <to state="horizontalprofile_mesh_calculate_results"/>
        </transition>
-       
-       <state id="horizontalprofile_mesh_calculate_results" description="horizontalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.horizontal.HorizontalProfileOutputState">
+
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_mesh_date_vector"/>
+           <to state="horizontalprofile_mesh_calculate_results_vector"/>
+       </transition>
+
+       <state id="horizontalprofile_mesh_calculate_results"
+       description="horizontalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.horizontal.HorizontalProfileMeshOutputState">
            <queryID>horizontalprofile_mesh_chart_data</queryID>
            <queryID-odv>horizontalprofile_mesh_odv_data</queryID-odv>
            <inputvalues>
@@ -201,10 +400,76 @@
                    <parameters>
                        <inputvalue name="width" type="Integer" value="600"/>
                        <inputvalue name="height" type="Integer" value="400"/>
+                       <inputvalue name="points" type="Boolean" value="false"/>
                    </parameters>
+                   <exportModes>
+                       <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                       <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                       <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                   </exportModes>
                </outputsMode>
-               <outputsMode name="pdf" description="PDF-Export der Daten" mime-type="application/pdf"/>
-               <outputsMode name="svg" description="PDF-Export der Daten" mime-type="image/svg+xml"/>
+                <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
+               <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
+               <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
+               <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
+           </outputsModes>
+       </state>
+
+       <state id="horizontalprofile_mesh_calculate_results_vector" description="horizontalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.horizontal.HorizontalProfileMeshVectorOutputState">
+           <queryID>horizontalprofile_mesh_chart_data_vector</queryID>
+           <queryID-odv>horizontalprofile_mesh_odv_data_vector</queryID-odv>
+           <inputvalues>
+               <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+               <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="2"/>
+               <inputvalue name="depthid" type="Integer" multiselect="true"  usedinquery="1"/>
+               <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="2"/>
+               <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="1"/> 
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+           <value-names>
+               <value-name name="feature" value="mesh_point"></value-name>
+               <value-name name="parameter" value="parameterid"></value-name>
+               <value-name name="measurement" value="depthid"></value-name>
+           </value-names>
+           <outputsModes>
+               <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
+                   <parameters>
+                       <inputvalue name="width" type="Integer" value="600"/>
+                       <inputvalue name="height" type="Integer" value="400"/>
+                       <inputvalue name="points" type="Boolean" value="false"/>
+                   </parameters>
+                   <exportModes>
+                       <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                       <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                       <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                   </exportModes>
+               </outputsMode>
+                <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
                <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
                <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
                <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
--- a/gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh_cross.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/horizontalprofile/conf_mesh_cross.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,7 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="horizontalProfileMeshCross">
   <states>
-        <state id="horizontalprofile_mesh_area" description="horizontalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultState">
+        <state id="horizontalprofile_mesh_cross_mapviewerswitch" description="horizontalprofile_mesh_cross_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh_cross_mapviewerswitch"/>
+            <to state="horizontalprofile_mesh_cross_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh_cross_mapviewerswitch"/>
+            <to state="horizontalprofile_mesh_cross_with_wkt"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+        
+        <state id="horizontalprofile_mesh_cross_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState">
+            <queryID>verticalprofile_mesh_with_wkt</queryID>
+            <dataname>meshid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_polygon"/>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_polygon" type="Geometry" multiselect="false" usedinquery="1"/>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="horizontalprofile_mesh_cross_with_wkt"/>
+            <to state="horizontalprofile_mesh_cross_linestring"/>
+        </transition>
+        
+        <state id="horizontalprofile_mesh_cross_area" description="horizontalprofile_mesh_cross_area_one" state="de.intevation.gnv.state.DefaultState">
                <queryID>area_filter</queryID>
                <dataname>areaid</dataname>
                <data-multiselect>false</data-multiselect>
@@ -14,17 +53,17 @@
           </state>
           
           <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
-              <from state="horizontalprofile_mesh_area"/>
-              <to state="horizontalprofile_mesh_subarea"/>
+              <from state="horizontalprofile_mesh_cross_area"/>
+              <to state="horizontalprofile_mesh_cross_subarea"/>
               <condition inputvalue="areaid" value="n/n" operator="notequal"/>
           </transition>
           <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
-              <from state="horizontalprofile_mesh_area"/>
-              <to state="horizontalprofile_mesh_without_geom"/>
+              <from state="horizontalprofile_mesh_cross_area"/>
+              <to state="horizontalprofile_mesh_cross_without_geom"/>
               <condition inputvalue="areaid" value="n/n" operator="equal"/>
           </transition>
         
-          <state id="horizontalprofile_mesh_subarea" description="horizontalprofile_mesh_subaera" state="de.intevation.gnv.state.DefaultState">
+          <state id="horizontalprofile_mesh_cross_subarea" description="horizontalprofile_mesh_cross_subaera" state="de.intevation.gnv.state.DefaultState">
                <queryID>subarea_filter</queryID>
                <dataname>subareaid</dataname>
                <data-multiselect>false</data-multiselect>
@@ -37,11 +76,11 @@
          </state>
          
          <transition transition="de.intevation.gnv.transition.DefaultTransition">
-             <from state="horizontalprofile_mesh_subarea"/>
-             <to state="horizontalprofile_mesh"/>
+             <from state="horizontalprofile_mesh_cross_subarea"/>
+             <to state="horizontalprofile_mesh_cross"/>
          </transition>
          
-         <state id="horizontalprofile_mesh_without_geom" description="horizontalprofile_mesh_without_geom" state="de.intevation.gnv.state.DefaultState">
+         <state id="horizontalprofile_mesh_cross_without_geom" description="horizontalprofile_mesh_cross_without_geom" state="de.intevation.gnv.state.DefaultState">
               <queryID>verticalprofile_mesh</queryID>
               <dataname>meshid</dataname>
               <data-multiselect>false</data-multiselect>
@@ -52,12 +91,19 @@
               </inputvalues>
          </state>
           
-         <transition transition="de.intevation.gnv.transition.DefaultTransition">
-             <from state="horizontalprofile_mesh_without_geom"/>
-             <to state="horizontalprofile_mesh_linestring"/>
-         </transition>
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh_cross_without_geom"/>
+            <to state="horizontalprofile_mesh_cross_linestring"/>
+            <condition inputvalue="geometry" value="LINESTRING" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh_cross_without_geom"/>
+            <to state="horizontalprofile_meshpoint_cross_parameter_presettings"/>
+            <condition inputvalue="geometry" value="LINESTRING" operator="equal"/>
+        </transition>
           
-        <state id="horizontalprofile_mesh" description="horizontalprofile_mesh" state="de.intevation.gnv.state.DefaultState">
+        <state id="horizontalprofile_mesh_cross" description="horizontalprofile_mesh_cross" state="de.intevation.gnv.state.DefaultState">
            <queryID>verticalprofile_mesh_with_area</queryID>
            <dataname>meshid</dataname>
            <data-multiselect>false</data-multiselect>
@@ -69,12 +115,19 @@
            </inputvalues>
        </state>
        
-       <transition transition="de.intevation.gnv.transition.DefaultTransition">
-           <from state="horizontalprofile_mesh"/>
-           <to state="horizontalprofile_mesh_linestring"/>
-       </transition>
+       <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh_cross"/>
+            <to state="horizontalprofile_mesh_cross_linestring"/>
+            <condition inputvalue="geometry" value="LINESTRING" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="horizontalprofile_mesh_cross"/>
+            <to state="horizontalprofile_meshpoint_cross_parameter_presettings"/>
+            <condition inputvalue="geometry" value="LINESTRING" operator="equal"/>
+        </transition>
        
-       <state id="horizontalprofile_mesh_linestring" description="horizontalprofile_mesh_coordinate" state="de.intevation.gnv.state.SingleInputState">
+       <state id="horizontalprofile_mesh_cross_linestring" description="horizontalprofile_mesh_cross_coordinate" state="de.intevation.gnv.state.SingleInputState">
            <dataname>mesh_linestring</dataname>
            <data-multiselect>false</data-multiselect>
            <inputvalues>
@@ -85,16 +138,14 @@
        </state>
        
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
-           <from state="horizontalprofile_mesh_linestring"/>
-           <to state="horizontalprofile_meshpoint_parameter"/>
+           <from state="horizontalprofile_mesh_cross_linestring"/>
+           <to state="horizontalprofile_meshpoint_cross_parameter"/>
        </transition>
        
-       <!-- mesh_point -->
-       
-       
-       <state id="horizontalprofile_meshpoint_parameter" description="horizontalprofile_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState">
+       <state id="horizontalprofile_meshpoint_cross_parameter" description="horizontalprofile_mesh_crosspoint_parameter" state="de.intevation.gnv.state.DefaultState">
            <queryID>verticalprofile_mesh_parameter</queryID>
            <dataname>parameterid</dataname>
+           <presettings-name>parameter</presettings-name>
            <data-multiselect>true</data-multiselect>
            <inputvalues>
                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
@@ -105,11 +156,30 @@
        </state>
        
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
-           <from state="horizontalprofile_meshpoint_parameter"/>
-           <to state="horizontalprofile_meshpoint_depth"/>
+           <from state="horizontalprofile_meshpoint_cross_parameter"/>
+           <to state="horizontalprofile_meshpoint_cross_depth"/>
        </transition>
        
-        <state id="horizontalprofile_meshpoint_depth" description="horizontalprofile_meshpoint_depth" state="de.intevation.gnv.state.DefaultState">
+       <state id="horizontalprofile_meshpoint_cross_parameter_presettings" description="horizontalprofile_meshpoint_cross_parameter" state="de.intevation.gnv.state.PreSettingsTransferState">
+           <queryID>verticalprofile_mesh_parameter</queryID>
+           <dataname>parameterid</dataname>
+           <presettings-name>parameter</presettings-name>
+           <data-multiselect>true</data-multiselect>
+           <presettings-transfer presetting="geometry" inputvalue="mesh_linestring"/>
+           <inputvalues>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true" useinquery="0"/>
+                <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+       
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_meshpoint_cross_parameter_presettings"/>
+           <to state="horizontalprofile_meshpoint_cross_depth"/>
+       </transition>
+       
+        <state id="horizontalprofile_meshpoint_cross_depth" description="horizontalprofile_meshpoint_cross_depth" state="de.intevation.gnv.state.DefaultState">
            <queryID>horizontalprofile_meshpoint_depth</queryID>
            <dataname>depthid</dataname>
            <data-multiselect>true</data-multiselect>
@@ -123,11 +193,31 @@
        </state>
        
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
-           <from state="horizontalprofile_meshpoint_depth"/>
-           <to state="horizontalprofile_mesh_date"/>
+           <from state="horizontalprofile_meshpoint_cross_depth"/>
+           <to state="horizontalprofile_mesh_cross_year"/>
+       </transition>
+
+       <state id="horizontalprofile_mesh_cross_year" description="horizontalprofile_mesh_cross_year" state="de.intevation.gnv.state.DefaultState">
+           <queryID>verticalprofile_mesh_year</queryID>
+           <dataname>yearid</dataname>
+           <data-multiselect>true</data-multiselect>
+           <inputvalues>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+               <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="1"/>
+               <inputvalue name="depthid" type="Integer" multiselect="true"  usedinquery="0"/>
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/>
+               <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="horizontalprofile_mesh_cross_year"/>
+           <to state="horizontalprofile_mesh_cross_date"/>
        </transition>
        
-       <state id="horizontalprofile_mesh_date" description="horizontalprofile_mesh_date" state="de.intevation.gnv.state.DefaultState">
+       <state id="horizontalprofile_mesh_cross_date" description="horizontalprofile_mesh_cross_date" state="de.intevation.gnv.state.DefaultState">
            <queryID>verticalprofile_mesh_date</queryID>
            <dataname>dateid</dataname>
            <data-multiselect>true</data-multiselect>
@@ -136,17 +226,18 @@
                <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="1"/>
                <inputvalue name="depthid" type="Integer" multiselect="true"  usedinquery="0"/>
                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/>
                <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0"/>
                <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/>
            </inputvalues>
        </state>
        
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
-           <from state="horizontalprofile_mesh_date"/>
-           <to state="horizontalprofile_mesh_calculate_results"/>
+           <from state="horizontalprofile_mesh_cross_date"/>
+           <to state="horizontalprofile_mesh_cross_calculate_results"/>
        </transition>
        
-       <state id="horizontalprofile_mesh_calculate_results" description="horizontalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.horizontal.HorizontalProfileMeshCrossOutputState">
+       <state id="horizontalprofile_mesh_cross_calculate_results" description="horizontalprofile_mesh_cross_calculate_results" state="de.intevation.gnv.state.profile.horizontal.HorizontalProfileMeshCrossOutputState">
            <queryID>horizontalprofile_mesh_cross_chart_data</queryID>
            <queryID-ijk>horizontalprofile_meshpoint_cross_ij</queryID-ijk>
            <queryID-odv>horizontalprofile_mesh_odv_data</queryID-odv>
@@ -168,10 +259,27 @@
                    <parameters>
                        <inputvalue name="width" type="Integer" value="600"/>
                        <inputvalue name="height" type="Integer" value="400"/>
+                       <inputvalue name="points" type="Boolean" value="false"/>
                    </parameters>
+                   <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
                </outputsMode>
-               <outputsMode name="pdf" description="PDF-Export der Daten" mime-type="application/pdf"/>
-               <outputsMode name="svg" description="PDF-Export der Daten" mime-type="image/svg+xml"/>
+               <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
                <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
                <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
                <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/products/layer/conf.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<artifact name="layer">
+    <states>
+
+        <state id="layer_mapviewerswitch" description="layer_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="layer_mapviewerswitch"/>
+            <to state="layer_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="layer_mapviewerswitch"/>
+            <to state="layer"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+        
+        <state id="layer_area" description="layer_area_one" state="de.intevation.gnv.state.DefaultState">
+            <queryID>area_filter</queryID>
+            <dataname>areaid</dataname>
+            <data-multiselect>false</data-multiselect>
+             <data-noselect>true</data-noselect>
+            <inputvalues>
+                <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="areaid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="layer_area"/>
+            <to state="layer_subarea"/>
+            <condition inputvalue="areaid" value="n/n" operator="notequal"/>
+        </transition>
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="layer_area"/>
+            <to state="layer_without_geom"/>
+            <condition inputvalue="areaid" value="n/n" operator="equal"/>
+        </transition>
+        
+        <state id="layer_subarea" description="layer_subaera" state="de.intevation.gnv.state.DefaultState">
+            <queryID>subarea_filter</queryID>
+            <dataname>subareaid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="areaid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="layer_subarea"/>
+            <to state="layer"/>
+        </transition>
+        
+         <state id="layer_without_geom" description="layer_without_geom" state="de.intevation.gnv.state.DefaultState">
+             <queryID>layer</queryID>
+             <dataname>layerid</dataname>
+             <data-multiselect>true</data-multiselect>
+             <inputvalues>
+                 <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="layerid" type="Integer" multiselect="false" usedinquery="0"/>
+             </inputvalues>
+         </state>
+         
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="layer_without_geom"/>
+            <to state="layer_calculate_results_without_geom"/>
+        </transition>
+        
+        <state id="layer_calculate_results_without_geom" description="layer_calculate_results" state="de.intevation.gnv.state.layer.LayerOutputState">
+            <queryID>layer_request_data</queryID>
+            <queryID-layerdata>layer_data</queryID-layerdata>
+            <inputvalues>
+               <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="layerid" type="Integer" multiselect="false" usedinquery="1"/>
+            </inputvalues>
+            <outputsModes>
+                <outputsMode name="zip" description="Export als ZIP-Archiv" mime-type="application/zip"/>
+                <outputsMode name="wms" description="WMS-Layer bereitstellen" mime-type="text/url">
+                    <parameters>
+                        <inputvalue name="title" type="String" value="Layer Title"/>
+                    </parameters>
+                </outputsMode>
+            </outputsModes>
+        </state>
+         
+        <state id="layer" description="layer" state="de.intevation.gnv.state.DefaultState">
+             <queryID>layer</queryID>
+             <dataname>layerid</dataname>
+             <data-multiselect>true</data-multiselect>
+             <inputvalues>
+                 <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="layerid" type="Integer" multiselect="false" usedinquery="0"/>
+             </inputvalues>
+         </state>
+         
+         <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="layer"/>
+            <to state="layer_calculate_results"/>
+         </transition>
+         
+         <state id="layer_calculate_results" description="layer_calculate_results" state="de.intevation.gnv.state.layer.LayerOutputState">
+            <queryID>layer_request_data</queryID>
+            <queryID-layerdata>layer_data_with_geom</queryID-layerdata>
+            <queryID-geometry>geometry_for_subareafilter</queryID-geometry>
+            <queryID-columns>layer_colums</queryID-columns>
+            <inputvalue-geometry>subareaid</inputvalue-geometry>
+            <inputvalues>
+               <inputvalue name="sourceid" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="layerid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+            <outputsModes>
+                <outputsMode name="zip" description="Export als ZIP-Archiv" mime-type="application/zip"/>
+                <outputsMode name="wms" description="WMS-Layer bereitstellen" mime-type="text/url">
+                    <parameters>
+                        <inputvalue name="title" type="String" value="Layer Title"/>
+                    </parameters>
+                </outputsMode>
+            </outputsModes>
+         </state>
+        
+    </states>
+</artifact>
--- a/gnv-artifacts/doc/conf/products/timeseries/conf_mesh.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/timeseries/conf_mesh.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,27 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="timeSeriesMesh">
     <states>
+        <state id="timeseries_mesh_mapviewerswitch" description="timeseries_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="timeseries_mesh_mapviewerswitch"/>
+            <to state="timeseries_mesh_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="timeseries_mesh_mapviewerswitch"/>
+            <to state="timeseries_mesh_with_wkt"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+        
         <state id="timeseries_mesh_area" description="timeseries_mesh_area_one" state="de.intevation.gnv.state.DefaultState">
             <queryID>area_filter</queryID>
             <dataname>areaid</dataname>
@@ -52,11 +73,37 @@
              </inputvalues>
          </state>
          
-         <transition transition="de.intevation.gnv.transition.DefaultTransition">
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
             <from state="timeseries_mesh_without_geom"/>
             <to state="timeseries_mesh_coordinate"/>
+            <condition inputvalue="geometry" value="POINT" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="timeseries_mesh_without_geom"/>
+            <to state="timeseries_meshpoint_presettings"/>
+            <condition inputvalue="geometry" value="POINT" operator="equal"/>
+        </transition>
+         
+         
+         <state id="timeseries_mesh_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState">
+            <queryID>verticalprofile_mesh_with_wkt</queryID>
+            <dataname>meshid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+         
+         <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="timeseries_mesh_with_wkt"/>
+            <to state="timeseries_meshpoint_presettings"/>
          </transition>
-                
+        
         <state id="timeseries_mesh" description="timeseries_mesh" state="de.intevation.gnv.state.DefaultState">
             <queryID>verticalprofile_mesh_with_area</queryID>
             <dataname>meshid</dataname>
@@ -69,10 +116,18 @@
             </inputvalues>
         </state>
         
-        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
             <from state="timeseries_mesh"/>
             <to state="timeseries_mesh_coordinate"/>
-         </transition>
+            <condition inputvalue="geometry" value="POINT" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="timeseries_mesh"/>
+            <to state="timeseries_meshpoint_presettings"/>
+            <condition inputvalue="geometry" value="POINT" operator="equal"/>
+        </transition>
          
         <state id="timeseries_mesh_coordinate" description="timeseries_mesh_coordinate" state="de.intevation.gnv.state.SingleInputState">
             <dataname>mesh_coordinate</dataname>
@@ -89,6 +144,25 @@
             <to state="timeseries_meshpoint"/>
          </transition>
          
+         <state id="timeseries_meshpoint_presettings" description="timeseries_meshpoint" state="de.intevation.gnv.state.PreSettingsTransferCoordinateSelectionState">
+            <queryID>timeseries_meshpoint</queryID>
+            <dataname>mesh_point</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/>
+            <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false"/>
+                 <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+            <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="timeseries_meshpoint_presettings"/>
+            <to state="timeseries_meshpoint_depth"/>
+         </transition>
+         
         <state id="timeseries_meshpoint" description="timeseries_meshpoint" state="de.intevation.gnv.state.CoordinateSelectionState">
             <queryID>timeseries_meshpoint</queryID>
             <dataname>mesh_point</dataname>
@@ -99,13 +173,76 @@
                  <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                  <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
             </inputvalues>
+            <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/>
         </state>
         
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="timeseries_meshpoint"/>
+            <to state="timeseries_meshpoint_vector_scalar"/>
+         </transition>
+         
+
+        <state id="timeseries_meshpoint_vector_scalar" description="timeseries_meshpoint_vector_scalar" state="de.intevation.gnv.state.SwitchModeState">
+            <dataname>vectorscalar</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="vectorscalar" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
+         <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="timeseries_meshpoint_vector_scalar"/>
+            <to state="timeseries_meshpoint_parameter"/>
+            <condition inputvalue="vectorscalar" value="scalar" operator="equal"/>
+         </transition>
+
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="timeseries_meshpoint_vector_scalar"/>
+            <to state="timeseries_meshpoint_parameter_vector"/>
+            <condition inputvalue="vectorscalar" value="vector" operator="equal"/>
+         </transition>
+
+        <state id="timeseries_meshpoint_parameter" description="timeseries_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState">
+            <queryID>timeseries_mesh_parameter</queryID>
+            <dataname>parameterid</dataname>
+            <presettings-name>parameter</presettings-name>
+            <data-multiselect>true</data-multiselect>
+            <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
+        <state id="timeseries_meshpoint_parameter_vector" description="timeseries_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState">
+            <queryID>timeseries_mesh_parameter_vector</queryID>
+            <dataname>parameterid</dataname>
+            <presettings-name>parameter</presettings-name>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="timeseries_meshpoint_parameter"/>
             <to state="timeseries_meshpoint_depth"/>
          </transition>
-         
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="timeseries_meshpoint_parameter_vector"/>
+            <to state="timeseries_meshpoint_depth_vector"/>
+         </transition>
+
         <state id="timeseries_meshpoint_depth" description="timeseries_meshpoint_depth" state="de.intevation.gnv.state.DefaultState">
             <queryID>timeseries_meshpoint_depth</queryID>
             <dataname>depthid</dataname>
@@ -115,32 +252,33 @@
                  <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="2"/>
                  <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                  <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/>
-            </inputvalues>
-        </state>
-        
-         <transition transition="de.intevation.gnv.transition.DefaultTransition">
-            <from state="timeseries_meshpoint_depth"/>
-            <to state="timeseries_meshpoint_parameter"/>
-         </transition>
-         
-        <state id="timeseries_meshpoint_parameter" description="timeseries_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState">
-            <queryID>timeseries_mesh_parameter</queryID>
-            <dataname>parameterid</dataname>
-            <data-multiselect>true</data-multiselect>
-            <inputvalues>
-                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
-                 <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/>
-                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
-                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                  <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/>
             </inputvalues>
         </state>
-        
+
+        <state id="timeseries_meshpoint_depth_vector" description="timeseries_meshpoint_depth" state="de.intevation.gnv.state.DefaultState">
+            <queryID>timeseries_meshpoint_depth</queryID>
+            <dataname>depthid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="2"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
-            <from state="timeseries_meshpoint_parameter"/>
+            <from state="timeseries_meshpoint_depth"/>
             <to state="timeseries_meshpoint_interval"/>
          </transition>
-        
+
+         <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="timeseries_meshpoint_depth_vector"/>
+            <to state="timeseries_meshpoint_interval_vector"/>
+         </transition>
+
         <state id="timeseries_meshpoint_interval" description="timeseries_interval" state="de.intevation.gnv.state.MinMaxState">
             <queryID>timeseries_mesh_interval</queryID>
             <dataname>timeinterval</dataname>
@@ -155,12 +293,32 @@
                  <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="0"/>
             </inputvalues>
         </state>
-        
+
+        <state id="timeseries_meshpoint_interval_vector" description="timeseries_interval" state="de.intevation.gnv.state.MinMaxState">
+            <queryID>timeseries_mesh_interval_vector</queryID>
+            <dataname>timeinterval</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+                  <inputvalue name="minvalue" type="Date" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="timeseries_meshpoint_interval"/>
             <to state="timeseries_meshpoint_calculate_results"/>
          </transition>
-        
+
+         <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="timeseries_meshpoint_interval_vector"/>
+            <to state="timeseries_meshpoint_calculate_results_vector"/>
+         </transition>
+
         <state id="timeseries_meshpoint_calculate_results" description="timeseries_interval" state="de.intevation.gnv.state.timeseries.TimeSeriesOutputState">
             <queryID>timeseries_mesh_chart_data</queryID>
             <queryID-odv>timeseries_mesh_odv_data</queryID-odv>
@@ -177,21 +335,89 @@
                 <value-name name="feature" value="mesh_point"></value-name>
                 <value-name name="parameter" value="parameterid"></value-name>
                 <value-name name="measurement" value="depthid"></value-name>
+                <value-name name="timeinterval" value="timeinterval"></value-name>
             </value-names>
             <outputsModes>
                 <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
                     <parameters>
                         <inputvalue name="width" type="Integer" value="600"/>
                         <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="points" type="Boolean" value="false"/>
                     </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
                 </outputsMode>
-                <outputsMode name="svg" description="PDF-Export der Daten" mime-type="image/svg+xml"/>
-                <outputsMode name="pdf" description="PDF-Export der Daten" mime-type="application/pdf"/>
+                <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
                 <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
                 <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
                 <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
             </outputsModes>
         </state>
-        
+
+        <state id="timeseries_meshpoint_calculate_results_vector" description="timeseries_interval" state="de.intevation.gnv.state.timeseries.TimeSeriesVectorOutputState">
+            <queryID>timeseries_mesh_chart_data_vector</queryID>
+            <queryID-odv>timeseries_mesh_odv_data_vector</queryID-odv>
+            <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+                 <inputvalue name="depthid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="minvalue" type="Date" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="1"/>
+            </inputvalues>
+            <value-names>
+                <value-name name="feature" value="mesh_point"></value-name>
+                <value-name name="parameter" value="parameterid"></value-name>
+                <value-name name="measurement" value="depthid"></value-name>
+                <value-name name="timeinterval" value="timeinterval"></value-name>
+            </value-names>
+            <outputsModes>
+                <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="points" type="Boolean" value="false"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
+                <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
+                <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
+                <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
+                <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
+            </outputsModes>
+        </state>
+
     </states>
 </artifact>
--- a/gnv-artifacts/doc/conf/products/timeseries/conf_timeseriespoint.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/timeseries/conf_timeseriespoint.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -24,7 +24,46 @@
               * description: A short description which should describe the state
               * state: The Class which must be load to handle the required logic,
                             This class will be load using reflection. -->
-              
+        
+        <state id="timeseries_mapviewerswitch" description="timeseries_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="timeseries_mapviewerswitch"/>
+            <to state="timeseries_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="timeseries_mapviewerswitch"/>
+            <to state="timeseries_with_wkt"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+        
+        <state id="timeseries_with_wkt" description="timeseries_timeseriespoint" state="de.intevation.gnv.state.PreSettingsTransferState">
+            <queryID>timeseries_timeseriespoint_with_wkt</queryID>
+            <dataname>featureid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="wktid"/>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/>
+                <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="timeseries_with_wkt"/>
+            <to state="timeseries_vector_scalar"/>
+        </transition>
+        
         <state id="timeseries_area" description="timeseries_area_one" state="de.intevation.gnv.state.DefaultState">
             
             <!-- The QueryID which identifies the Query which is configured in 
@@ -102,12 +141,12 @@
                <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="0"/>
            </inputvalues>
        </state>
-       
+
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="timeseries_without_geom"/>
-            <to state="timeseries_parameter"/>
+            <to state="timeseries_vector_scalar"/>
         </transition>
-       
+
         <state id="timeseries_timeseriespoint" description="timeseries_timeseriespoint" state="de.intevation.gnv.state.DefaultState">
             <queryID>timeseries_timeseriespoint_with_area</queryID>
             <dataname>featureid</dataname>
@@ -119,15 +158,39 @@
                 <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="0"/>
             </inputvalues>
         </state>
-        
+
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="timeseries_timeseriespoint"/>
+            <to state="timeseries_vector_scalar"/>
+        </transition>
+
+        <state id="timeseries_vector_scalar" description="timeseries_vector_scalar" state="de.intevation.gnv.state.SwitchModeState">
+            <dataname>vectorscalar</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="vectorscalar" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="timeseries_vector_scalar"/>
             <to state="timeseries_parameter"/>
+            <condition inputvalue="vectorscalar" value="scalar" operator="equal"/>
         </transition>
-        
+
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="timeseries_vector_scalar"/>
+            <to state="timeseries_parameter_vector"/>
+            <condition inputvalue="vectorscalar" value="vector" operator="equal"/>
+        </transition>
+
         <state id="timeseries_parameter" description="timeseries_parameter" state="de.intevation.gnv.state.DefaultState">
             <queryID>timeseries_parameter</queryID>
             <dataname>parameterid</dataname>
+            <presettings-name>parameter</presettings-name>
             <data-multiselect>true</data-multiselect>
             <inputvalues>
                 <inputvalue name="featureid" type="Integer" multiselect="false"/>
@@ -135,13 +198,30 @@
                 <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0"/>
             </inputvalues>
         </state>
-        
+
+        <state id="timeseries_parameter_vector" description="timeseries_parameter_vector" state="de.intevation.gnv.state.DefaultState">
+            <queryID>timeseries_parameter_vector</queryID>
+            <dataname>parameterid</dataname>
+            <presettings-name>parameter</presettings-name>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="featureid" type="Integer" multiselect="false"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="timeseries_parameter"/>
             <to state="timeseries_depth_height"/>
         </transition>
-        
-         <state id="timeseries_depth_height" description="timeseries_depth_height" state="de.intevation.gnv.state.DefaultState">
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="timeseries_parameter_vector"/>
+            <to state="timeseries_depth_height_vector"/>
+        </transition>
+
+         <state id="timeseries_depth_height" description="timeseries_depth_height" state="de.intevation.gnv.state.MeasurementState">
             <queryID>timeseries_depth_height</queryID>
             <dataname>measurementid</dataname>
             <data-multiselect>true</data-multiselect>
@@ -152,13 +232,30 @@
                 <inputvalue name="measurementid" type="Integer" multiselect="true" usedinquery="0"/>
             </inputvalues>
         </state>
-        
+
+        <state id="timeseries_depth_height_vector" description="timeseries_depth_height_vector" state="de.intevation.gnv.state.DefaultState">
+            <queryID>timeseries_depth_height_vector</queryID>
+            <dataname>measurementid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="featureid" type="Integer" multiselect="false"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="measurementid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="timeseries_depth_height"/>
             <to state="timeseries_interval"/>
         </transition>
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="timeseries_depth_height_vector"/>
+            <to state="timeseries_interval_vector"/>
+        </transition>
         
-        <state id="timeseries_interval" description="timeseries_interval" state="de.intevation.gnv.state.MinMaxState">
+        <state id="timeseries_interval" description="timeseries_interval" state="de.intevation.gnv.state.MinMaxDateState">
             <queryID>timeseries_interval</queryID>
             <dataname>timeinterval</dataname>
             <data-multiselect>false</data-multiselect>
@@ -170,12 +267,30 @@
                 <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="0"/>
             </inputvalues>
         </state>
+
+        <state id="timeseries_interval_vector" description="timeseries_interval_vector" state="de.intevation.gnv.state.MinMaxDateState">
+            <queryID>timeseries_interval_vector</queryID>
+            <dataname>timeinterval</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true"/>
+                <inputvalue name="measurementid" type="Integer" multiselect="true"/>
+                <inputvalue name="minvalue" type="Date" multiselect="false" usedinquery="0"/>
+                <inputvalue name="maxvalue" type="Date" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
         
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="timeseries_interval"/>
             <to state="timeseries_calculate_results"/>
         </transition>
-        
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="timeseries_interval_vector"/>
+            <to state="timeseries_calculate_results_vector"/>
+        </transition>
+
         <!--  Last state is the Output-state. At this place the differen OutputModes are configured.
               For each OutputMode it might be necessary to configure separat Databasequery which collect the
               Data. -->
@@ -194,18 +309,79 @@
                     <parameters>
                         <inputvalue name="width" type="Integer" value="600"/>
                         <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="points" type="Boolean" value="false"/>
                     </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
                 </outputsMode>
-                <outputsMode name="svg" description="PDF-Export der Daten" mime-type="application/pdf"/>
-                <outputsMode name="pdf" description="PDF-Export der Daten" mime-type="application/pdf"/>
+                <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
                 <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
                 <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
                 <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
             </outputsModes>
             <!--  Definition of the TimeGaps which are required to render the Charts properly.
                   each Parameter in each FIS can have   -->
-            <time-gap-definition xlink:href="${artifacts.config.dir}/products/timeseries/timegap_definition.xml" />
+            <time-gap-definition xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/timeseries/timegap_definition.xml" />
         </state>
-        
+
+        <state id="timeseries_calculate_results_vector" description="timeseries_results_vector" state="de.intevation.gnv.state.timeseries.TimeSeriesVectorOutputState">
+            <queryID>timeseries_chart_data_vector</queryID>
+            <queryID-odv>timeseries_odv_data_vector</queryID-odv>
+            <inputvalues>
+                <inputvalue name="parameterid" type="Integer" multiselect="true"/>
+                <inputvalue name="measurementid" type="Integer" multiselect="true"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="minvalue" type="Date" multiselect="false"/>
+                <inputvalue name="maxvalue" type="Date" multiselect="false"/>
+            </inputvalues>
+            <outputsModes>
+                <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="points" type="Boolean" value="false"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
+                <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
+                <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
+                <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
+                <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
+            </outputsModes>
+            <!--  Definition of the TimeGaps which are required to render the Charts properly.
+                  each Parameter in each FIS can have   -->
+            <time-gap-definition xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/products/timeseries/timegap_definition.xml" />
+        </state>
     </states>
 </artifact>
--- a/gnv-artifacts/doc/conf/products/timeseries/timegap_definition.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/timeseries/timegap_definition.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,5 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <time-gaps>
+    <!-- 
+        These gaps are taken from MEDIAN Coded Value Domains.
+        Section is TSIntervalTypes.
+        The attribute key is the value which will be used to 
+        lookup a TimeSeriesInterval defined in Table Median.TimeSeries.
+        The attribute gap is the value of the gap it has to be combined 
+        with the unit of the gap
+        m ==> Minutes
+        h ==> Hours
+        D ==> Days
+        W ==> Weeks
+        M ==> Months
+        Y ==> Years
+        
+        These gaps will only be used for TimeSeries on TimeSeriesPoints.
+      -->
     <time-gap key = "1" gap="1" unit = "m"/>
     <time-gap key = "2" gap="2" unit = "m"/>
     <time-gap key = "3" gap="3" unit = "m"/>
--- a/gnv-artifacts/doc/conf/products/verticalcrosssection/conf_mesh.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/verticalcrosssection/conf_mesh.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,46 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="verticalCrossSectionMesh">
      <states>
+     
+        <state id="verticalcrosssection_mesh_mapviewerswitch" description="verticalcrosssection_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh_mapviewerswitch"/>
+            <to state="verticalcrosssection_mesh_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh_mapviewerswitch"/>
+            <to state="verticalcrosssection_mesh_with_wkt"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+        
+        <state id="verticalcrosssection_mesh_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState">
+            <queryID>verticalprofile_mesh_with_wkt</queryID>
+            <dataname>meshid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+       
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalcrosssection_mesh_with_wkt"/>
+            <to state="verticalcrosssection_mesh_linestring"/>
+        </transition>
+        
         <state id="verticalcrosssection_mesh_area" description="verticalcrosssection_mesh_area_one" state="de.intevation.gnv.state.DefaultState">
                <queryID>area_filter</queryID>
                <dataname>areaid</dataname>
@@ -52,10 +92,18 @@
               </inputvalues>
           </state>
           
-          <transition transition="de.intevation.gnv.transition.DefaultTransition">
-              <from state="verticalcrosssection_mesh_without_geom"/>
-              <to state="verticalcrosssection_mesh_coordinate"/>
-          </transition>
+         <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh_without_geom"/>
+            <to state="verticalcrosssection_mesh_linestring"/>
+            <condition inputvalue="geometry" value="LINESTRING" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh_without_geom"/>
+            <to state="verticalcrosssection_mesh_parameter_presettings"/>
+            <condition inputvalue="geometry" value="LINESTRING" operator="equal"/>
+        </transition>
+          
          
          <state id="verticalcrosssection_mesh" description="verticalcrosssection_mesh" state="de.intevation.gnv.state.DefaultState">
              <queryID>verticalprofile_mesh_with_area</queryID>
@@ -68,75 +116,88 @@
                  <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
              </inputvalues>
          </state>
+          
+         <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh"/>
+            <to state="verticalcrosssection_mesh_linestring"/>
+            <condition inputvalue="geometry" value="LINESTRING" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh"/>
+            <to state="verticalcrosssection_mesh_parameter_presettings"/>
+            <condition inputvalue="geometry" value="LINESTRING" operator="equal"/>
+        </transition>
+         
+        <state id="verticalcrosssection_mesh_linestring" description="verticalcrosssection_mesh_linestring" state="de.intevation.gnv.state.SingleInputState">
+           <dataname>mesh_linestring</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+                <inputvalue name="meshid" type="Integer" multiselect="false"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_linestring" type="Linestring" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+        </state>
          
          <transition transition="de.intevation.gnv.transition.DefaultTransition">
-              <from state="verticalcrosssection_mesh"/>
-              <to state="verticalcrosssection_mesh_coordinate"/>
-          </transition>
+              <from state="verticalcrosssection_mesh_linestring"/>
+              <to state="verticalcrosssection_mesh_parameter"/>
+         </transition>
          
-         <state id="verticalcrosssection_mesh_coordinate" description="verticalcrosssection_mesh_coordinate" state="de.intevation.gnv.state.SingleInputState">
-             <dataname>mesh_coordinate</dataname>
+         <state id="verticalcrosssection_mesh_parameter_presettings" description="verticalcrosssection_mesh_parameter_presettings" state="de.intevation.gnv.state.PreSettingsTransferState">
+             <queryID>verticalprofile_mesh_parameter</queryID>
+             <dataname>parameterid</dataname>
+             <presettings-name>parameter</presettings-name>
              <data-multiselect>false</data-multiselect>
+             <presettings-transfer presetting="geometry" inputvalue="mesh_linestring"/>
              <inputvalues>
                   <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
                   <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
-                  <inputvalue name="mesh_coordinate" type="Coordinate" multiselect="false" usedinquery="0"/>
+                  <inputvalue name="parameterid" type="Integer" multiselect="false"  usedinquery="0"/>
+                  <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/>
              </inputvalues>
          </state>
          
          <transition transition="de.intevation.gnv.transition.DefaultTransition">
-              <from state="verticalcrosssection_mesh_coordinate"/>
-              <to state="verticalcrosssection_mesh_point"/>
-          </transition>
-         
-         <state id="verticalcrosssection_mesh_point" description="verticalcrosssection_mesh__point" state="de.intevation.gnv.state.CoordinateSelectionState">
-             <queryID>verticalprofile_mesh_point</queryID>
-             <dataname>mesh_point</dataname>
-             <data-multiselect>false</data-multiselect>
-             <inputvalues>
-                  <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
-                  <inputvalue name="mesh_coordinate" type="Coordinate" multiselect="false" usedinquery="1"/>
-                  <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
-                  <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
-             </inputvalues>
-         </state>
-         
-         <transition transition="de.intevation.gnv.transition.DefaultTransition">
-              <from state="verticalcrosssection_mesh_point"/>
-              <to state="verticalcrosssection_mesh_axis"/>
-         </transition>
-         
-          <state id="verticalcrosssection_mesh_axis" description="verticalcrosssection_mesh_axis" state="de.intevation.gnv.state.profile.horizontal.NorthSouthEastWestState">
-            <dataname>axisid</dataname>
-             <data-multiselect>false</data-multiselect>
-             <inputvalues>
-                  <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
-                  <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="1"/>
-                  <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
-                  <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
-             </inputvalues>
-         </state>
-         
-         <transition transition="de.intevation.gnv.transition.DefaultTransition">
-              <from state="verticalcrosssection_mesh_axis"/>
-              <to state="verticalcrosssection_mesh_parameter"/>
+              <from state="verticalcrosssection_mesh_parameter_presettings"/>
+              <to state="verticalcrosssection_mesh_year"/>
          </transition>
          
          <state id="verticalcrosssection_mesh_parameter" description="verticalcrosssection_mesh_parameter" state="de.intevation.gnv.state.DefaultState">
              <queryID>verticalprofile_mesh_parameter</queryID>
              <dataname>parameterid</dataname>
+             <presettings-name>parameter</presettings-name>
              <data-multiselect>false</data-multiselect>
              <inputvalues>
                   <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
-                  <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
-                  <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
                   <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
-                  <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="0"/>
+                  <inputvalue name="parameterid" type="Integer" multiselect="false"  usedinquery="0"/>
+                  <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/>
+             </inputvalues>
+         </state>
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+              <from state="verticalcrosssection_mesh_parameter"/>
+              <to state="verticalcrosssection_mesh_year"/>
+         </transition>
+         
+         <state id="verticalcrosssection_mesh_year" description="verticalcrosssection_mesh_year" state="de.intevation.gnv.state.DefaultState">
+             <queryID>verticalcrosssection_mesh_year</queryID>
+             <dataname>yearid</dataname>
+             <data-multiselect>false</data-multiselect>
+             <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="yearid" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/>
              </inputvalues>
          </state>
          
          <transition transition="de.intevation.gnv.transition.DefaultTransition">
-              <from state="verticalcrosssection_mesh_parameter"/>
+              <from state="verticalcrosssection_mesh_year"/>
               <to state="verticalcrosssection_mesh_date"/>
          </transition>
          
@@ -150,7 +211,9 @@
                  <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
                  <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="1"/>
                  <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/>
                  <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0"/>
+                 <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/>
              </inputvalues>
          </state>
          
@@ -165,10 +228,9 @@
              <inputvalues>
                  <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
                  <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/>
-                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="2"/>
-                 <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="2"/>
-                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="1"/> 
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
                  <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_linestring" type="String" multiselect="false" usedinquery="0"/>
              </inputvalues>
              <value-names>
                  <value-name name="feature" value="mesh_point"></value-name>
@@ -181,10 +243,13 @@
                          <inputvalue name="width" type="Integer" value="600"/>
                          <inputvalue name="height" type="Integer" value="400"/>
                      </parameters>
+                     <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
                  </outputsMode>
-                 <outputsMode name="pdf" description="PDF-Export der Daten" mime-type="application/pdf"/>
-                 <outputsMode name="svg" description="PDF-Export der Daten" mime-type="image/svg+xml"/>
-                 <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
+                 <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
              </outputsModes>
          </state>
      </states>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/products/verticalcrosssection/conf_mesh_parallel.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,295 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<artifact name="verticalCrossSectionMeshParallel">
+     <states>
+
+        <state id="verticalcrosssection_mesh_parallel_mapviewerswitch" description="verticalcrosssection_mesh_parallel_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh_parallel_mapviewerswitch"/>
+            <to state="verticalcrosssection_mesh_parallel_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh_parallel_mapviewerswitch"/>
+            <to state="verticalcrosssection_mesh_parallel_with_wkt"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+
+        <state id="verticalcrosssection_mesh_parallel_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState">
+            <queryID>verticalprofile_mesh_with_wkt</queryID>
+            <dataname>meshid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalcrosssection_mesh_parallel_with_wkt"/>
+            <to state="verticalcrosssection_mesh_point_parallel_presettings"/>
+        </transition>
+
+        <state id="verticalcrosssection_mesh_parallel_area" description="verticalcrosssection_mesh_parallel_area_one" state="de.intevation.gnv.state.DefaultState">
+               <queryID>area_filter</queryID>
+               <dataname>areaid</dataname>
+               <data-multiselect>false</data-multiselect>
+                <data-noselect>true</data-noselect>
+               <inputvalues>
+                   <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                   <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                   <inputvalue name="areaid" type="Integer" multiselect="false" usedinquery="0"/>
+               </inputvalues>
+          </state>
+
+          <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+              <from state="verticalcrosssection_mesh_parallel_area"/>
+              <to state="verticalcrosssection_mesh_parallel_subarea"/>
+              <condition inputvalue="areaid" value="n/n" operator="notequal"/>
+          </transition>
+          <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+              <from state="verticalcrosssection_mesh_parallel_area"/>
+              <to state="verticalcrosssection_mesh_parallel_without_geom"/>
+              <condition inputvalue="areaid" value="n/n" operator="equal"/>
+          </transition>
+
+          <state id="verticalcrosssection_mesh_parallel_subarea" description="verticalcrosssection_mesh_parallel_area_one" state="de.intevation.gnv.state.DefaultState">
+               <queryID>subarea_filter</queryID>
+               <dataname>subareaid</dataname>
+               <data-multiselect>false</data-multiselect>
+               <inputvalues>
+                   <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                   <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                   <inputvalue name="areaid" type="Integer" multiselect="false" usedinquery="1"/>
+                   <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="0"/>
+               </inputvalues>
+         </state>
+
+         <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalcrosssection_mesh_parallel_subarea"/>
+            <to state="verticalcrosssection_mesh_parallel"/>
+        </transition>
+
+        <state id="verticalcrosssection_mesh_parallel" description="verticalcrosssection_mesh_parallel" state="de.intevation.gnv.state.DefaultState">
+            <queryID>verticalprofile_mesh_with_area</queryID>
+            <dataname>meshid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+               <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh_parallel"/>
+            <to state="verticalcrosssection_mesh_point_parallel_presettings"/>
+            <condition inputvalue="geometry" value="POINT" operator="equal"/>
+        </transition>
+
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh_parallel"/>
+            <to state="verticalcrosssection_mesh_parallel_coordinate"/>
+            <condition inputvalue="geometry" value="POINT" operator="notequal"/>
+        </transition>
+
+         <state id="verticalcrosssection_mesh_parallel_without_geom" description="verticalcrosssection_mesh_parallel" state="de.intevation.gnv.state.DefaultState">
+              <queryID>verticalprofile_mesh</queryID>
+              <dataname>meshid</dataname>
+              <data-multiselect>false</data-multiselect>
+              <inputvalues>
+                  <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                  <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                   <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
+              </inputvalues>
+          </state>
+
+         <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh_parallel_without_geom"/>
+            <to state="verticalcrosssection_mesh_parallel_coordinate"/>
+            <condition inputvalue="geometry" value="POINT" operator="notequal"/>
+        </transition>
+
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalcrosssection_mesh_parallel_without_geom"/>
+            <to state="verticalcrosssection_mesh_point_parallel_presettings"/>
+            <condition inputvalue="geometry" value="POINT" operator="equal"/>
+        </transition>
+
+         <state id="verticalcrosssection_mesh_parallel_coordinate" description="verticalcrosssection_mesh_parallel_coordinate" state="de.intevation.gnv.state.SingleInputState">
+           <dataname>mesh_coordinate</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="meshid" type="Integer" multiselect="false"/>
+                <inputvalue name="mesh_coordinate" type="Coordinate" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="verticalcrosssection_mesh_parallel_coordinate"/>
+           <to state="verticalcrosssection_mesh_parallel_point"/>
+       </transition>
+
+        <state id="verticalcrosssection_mesh_parallel_point" description="verticalcrosssection_mesh_parallel_point" state="de.intevation.gnv.state.CoordinateSelectionState">
+           <queryID>verticalprofile_mesh_point</queryID>
+           <dataname>mesh_point</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="meshid" type="Integer" multiselect="false"/>
+                <inputvalue name="mesh_coordinate" type="Coordinate" multiselect="false"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+           <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/>
+       </state>
+
+       <state id="verticalcrosssection_mesh_point_parallel_presettings" description="verticalcrosssection_mesh_point_parallel_presettings" state="de.intevation.gnv.state.PreSettingsTransferCoordinateSelectionState">
+            <queryID>verticalprofile_mesh_point</queryID>
+            <dataname>mesh_point</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/>
+            <inputvalues>
+                 <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="meshid" type="Integer" multiselect="false"/>
+                 <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+           <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/>
+        </state>
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalcrosssection_mesh_point_parallel_presettings"/>
+            <to state="verticalcrosssection_mesh_parallel_axis"/>
+        </transition>
+
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="verticalcrosssection_mesh_parallel_point"/>
+           <to state="verticalcrosssection_mesh_parallel_axis"/>
+       </transition>
+
+       <state id="verticalcrosssection_mesh_parallel_axis" description="verticalcrosssection_mesh_parallel_axis" state="de.intevation.gnv.state.profile.horizontal.NorthSouthEastWestState">
+          <dataname>axisid</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+                <inputvalue name="meshid" type="Integer" multiselect="false"/>
+                <inputvalue name="mesh_point" type="Integer" multiselect="false"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+
+        <!-- the rest is the same as in conf_mesh -->
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalcrosssection_mesh_parallel_axis"/>
+            <to state="verticalcrosssection_mesh_parallel_parameter"/>
+        </transition>
+
+        <state id="verticalcrosssection_mesh_parallel_parameter" description="verticalcrosssection_mesh_parallel_parameter" state="de.intevation.gnv.state.DefaultState">
+            <queryID>verticalprofile_mesh_parameter</queryID>
+            <dataname>parameterid</dataname>
+            <presettings-name>parameter</presettings-name>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="false"  usedinquery="0"/>
+                <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+             </inputvalues>
+        </state>
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+              <from state="verticalcrosssection_mesh_parallel_parameter"/>
+              <to state="verticalcrosssection_mesh_parallel_year"/>
+         </transition>
+
+         <state id="verticalcrosssection_mesh_parallel_year" description="verticalcrosssection_mesh_parallel_year" state="de.intevation.gnv.state.DefaultState">
+             <queryID>verticalcrosssection_mesh_year</queryID>
+             <dataname>yearid</dataname>
+             <data-multiselect>false</data-multiselect>
+             <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="yearid" type="String" multiselect="false" usedinquery="0"/>
+             </inputvalues>
+         </state>
+
+         <transition transition="de.intevation.gnv.transition.DefaultTransition">
+              <from state="verticalcrosssection_mesh_parallel_year"/>
+              <to state="verticalcrosssection_mesh_parallel_date"/>
+         </transition>
+
+         <state id="verticalcrosssection_mesh_parallel_date" description="verticalcrosssection_mesh_parallel_date" state="de.intevation.gnv.state.DefaultState">
+             <queryID>verticalcrosssection_mesh_date</queryID>
+             <dataname>dateid</dataname>
+             <data-multiselect>false</data-multiselect>
+             <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/>
+                 <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0"/>
+             </inputvalues>
+         </state>
+
+         <transition transition="de.intevation.gnv.transition.DefaultTransition">
+              <from state="verticalcrosssection_mesh_parallel_date"/>
+              <to state="verticalcrosssection_mesh_parallel_calculate_results"/>
+         </transition>
+
+         <state id="verticalcrosssection_mesh_parallel_calculate_results" description="verticalcrosssection_mesh_parallel_calculate_results" state="de.intevation.gnv.state.profile.verticalcrosssection.VerticalCrossSectionParallelOutputState">
+             <queryID>verticalcrosssection_mesh_chart_data</queryID>
+             <queryID-linestring>verticalcrosssection_mesh_linestring</queryID-linestring>
+             <queryID-odv>verticalcrosssection_mesh_parallel_odv_data</queryID-odv>
+             <inputvalues>
+                 <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+                 <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/>
+                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="axisid" type="AttributeName" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+             </inputvalues>
+             <value-names>
+                 <value-name name="feature" value="mesh_point"></value-name>
+                 <value-name name="parameter" value="parameterid"></value-name>
+                 <value-name name="measurement" value="depthid"></value-name>
+             </value-names>
+             <outputsModes>
+                 <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
+                     <parameters>
+                         <inputvalue name="width" type="Integer" value="600"/>
+                         <inputvalue name="height" type="Integer" value="400"/>
+                     </parameters>
+                     <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                 </outputsMode>
+                 <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
+             </outputsModes>
+         </state>
+     </states>
+</artifact>
--- a/gnv-artifacts/doc/conf/products/verticalprofile/conf_instantaneouspoint.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/verticalprofile/conf_instantaneouspoint.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,142 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="verticalProfileInstantaneousPoint">
    <states>
+        <state id="verticalprofile_instantaneouspoint_mapviewerswitch" description="verticalprofile_instantaneouspoint_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalprofile_instantaneouspoint_mapviewerswitch"/>
+            <to state="verticalprofile_instantaneouspoint_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalprofile_instantaneouspoint_mapviewerswitch"/>
+            <to state="verticalprofile_instantaneouspoint_series_with_wkt"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+        
+        <state id="verticalprofile_instantaneouspoint_area" description="verticalprofile_instantaneouspoint_area" state="de.intevation.gnv.state.DefaultState">
+            <queryID>area_filter</queryID>
+            <dataname>areaid</dataname>
+            <data-multiselect>false</data-multiselect>
+             <data-noselect>true</data-noselect>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="areaid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="verticalprofile_instantaneouspoint_area"/>
+            <to state="verticalprofile_instantaneouspoint_subarea"/>
+            <condition inputvalue="areaid" value="n/n" operator="notequal"/>
+        </transition>
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="verticalprofile_instantaneouspoint_area"/>
+            <to state="verticalprofile_instantaneouspoint_series"/>
+            <condition inputvalue="areaid" value="n/n" operator="equal"/>
+        </transition>
+        
+        <state id="verticalprofile_instantaneouspoint_subarea" description="verticalprofile_instantaneouspoint_subarea" state="de.intevation.gnv.state.DefaultState">
+            <queryID>subarea_filter</queryID>
+            <dataname>subareaid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="areaid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+       </state>
+       
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="verticalprofile_instantaneouspoint_subarea"/>
+           <to state="verticalprofile_instantaneouspoint_series_with_aera"/>
+       </transition>
+       
+       
+       <!-- Anfang: Sonderfall Aufruf unter Berücksichtigung des WKT -->
+       <state id="verticalprofile_instantaneouspoint_series_with_wkt" description="verticalprofile_instantaneouspoint_series" state="de.intevation.gnv.state.PreSettingsTransferState">
+            <queryID>verticalprofile_instantaneouspoint_series_with_wkt</queryID>
+            <dataname>seriesid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="wktid"/>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="seriesid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/>
+            </inputvalues>
+       </state>
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="verticalprofile_instantaneouspoint_series_with_wkt"/>
+           <to state="verticalprofile_instantaneouspoint_point_with_wkt"/>
+       </transition>
+       
+       <state id="verticalprofile_instantaneouspoint_point_with_wkt" description="verticalprofile_instantaneouspoint_point" state="de.intevation.gnv.state.CoordinateSelectionState">
+         <queryID>verticalprofile_instantaneouspoint_point_with_wkt</queryID>
+         <dataname>instantaneouspoint_point</dataname>
+         <data-multiselect>false</data-multiselect>
+         <inputvalues>
+              <inputvalue name="seriesid" type="Integer" multiselect="false" usedinquery="1"/>
+              <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+              <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+              <inputvalue name="instantaneouspoint_point" type="Integer" multiselect="false" usedinquery="0"/>
+              <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/>
+         </inputvalues>
+     </state>
+     
+     <transition transition="de.intevation.gnv.transition.DefaultTransition">
+          <from state="verticalprofile_instantaneouspoint_point_with_wkt"/>
+          <to state="verticalprofile_instantaneouspoint_parameter"/>
+     </transition>
+     <!-- Ende: Sonderfall Aufruf unter Berücksichtigung des WKT -->
+       
+       
+       <!-- Anfang: Sonderfall Aufruf unter Berücksichtigung des Gebietsfilters -->
+       <state id="verticalprofile_instantaneouspoint_series_with_aera" description="verticalprofile_instantaneouspoint_series" state="de.intevation.gnv.state.DefaultState">
+            <queryID>verticalprofile_instantaneouspoint_series_with_area</queryID>
+            <dataname>seriesid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="seriesid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="1"/>
+            </inputvalues>
+       </state>
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="verticalprofile_instantaneouspoint_series_with_aera"/>
+           <to state="verticalprofile_instantaneouspoint_point_with_aera"/>
+       </transition>
+       
+       <state id="verticalprofile_instantaneouspoint_point_with_aera" description="verticalprofile_instantaneouspoint_point" state="de.intevation.gnv.state.CoordinateSelectionState">
+         <queryID>verticalprofile_instantaneouspoint_point_with_aera</queryID>
+         <dataname>instantaneouspoint_point</dataname>
+         <data-multiselect>false</data-multiselect>
+         <inputvalues>
+              <inputvalue name="seriesid" type="Integer" multiselect="false" usedinquery="1"/>
+              <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+              <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+              <inputvalue name="instantaneouspoint_point" type="Integer" multiselect="false" usedinquery="0"/>
+              <inputvalue name="subareaid" type="Integer" multiselect="false" usedinquery="1"/>
+         </inputvalues>
+     </state>
+     
+     <transition transition="de.intevation.gnv.transition.DefaultTransition">
+          <from state="verticalprofile_instantaneouspoint_point_with_aera"/>
+          <to state="verticalprofile_instantaneouspoint_parameter"/>
+     </transition>
+     <!-- Ende: Sonderfall Aufruf unter Berücksichtigung des Gebietsfilters -->
+   
      <state id="verticalprofile_instantaneouspoint_series" description="verticalprofile_instantaneouspoint_series" state="de.intevation.gnv.state.DefaultState">
          <queryID>verticalprofile_instantaneouspoint_series</queryID>
          <dataname>seriesid</dataname>
@@ -37,6 +173,7 @@
      <state id="verticalprofile_instantaneouspoint_parameter" description="verticalprofile_instantaneouspoint_parameter" state="de.intevation.gnv.state.DefaultState">
          <queryID>verticalprofile_instantaneouspoint_parameter</queryID>
          <dataname>parameterid</dataname>
+         <presettings-name>parameter</presettings-name>
          <data-multiselect>true</data-multiselect>
          <inputvalues>
               <inputvalue name="seriesid" type="Integer" multiselect="false" usedinquery="0" />
@@ -91,10 +228,27 @@
                  <parameters>
                      <inputvalue name="width" type="Integer" value="600"/>
                      <inputvalue name="height" type="Integer" value="400"/>
+                     <inputvalue name="points" type="Boolean" value="false"/>
                  </parameters>
+                 <exportModes>
+                     <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                     <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                     <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                 </exportModes>
              </outputsMode>
-             <outputsMode name="pdf" description="PDF-Export der Daten" mime-type="application/pdf"/>
-             <outputsMode name="svg" description="PDF-Export der Daten" mime-type="image/svg+xml"/>
+             <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                 <parameters>
+                     <inputvalue name="width" type="Integer" value="600"/>
+                     <inputvalue name="height" type="Integer" value="400"/>
+                     <inputvalue name="bincount" type="Integer" value="7"/>
+                     <inputvalue name="binwidth" type="Double" value="7"/>
+                 </parameters>
+                 <exportModes>
+                     <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                     <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                     <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                 </exportModes> 
+             </outputsMode>
              <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
              <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
              <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
--- a/gnv-artifacts/doc/conf/products/verticalprofile/conf_mesh.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/verticalprofile/conf_mesh.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,64 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="verticalProfileMesh">
    <states>
+       <state id="verticalprofile_mesh_mapviewerswitch" description="verticalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+           <!-- Empty State which will be used to integrate the switch for a 
+                standalone and an mapviewer based call. -->
+           <inputvalues>
+               <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+       
+       <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+           <from state="verticalprofile_mesh_mapviewerswitch"/>
+           <to state="verticalprofile_mesh_area"/>
+           <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+       </transition>
+       
+       <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+           <from state="verticalprofile_mesh_mapviewerswitch"/>
+           <to state="verticalprofile_mesh_with_wkt"/>
+           <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+       </transition>
+       
+       <state id="verticalprofile_mesh_with_wkt" description="timeseries_mesh" state="de.intevation.gnv.state.PreSettingsTransferState">
+           <queryID>verticalprofile_mesh_with_wkt</queryID>
+           <dataname>meshid</dataname>
+           <data-multiselect>false</data-multiselect>
+           <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/>
+           <inputvalues>
+               <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+       
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="verticalprofile_mesh_with_wkt"/>
+           <to state="verticalprofile_mesh_point_presettings"/>
+       </transition>
+       
+        <state id="verticalprofile_mesh_point_presettings" description="verticalprofile_meshpoint" state="de.intevation.gnv.state.PreSettingsTransferCoordinateSelectionState">
+            <queryID>verticalprofile_mesh_point</queryID>
+            <dataname>mesh_point</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="mesh_coordinate"/>
+            <inputvalues>
+                 <inputvalue name="meshid" type="Integer" multiselect="false"/>
+                 <inputvalue name="mesh_coordinate" type="Geometry" multiselect="false" usedinquery="1"/>
+                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+            <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalprofile_mesh_point_presettings"/>
+            <to state="verticalprofile_mesh_mindepth"/>
+        </transition>
+       
        <state id="verticalprofile_mesh_area" description="verticalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultState">
            <queryID>area_filter</queryID>
            <dataname>areaid</dataname>
@@ -41,7 +99,7 @@
            <to state="verticalprofile_mesh"/>
        </transition>
        
-        <state id="verticalprofile_mesh_without_geom" description="timeseries_mesh_without_geom" state="de.intevation.gnv.state.DefaultState">
+        <state id="verticalprofile_mesh_without_geom" description="verticalprofile_mesh_without_geom" state="de.intevation.gnv.state.DefaultState">
             <queryID>verticalprofile_mesh</queryID>
             <dataname>meshid</dataname>
             <data-multiselect>false</data-multiselect>
@@ -52,10 +110,17 @@
             </inputvalues>
         </state>
        
-       <transition transition="de.intevation.gnv.transition.DefaultTransition">
-           <from state="verticalprofile_mesh_without_geom"/>
-           <to state="verticalprofile_mesh_coordinate"/>
-       </transition>
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalprofile_mesh_without_geom"/>
+            <to state="verticalprofile_mesh_coordinate"/>
+            <condition inputvalue="geometry" value="POINT" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalprofile_mesh_without_geom"/>
+            <to state="verticalprofile_mesh_point_presettings"/>
+            <condition inputvalue="geometry" value="POINT" operator="equal"/>
+        </transition>
        
        <state id="verticalprofile_mesh" description="verticalprofile_mesh" state="de.intevation.gnv.state.DefaultState">
            <queryID>verticalprofile_mesh_with_area</queryID>
@@ -69,10 +134,17 @@
            </inputvalues>
        </state>
        
-       <transition transition="de.intevation.gnv.transition.DefaultTransition">
-           <from state="verticalprofile_mesh"/>
-           <to state="verticalprofile_mesh_coordinate"/>
-       </transition>
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalprofile_mesh"/>
+            <to state="verticalprofile_mesh_coordinate"/>
+            <condition inputvalue="geometry" value="POINT" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalprofile_mesh"/>
+            <to state="verticalprofile_mesh_point_presettings"/>
+            <condition inputvalue="geometry" value="POINT" operator="equal"/>
+        </transition>
        
        <state id="verticalprofile_mesh_coordinate" description="verticalprofile_mesh_coordinate" state="de.intevation.gnv.state.SingleInputState">
            <dataname>mesh_coordinate</dataname>
@@ -99,6 +171,7 @@
                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                 <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
            </inputvalues>
+           <mesh-width xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="${artifacts.config.dir}/meshwidth.xml"/>
        </state>
        
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
@@ -138,15 +211,41 @@
                 <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/>
             </inputvalues>
         </state>
-        
+
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
            <from state="verticalprofile_mesh_maxdepth"/>
-           <to state="verticalprofile_meshpoint_parameter"/>
+           <to state="verticalprofile_meshpoint_vector_scalar"/>
         </transition>
-        
+
+        <state id="verticalprofile_meshpoint_vector_scalar" description="verticalprofile_meshpoint_vector_scalar" state="de.intevation.gnv.state.SwitchModeState">
+           <dataname>vectorscalar</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="0"/>
+                <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/>
+                <inputvalue name="vectorscalar" type="String" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+
+       <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="verticalprofile_meshpoint_vector_scalar"/>
+            <to state="verticalprofile_meshpoint_parameter"/>
+            <condition inputvalue="vectorscalar" value="scalar" operator="equal"/>
+         </transition>
+
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="verticalprofile_meshpoint_vector_scalar"/>
+            <to state="verticalprofile_meshpoint_parameter_vector"/>
+            <condition inputvalue="vectorscalar" value="vector" operator="equal"/>
+         </transition>
+
         <state id="verticalprofile_meshpoint_parameter" description="verticalprofile_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState">
            <queryID>verticalprofile_mesh_parameter</queryID>
            <dataname>parameterid</dataname>
+           <presettings-name>parameter</presettings-name>
            <data-multiselect>true</data-multiselect>
            <inputvalues>
                 <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
@@ -157,12 +256,72 @@
                 <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0" />
            </inputvalues>
        </state>
-       
+
+       <state id="verticalprofile_meshpoint_parameter_vector" description="verticalprofile_meshpoint_parameter" state="de.intevation.gnv.state.DefaultState">
+           <queryID>verticalprofile_mesh_parameter_vector</queryID>
+           <dataname>parameterid</dataname>
+           <presettings-name>parameter</presettings-name>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+                <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="0"/>
+                <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="0" />
+           </inputvalues>
+       </state>
+
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
            <from state="verticalprofile_meshpoint_parameter"/>
+           <to state="verticalprofile_mesh_year"/>
+        </transition>
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="verticalprofile_meshpoint_parameter_vector"/>
+           <to state="verticalprofile_mesh_year_vector"/>
+        </transition>
+
+       <state id="verticalprofile_mesh_year" description="verticalprofile_mesh_year" state="de.intevation.gnv.state.DefaultState">
+           <queryID>verticalprofile_mesh_year</queryID>
+           <dataname>yearid</dataname>
+           <data-multiselect>true</data-multiselect>
+           <inputvalues>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+               <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1" />
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="0"/>
+               <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/>
+           </inputvalues>
+       </state>
+
+       <state id="verticalprofile_mesh_year_vector" description="verticalprofile_mesh_year" state="de.intevation.gnv.state.DefaultState">
+           <queryID>verticalprofile_mesh_year_vector</queryID>
+           <dataname>yearid</dataname>
+           <data-multiselect>true</data-multiselect>
+           <inputvalues>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+               <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1" />
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="0"/>
+               <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/>
+           </inputvalues>
+       </state>
+       
+       <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="verticalprofile_mesh_year"/>
            <to state="verticalprofile_mesh_date"/>
         </transition>
-       
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="verticalprofile_mesh_year_vector"/>
+           <to state="verticalprofile_mesh_date_vector"/>
+        </transition>
+
        <state id="verticalprofile_mesh_date" description="verticalprofile_mesh_date" state="de.intevation.gnv.state.DefaultState">
            <queryID>verticalprofile_mesh_date</queryID>
            <dataname>dateid</dataname>
@@ -174,15 +333,37 @@
                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="0"/>
                <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/>
                <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0"/>
            </inputvalues>
        </state>
-       
+
+       <state id="verticalprofile_mesh_date_vector" description="verticalprofile_mesh_date" state="de.intevation.gnv.state.DefaultState">
+           <queryID>verticalprofile_mesh_date_vector</queryID>
+           <dataname>dateid</dataname>
+           <data-multiselect>false</data-multiselect>
+           <inputvalues>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="1"/>
+               <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="0"/>
+               <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1" />
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="0"/>
+               <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="0"/>
+               <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/>
+               <inputvalue name="dateid" type="Date" multiselect="false" usedinquery="0"/>
+           </inputvalues>
+       </state>
+
        <transition transition="de.intevation.gnv.transition.DefaultTransition">
            <from state="verticalprofile_mesh_date"/>
            <to state="verticalprofile_mesh_calculate_results"/>
         </transition>
-       
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+           <from state="verticalprofile_mesh_date_vector"/>
+           <to state="verticalprofile_mesh_calculate_results_vector"/>
+        </transition>
+
        <state id="verticalprofile_mesh_calculate_results" description="verticalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.vertical.VerticalProfileOutputState">
            <queryID>verticalprofile_mesh_chart_data</queryID>
            <queryID-odv>verticalprofile_mesh_odv_data</queryID-odv>
@@ -205,10 +386,76 @@
                    <parameters>
                        <inputvalue name="width" type="Integer" value="600"/>
                        <inputvalue name="height" type="Integer" value="400"/>
+                       <inputvalue name="points" type="Boolean" value="false"/>
                    </parameters>
+                   <exportModes>
+                       <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                       <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                       <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                   </exportModes>
                </outputsMode>
-               <outputsMode name="pdf" description="PDF-Export der Daten" mime-type="application/pdf"/>
-               <outputsMode name="svg" description="PDF-Export der Daten" mime-type="image/svg+xml"/>
+               <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
+               <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
+               <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
+               <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
+           </outputsModes>
+       </state>
+
+       <state id="verticalprofile_mesh_calculate_results_vector" description="verticalprofile_mesh_calculate_results" state="de.intevation.gnv.state.profile.vertical.VerticalProfileMeshVectorOutputState">
+           <queryID>verticalprofile_mesh_chart_data_vector</queryID>
+           <queryID-odv>verticalprofile_mesh_odv_data_vector</queryID-odv>
+           <inputvalues>
+               <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+               <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/>
+               <inputvalue name="meshid" type="Integer" multiselect="false" usedinquery="2"/>
+               <inputvalue name="mesh_point" type="Integer" multiselect="false" usedinquery="2"/> 
+               <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+               <inputvalue name="mindepthid" type="Double" multiselect="false" usedinquery="1"/>
+               <inputvalue name="maxdepthid" type="Double" multiselect="false" usedinquery="1"/>
+           </inputvalues>
+           <value-names>
+               <value-name name="feature" value="mesh_point"></value-name>
+               <value-name name="parameter" value="parameterid"></value-name>
+               <value-name name="measurement" value="dateid"></value-name>
+           </value-names>
+           <outputsModes>
+               <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
+                   <parameters>
+                       <inputvalue name="width" type="Integer" value="600"/>
+                       <inputvalue name="height" type="Integer" value="400"/>
+                       <inputvalue name="points" type="Boolean" value="false"/>
+                   </parameters>
+                   <exportModes>
+                       <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                       <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                       <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                   </exportModes>
+               </outputsMode>
+               <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                        <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                        <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                        <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
                <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
                <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
                <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
--- a/gnv-artifacts/doc/conf/products/verticalprofile/conf_timeseriespoint.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/products/verticalprofile/conf_timeseriespoint.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,45 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <artifact name="verticalProfile">
     <states>
+        <state id="verticalprofile_mapviewerswitch" description="verticalprofile_mesh_area_one" state="de.intevation.gnv.state.DefaultAutoResumeState">
+            <!-- Empty State which will be used to integrate the switch for a 
+                 standalone and an mapviewer based call. -->
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="0"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalprofile_mapviewerswitch"/>
+            <to state="verticalprofile_area"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="notequal"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.PresettingsValueCompareTransition">
+            <from state="verticalprofile_mapviewerswitch"/>
+            <to state="verticalprofile_with_wkt"/>
+            <condition inputvalue="geometry" value="POLYGON" operator="equal"/>
+        </transition>
+        
+        <state id="verticalprofile_with_wkt" description="verticalprofile_timeseriespoint" state="de.intevation.gnv.state.PreSettingsTransferState">
+            <queryID>timeseries_timeseriespoint_with_wkt</queryID>
+            <dataname>featureid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <presettings-transfer presetting="geometry" inputvalue="wktid"/>
+            <inputvalues>
+                <inputvalue name="sourceid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="wktid" type="Geometry" multiselect="false" usedinquery="1"/>
+                <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalprofile_with_wkt"/>
+            <to state="verticalprofile_vector_scalar"/>
+        </transition>
+        
         <state id="verticalprofile_area" description="verticalprofile_area_one" state="de.intevation.gnv.state.DefaultState">
             <queryID>area_filter</queryID>
             <dataname>areaid</dataname>
@@ -54,7 +93,7 @@
         
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="verticalprofile_without_geom"/>
-            <to state="verticalprofile_parameter"/>
+            <to state="verticalprofile_vector_scalar"/>
         </transition>
         
         <state id="verticalprofile_timeseriespoint" description="timeseries_timeseriespoint" state="de.intevation.gnv.state.DefaultState">
@@ -71,12 +110,35 @@
         
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="verticalprofile_timeseriespoint"/>
+            <to state="verticalprofile_vector_scalar"/>
+        </transition>
+
+        <state id="verticalprofile_vector_scalar" description="timeseries_vector_scalar" state="de.intevation.gnv.state.SwitchModeState">
+            <dataname>vectorscalar</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="featureid" type="Integer" multiselect="false"  usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="vectorscalar" type="String" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="verticalprofile_vector_scalar"/>
             <to state="verticalprofile_parameter"/>
-        </transition>
-        
+            <condition inputvalue="vectorscalar" value="scalar" operator="equal"/>
+         </transition>
+
+        <transition transition="de.intevation.gnv.transition.ValueCompareTransition">
+            <from state="verticalprofile_vector_scalar"/>
+            <to state="verticalprofile_parameter_vector"/>
+            <condition inputvalue="vectorscalar" value="vector" operator="equal"/>
+         </transition>
+
         <state id="verticalprofile_parameter" description="timeseries_parameter" state="de.intevation.gnv.state.DefaultState">
             <queryID>verticalprofile_parameter</queryID>
             <dataname>parameterid</dataname>
+            <presettings-name>parameter</presettings-name>
             <data-multiselect>true</data-multiselect>
             <inputvalues>
                 <inputvalue name="featureid" type="Integer" multiselect="false"  usedinquery="1"/>
@@ -84,11 +146,62 @@
                 <inputvalue name="parameterid" type="Integer" multiselect="true"  usedinquery="0"/>
             </inputvalues>
         </state>
+
+        <state id="verticalprofile_parameter_vector" description="timeseries_parameter" state="de.intevation.gnv.state.DefaultState">
+            <queryID>verticalprofile_parameter_vector</queryID>
+            <dataname>parameterid</dataname>
+            <presettings-name>parameter</presettings-name>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="featureid" type="Integer" multiselect="false"  usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="false"  usedinquery="0"/>
+            </inputvalues>
+        </state>
         
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="verticalprofile_parameter"/>
+            <to state="verticalprofile_year"/>
+        </transition>
+        
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalprofile_parameter_vector"/>
+            <to state="verticalprofile_year_vector"/>
+        </transition>
+        
+         <state id="verticalprofile_year" description="verticalprofile_year" state="de.intevation.gnv.state.DefaultState">
+            <queryID>verticalprofile_year</queryID>
+            <dataname>yearid</dataname>
+            <data-multiselect>true</data-multiselect>
+            <inputvalues>
+                <inputvalue name="featureid" type="Integer" multiselect="false"  usedinquery="1"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
+        <state id="verticalprofile_year_vector" description="verticalprofile_year" state="de.intevation.gnv.state.DefaultState">
+            <queryID>verticalprofile_year_vector</queryID>
+            <dataname>yearid</dataname>
+            <data-multiselect>true</data-multiselect>
+            <inputvalues>
+                <inputvalue name="featureid" type="Integer" multiselect="false"  usedinquery="1"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="yearid" type="String" multiselect="true" usedinquery="0"/>
+            </inputvalues>
+        </state>
+        
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalprofile_year"/>
             <to state="verticalprofile_date"/>
         </transition>
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalprofile_year_vector"/>
+            <to state="verticalprofile_date_vector"/>
+        </transition>
         
         <state id="verticalprofile_date" description="verticalprofile_date" state="de.intevation.gnv.state.DefaultState">
             <queryID>verticalprofile_date</queryID>
@@ -97,16 +210,35 @@
             <inputvalues>
                 <inputvalue name="featureid" type="Integer" multiselect="false"  usedinquery="1"/>
                 <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+                 <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/>
                 <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
                 <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="0"/>
             </inputvalues>
         </state>
+
+        <state id="verticalprofile_date_vector" description="verticalprofile_date" state="de.intevation.gnv.state.DefaultState">
+            <queryID>verticalprofile_date_vector</queryID>
+            <dataname>dateid</dataname>
+            <data-multiselect>false</data-multiselect>
+            <inputvalues>
+                <inputvalue name="featureid" type="Integer" multiselect="false"  usedinquery="1"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+                 <inputvalue name="yearid" type="String" multiselect="true" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="dateid" type="Date" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
         
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="verticalprofile_date"/>
             <to state="verticalprofile_minmaxdepth"/>
         </transition>
-        
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalprofile_date_vector"/>
+            <to state="verticalprofile_minmaxdepth_vector"/>
+        </transition>
+
         <state id="verticalprofile_minmaxdepth" description="verticalprofile_minmaxdepth" state="de.intevation.gnv.state.MinMaxState">
             <queryID>verticalprofile_minmaxdepth</queryID>
             <dataname>depthrange</dataname>
@@ -120,12 +252,31 @@
                 <inputvalue name="maxvalue" type="Double" multiselect="false" usedinquery="0"/>
             </inputvalues>
         </state>
-        
+
+        <state id="verticalprofile_minmaxdepth_vector" description="verticalprofile_minmaxdepth" state="de.intevation.gnv.state.MinMaxState">
+            <queryID>verticalprofile_minmaxdepth_vector</queryID>
+            <dataname>depthrange</dataname>
+            <data-multiselect>true</data-multiselect>
+            <inputvalues>
+                <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/>
+                <inputvalue name="minvalue" type="Double" multiselect="false" usedinquery="0"/>
+                <inputvalue name="maxvalue" type="Double" multiselect="false" usedinquery="0"/>
+            </inputvalues>
+        </state>
+
         <transition transition="de.intevation.gnv.transition.DefaultTransition">
             <from state="verticalprofile_minmaxdepth"/>
             <to state="verticalprofile_calculate_results"/>
         </transition>
-        
+
+        <transition transition="de.intevation.gnv.transition.DefaultTransition">
+            <from state="verticalprofile_minmaxdepth_vector"/>
+            <to state="verticalprofile_calculate_results_vector"/>
+        </transition>
+
         <state id="verticalprofile_calculate_results" description="verticalprofile_calculate_results" state="de.intevation.gnv.state.profile.vertical.VerticalProfileOutputState">
             <queryID>verticalprofile_chart_data</queryID>
             <queryID-odv>verticalprofile_odv_data</queryID-odv>
@@ -147,10 +298,75 @@
                     <parameters>
                         <inputvalue name="width" type="Integer" value="600"/>
                         <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="points" type="Boolean" value="false"/>
                     </parameters>
+                    <exportModes>
+                       <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                       <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                       <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
                 </outputsMode>
-                <outputsMode name="pdf" description="PDF-Export der Daten" mime-type="application/pdf"/>
-                <outputsMode name="svg" description="PDF-Export der Daten" mime-type="image/svg+xml"/>
+                <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                       <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                       <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                       <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
+                <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
+                <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
+                <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
+            </outputsModes>
+        </state>
+
+        <state id="verticalprofile_calculate_results_vector" description="verticalprofile_calculate_results" state="de.intevation.gnv.state.profile.vertical.VerticalProfileVectorOutputState">
+            <queryID>verticalprofile_chart_data_vector</queryID>
+            <queryID-odv>verticalprofile_odv_data_vector</queryID-odv>
+            <inputvalues>
+                <inputvalue name="featureid" type="Integer" multiselect="false" usedinquery="1"/>
+                <inputvalue name="parameterid" type="Integer" multiselect="true" usedinquery="1"/>
+                <inputvalue name="dateid" type="Date" multiselect="true" usedinquery="1"/>
+                <inputvalue name="fisname" type="String" multiselect="false" usedinquery="0"/>
+                <inputvalue name="minvalue" type="Double" multiselect="false" usedinquery="1"/>
+                <inputvalue name="maxvalue" type="Double" multiselect="false" usedinquery="1"/>
+            </inputvalues>
+            <value-names>
+                <value-name name="feature" value="featureid"></value-name>
+                <value-name name="parameter" value="parameterid"></value-name>
+                <value-name name="measurement" value="dateid"></value-name>
+            </value-names>
+            <outputsModes>
+                <outputsMode name="chart" description="Chartrepresentation of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="points" type="Boolean" value="false"/>
+                    </parameters>
+                    <exportModes>
+                       <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                       <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                       <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
+                <outputsMode name="histogram" description="Histogram of the Values" mime-type="image/png">
+                    <parameters>
+                        <inputvalue name="width" type="Integer" value="600"/>
+                        <inputvalue name="height" type="Integer" value="400"/>
+                        <inputvalue name="bincount" type="Integer" value="7"/>
+                        <inputvalue name="binwidth" type="Double" value="7"/>
+                    </parameters>
+                    <exportModes>
+                       <export name="img" description="IMG-Export der Daten" mime-type="image/png" />
+                       <export name="pdf" description="PDF-Export der Daten" mime-type="application/pdf" />
+                       <export name="svg" description="SVG-Export der Daten" mime-type="image/svg+xml" />
+                    </exportModes>
+                </outputsMode>
                 <outputsMode name="csv" description="CSV-Export der Daten" mime-type="text/plain"/>
                 <outputsMode name="odv" description="ODV-Export der Daten" mime-type="text/plain"/>
                 <outputsMode name="statistics" description="Statistik zu den Daten" mime-type="text/xml"/>
--- a/gnv-artifacts/doc/conf/queries.properties	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/doc/conf/queries.properties	Fri Sep 28 12:15:18 2012 +0200
@@ -28,6 +28,16 @@
                       )\
     ORDER BY MEDIAN.TIMESERIESPOINT.NAME
 
+timeseries_timeseriespoint_with_wkt=SELECT \
+        MEDIAN.TIMESERIESPOINT.FEATUREID KEY, \
+        MEDIAN.TIMESERIESPOINT.NAME VALUE \
+    FROM MEDIAN.TIMESERIESPOINT, \
+         MEDIAN.MEASUREMENT MMT \
+    WHERE MEDIAN.TIMESERIESPOINT.FEATUREID =  MMT.FEATUREID AND \
+          MMT.SOURCEID = ? AND \
+          INTERSECTS(SHAPE,"?")\
+    ORDER BY MEDIAN.TIMESERIESPOINT.NAME
+
 timeseries_parameter=SELECT DISTINCT \
         p.PARAMETERID KEY, \
         p.GERMANNAME || '  ['|| p.UNIT ||']' VALUE, \
@@ -46,7 +56,8 @@
     
 timeseries_depth_height=SELECT DISTINCT \
         M.MEASUREMENTID KEY, \
-        M.ZLOCATION VALUE \
+        M.ZLOCATION VALUE, \
+        P.PARAMETERID PARAMETERID \
     FROM MEDIAN.MEASUREMENT M, \
          MEDIAN.TIMESERIESVALUE TSV, \
          MEDIAN.TIMESERIES T, \
@@ -94,7 +105,8 @@
             TSV.DATAVALUE, \
             TS.PARAMETERID PARAMETER, \
             TSV.MEASUREMENTID, \
-            TSV.TIMESERIESID \
+            TSV.TIMESERIESID, \
+            '1' QF \
      FROM MEDIAN.TIMESERIESPOINT, \
           MEDIAN.TIMESERIESVALUE TSV, \
           MEDIAN.TIMESERIES TS, \
@@ -108,12 +120,114 @@
            TSV.MEASUREMENTID IN ( ? ) AND \
            TSV.TIMEVALUE >= ? AND \
            TSV.TIMEVALUE <= ? \
-     ORDER BY TSV.MEASUREMENTID, \
+     ORDER BY TS.PARAMETERID, \
+              TSV.MEASUREMENTID, \
               TSV.TIMESERIESID, \
-              TS.PARAMETERID, \
+              TSV.TIMEVALUE
+              
+#############################################
+#############################################
+##########     Zeitserie       ##############
+##########    Vektordaten     ###############
+#############################################
+#############################################
+
+timeseries_parameter_vector=SELECT DISTINCT \
+        p.PARAMETERID KEY, \
+        p.GERMANNAME || '  ['|| p.UNIT ||']' VALUE, \
+        p.GERMANNAME \
+    FROM MEDIAN.PARAMETER P, \
+         MEDIAN.TIMESERIES TS, \
+         MEDIAN.TIMESERIESVECTORVALUE TSV, \
+         MEDIAN.MEASUREMENT M, \
+         MEDIAN.TIMESERIESPOINT TSP \
+    WHERE M.FEATUREID = TSP.FEATUREID AND \
+          M.MEASUREMENTID = TSV.MEASUREMENTID AND \
+          TS.TIMESERIESID = TSV.TIMESERIESID AND \
+          P.PARAMETERID = TS.PARAMETERID AND \
+          TSP.FEATUREID = ? \
+    ORDER BY P.GERMANNAME
+    
+timeseries_depth_height_vector=SELECT DISTINCT \
+        M.MEASUREMENTID KEY, \
+        M.ZLOCATION VALUE, \
+        P.PARAMETERID PARAMETERID \
+    FROM MEDIAN.MEASUREMENT M, \
+         MEDIAN.TIMESERIESVECTORVALUE TSV, \
+         MEDIAN.TIMESERIES T, \
+         MEDIAN.PARAMETER P \
+    WHERE M.MEASUREMENTID = TSV.MEASUREMENTID AND \
+          TSV.TIMESERIESID = T.TIMESERIESID AND \
+          T.PARAMETERID = P.PARAMETERID AND \
+          M.FEATUREID = ? AND \
+          P.PARAMETERID = ? \
+    ORDER BY m.ZLOCATION DESC
+
+timeseries_interval_vector=select min(tsv.TIMEVALUE) MIN, \
+        max(tsv.TIMEVALUE) MAX \
+    from MEDIAN.TIMESERIES t, \
+         MEDIAN.TIMESERIESVECTORVALUE tsv \
+    where tsv.TIMESERIESID = t.TIMESERIESID AND \
+          t.PARAMETERID = ? AND \
+          tsv.MEASUREMENTID = ?
+
+timeseries_chart_data_vector=SELECT tsv.TIMEVALUE XORDINATE, \
+        tsv.XCOMPONENT, \
+        tsv.YCOMPONENT, \
+        tsv.ZCOMPONENT, \
+        tsv.SPEED, \
+        tsv.DIRECTION, \
+        t.PARAMETERID GROUP1, \
+        tsv.MEASUREMENTID GROUP2, \
+        tsv.TIMESERIESID GROUP3, \
+        t.TIMEINTERVAL GAPID \
+    FROM MEDIAN.TIMESERIESFULLVECTORVALUE tsv, \
+         MEDIAN.TIMESERIES t \
+    WHERE tsv.TIMESERIESID = t.TIMESERIESID AND \
+          t.PARAMETERID = ? AND \
+          tsv.MEASUREMENTID = ? AND \
+          tsv.TIMEVALUE >= ? AND \
+          tsv.TIMEVALUE <= ? \
+    ORDER BY tsv.MEASUREMENTID, \
+             tsv.TIMESERIESID, \
+             t.PARAMETERID, \
+             tsv.TIMEVALUE
+
+timeseries_odv_data_vector = SELECT SI.NAME CRUISE, \
+            MEDIAN.TIMESERIESPOINT.NAME STATION, \
+            '*' TYPE, \
+            ST_ASTEXT(SHAPE), \
+            0 BOTDEPTH, \
+            (M.ZLOCATION *-1) DEPTH, \
+            TSV.TIMEVALUE, \
+            TSV.XCOMPONENT, \
+            TSV.YCOMPONENT, \
+            TSV.ZCOMPONENT, \
+            TSV.SPEED, \
+            TSV.DIRECTION, \
+            TS.PARAMETERID PARAMETER, \
+            TSV.MEASUREMENTID, \
+            TSV.TIMESERIESID, \
+            '1' QF \
+     FROM MEDIAN.TIMESERIESPOINT, \
+          MEDIAN.TIMESERIESFULLVECTORVALUE TSV, \
+          MEDIAN.TIMESERIES TS, \
+          MEDIAN.MEASUREMENT M, \
+          MEDIAN.SOURCEINFO SI \
+     WHERE SI.SOURCEID = M.SOURCEID AND \
+           M.FEATUREID = MEDIAN.TIMESERIESPOINT.FEATUREID AND \
+           M.MEASUREMENTID = TSV.MEASUREMENTID AND \
+           TSV.TIMESERIESID = TS.TIMESERIESID AND \
+           TS.PARAMETERID = ?  AND \
+           TSV.MEASUREMENTID = ? AND \
+           TSV.TIMEVALUE >= ? AND \
+           TSV.TIMEVALUE <= ? \
+     ORDER BY TS.PARAMETERID, \
+              TSV.MEASUREMENTID, \
+              TSV.TIMESERIESID, \
               TSV.TIMEVALUE
 
-#############################################
+############################################
 #############################################
 ##########   Zeitserie Mesh    ##############
 #############################################
@@ -153,8 +267,9 @@
     from MEDIAN.PARAMETER p, \
          MEDIAN.MESHSCALARVALUE msc, \
          MEDIAN.MESH m \
-    where m.OBJECTID = ? AND \
-          msc.PARTID = m.PARTIDMIN AND \
+   where m.OBJECTID = ? AND \
+          msc.PARTID >= m.PARTIDMIN AND \
+          msc.PARTID <= m.PARTIDMAX AND \
           msc.PARAMETERID = p.PARAMETERID \
     order by p.GERMANNAME
 timeseries_mesh_interval=select /*+ parallel(TIMEVALUE,5) */ \
@@ -199,7 +314,8 @@
         (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)*-1) DEPTH, \
         msv.TIMEVALUE, \
         msv.DATAVALUE, \
-        msv.PARAMETERID PARAMETER \
+        msv.PARAMETERID PARAMETER, \
+        '1' QF \
     from MEDIAN.MESHSCALARVALUE msv, \
          MEDIAN.MESHPOINT, \
          MEDIAN.MESH m, \
@@ -218,9 +334,101 @@
           msv.TIMEVALUE <= ? \
     order by MEDIAN.MESHPOINT.FEATUREID, \
              msv.FEATUREID, \
-             msv.PARAMETERID, \
-             msv.TIMEVALUE
+             msv.TIMEVALUE, \
+             msv.PARAMETERID
 
+#############################################
+#############################################
+##########   Zeitserie Mesh    ##############
+##########     Vektordaten     ##############
+#############################################
+#############################################
+
+timeseries_mesh_parameter_vector=SELECT DISTINCT \
+        P.PARAMETERID KEY, \
+        P.GERMANNAME || '  ['|| P.UNIT ||']' VALUE, \
+        P.GERMANNAME \
+    FROM MEDIAN.PARAMETER P, \
+         MEDIAN.MESHVECTORVALUE MVV, \
+         MEDIAN.MESH M \
+   WHERE M.OBJECTID = ? AND \
+          MVV.PARTID >= M.PARTIDMIN AND \
+          MVV.PARTID <= M.PARTIDMAX AND \
+          MVV.PARAMETERID = P.PARAMETERID \
+    ORDER BY P.GERMANNAME
+
+timeseries_mesh_interval_vector=SELECT /*+ parallel(TIMEVALUE,5) */ \
+        MIN(TIMEVALUE) MIN, \
+        MAX(TIMEVALUE) MAX \
+    FROM MEDIAN.MESHVECTORVALUE MVV, \
+         MEDIAN.MESH M \
+    WHERE M.OBJECTID = ? AND \
+          MVV.PARTID >= M.PARTIDMIN AND \
+          MVV.PARTID <= M.PARTIDMAX AND \
+          MVV.PARAMETERID IN (?)
+
+timeseries_mesh_chart_data_vector =SELECT /*+ parallel(TIMEVALUE,10) */ \
+        MVV.TIMEVALUE XORDINATE, \
+        MVV.XCOMPONENT, \
+        MVV.YCOMPONENT, \
+        MVV.ZCOMPONENT, \
+        MVV.SPEED, \
+        MVV.DIRECTION, \
+        MVV.PARAMETERID GROUP1, \
+        MVV.FEATUREID GROUP2, \
+        MP.FEATUREID GROUP3, \
+        -1 GAPID \
+    FROM MEDIAN.MESHCURRENTVALUE MVV, \
+         MEDIAN.MESHPOINT MP, \
+         MEDIAN.MESH M \
+    WHERE (M.OBJECTID = ? AND \
+           MVV.PARTID >= M.PARTIDMIN AND \
+           MVV.PARTID <= M.PARTIDMAX ) AND \
+          MVV.FEATUREID = MP.FEATUREID AND \
+          MVV.PARAMETERID in ( ? ) AND \
+          MP.FEATUREID in ( ? ) AND \
+          MVV.TIMEVALUE >= ? AND \
+          MVV.TIMEVALUE <= ? \
+    ORDER BY MP.FEATUREID, \
+             MVV.FEATUREID, \
+             MVV.PARAMETERID, \
+             MVV.TIMEVALUE
+
+timeseries_mesh_odv_data_vector = SELECT /*+ parallel(timevalue,10) */ \
+        SI.NAME CRUISE, \
+        M.MESHID || '-' || MEDIAN.MESHPOINT.IPOSITION || '-' || MEDIAN.MESHPOINT.JPOSITION STATION, \
+        '*' TYPE, \
+        ST_ASTEXT(SHAPE), \
+        0 BOTDEPTH, \
+        (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)*-1) DEPTH, \
+        MVV.TIMEVALUE, \
+        MVV.XCOMPONENT, \
+        MVV.YCOMPONENT, \
+        MVV.ZCOMPONENT, \
+        MVV.SPEED, \
+        MVV.DIRECTION, \
+        MVV.PARAMETERID PARAMETER, \
+        '1' QF \
+    FROM MEDIAN.MESHCURRENTVALUE MVV, \
+         MEDIAN.MESHPOINT, \
+         MEDIAN.MESH M, \
+         MEDIAN.SOURCEINFO SI, \
+         MEDIAN.MESHLAYER ML \
+    WHERE (M.OBJECTID = ? AND \
+           MVV.PARTID >= M.PARTIDMIN AND \
+           MVV.PARTID <= M.PARTIDMAX ) AND \
+          M.SOURCEID = SI.SOURCEID AND \
+          ML.MESHID = MEDIAN.MESHPOINT.MESHID AND \
+          ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION AND \
+          MVV.FEATUREID = MEDIAN.MESHPOINT.FEATUREID AND \
+          MVV.PARAMETERID in (? ) AND \
+          MEDIAN.MESHPOINT.FEATUREID in ( ? ) AND \
+          MVV.TIMEVALUE >= ? AND \
+          MVV.TIMEVALUE <= ? \
+    ORDER BY MEDIAN.MESHPOINT.FEATUREID, \
+             MVV.FEATUREID, \
+             MVV.TIMEVALUE, \
+             MVV.PARAMETERID
 
 #############################################
 #############################################
@@ -261,6 +469,19 @@
           M.FEATUREID = ? and \
           TS.PARAMETERID IN ( ? )
           
+          
+verticalprofile_year=select distinct \
+        to_char(tsv.TIMEVALUE,'YYYY') KEY, \
+        to_char(tsv.TIMEVALUE,'YYYY') VALUE \
+    from MEDIAN.TIMESERIES ts, \
+         MEDIAN.TIMESERIESVALUE tsv, \
+         MEDIAN.MEASUREMENT m \
+    where ts.TIMESERIESID = tsv.TIMESERIESID and \
+          m.MEASUREMENTID = tsv.MEASUREMENTID and \
+          m.FEATUREID = ? and \
+          ts.PARAMETERID IN ( ? ) \
+    order by to_char(tsv.TIMEVALUE,'YYYY')
+          
 verticalprofile_date=select distinct \
            tsv.TIMEVALUE KEY, \
            tsv.TIMEVALUE VALUE \
@@ -270,7 +491,8 @@
     where ts.TIMESERIESID = tsv.TIMESERIESID and \
           m.MEASUREMENTID = tsv.MEASUREMENTID and \
           m.FEATUREID = ? and \
-          ts.PARAMETERID IN ( ? ) \
+          ts.PARAMETERID IN ( ? ) and \
+          to_char(tsv.TIMEVALUE,'YYYY') IN (?) \
     order by tsv.TIMEVALUE 
 
 verticalprofile_chart_data= SELECT M.ZLOCATION XORDINATE, \
@@ -278,7 +500,9 @@
            TS.PARAMETERID GROUP1, \
            TSV.TIMEVALUE GROUP2, \
            1 GROUP3, \
-           1 DATAID \
+           1 DATAID, \
+           M.FEATUREID, \
+           TS.TIMESERIESID \
     from MEDIAN.TIMESERIES TS, \
          MEDIAN.TIMESERIESVALUE TSV, \
          MEDIAN.MEASUREMENT M \
@@ -299,12 +523,13 @@
             '*' TYPE, \
             ST_ASTEXT(SHAPE), \
             0 BOTDEPTH, \
-            (M.ZLOCATION *-1) DEPTH, \
+            (M.ZLOCATION) DEPTH, \
             TSV.TIMEVALUE, \
             TSV.DATAVALUE, \
             TS.PARAMETERID PARAMETER, \
             TSV.MEASUREMENTID, \
-            TSV.TIMESERIESID \
+            TSV.TIMESERIESID, \
+            '1' QF \
      FROM MEDIAN.TIMESERIESPOINT, \
           MEDIAN.TIMESERIESVALUE TSV, \
           MEDIAN.TIMESERIES TS, \
@@ -321,9 +546,127 @@
            M.ZLOCATION <= ? \
      ORDER BY TSV.MEASUREMENTID, \
               TSV.TIMESERIESID, \
-              TS.PARAMETERID, \
-              TSV.TIMEVALUE
-             
+              TSV.TIMEVALUE, \
+              TS.PARAMETERID
+
+#############################################
+#############################################
+##########   Vertikalprofil    ##############
+##########     Vektordaten     ##############
+#############################################
+#############################################
+
+verticalprofile_parameter_vector=SELECT DISTINCT \
+           P.PARAMETERID KEY, \
+           P.GERMANNAME || '  ['|| P.UNIT ||']' VALUE, \
+           P.GERMANNAME \
+    from MEDIAN.PARAMETER P, \
+           MEDIAN.TIMESERIES TS, \
+           MEDIAN.TIMESERIESVECTORVALUE TVV, \
+           MEDIAN.MEASUREMENT M \
+    where TS.PARAMETERID = P.PARAMETERID AND \
+          TS.TIMESERIESID = TVV.TIMESERIESID AND \
+          M.MEASUREMENTID = TVV.MEASUREMENTID AND \
+          M.FEATUREID = ? \
+    ORDER BY P.GERMANNAME
+
+verticalprofile_minmaxdepth_vector= SELECT MIN(M.ZLOCATION) MIN, \
+           MAX(M.ZLOCATION) MAX \
+    FROM MEDIAN.MEASUREMENT M, \
+         MEDIAN.TIMESERIES TS, \
+         MEDIAN.TIMESERIESVECTORVALUE TVV \
+    WHERE TS.TIMESERIESID = TVV.TIMESERIESID AND \
+          M.MEASUREMENTID = TVV.MEASUREMENTID AND \
+          M.FEATUREID = ? AND \
+          TS.PARAMETERID = ? 
+
+verticalprofile_year_vector=SELECT DISTINCT \
+        TO_CHAR(TVV.TIMEVALUE,'YYYY') KEY, \
+        TO_CHAR(TVV.TIMEVALUE,'YYYY') VALUE \
+    FROM MEDIAN.TIMESERIES TS, \
+         MEDIAN.TIMESERIESVECTORVALUE TVV, \
+         MEDIAN.MEASUREMENT M \
+    WHERE TS.TIMESERIESID = TVV.TIMESERIESID AND \
+          M.MEASUREMENTID = TVV.MEASUREMENTID AND \
+          M.FEATUREID = ? AND \
+          TS.PARAMETERID = ? \
+    ORDER BY to_char(TVV.TIMEVALUE,'YYYY')
+
+verticalprofile_date_vector=SELECT DISTINCT \
+           TVV.TIMEVALUE KEY, \
+           TVV.TIMEVALUE VALUE \
+    from MEDIAN.TIMESERIES TS, \
+         MEDIAN.TIMESERIESVECTORVALUE TVV, \
+         MEDIAN.MEASUREMENT M \
+    WHERE TS.TIMESERIESID = TVV.TIMESERIESID AND \
+          M.MEASUREMENTID = TVV.MEASUREMENTID AND \
+          M.FEATUREID = ? AND \
+          TS.PARAMETERID = ? AND \
+          TO_CHAR(TVV.TIMEVALUE,'YYYY') IN (?) \
+    ORDER BY TVV.TIMEVALUE 
+
+verticalprofile_chart_data_vector= SELECT M.ZLOCATION XORDINATE, \
+           TS.PARAMETERID GROUP1, \
+           TVV.TIMEVALUE GROUP2, \
+           TVV.XCOMPONENT, \
+           TVV.YCOMPONENT, \
+           TVV.ZCOMPONENT, \
+           TVV.SPEED, \
+           TVV.DIRECTION, \
+           1 GROUP3, \
+           1 DATAID, \
+           M.FEATUREID, \
+           TS.TIMESERIESID \
+    FROM MEDIAN.TIMESERIES TS, \
+         MEDIAN.TIMESERIESFULLVECTORVALUE TVV, \
+         MEDIAN.MEASUREMENT M \
+    WHERE TS.TIMESERIESID = TVV.TIMESERIESID AND \
+          M.MEASUREMENTID = TVV.MEASUREMENTID AND \
+          M.FEATUREID = ? AND \
+          TS.PARAMETERID = ? AND \
+          TVV.TIMEVALUE = ? AND \
+          M.ZLOCATION >= ? AND \
+          M.ZLOCATION <= ? \
+    ORDER BY TVV.TIMEVALUE, \
+             TVV.TIMESERIESID, \
+             TS.PARAMETERID, \
+             TVV.TIMEVALUE
+
+verticalprofile_odv_data_vector = SELECT SI.NAME CRUISE, \
+            MEDIAN.TIMESERIESPOINT.NAME STATION, \
+            '*' TYPE, \
+            ST_ASTEXT(SHAPE), \
+            0 BOTDEPTH, \
+            (M.ZLOCATION) DEPTH, \
+            TVV.TIMEVALUE, \
+            TVV.XCOMPONENT, \
+            TVV.YCOMPONENT, \
+            TVV.ZCOMPONENT, \
+            TVV.SPEED, \
+            TVV.DIRECTION, \
+            TS.PARAMETERID PARAMETER, \
+            TVV.MEASUREMENTID, \
+            TVV.TIMESERIESID, \
+            '1' QF \
+     FROM MEDIAN.TIMESERIESPOINT, \
+           MEDIAN.TIMESERIESFULLVECTORVALUE TVV, \
+          MEDIAN.TIMESERIES TS, \
+          MEDIAN.MEASUREMENT M, \
+          MEDIAN.SOURCEINFO SI \
+     WHERE SI.SOURCEID = M.SOURCEID AND \
+           M.FEATUREID = MEDIAN.TIMESERIESPOINT.FEATUREID AND \
+           M.MEASUREMENTID = TVV.MEASUREMENTID AND \
+           TVV.TIMESERIESID = TS.TIMESERIESID AND \
+           M.FEATUREID = ? AND \
+           TS.PARAMETERID = ? AND \
+           TVV.TIMEVALUE = ? AND \
+           M.ZLOCATION >= ? AND \
+           M.ZLOCATION <= ? \
+     ORDER BY TVV.MEASUREMENTID, \
+              TVV.TIMESERIESID, \
+              TVV.TIMEVALUE, \
+              TS.PARAMETERID
+
 #############################################
 #############################################
 ########## Vertikalprofil Mesh ##############
@@ -349,6 +692,15 @@
                               FEATURECODE = ? )\
                       ) \
      order by M.NAME
+     
+verticalprofile_mesh_with_wkt = SELECT M.OBJECTID KEY, \
+         M.NAME VALUE \
+     FROM MEDIAN.MESHPOINT, \
+          MEDIAN.MESH M \
+     WHERE M.SOURCEID IN (?) AND \
+           M.MESHID = MEDIAN.MESHPOINT.MESHID AND \
+           INTERSECTS(SHAPE, "?") \
+     order by M.NAME
     
 verticalprofile_mesh_point = SELECT FEATUREID, \
         ST_ASTEXT(SHAPE) \
@@ -395,9 +747,21 @@
          MEDIAN.MESHSCALARVALUE msc, \
          MEDIAN.MESH m  \
     where m.OBJECTID = ? AND \
-          m.PARTIDMIN = msc.PARTID AND \
+          msc.PARTID >= m.PARTIDMIN AND \
+          msc.PARTID <= m.PARTIDMAX AND \
           msc.PARAMETERID = p.PARAMETERID \
     order by p.GERMANNAME
+
+verticalprofile_mesh_year= select  distinct \
+        to_char(msv.TIMEVALUE,'YYYY') KEY, \
+        to_char(msv.TIMEVALUE,'YYYY') VALUE \
+    from MEDIAN.MESHSCALARVALUE msv, \
+         MEDIAN.MESH m \
+    where m.OBJECTID = ?  AND \
+          msv.PARTID >= m.PARTIDMIN AND \
+          msv.PARTID <= m.PARTIDMAX AND \
+          msv.PARAMETERID in (?) \
+    order by to_char(msv.TIMEVALUE, 'YYYY')
           
 verticalprofile_mesh_date= select  distinct \
         msv.TIMEVALUE KEY, \
@@ -407,7 +771,8 @@
     where m.OBJECTID = ?  AND \
           msv.PARTID >= m.PARTIDMIN AND \
           msv.PARTID <= m.PARTIDMAX AND \
-          msv.PARAMETERID in (?) \
+          msv.PARAMETERID in (?) AND \
+          to_char(msv.TIMEVALUE,'YYYY') in (?) \
     order by msv.TIMEVALUE
 
 verticalprofile_mesh_chart_data=select ml.UPPERZLOCATION XORDINATE, \
@@ -416,7 +781,9 @@
            msv.PARAMETERID GROUP1, \
            msv.TIMEVALUE GROUP2, \
            1 GROUP3, \
-           2 DATAID \
+           2 DATAID, \
+           MP.FEATUREID, \
+           MP.MESHID \
     from MEDIAN.MESHLAYER ml, \
          MEDIAN.MESHPOINT mp, \
          MEDIAN.MESH m, \
@@ -449,10 +816,11 @@
         '*' TYPE, \
         ST_ASTEXT(SHAPE), \
         0 BOTDEPTH, \
-        (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)*-1) DEPTH, \
+        (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)) DEPTH, \
         msv.DATAVALUE, \
         msv.PARAMETERID PARAMETER, \
-        msv.TIMEVALUE \
+        msv.TIMEVALUE , \
+        '1' QF \
     from MEDIAN.MESHLAYER ml, \
          MEDIAN.MESHPOINT, \
          MEDIAN.MESH m, \
@@ -478,10 +846,136 @@
                                   JPOSITION = (select JPOSITION from MEDIAN.MESHPOINT where FEATUREID = ?)) AND \
           MEDIAN.MESHPOINT.KPOSITION <= ? AND \
           MEDIAN.MESHPOINT.KPOSITION >= ? \
-    order by msv.PARAMETERID, \
-             msv.TIMEVALUE, \
-             ml.UPPERZLOCATION
+    order by msv.TIMEVALUE, \
+             ml.UPPERZLOCATION, \
+             msv.PARAMETERID
+
+#############################################
+#############################################
+########## Vertikalprofil Mesh ##############
+##########     Vektordaten     ##############
+#############################################
+#############################################
+
+verticalprofile_mesh_parameter_vector=SELECT DISTINCT \
+        P.PARAMETERID KEY, \
+        P.GERMANNAME || '  ['|| P.UNIT ||']' VALUE, \
+        P.GERMANNAME \
+    FROM MEDIAN.PARAMETER P, \
+         MEDIAN.MESHVECTORVALUE MVV, \
+         MEDIAN.MESH M  \
+    WHERE M.OBJECTID = ? AND \
+          MVV.PARTID >= M.PARTIDMIN AND \
+          MVV.PARTID <= M.PARTIDMAX AND \
+          MVV.PARAMETERID = P.PARAMETERID \
+    ORDER BY P.GERMANNAME
+
+verticalprofile_mesh_year_vector= SELECT DISTINCT \
+        to_char(MVV.TIMEVALUE,'YYYY') KEY, \
+        to_char(MVV.TIMEVALUE,'YYYY') VALUE \
+    FROM MEDIAN.MESHVECTORVALUE MVV, \
+         MEDIAN.MESH M \
+    WHERE M.OBJECTID = ?  AND \
+          MVV.PARTID >= M.PARTIDMIN AND \
+          MVV.PARTID <= M.PARTIDMAX AND \
+          MVV.PARAMETERID in (?) \
+    ORDER BY to_char(MVV.TIMEVALUE, 'YYYY')
+          
+verticalprofile_mesh_date_vector= SELECT DISTINCT \
+        MVV.TIMEVALUE KEY, \
+        MVV.TIMEVALUE VALUE \
+    FROM MEDIAN.MESHVECTORVALUE MVV, \
+         MEDIAN.MESH M \
+    WHERE M.OBJECTID = ?  AND \
+          MVV.PARTID >= M.PARTIDMIN AND \
+          MVV.PARTID <= M.PARTIDMAX AND \
+          MVV.PARAMETERID in (?) AND \
+          to_char(MVV.TIMEVALUE,'YYYY') in (?) \
+    ORDER BY MVV.TIMEVALUE
+
+verticalprofile_mesh_chart_data_vector=SELECT ML.UPPERZLOCATION XORDINATE, \
+           MP.KPOSITION KPOSITION, \
+           MVV.XCOMPONENT, \
+           MVV.YCOMPONENT, \
+           MVV.ZCOMPONENT, \
+           MVV.SPEED, \
+           MVV.DIRECTION, \
+           MVV.PARAMETERID GROUP1, \
+           MVV.TIMEVALUE GROUP2, \
+           1 GROUP3, \
+           2 DATAID, \
+           MP.FEATUREID, \
+           MP.MESHID \
+    from MEDIAN.MESHLAYER ML, \
+         MEDIAN.MESHPOINT MP, \
+         MEDIAN.MESH M, \
+         MEDIAN.MESHCURRENTVALUE MVV \
+    where MVV.FEATUREID = MP. FEATUREID AND \
+          ML.KPOSITION = MP.KPOSITION AND \
+          ML.MESHID = MP.MESHID AND \
+          M.MESHID = MP.MESHID AND \
+          M.PARTIDMIN <= MVV.PARTID AND \
+          M.PARTIDMAX >= MVV.PARTID AND \
+          MVV.PARAMETERID IN (?) AND \
+          MVV.TIMEVALUE IN (?) AND \
+          M.OBJECTID = ? AND \
+          MP.FEATUREID IN \
+            ( SELECT FEATUREID \
+              FROM MEDIAN.MESHPOINT MP, \
+                   MEDIAN.MESH M \
+              WHERE M.OBJECTID = ? AND \
+                    MP.MESHID = M.MESHID  AND \
+                    IPOSITION = (SELECT IPOSITION FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?) AND \
+                    JPOSITION = (SELECT JPOSITION FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?)) AND \
+          MP.KPOSITION <= ? AND \
+          MP.KPOSITION >= ? \
+   ORDER BY MVV.PARAMETERID, \
+            MVV.TIMEVALUE, \
+            ML.UPPERZLOCATION
             
+verticalprofile_mesh_odv_data_vector=SELECT SI.NAME CRUISE, \
+        M.MESHID || '-' || MEDIAN.MESHPOINT.IPOSITION || '-' || MEDIAN.MESHPOINT.JPOSITION STATION, \
+        '*' TYPE, \
+        ST_ASTEXT(SHAPE), \
+        0 BOTDEPTH, \
+        (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)) DEPTH, \
+        MVV.XCOMPONENT, \
+        MVV.YCOMPONENT, \
+        MVV.ZCOMPONENT, \
+        MVV.SPEED, \
+        MVV.DIRECTION, \
+        MVV.PARAMETERID PARAMETER, \
+        MVV.TIMEVALUE , \
+        '1' QF \
+    FROM MEDIAN.MESHLAYER ML, \
+         MEDIAN.MESHPOINT, \
+         MEDIAN.MESH M, \
+         MEDIAN.MESHCURRENTVALUE MVV, \
+         MEDIAN.SOURCEINFO SI \
+    WHERE M.SOURCEID = SI.SOURCEID AND \
+          MVV.FEATUREID = MEDIAN.MESHPOINT. FEATUREID AND \
+          ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION AND \
+          ML.MESHID = MEDIAN.MESHPOINT.MESHID AND \
+          M.MESHID = MEDIAN.MESHPOINT.MESHID AND \
+          M.PARTIDMIN <= MVV.PARTID AND \
+          M.PARTIDMAX >= MVV.PARTID AND \
+          MVV.PARAMETERID IN (?) AND \
+          MVV.TIMEVALUE IN (?) AND \
+          M.OBJECTID = ? AND \
+          MEDIAN.MESHPOINT.FEATUREID IN \
+                          ( SELECT FEATUREID \
+                            FROM MEDIAN.MESHPOINT MP, \
+                                 MEDIAN.MESH M \
+                            WHERE M.OBJECTID = ? AND \
+                                  MP.MESHID = M.MESHID  AND \
+                                  IPOSITION = (SELECT IPOSITION FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?) AND \
+                                  JPOSITION = (SELECT JPOSITION FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?)) AND \
+          MEDIAN.MESHPOINT.KPOSITION <= ? AND \
+          MEDIAN.MESHPOINT.KPOSITION >= ? \
+    ORDER BY MVV.TIMEVALUE, \
+             ML.UPPERZLOCATION, \
+             MVV.PARAMETERID
+
 #############################################
 #############################################
 ##### Vertikalprofil InstantaneousPoint #####
@@ -511,12 +1005,24 @@
           MEDIAN.INSTANTANEOUSPOINT.FEATUREID = M.FEATUREID AND \
           M.SOURCEID= ? AND \
           INTERSECTS(SHAPE, \
-                     (SELECT st_astext(SHAPE) \
-                      FROM MEDIAN.FEATUREAREA \
-                      WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND \
-                             FEATURECODE = ? )\
+                    (SELECT st_astext(SHAPE) \
+                     FROM MEDIAN.FEATUREAREA \
+                     WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND \
+                            FEATURECODE = ? )\
                      ) \
     ORDER BY S.DESCRIPTION
+verticalprofile_instantaneouspoint_series_with_wkt = SELECT \
+        S.SERIESID KEY, \
+        S.DESCRIPTION VALUE \
+    FROM MEDIAN.INSTANTANEOUSPOINT, \
+         MEDIAN.SERIES S, \
+         MEDIAN.MEASUREMENT M \
+    WHERE S.SERIESID = MEDIAN.INSTANTANEOUSPOINT.SERIESID AND \
+          MEDIAN.INSTANTANEOUSPOINT.POINTSPEC = 4 AND \
+          MEDIAN.INSTANTANEOUSPOINT.FEATUREID = M.FEATUREID AND \
+          M.SOURCEID= ? AND \
+          INTERSECTS(SHAPE, "?") \
+    ORDER BY S.DESCRIPTION
     
 verticalprofile_instantaneouspoint_point = SELECT \
         MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \
@@ -532,6 +1038,41 @@
     ORDER BY MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \
              MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE
 
+verticalprofile_instantaneouspoint_point_with_aera = SELECT \
+        MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \
+        to_char(MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE,'DD.MM.YYYY HH24:MI') VALUE, \
+        MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE, \
+         ST_ASTEXT(SHAPE) \
+    FROM MEDIAN.INSTANTANEOUSPOINT, \
+         MEDIAN.MEASUREMENT M \
+    WHERE MEDIAN.INSTANTANEOUSPOINT.SERIESID = ? AND \
+          MEDIAN.INSTANTANEOUSPOINT.POINTSPEC = 4 AND \
+          MEDIAN.INSTANTANEOUSPOINT.FEATUREID = M.FEATUREID AND \
+          M.SOURCEID = ? AND \
+          INTERSECTS(SHAPE, \
+                    (SELECT st_astext(SHAPE) \
+                     FROM MEDIAN.FEATUREAREA \
+                     WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND \
+                            FEATURECODE = ? )\
+                     ) \
+    ORDER BY MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \
+             MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE
+             
+verticalprofile_instantaneouspoint_point_with_wkt = SELECT \
+        MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \
+        to_char(MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE,'DD.MM.YYYY HH24:MI') VALUE, \
+        MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE, \
+         ST_ASTEXT(SHAPE) \
+    FROM MEDIAN.INSTANTANEOUSPOINT, \
+         MEDIAN.MEASUREMENT M \
+    WHERE MEDIAN.INSTANTANEOUSPOINT.SERIESID = ? AND \
+          MEDIAN.INSTANTANEOUSPOINT.POINTSPEC = 4 AND \
+          MEDIAN.INSTANTANEOUSPOINT.FEATUREID = M.FEATUREID AND \
+          M.SOURCEID = ? AND \
+          INTERSECTS(SHAPE,"?") \
+    ORDER BY MEDIAN.INSTANTANEOUSPOINT.FEATUREID, \
+             MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE
+
 verticalprofile_instantaneouspoint_parameter = SELECT DISTINCT \
         P.PARAMETERID KEY, \
         p.GERMANNAME || '  ['|| p.UNIT ||']' VALUE, \
@@ -561,7 +1102,9 @@
         MSV.PARAMETERID GROUP1, \
         IP.TIMEVALUE GROUP2, \
         1 GROUP3, \
-        3 DATAID \
+        3 DATAID, \
+        IP.FEATUREID, \
+        IP.SERIESID \
     FROM MEDIAN.INSTANTANEOUSPOINT IP, \
          MEDIAN.MEASUREMENT M, \
          MEDIAN.MEASUREDSCALARVALUE MSV \
@@ -580,10 +1123,11 @@
         '*' TYPE, \
         ST_ASTEXT(SHAPE), \
         0 BOTDEPTH, \
-        (M.ZLOCATION * -1) DEPTH, \
+        (M.ZLOCATION) DEPTH, \
         MSV.DATAVALUE, \
         MSV.PARAMETERID PARAMETER, \
-        MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE \
+        MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE , \
+        '1' QF \
     FROM MEDIAN.SERIES S, \
          MEDIAN.INSTANTANEOUSPOINT, \
          MEDIAN.MEASUREMENT M, \
@@ -596,8 +1140,8 @@
           M.ZLOCATION >= ? AND \
           M.ZLOCATION <= ? \
     ORDER BY MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE, \
-          MSV.PARAMETERID, \
-          M.ZLOCATION
+          M.ZLOCATION, \
+          MSV.PARAMETERID
           
 #############################################
 #############################################
@@ -643,6 +1187,25 @@
                                                 FEATURECODE = ? )\
                                          ) \
     ORDER BY V.NAME
+
+horizontalprofile_instantaneouspoint_vehicle_with_wkt = SELECT V.VEHICLEID KEY, \
+                V.NAME VALUE \
+    FROM MEDIAN.TRACK, \
+         MEDIAN.VEHICLE V, \
+         MEDIAN.CRUISE C \
+    WHERE V.VEHICLEID = C.VEHICLEID AND \
+          C.CRUISEID = MEDIAN.TRACK.CRUISEID AND \
+          MEDIAN.TRACK.TRACKID IN \
+                      (SELECT DISTINCT S.TRACKID \
+                       FROM MEDIAN.MEASUREMENT M ,\
+                            MEDIAN.INSTANTANEOUSPOINT I, \
+                            MEDIAN.SURVEYINFO S \
+                       WHERE M.SOURCEID = ? AND \
+                             I.FEATUREID = M.FEATUREID AND \
+                             S.SURVEYID = I.SURVEYID)AND \
+                             INTERSECTS(SHAPE,"?") \
+    ORDER BY V.NAME
+
 horizontalprofile_instantaneouspoint_cruise = SELECT DISTINCT \
         C.CRUISEID KEY, \
         V.NAME || ' ' || \
@@ -694,6 +1257,31 @@
                                                 FEATURECODE = ? )\
                                          ) \
     ORDER BY V.NAME
+
+horizontalprofile_instantaneouspoint_cruise_with_wkt = SELECT C.CRUISEID KEY, \
+        V.NAME || ' ' || \
+        C.NAME || ' ' || \
+        TO_CHAR(C.STARTDATE,'DD.MM.YYYY') || ' - ' || \
+        TO_CHAR(C.ENDDATE,'DD.MM.YYYY') VALUE, \
+        V.NAME, \
+        C.NAME \
+    FROM MEDIAN.TRACK, \
+         MEDIAN.VEHICLE V, \
+         MEDIAN.CRUISE C \
+    WHERE V.VEHICLEID = C.VEHICLEID AND \
+          C.CRUISEID = MEDIAN.TRACK.CRUISEID AND \
+          MEDIAN.TRACK.TRACKID IN \
+                      (SELECT DISTINCT S.TRACKID \
+                       FROM MEDIAN.MEASUREMENT M ,\
+                            MEDIAN.INSTANTANEOUSPOINT I, \
+                            MEDIAN.SURVEYINFO S \
+                       WHERE M.SOURCEID = ? AND \
+                             C.VEHICLEID  = ? AND \
+                             I.FEATUREID = M.FEATUREID AND \
+                             S.SURVEYID = I.SURVEYID)AND \
+                             INTERSECTS(SHAPE,"?") \
+    ORDER BY V.NAME
+
 horizontalprofile_instantaneouspoint_track= SELECT \
         T.TRACKID KEY, \
         to_char(T.STARTDATE,'DD.MM.YYYY HH24:MI') || ' - '|| to_char(T.ENDDATE,'DD.MM.YYYY HH24:MI') || ' - '|| T.NAME VALUE \
@@ -705,7 +1293,7 @@
              
 horizontalprofile_instantaneouspoint_track_with_area = SELECT \
         MEDIAN.TRACK.TRACKID KEY, \
-        to_char(STARTDATE,'DD.MM.YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD.MM.YYYY HH24:MI') || ' - '|| NAME VALUE, \
+        to_char(STARTDATE,'DD-MM-YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD-MM-YYYY HH24:MI') || ' - '|| NAME VALUE, \
         NAME \
     FROM MEDIAN.TRACK \
     WHERE MEDIAN.TRACK.CRUISEID = ? AND \
@@ -718,6 +1306,18 @@
     ORDER BY STARTDATE, \
              ENDDATE, \
              NAME
+
+horizontalprofile_instantaneouspoint_track_with_wkt = SELECT \
+        MEDIAN.TRACK.TRACKID KEY, \
+        to_char(STARTDATE,'DD-MM-YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD-MM-YYYY HH24:MI') || ' - '|| NAME VALUE, \
+        NAME \
+    FROM MEDIAN.TRACK \
+    WHERE MEDIAN.TRACK.CRUISEID = ? AND \
+          INTERSECTS(SHAPE, "?") \
+    ORDER BY STARTDATE, \
+             ENDDATE, \
+             NAME
+
 horizontalprofile_instantaneouspoint_surveyinfo = SELECT \
         SURVEYID KEY, \
         to_char(STARTDATE,'DD.MM.YYYY HH24:MI') || ' - '|| to_char(ENDDATE,'DD.MM.YYYY HH24:MI') || ' - '|| DESCRIPTION VALUE \
@@ -753,7 +1353,8 @@
         MSV.PARAMETERID GROUP1, \
         ZLOCATION GROUP2, \
         1 GROUP3, \
-        3 DATAID \
+        3 DATAID, \
+        MEDIAN.INSTANTANEOUSPOINT.SURVEYID \
     FROM MEDIAN.INSTANTANEOUSPOINT, \
          MEDIAN.MEASUREMENT M, \
          MEDIAN.MEASUREDSCALARVALUE MSV \
@@ -773,7 +1374,8 @@
         ST_ASTEXT(SHAPE), \
         MEDIAN.INSTANTANEOUSPOINT.TIMEVALUE, \
         MSV.DATAVALUE, \
-        MSV.PARAMETERID PARAMETER \
+        MSV.PARAMETERID PARAMETER , \
+        '1' QF \
     FROM MEDIAN.INSTANTANEOUSPOINT, \
          MEDIAN.VEHICLE V, \
          MEDIAN.CRUISE C, \
@@ -823,7 +1425,8 @@
            msv.TIMEVALUE GROUP3, \
            MEDIAN.MESHPOINT.JPOSITION, \
            MEDIAN.MESHPOINT.IPOSITION, \
-           2 DATAID \
+           2 DATAID, \
+           MEDIAN.MESHPOINT.MESHID \
     from MEDIAN.MESHLAYER ml, \
          MEDIAN.MESHPOINT, \
          MEDIAN.MESH m, \
@@ -861,7 +1464,8 @@
           msv.PARAMETERID PARAMETER, \
           msv.TIMEVALUE, \
           MEDIAN.MESHPOINT.JPOSITION, \
-          MEDIAN.MESHPOINT.IPOSITION \
+          MEDIAN.MESHPOINT.IPOSITION , \
+          '1' QF \
     from MEDIAN.MESHLAYER ml, \
          MEDIAN.MESHPOINT, \
          MEDIAN.MESH m, \
@@ -887,10 +1491,102 @@
                     ? = (select ? from MEDIAN.MESHPOINT where FEATUREID = ?)) \
    order by msv.TIMEVALUE, \
             MEDIAN.MESHPOINT.KPOSITION, \
-            msv.PARAMETERID, \
+            MEDIAN.MESHPOINT.JPOSITION, \
+            MEDIAN.MESHPOINT.IPOSITION, \
+            msv.PARAMETERID
+
+#############################################
+#############################################
+########### Horizontalprofil MESH ###########
+###########      Vektordaten      ###########
+#############################################
+#############################################
+
+horizontalprofile_mesh_chart_data_vector=  SELECT ST_ASTEXT(SHAPE), \
+           MVV.XCOMPONENT, \
+           MVV.YCOMPONENT, \
+           MVV.ZCOMPONENT, \
+           MVV.SPEED, \
+           MVV.DIRECTION, \
+           MVV.PARAMETERID GROUP1, \
+           MEDIAN.MESHPOINT.KPOSITION GROUP2, \
+           MVV.TIMEVALUE GROUP3, \
+           MEDIAN.MESHPOINT.JPOSITION, \
+           MEDIAN.MESHPOINT.IPOSITION, \
+           2 DATAID, \
+           MEDIAN.MESHPOINT.MESHID \
+    FROM MEDIAN.MESHLAYER ML, \
+         MEDIAN.MESHPOINT, \
+         MEDIAN.MESH M, \
+         MEDIAN.MESHCURRENTVALUE MVV \
+    WHERE MVV.FEATUREID = MEDIAN.MESHPOINT. FEATUREID AND \
+          ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION AND \
+          ML.MESHID = MEDIAN.MESHPOINT.MESHID AND \
+          M.MESHID = MEDIAN.MESHPOINT.MESHID AND \
+          M.PARTIDMIN <= MVV.PARTID AND \
+          M.PARTIDMAX >= MVV.PARTID AND \
+          MVV.PARAMETERID = ? AND \
+          MVV.TIMEVALUE = ? AND \
+          M.OBJECTID = ? AND \
+          MEDIAN.MESHPOINT.FEATUREID IN \
+            ( SELECT FEATUREID \
+              from MEDIAN.MESHPOINT MP, \
+                   MEDIAN.MESH M \
+              where M.OBJECTID = ? AND \
+                    MP.MESHID = M.MESHID  AND \
+                    KPOSITION IN ( ? ) AND \
+                    ? = (SELECT ? FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?)) \
+   ORDER BY MVV.TIMEVALUE, \
+            MEDIAN.MESHPOINT.KPOSITION, \
+            MVV.PARAMETERID, \
             MEDIAN.MESHPOINT.JPOSITION, \
             MEDIAN.MESHPOINT.IPOSITION
-            
+
+horizontalprofile_mesh_odv_data_vector=  SELECT SI.NAME CRUISE, \
+          M.MESHID || '-' || MEDIAN.MESHPOINT.IPOSITION || '-' || MEDIAN.MESHPOINT.JPOSITION STATION, \
+          '*' TYPE, \
+          ST_ASTEXT(SHAPE), \
+          0 BOTDEPTH, \
+          (((ML.UPPERZLOCATION + ML.LOWERZLOCATION) / 2)*-1) DEPTH, \
+          MVV.XCOMPONENT, \
+          MVV.YCOMPONENT, \
+          MVV.ZCOMPONENT, \
+          MVV.SPEED, \
+          MVV.DIRECTION, \
+          MVV.PARAMETERID PARAMETER, \
+          MVV.TIMEVALUE, \
+          MEDIAN.MESHPOINT.JPOSITION, \
+          MEDIAN.MESHPOINT.IPOSITION , \
+          '1' QF \
+    from MEDIAN.MESHLAYER ML, \
+         MEDIAN.MESHPOINT, \
+         MEDIAN.MESH M, \
+         MEDIAN.MESHCURRENTVALUE MVV, \
+         MEDIAN.SOURCEINFO SI \
+    where MVV.FEATUREID = MEDIAN.MESHPOINT. FEATUREID AND \
+          ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION and \
+          ML.MESHID = MEDIAN.MESHPOINT.MESHID and \
+          M.MESHID = MEDIAN.MESHPOINT.MESHID AND \
+          M.SOURCEID = SI.SOURCEID AND \
+          M.PARTIDMIN <= MVV.PARTID AND \
+          M.PARTIDMAX >= MVV.PARTID AND \
+          MVV.PARAMETERID = ? AND \
+          MVV.TIMEVALUE = ? AND \
+          M.OBJECTID = ? AND \
+          MEDIAN.MESHPOINT.FEATUREID IN \
+            ( SELECT FEATUREID \
+              FROM MEDIAN.MESHPOINT MP, \
+                   MEDIAN.MESH M \
+              WHERE M.OBJECTID = ? AND \
+                    MP.MESHID = M.MESHID  AND \
+                    KPOSITION IN ( ? ) AND \
+                    ? = (SELECT ? FROM MEDIAN.MESHPOINT WHERE FEATUREID = ?)) \
+   ORDER BY MVV.TIMEVALUE, \
+            MEDIAN.MESHPOINT.KPOSITION, \
+            MEDIAN.MESHPOINT.JPOSITION, \
+            MEDIAN.MESHPOINT.IPOSITION, \
+            MVV.PARAMETERID
+
 #############################################
 #############################################
 ########### Horizontalprofil MESH ###########
@@ -927,6 +1623,7 @@
            msv.TIMEVALUE GROUP3, \
            MEDIAN.MESHPOINT.JPOSITION, \
            MEDIAN.MESHPOINT.IPOSITION, \
+           MEDIAN.MESHPOINT.MESHID MESHID, \
            2 DATAID \
     from MEDIAN.MESHLAYER ml, \
          MEDIAN.MESHPOINT, \
@@ -953,11 +1650,68 @@
             msv.PARAMETERID, \
             MEDIAN.MESHPOINT.JPOSITION, \
             MEDIAN.MESHPOINT.IPOSITION
+
+#############################################
+#############################################
+########### Horizontalprofil MESH ###########
+###########     Schnittprofil     ###########
+###########      Vektordaten      ###########
+#############################################
+#############################################
+
+horizontalprofile_mesh_cross_chart_data_vector =  SELECT ST_ASTEXT(SHAPE), \
+           MVV.XCOMPONENT, \
+           MVV.YCOMPONENT, \
+           MVV.ZCOMPONENT, \
+           MVV.SPEED, \
+           MVV.DIRECTION, \
+           MVV.PARAMETERID GROUP1, \
+           MEDIAN.MESHPOINT.KPOSITION GROUP2, \
+           MVV.TIMEVALUE GROUP3, \
+           MEDIAN.MESHPOINT.JPOSITION, \
+           MEDIAN.MESHPOINT.IPOSITION, \
+           2 DATAID \
+    FROM MEDIAN.MESHLAYER ML, \
+         MEDIAN.MESHPOINT, \
+         MEDIAN.MESH M, \
+         MEDIAN.MESHCURRENTVALUE MVV \
+    WHERE MVV.FEATUREID = MEDIAN.MESHPOINT.FEATUREID AND \
+          ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION AND \
+          ML.MESHID = MEDIAN.MESHPOINT.MESHID AND \
+          M.MESHID = MEDIAN.MESHPOINT.MESHID AND \
+          M.PARTIDMIN <= MVV.PARTID AND \
+          M.PARTIDMAX >= MVV.PARTID AND \
+          MVV.PARAMETERID = ? AND \
+          MVV.TIMEVALUE = ? AND \
+          M.OBJECTID = ? AND \
+          ML.KPOSITION in (?) AND \
+          MEDIAN.MESHPOINT.FEATUREID in \
+              ( \
+               SELECT DISTINCT FEATUREID \
+               FROM MEDIAN.MESHPOINT \
+               WHERE ? \
+               ) \
+    ORDER BY MVV.TIMEVALUE, \
+             MEDIAN.MESHPOINT.KPOSITION, \
+             MVV.PARAMETERID, \
+             MEDIAN.MESHPOINT.JPOSITION, \
+             MEDIAN.MESHPOINT.IPOSITION
+
 #############################################
 #############################################
 ############# Profilschnitt MESH ############
 #############################################
 #############################################
+verticalcrosssection_mesh_year = select  distinct \
+        to_char(msv.TIMEVALUE,'YYYY') KEY, \
+        to_char(msv.TIMEVALUE,'YYYY') VALUE \
+    from MEDIAN.MESHSCALARVALUE msv, \
+         MEDIAN.MESH m \
+    where m.OBJECTID = ?  AND \
+          msv.PARTID >= m.PARTIDMIN AND \
+          msv.PARTID <= m.PARTIDMAX AND \
+          msv.PARAMETERID = ? \
+    order by to_char(msv.TIMEVALUE,'YYYY')
 verticalcrosssection_mesh_date = select  distinct \
         msv.TIMEVALUE KEY, \
         msv.TIMEVALUE VALUE \
@@ -966,7 +1720,8 @@
     where m.OBJECTID = ?  AND \
           msv.PARTID >= m.PARTIDMIN AND \
           msv.PARTID <= m.PARTIDMAX AND \
-          msv.PARAMETERID = ? \
+          msv.PARAMETERID = ? AND \
+          to_char(msv.TIMEVALUE,'YYYY') in (?) \
     order by msv.TIMEVALUE
 verticalcrosssection_mesh_chart_data = SELECT ST_ASTEXT(SHAPE), \
            ((ml.UPPERZLOCATION  + ml.LOWERZLOCATION) / 2) Z, \
@@ -990,12 +1745,11 @@
           msv.TIMEVALUE = ? AND \
           m.OBJECTID = ? AND \
           MEDIAN.MESHPOINT.FEATUREID in \
-            ( select FEATUREID \
-              from MEDIAN.MESHPOINT mp, \
-                   MEDIAN.MESH m \
-              where m.OBJECTID = ? AND \
-                    mp.MESHID = m.MESHID  AND \
-                    ? = (select ? from MEDIAN.MESHPOINT where FEATUREID = ?)) \
+              ( \
+               SELECT distinct FEATUREID \
+               FROM MEDIAN.MESHPOINT \
+               WHERE ? \
+               ) \
     order by msv.TIMEVALUE, \
              msv.PARAMETERID, \
              MEDIAN.MESHPOINT.JPOSITION, \
@@ -1014,7 +1768,8 @@
            MEDIAN.MESHPOINT.JPOSITION, \
            MEDIAN.MESHPOINT.IPOSITION, \
            MEDIAN.MESHPOINT.KPOSITION, \
-           2 DATAID \
+           2 DATAID , \
+           '1' QF \
     from MEDIAN.MESHLAYER ml, \
          MEDIAN.MESHPOINT, \
          MEDIAN.MESH m, \
@@ -1038,11 +1793,41 @@
                     mp.MESHID = m.MESHID  AND \
                     ? = (select ? from MEDIAN.MESHPOINT where FEATUREID = ?)) \
     order by msv.TIMEVALUE, \
-             msv.PARAMETERID, \
              MEDIAN.MESHPOINT.JPOSITION, \
              MEDIAN.MESHPOINT.IPOSITION, \
-             MEDIAN.MESHPOINT.KPOSITION
-             
+             MEDIAN.MESHPOINT.KPOSITION, \
+             msv.PARAMETERID
+
+##############################################
+#### Special case of VerticalCrossSection ####
+##############################################
+verticalcrosssection_mesh_parallel_linestring =  SELECT ST_ASTEXT(SHAPE), \
+    IPOSITION, \
+    JPOSITION \
+    from MEDIAN.MESHLAYER ml, \
+         MEDIAN.MESHPOINT, \
+         MEDIAN.MESH m, \
+         MEDIAN.MESHSCALARVALUE msv \
+    where msv.FEATUREID = MEDIAN.MESHPOINT.FEATUREID AND \
+          ml.KPOSITION = MEDIAN.MESHPOINT.KPOSITION and \
+          ml.MESHID = MEDIAN.MESHPOINT.MESHID and \
+          m.MESHID = MEDIAN.MESHPOINT.MESHID AND \
+          m.PARTIDMIN <= msv.PARTID AND \
+          m.PARTIDMAX >= msv.PARTID AND \
+          msv.PARAMETERID in (?) AND \
+          msv.TIMEVALUE in (?) AND \
+          m.OBJECTID = ? AND \
+          MEDIAN.MESHPOINT.FEATUREID in \
+            ( select FEATUREID \
+              from MEDIAN.MESHPOINT mp, \
+                   MEDIAN.MESH m \
+              where m.OBJECTID = ? AND \
+                    mp.MESHID = m.MESHID  AND \
+                    KPOSITION in ( 1 ) and \
+                    ? = (select ? from MEDIAN.MESHPOINT where FEATUREID = ?)) \
+   order by MEDIAN.MESHPOINT.JPOSITION, \
+            MEDIAN.MESHPOINT.IPOSITION
+
 #############################################
 #############################################
 ########## Horizontalschnitt MESH ###########
@@ -1059,6 +1844,16 @@
           MP.MESHID = M.MESHID \
     ORDER BY MP.KPOSITION
     
+horizontalcrosssection_mesh_year = select  distinct \
+        to_char(msv.TIMEVALUE,'YYYY') KEY, \
+        to_char(msv.TIMEVALUE,'YYYY') VALUE \
+    from MEDIAN.MESHSCALARVALUE msv, \
+         MEDIAN.MESH m \
+    where m.OBJECTID = ?  AND \
+          msv.PARTID >= m.PARTIDMIN AND \
+          msv.PARTID <= m.PARTIDMAX AND \
+          msv.PARAMETERID = ? \
+    order by to_char(msv.TIMEVALUE,'YYYY')
 horizontalcrosssection_mesh_date = select  distinct \
         msv.TIMEVALUE KEY, \
         msv.TIMEVALUE VALUE \
@@ -1067,31 +1862,34 @@
     where m.OBJECTID = ?  AND \
           msv.PARTID >= m.PARTIDMIN AND \
           msv.PARTID <= m.PARTIDMAX AND \
-          msv.PARAMETERID = ? \
+          msv.PARAMETERID = ? AND \
+          to_char(msv.TIMEVALUE,'YYYY') in (?) \
     order by msv.TIMEVALUE
     
 horizontalcrosssection_mesh_data = SELECT ST_ASTEXT(SHAPE), \
            MSV.DATAVALUE YORDINATE, \
-           MEDIAN.MESHFACE.JPOSITION, \
-           MEDIAN.MESHFACE.IPOSITION, \
-           MEDIAN.MESHFACE.KPOSITION, \
+           MEDIAN.MESHPOINT.JPOSITION, \
+           MEDIAN.MESHPOINT.IPOSITION, \
+           MEDIAN.MESHPOINT.KPOSITION, \
+           MSV.PARAMETERID, \
+           MSV.TIMEVALUE, \
            2 DATAID \
     from MEDIAN.MESHLAYER ML, \
-         MEDIAN.MESHFACE, \
+         MEDIAN.MESHPOINT, \
          MEDIAN.MESH M, \
          MEDIAN.MESHSCALARVALUE MSV \
-    where MSV.FEATUREID = MEDIAN.MESHFACE.FEATUREID AND \
-          ML.KPOSITION = MEDIAN.MESHFACE.KPOSITION and \
-          ML.MESHID = MEDIAN.MESHFACE.MESHID and \
-          M.MESHID = MEDIAN.MESHFACE.MESHID AND \
+    where MSV.FEATUREID = MEDIAN.MESHPOINT.FEATUREID AND \
+          ML.KPOSITION = MEDIAN.MESHPOINT.KPOSITION and \
+          ML.MESHID = MEDIAN.MESHPOINT.MESHID and \
+          M.MESHID = MEDIAN.MESHPOINT.MESHID AND \
           M.PARTIDMIN <= MSV.PARTID AND \
           M.PARTIDMAX >= MSV.PARTID AND \
           MSV.PARAMETERID = ? AND \
           MSV.TIMEVALUE = ? AND \
           M.OBJECTID = ? AND \
-          MEDIAN.MESHFACE.KPOSITION = ? \
-    order by MEDIAN.MESHFACE.JPOSITION, \
-             MEDIAN.MESHFACE.IPOSITION
+          MEDIAN.MESHPOINT.KPOSITION = ? \
+    order by MEDIAN.MESHPOINT.JPOSITION, \
+             MEDIAN.MESHPOINT.IPOSITION
 horizontalcrosssection_mesh_odv_data = SELECT SI.NAME CRUISE, \
             M.MESHID || '-' || MEDIAN.MESHPOINT.IPOSITION || '-' || MEDIAN.MESHPOINT.JPOSITION STATION, \
            '*' TYPE, \
@@ -1121,7 +1919,8 @@
           M.OBJECTID = ? AND \
           MEDIAN.MESHPOINT.KPOSITION = ? \
     order by MEDIAN.MESHPOINT.JPOSITION, \
-             MEDIAN.MESHPOINT.IPOSITION
+             MEDIAN.MESHPOINT.IPOSITION, \
+             MSV.PARAMETERID
              
 area_filter = SELECT DISTINCT \
        FEATUREID KEY ,\
@@ -1138,3 +1937,85 @@
     WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND \
           FEATUREID = ? \
     ORDER BY NAME
+    
+rasterQuery = SELECT ST_ASTEXT(RASTER) \
+    FROM MEDIAN.TOPO_WORLD_2MIN \
+    WHERE INTERSECTS(RASTER, "?")
+    
+mapviewer_interface_fis_region = SELECT ID_FIS \
+    FROM MEDIAN.FEATUREAREA, \
+         MEDIAN.FIS_HAS_REGION FHR \
+    WHERE FHR.FEATUREID = MEDIAN.FEATUREAREA.FEATUREID AND \
+          FHR.FEATURETYPE = MEDIAN.FEATUREAREA.FEATURETYPE AND \
+          FHR.FEATURECODE = MEDIAN.FEATUREAREA.FEATURECODE AND \
+          INTERSECTS(SHAPE,"?")
+          
+mapviewer_interface_mapservices_has_fis = SELECT DISTINCT ID_FIS, \
+         ID_MAPSERVICE \
+    FROM MEDIAN.FIS_HAS_MAPSERVICE \
+    WHERE ID_MAPSERVICE IN (?)
+
+mapviewer_interface_mapservices_has_parameter = SELECT DISTINCT ID_PARAMETER \
+    FROM MEDIAN.MAPSERVICE_HAS_PARAMETER \
+    WHERE ID_MAPSERVICE = ?
+
+mapviewer_interface_mapservices_has_parameter_using_layer = SELECT DISTINCT ID_PARAMETER \
+   FROM MEDIAN.LAYER_HAS_PARAMETER \
+   WHERE ID_MAPSERVICE = ? AND \
+         ID_LAYER IN (?)
+         
+#############################################
+#############################################
+# Layer Contis, Nauthis  and Marinefeatures #
+#############################################
+#############################################
+
+layer = SELECT ROW_ID KEY, \
+        TITLE || '-' || LAYER_NAME || '-' || BAND VALUE \
+    FROM MEDIAN.LAYER_HAS_SUBTYPES \
+    WHERE ID_FEATURECLASS LIKE ? AND \
+          ITEMS > 0 \
+    ORDER BY LAYER_NAME
+    
+layer_request_data = SELECT ID_FEATURECLASS, \
+        QUERY_STRING, \
+        ID_MAPSERVICE || '_' ||ID_LAYER, \
+        TITLE || '-' || LAYER_NAME || '-' || BAND VALUE \
+    FROM MEDIAN.LAYER_HAS_SUBTYPES \
+    WHERE ROW_ID IN (?)
+
+layer_data = SELECT ST_ASTEXT(SHAPE), ? \
+    FROM ? \
+    WHERE ?
+    
+layer_data_with_geom = SELECT ST_ASTEXT(SHAPE), ? \
+    FROM ? \
+    WHERE ? AND \
+          INTERSECTS(SHAPE,"?")
+    
+geometry_for_subareafilter=SELECT st_astext(SHAPE) \
+    FROM MEDIAN.FEATUREAREA \
+    WHERE (FEATURETYPE = 7 OR FEATURETYPE = 8) AND \
+           FEATURECODE = ?
+           
+layer_colums= SELECT OWNER || '.' || TABLE_NAME || '.' || COLUMN_NAME \
+    FROM SDE.COLUMN_REGISTRY \
+    WHERE COLUMN_NAME NOT LIKE 'SHAPE' AND \
+          OWNER = '?' AND \
+          TABLE_NAME = '?'
+          
+geometry_type = select geometry_type \
+    from sde.geometry_columns \
+    where f_table_schema = '?' and \
+          f_table_name = '?' and \
+          f_geometry_column='SHAPE'
+
+
+#############################################
+#############################################
+###### Sync of cache after DB updates #######
+#############################################
+#############################################
+updated_tables = SELECT FULLTABLENAME \
+    FROM MEDIAN.LASTUPDATED \
+    WHERE LASTUPDATE >= to_date('?', 'YYYY.MM.DD HH24:MI:SS')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/conf/sql-cache.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ehcache>
+    <defaultCache 
+        maxElementsInMemory="10000"
+        eternal="false"
+        memoryStoreEvictionPolicy="LFU"
+        timeToIdleSeconds="10800"
+        timeToLiveSeconds="14400"
+        />
+</ehcache>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/schema/externalinterface_schema.sql	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+/*
+ * Lookup-Tabelle für das FIS anhand eines Gebietes.
+ * Diese Tabelle ist in der ArcSDE als Layer zu integrieren.
+ * Die Inhalte der Spalte id_fis müssen mit den vergebenen IDs
+ * in der Konfiguration des Artefaktservers übereinstimmen.
+ *
+ * Abbildung als Layer in der ArcSDE
+ * Das hier bereitgestellte SQL ist lediglich als Anhalt zu betrachten.
+ */
+create table fis_has_region (
+    id_fis varchar2(30 char) not null, /* TODO maximale Länge bestimmen und ggf. anpassen.*/
+    description varchar2(90 char),
+    geometry ??? not null
+);
+
+ALTER TABLE fis_has_region ADD PRIMARY KEY (id_fis);
+
+/*
+ * Lookup-Tabelle für das FIS anhand eines Mapservices.
+ * Die Inhalte der Spalte id_fis müssen mit den vergebenen IDs
+ * in der Konfiguration des Artefaktservers übereinstimmen.
+ * Die Inhalte der Spalte id_mapservice müssen mit den vergebenen
+ * IDs der Services im Mapviewer übereinstimmen.
+ */
+create table fis_has_mapservice(
+    id_fis varchar2(30 char) not null, /* TODO maximale Länge bestimmen und ggf. anpassen.*/
+    id_mapservice varchar2(100 char) not null /* TODO maximale Länge bestimmen und ggf. anpassen.*/
+);
+
+ALTER TABLE fis_has_mapservice ADD PRIMARY KEY (id_fis,id_mapservice);
+
+/**
+ * Lookuptabelle zwischen einer LayerID und dem dazugehörigen 
+ * Mapservice und den im Layer dargestellten Parameter.
+ * Fremdschlüsselbeziehung zu der Tabelle fis_has_mapservice.
+ * Primärschlüssel: id_mapservice, id_layer, id_parameter
+ * id_parameter referenziert zusätzlich die Tabelle MEDIAN.PARAMETER.
+ * 
+ * Auf eine explizite Abbildung von GroupLayern kann verzichtet werden,
+ * da sie lediglich einen "ordnenden" Charakter haben.
+ * vgl. S 52 Pflichtenheft.
+ * 
+ * Ãœber id_group wird abgebildet ob ein Layer zu einer Gruppe von
+ * Layern gehört.
+ */
+create table layer_has_parameter(
+    id_mapservice varchar2(100 char) not null, /* TODO maximale Länge bestimmen und ggf. anpassen.*/
+    id_layer NUMBER(10) not null, /* TODO maximale Länge bestimmen und ggf. anpassen.*/
+    layer_name varchar2(30 char) not null, /* TODO maximale Länge bestimmen und ggf. anpassen.*/
+    id_group varchar2(30 char ), /* TODO maximale Länge bestimmen und ggf. anpassen.*/
+    id_parameter NUMBER(10) not null /* Referenz zur Tabelle MEDIAN.PARAMETER */
+);
+
+ALTER TABLE layer_has_parameter ADD 
+      PRIMARY KEY (id_mapservice,id_layer,id_parameter);
+
+/**
+ * Lookuptabelle ob ein Mapservice genau einen Parameter darstellt.
+ * Wenn in dieser Tabelle nichts vorhanden ist muss unter zurhilfenahme
+ * der Layer-ID in der Tabelle layer_has_parameter gesucht werden.
+ * Die Inhalte der Spalte id_mapservice müssen mit den vergebenen
+ * IDs der Services im Mapviewer übereinstimmen.
+ * id_parameter referenziert zusätzlich die Tabelle MEDIAN.PARAMETER.
+ */
+create table mapservice_has_parameter(
+    id_mapservice varchar2(100 char) not null, /* TODO maximale Länge bestimmen und ggf. anpassen.*/
+    id_parameter NUMBER(10) not null /* Referenz zur Tabelle MEDIAN.PARAMETER */
+);
+
+
+ALTER TABLE mapservice_has_parameter ADD 
+      PRIMARY KEY (id_mapservice,id_parameter);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/doc/schema/externalinterface_testdata.sql	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,18 @@
+/*
+ *Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+INSERT INTO fis_has_mapservice (id_fis,id_mapservice) VALUES ('modeldata','BSH_IMS_Prediction_Model_Salinity');
+INSERT INTO fis_has_mapservice (id_fis,id_mapservice) VALUES ('marnet','BSH_IMS_Marine_Environment_Monitoring_Network');
+
+INSERT INTO mapservice_has_parameter(id_mapservice,id_parameter) VALUES ('BSH_IMS_Prediction_Model_Salinity',2);
+
+INSERT INTO layer_has_parameter(id_mapservice,id_layer,layer_name,id_group,id_parameter) VALUES ('BSH_IMS_Marine_Environment_Monitoring_Network', 1, 'Sealevel', null, ?);
+INSERT INTO layer_has_parameter(id_mapservice,id_layer,layer_name,id_group,id_parameter) VALUES ('BSH_IMS_Marine_Environment_Monitoring_Network', 2, 'Temperature', null, 1);
+INSERT INTO layer_has_parameter(id_mapservice,id_layer,layer_name,id_group,id_parameter) VALUES ('BSH_IMS_Marine_Environment_Monitoring_Network', 3, 'Salinity', null, 2);
+INSERT INTO layer_has_parameter(id_mapservice,id_layer,layer_name,id_group,id_parameter) VALUES ('BSH_IMS_Marine_Environment_Monitoring_Network', 4, 'OxygenSaturation', null, 31);
+INSERT INTO layer_has_parameter(id_mapservice,id_layer,layer_name,id_group,id_parameter) VALUES ('BSH_IMS_Marine_Environment_Monitoring_Network', 5, 'Current', null, ?);
--- a/gnv-artifacts/pom.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/pom.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -7,12 +7,33 @@
   <version>1.0-SNAPSHOT</version>
   <name>gnv-artifacts</name>
   <url>http://maven.apache.org</url>
+  <scm>
+    <connection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv-artifacts</connection>
+    <developerConnection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv-artifacts</developerConnection>
+    <url>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv-artifacts</url>
+  </scm>
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>
   <build>
     <plugins>
       <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>buildnumber-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>validate</phase>
+            <goals>
+              <goal>create</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <doCheck>false</doCheck>
+          <doUpdate>false</doUpdate>
+        </configuration>
+      </plugin>
+      <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-eclipse-plugin</artifactId>
         <version>2.5.1</version>
@@ -26,6 +47,20 @@
           <target>1.5</target>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jar-plugin</artifactId>
+        <configuration>
+          <archive>
+            <manifest>
+              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+            </manifest>
+            <manifestEntries>
+              <SCM-Revision>${buildNumber}</SCM-Revision>
+            </manifestEntries>
+          </archive>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
   <dependencies>
@@ -48,13 +83,19 @@
     <dependency>
       <groupId>com.esri.sde</groupId>
       <artifactId>jsde_sdk</artifactId>
-      <version>9.2.5</version>
+      <version>9.3</version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>com.esri.sde</groupId>
       <artifactId>jpe_sdk</artifactId>
-      <version>9.2.5</version>
+      <version>9.3</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.esri.sde</groupId>
+      <artifactId>jpe_sdkres</artifactId>
+      <version>9.3</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -66,7 +107,7 @@
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
-      <version>[1.2,)</version>
+      <version>1.2.14</version>
     </dependency>
     <dependency>
       <groupId>jfree</groupId>
@@ -77,12 +118,17 @@
       <groupId>org.apache.xmlgraphics</groupId>
       <artifactId>batik-dom</artifactId>
       <version>1.7</version>
-    </dependency> 
+    </dependency>
     <dependency>
       <groupId>org.apache.xmlgraphics</groupId>
       <artifactId>batik-svggen</artifactId>
       <version>1.7</version>
-    </dependency> 
+    </dependency>
+    <dependency>
+      <groupId>org.apache.velocity</groupId>
+      <artifactId>velocity</artifactId>
+      <version>1.6.1</version>        
+    </dependency>
     <dependency>
       <groupId>com.lowagie</groupId>
       <artifactId>itext</artifactId>
@@ -113,17 +159,32 @@
       <artifactId>oro</artifactId>
       <version>2.0.8</version>
     </dependency>
-  <dependency>
+    <dependency>
+      <groupId>org.geotools</groupId>
+      <artifactId>gt-shapefile</artifactId>
+      <version>2.5.8</version>
+    </dependency>
+    <dependency>
+      <groupId>org.geotools</groupId>
+      <artifactId>gt-epsg-wkt</artifactId>
+      <version>2.5.8</version>
+    </dependency>
+    <dependency>
       <groupId>com.vividsolutions</groupId>
       <artifactId>jts</artifactId>
       <version>1.9</version>
     </dependency>
+    <dependency>
+      <groupId>trove</groupId>
+      <artifactId>trove</artifactId>
+      <version>2.1.1</version>
+    </dependency>
   </dependencies>
   <repositories>
     <repository>
       <id>gt2.repo</id>
       <name>GeoTools2 Repository including JTS</name>
-      <url>http://maven.geotools.fr/repository</url>
+      <url>http://download.osgeo.org/webdav/geotools</url>
     </repository>
     <repository>
       <id>repository.jboss.org</id>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/APP.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/APP.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,13 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
 import de.intevation.artifactdatabase.App;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class APP {
 
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactBase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,49 +1,79 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.artifactdatabase.ProxyArtifact;
+import de.intevation.artifacts.common.utils.XMLUtils;
 
-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.Config;
-import de.intevation.artifactdatabase.DefaultArtifact;
-import de.intevation.artifactdatabase.XMLUtils;
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.ArtifactDatabase;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.ArtifactNamespaceContext;
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.GlobalContext;
+
 import de.intevation.gnv.artifacts.context.GNVArtifactContext;
+
+import de.intevation.gnv.artifacts.fis.product.Product;
+
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+
+import de.intevation.gnv.state.AutoResumeState;
 import de.intevation.gnv.state.DefaultInputData;
+import de.intevation.gnv.state.ExportMode;
 import de.intevation.gnv.state.InputData;
 import de.intevation.gnv.state.InputValue;
 import de.intevation.gnv.state.OutputMode;
 import de.intevation.gnv.state.OutputState;
 import de.intevation.gnv.state.State;
 import de.intevation.gnv.state.StateFactory;
+
 import de.intevation.gnv.state.exception.StateException;
+
 import de.intevation.gnv.transition.Transition;
 import de.intevation.gnv.transition.TransitionFactory;
+
 import de.intevation.gnv.utils.ArtifactXMLUtilities;
 
+import java.io.IOException;
+import java.io.OutputStream;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+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 Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the major gnv artifact and handles the requests specified in
+ * <code>de.intevation.artifactdatabase.Artifact</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
-public abstract class GNVArtifactBase extends DefaultArtifact {
+public abstract class GNVArtifactBase extends GNVDefaultArtifact
+                                      implements PreSettingArtifact {
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
@@ -65,6 +95,20 @@
                                                               + XPATH_IDENTIFIER_REPLACE
                                                               + "']";
 
+    public static final String XPATH_STATIC_NODE = "/art:result/art:ui/art:static";
+
+    public static final String XPATH_INPUT_DATA = "/art:action/art:data/art:input";
+
+    public static final String XPATH_INCLUDE_UI = "/art:action/art:include-ui";
+
+    public static final String XPATH_TARGET_NAME = "/art:action/art:target/@name";
+
+    public static final String XPATH_OUTPUT_NAME = "/art:action/art:out/@name";
+
+    public static final String XPATH_OUTPUT_PARAMS = "/art:action/art:out/art:params/art:input";
+
+    public static final String INITIAL_STATE = "product";
+
     /**
      * The current State
      */
@@ -74,18 +118,28 @@
      * The States that can be used
      */
     protected Map<String, State> states = null;
-    
+
     /**
      * The Transitions which can switch between the different States.
      */
     protected Collection<Transition> transitions = null;
 
     /**
+     * The current product
+     */
+    protected Product product;
+
+    /**
      * The Name of the Artifact
      */
     protected String name = null;
 
-    private ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
+    /**
+     * The Presettings of InputData which can be used to
+     * travel through the States in different Ways or
+     * manipulate the InputData
+     */
+    private Map<String, InputData> preSettings = null;
 
     /**
      * Constructor
@@ -94,66 +148,184 @@
         super();
     }
 
+
     /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#advance(org.w3c.dom.Document,
-     *      de.intevation.artifacts.CallContext)
+     * This method handles request for changing the current state of an
+     * artifact. It is possible to step forward, backward, or to the initial
+     * state for choosing a fis.
      */
     @Override
     public Document advance(Document target, CallContext context) {
-        log.debug("GNVArtifactBase.advance");
-        Document result = XMLUtils.newDocument();
+        log.debug("GNVArtifactBase.advance()");
+
+        Document result      = XMLUtils.newDocument();
+        String   targetState = XMLUtils.xpathString(
+            target, XPATH_TARGET_NAME, ArtifactNamespaceContext.INSTANCE
+        );
+
+        // no current state...
+        if (current == null) {
+            log.warn("No current state. Advance not possible.");
+
+            result = createReport(
+                result,
+                "exceptionreport",
+                "exception",
+                "No State activated."
+            );
+
+            return result;
+        }
+
+        State next = null;
+
         try {
-            if (this.current != null) {
-                String stateName = this.readStateName(target);
-                log.debug("Statename: " + stateName);
-                if (this.isStateCurrentlyReachable(stateName)) {
-                    try {
-                        State nextStep = this.states
-                                .get(stateName);
-                        // 1.Ergebnisse Berechnen
-                        this.current.advance(super.identifier, context.getMeta());
-                        // 2. Ergebnisse Übergeben
-                        nextStep.putInputData(this.current.getInputData(), 
-                                              super.identifier);
-                        // 3. Umschalten auf neue Transistion
-                        this.current = nextStep;
-                        
-                        // 4. Initialisieren des nächsten Schrittes == Laden der Daten
-                        this.current.initialize(super.identifier, context.getMeta());
-                        
-                        result = new ArtifactXMLUtilities()
-                                .createSuccessReport("Advance success",
-                                        XMLUtils.newDocument());
-                    } catch (StateException e) {
-                        log.error(e, e);
-                        result = new ArtifactXMLUtilities()
-                                .createExceptionReport(e
-                                        .getLocalizedMessage(), XMLUtils
-                                        .newDocument());
-                    }
-                } else {
-                    String msg = "Transitionsübergang wird nicht unterstützt.";
-                    log.error(msg);
-                    result = new ArtifactXMLUtilities().createExceptionReport(
-                            msg, XMLUtils.newDocument());
+
+            // step forward
+            if (isStateCurrentlyReachable(targetState)) {
+
+                next = states.get(targetState);
+
+                boolean success = go2NextState(context, result, next);
+
+                if (success){
+                    result = createReport(
+                            result, "result", "success", "Advance success"
+                        );
+                }else{
+                    result =  ArtifactXMLUtilities.
+                    createExceptionReport("Error while going to next State.",
+                            XMLUtils.newDocument());
                 }
-            } else {
-                String msg = "Kein State aktiviert.";
-                log.error(msg);
-                result = new ArtifactXMLUtilities().createExceptionReport(msg,
-                        XMLUtils.newDocument());
             }
-        } catch (Exception e) {
-            log.error(e, e);
-            result = new ArtifactXMLUtilities().createExceptionReport(e
-                    .getLocalizedMessage(), XMLUtils.newDocument());
+
+            // step backward
+            else if((next = getPreviousState(current, targetState, context))
+                     != null)
+            {
+
+                if (current != null) {
+                    current.endOfLife(context.globalContext());
+                }
+
+                current = next;
+
+                // 2. Transfer Results
+                current.reset(identifier);
+
+                result = createReport(
+                    result, "result", "success", "Advance success"
+                );
+            }
+
+            // goto initial step
+            else if(targetState.equals(INITIAL_STATE)) {
+
+                String fis                    = product.getArtifactFactory();
+                ArtifactDatabase db           = context.getDatabase();
+                GNVProductArtifactFactory fac = (GNVProductArtifactFactory)
+                    db.getInternalArtifactFactory(fis);
+
+                Artifact select = fac.createArtifact(
+                    identifier,
+                    (GlobalContext) context.globalContext(),
+                    context.getMeta(),
+                    null);
+
+                context.putContextValue(ProxyArtifact.REPLACE_PROXY, select);
+
+                result = createReport(
+                    result, "result", "success", "Advance success"
+                );
+            }
+
+            // advance not possible
+            else {
+                log.warn("advance not possible for target: " + targetState);
+                result = createReport(
+                    result,
+                    "exceptionreport",
+                    "exception",
+                    "Statetransition not supported"
+                );
+            }
         }
+        catch (StateException se) {
+            log.error(se, se);
+            result = createReport(
+                result,
+                "exceptionreport",
+                "exception",
+                se.getLocalizedMessage()
+            );
+        }
+
         return result;
     }
-    
-    
+
+
+    private boolean go2NextState(CallContext context, Document result,
+                                  State next) throws StateException {
+        // 2. Transfer Results
+        next.putInputData(current.getInputData(), identifier);
+        next.setParent(current);
+        next.setPreSettings(this.preSettings);
+
+        // 3. Switch to next State
+        current = next;
+
+        // 4. Initialize next Step
+        current.initialize(identifier, context);
+
+        return true;
+    }
+
+
+    protected Document createReport(
+        Document document,
+        String   nodeName,
+        String   state,
+        String   msg
+    ) {
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
+
+        Element reportNode = creator.create(nodeName);
+        Element stateNode  = creator.create(state);
+
+        stateNode.setTextContent(msg);
+        reportNode.appendChild(stateNode);
+        document.appendChild(reportNode);
+
+        return document;
+
+    }
+
+
+    /**
+     * Step back to the previous state specified by <code>name</code>.
+     */
+    protected State getPreviousState(
+        State current, String name, CallContext context)
+    {
+        if (current == null) {
+            return null;
+        }
+
+        if (current.getID().equals(name)) {
+            return current;
+        }
+        else {
+            current.endOfLife(context);
+            return getPreviousState(current.getParent(), name, context);
+        }
+    }
+
+
     private boolean isStateCurrentlyReachable(String stateid){
-        log.debug("GNVArtifactBase.isStateCurrentlyReachable "+stateid);
         Iterator<Transition> it = this.transitions.iterator();
         String from = this.current.getID();
         while (it.hasNext()){
@@ -166,89 +338,169 @@
         }
         return false;
     }
-    
-    public Document initialize (CallContext context) {
+
+
+    public Document initialize(CallContext context) {
         Document result = XMLUtils.newDocument();
         try {
-            this.current.initialize(super.identifier, context.getMeta());
-            result = new ArtifactXMLUtilities()
-            .createSuccessReport("Initialize success",
-                    XMLUtils.newDocument());
+            this.current.initialize(super.identifier, context);
+
+            if (this.current instanceof AutoResumeState){
+                // Jump to next State using the Transitions.
+                State next = this.getNextReachableState(this.current);
+                if (next != null){
+                    boolean success = go2NextState(context, result, next);
+                    if (success){
+                        result = ArtifactXMLUtilities
+                        .createSuccessReport("Initialize success",
+                                XMLUtils.newDocument());
+                    }else{
+                        result =  ArtifactXMLUtilities.
+                                    createExceptionReport(
+                                            "Error while going to next State.",
+                                            XMLUtils.newDocument());
+                    }
+                }else{
+                    result = ArtifactXMLUtilities.
+                                     createExceptionReport("No propper State found.",
+                                                           XMLUtils.newDocument());
+                }
+            }else{
+                result = ArtifactXMLUtilities
+                            .createSuccessReport("Initialize success",
+                                    XMLUtils.newDocument());
+            }
         } catch (StateException e) {
             log.error(e,e);
-            result = new ArtifactXMLUtilities().createExceptionReport(e
-                    .getLocalizedMessage(), XMLUtils.newDocument());
-        }
-        return result;
-    }
-
-    protected String readStateName(Document document) {
-        String returnValue = Config.getStringXPath(document,
-                "action/target/@name");
-        return returnValue;
-    }
-
-    protected Node getConfigurationFragment(Document document) {
-        log.debug("GNVArtifactBase.getConfigurationFragment");
-        String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll(
-                XPATH_IDENTIFIER_REPLACE, this.name);
-        log.debug(xpathQuery);
-        
-        Element configurationNode = (Element)Config.getNodeXPath(document, xpathQuery);
-        
-        String link = configurationNode.getAttribute("xlink:href");
-        if (link != null ){
-            String absolutFileName = Config.replaceConfigDir(link);
-            configurationNode = (Element)new ArtifactXMLUtilities().readConfiguration(absolutFileName);
-        }
-        
-        return configurationNode;
-    }
-
-    /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#feed(org.w3c.dom.Document,
-     *      de.intevation.artifacts.CallContext)
-     */
-    @Override
-    public Document feed(Document target, CallContext context) {
-        log.debug("GNVArtifactBase.feed");
-        Document result = XMLUtils.newDocument();
-        try {
-            if (this.current != null) {
-                Collection<InputData> inputData = this.parseInputData(target,
-                                                                      "/action/data/input");
-                if (!inputData.isEmpty()){
-                    this.current.putInputData(inputData, super.identifier);
-                    result = new ArtifactXMLUtilities().createSuccessReport(
-                            "Feed success", XMLUtils.newDocument());
-                }else{
-                    String msg = "No Inputdata given. Please select at least one Entry.";
-                    log.warn(msg);
-                    result = new ArtifactXMLUtilities().createExceptionReport(msg,
-                            XMLUtils.newDocument());
-                }
-            } else {
-                String msg = "No State instantiated";
-                log.warn(msg);
-                result = new ArtifactXMLUtilities().createExceptionReport(msg,
-                        XMLUtils.newDocument());
-            }
-        } catch (StateException e) {
-            log.error(e, e);
-            result = new ArtifactXMLUtilities().createExceptionReport(e
+            result = ArtifactXMLUtilities.createExceptionReport(e
                     .getLocalizedMessage(), XMLUtils.newDocument());
         }
         return result;
     }
 
     /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#setup(java.lang.String,
-     *      java.lang.Object)
+     * Step forward to the next reachable state.
+     * @param current Current state.
+     * @return Reachable state.
+     */
+    protected State getNextReachableState(State current){
+        Iterator<Transition> it = this.transitions.iterator();
+        String from = current.getID();
+        while (it.hasNext()){
+            Transition transition = it.next();
+            if (transition.getFrom().equals(from)){
+                if (transition.isValid(current)){
+                    return this.states.get(transition.getTo());
+                }
+            }
+        }
+        return null;
+    }
+
+
+    protected String readStateName(Document document) {
+        String returnValue = XMLUtils.xpathString(
+            document, XPATH_TARGET_NAME, ArtifactNamespaceContext.INSTANCE);
+        return returnValue;
+    }
+
+
+    protected Node getConfigurationFragment(Document document) {
+        log.debug("GNVArtifactBase.getConfigurationFragment");
+        String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll(
+                XPATH_IDENTIFIER_REPLACE, this.name);
+
+        Element configurationNode = (Element)Config.getNodeXPath(document, xpathQuery);
+
+        String link = configurationNode.getAttribute("xlink:href");
+        if (link != null ){
+            String absolutFileName = Config.replaceConfigDir(link);
+            configurationNode = (Element)new ArtifactXMLUtilities().readConfiguration(absolutFileName);
+        }
+
+        return configurationNode;
+    }
+
+    /**
+     * Insert new data included in <code>target</code> into the current state.
+     * @param target XML document which contains data.
+     * @param context CallContext
+     * @return XML document with success or error message.
      */
     @Override
-    public void setup(String identifier, ArtifactFactory factory, Object context) {
+    public Document feed(Document target, CallContext context) {
+        log.debug("GNVArtifactBase.feed");
+        RessourceFactory fac = RessourceFactory.getInstance();
+        Locale[] locales     = fac.getLocales();
+        Locale   locale      = context.getMeta().getPreferredLocale(locales);
+        Document result      = XMLUtils.newDocument();
+
+        try {
+            if (this.current != null) {
+                Collection<InputData> inputData = this.parseInputData(
+                    target,
+                    XPATH_INPUT_DATA);
+
+                if (!inputData.isEmpty()){
+                    result = current.feed(context, inputData, super.identifier);
+                }else{
+                    //String msg = "No Inputdata given. Please select at least one Entry.";
+                    String msg = fac.getRessource(
+                        locale,
+                        EXCEPTION_NO_INPUT,
+                        EXCEPTION_NO_INPUT);
+
+                    log.warn(msg);
+                    result = ArtifactXMLUtilities.createInputExceptionReport(
+                        msg,
+                        XMLUtils.newDocument());
+                }
+            } else {
+                String msg = "No State instantiated";
+                log.warn(msg);
+                result = ArtifactXMLUtilities.createExceptionReport(msg,
+                        XMLUtils.newDocument());
+            }
+        } catch (StateException e) {
+            log.error(e, e);
+            result = ArtifactXMLUtilities.createExceptionReport(e
+                    .getLocalizedMessage(), XMLUtils.newDocument());
+        }
+        return result;
+    }
+
+
+    /**
+     * Describe the current artifact.
+     * @return The description of the current artifact.
+     */
+    @Override
+    public Document describe(Document data, CallContext context) {
+        log.debug("GNVArtifactBase.describe");
+
+        Document document = createDescibeOutput(
+            context,
+            identifier,
+            getIncludeUIFromDocument(data)
+        );
+
+        return document;
+    }
+
+    /**
+     * Initialse this artifact and insert some data if <code>data</code>
+     * contains necessary information for this artifact.
+     */
+    @Override
+    public void setup(
+        String identifier,
+        ArtifactFactory factory,
+        Object context,
+        CallMeta meta,
+        Document data
+    ) {
         log.debug("GNVArtifactBase.setup");
-        super.setup(identifier, factory, context);
+        super.setup(identifier, factory, context, meta, data);
 
         Object localContext = context;
         if (context instanceof CallContext) {
@@ -260,7 +512,7 @@
             GNVArtifactContext gnvContext = (GNVArtifactContext) localContext;
             Document doc = gnvContext.getConfig();
             Node artifactNode = this.getConfigurationFragment(doc);
-                        
+
             NodeList stateList = Config.getNodeSetXPath(artifactNode,
                     "states/state");
             this.states = new HashMap<String, State>(stateList
@@ -269,13 +521,14 @@
                 State tmpState = StateFactory.getInstance()
                         .createState(stateList.item(i));
                 if (tmpState != null) {
+                    log.debug("Initiate new state: " + tmpState.getID());
                     this.states.put(tmpState.getID(), tmpState);
                     if (this.current == null) {
                         this.current = tmpState;
                     }
                 }
             }
-            
+
             NodeList transitionList = Config.getNodeSetXPath(artifactNode,
             "states/transition");
             this.transitions = new ArrayList<Transition>(transitionList.getLength());
@@ -289,26 +542,49 @@
 
         }
     }
-    
-    
 
-    protected Document createDescibeOutput(CallMeta callMeta, String uuid, boolean incudeUI) {
+
+    /**
+     * Create the xml document returned in {@link #describe(org.w3c.dom.Document,
+     * de.intevation.artifacts.CallContext)}
+     */
+    protected Document createDescibeOutput(
+        CallContext context,
+        String      uuid,
+        boolean     incudeUI
+    ) {
         log.debug("GNVArtifactBase.createDescibeOutput");
         Document document = XMLUtils.newDocument();
-        Element rootNode = this.createRootNode(document);
-        this.createHeader(rootNode, document, "describe");
-        this.createOutputs(rootNode, document);
-        this.createCurrentState(rootNode, document);
-        this.createReachableStates(rootNode, document);
-        this.createModel(rootNode, document);
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
+        Element rootNode = this.createRootNode(creator, document);
+        this.createHeader(creator, rootNode, document, "describe");
+        this.createOutputs(creator, rootNode, document);
+        this.createCurrentState(creator, rootNode, document);
+        this.createReachableStates(creator, rootNode, document);
+        this.createModel(creator, rootNode, document);
         if (incudeUI){
-            this.createUserInterface(rootNode, document, callMeta, uuid);
+            this.createUserInterface(creator, rootNode, document, context, uuid);
         }
+
         return document;
     }
-    
+
+    /**
+     * Determine the wish to append the user interface description to the
+     * describe document.
+     *
+     * @return True, if the user interface description should be appended,
+     * otherwise false.
+     */
     protected boolean getIncludeUIFromDocument(Document document){
-        String value = Config.getStringXPath(document, "action/include-ui");
+        String value = XMLUtils.xpathString(
+            document, XPATH_INCLUDE_UI, ArtifactNamespaceContext.INSTANCE);
+
         boolean includeUI = false;
         if (value != null){
             includeUI = Boolean.parseBoolean(value);
@@ -316,62 +592,169 @@
         return includeUI;
     }
 
-    protected Element createRootNode(Document document) {
-        Element rootNode = xmlUtilities.createArtifactElement(document,
-                "result");
+
+    protected Element createRootNode(
+        XMLUtils.ElementCreator creator,
+        Document                document
+    ) {
+        Element rootNode = creator.create("result");
         document.appendChild(rootNode);
         return rootNode;
     }
 
-    protected void createHeader(Element parent, Document document,
-                                String documentType) {
-        Element typeNode = xmlUtilities.createArtifactElement(document, "type");
-        typeNode.setAttribute("name", documentType);
+    /**
+     * Append information about the current artifact (uuid, hash).
+     */
+    protected void createHeader(
+        XMLUtils.ElementCreator creator,
+        Element                 parent,
+        Document                document,
+        String                  documentType
+    ) {
+        Element typeNode = creator.create("type");
+        creator.addAttr(typeNode, "name", documentType);
         parent.appendChild(typeNode);
 
-        Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid");
-        uuidNode.setAttribute("value", super.identifier);
+        Element uuidNode = creator.create("uuid");
+        creator.addAttr(uuidNode, "value", super.identifier);
         parent.appendChild(uuidNode);
 
-        Element hashNode = xmlUtilities.createArtifactElement(document, "hash");
-        hashNode.setAttribute("value", this.hash());
+        Element hashNode = creator.create("hash");
+        creator.addAttr(hashNode, "value", this.hash());
         parent.appendChild(hashNode);
     }
 
-    protected void createReachableStates(Element parent, Document document) {
-        Element stateNode = xmlUtilities.createArtifactElement(document,
-                "reachable-states");
+    /**
+     * Create the fis select box.
+     */
+    protected Element createSelectBox(
+        XMLUtils.ElementCreator artCreator,
+        XMLUtils.ElementCreator creator,
+        Document                document,
+        CallContext             context
+    ) {
+        RessourceFactory resource = RessourceFactory.getInstance();
+        CallMeta callMeta         = (CallMeta) context.getMeta();
+        String productName        = product.getName();
+
+        Element selectNode = creator.create("select1");
+        creator.addAttr(selectNode, "ref", "product");
+        artCreator.addAttr(selectNode, "state", INITIAL_STATE, true);
+
+
+        Element labelNode = creator.create("label");
+        labelNode.setTextContent(
+            resource.getRessource(callMeta.getLanguages(), "product", "product")
+        );
+
+        Element choicesNode = creator.create("choices");
+
+        Element itemNode = creator.create("item");
+        creator.addAttr(itemNode, "selected", "true");
+
+        Element choiceLabel = creator.create("label");
+        choiceLabel.setTextContent(resource.getRessource(
+            callMeta.getLanguages(),
+            productName,
+            productName
+        ));
+
+        Element choiceValue = creator.create("value");
+        choiceValue.setTextContent(productName);
+
+        itemNode.appendChild(choiceLabel);
+        itemNode.appendChild(choiceValue);
+        choicesNode.appendChild(itemNode);
+
+        selectNode.appendChild(labelNode);
+        selectNode.appendChild(choicesNode);
+
+        return selectNode;
+    }
+
+
+    /**
+     * Insert all reachable states into the describe document returned by
+     * {@link #describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)}
+     */
+    protected void createReachableStates(
+        XMLUtils.ElementCreator creator,
+        Element                 parent,
+        Document                document
+    ) {
+        Element stateNode = creator.create("reachable-states");
         if (this.current != null) {
+
+            // add future states
             Iterator<Transition> transitions = this.transitions.iterator();
             while (transitions.hasNext()) {
                 Transition tmpTransition = transitions.next();
-                if (tmpTransition.getFrom().equals(current.getID()) && 
+                if (tmpTransition.getFrom().equals(current.getID()) &&
                     tmpTransition.isValid(this.current)){
-                    Element currentNode = xmlUtilities.createArtifactElement(
-                            document, "state");
-                    currentNode.setAttribute("name", tmpTransition.getTo());
-                    log.debug("Reachable State: " + tmpTransition.getTo());
-                    currentNode.setAttribute("description", 
-                                             this.states.get(tmpTransition.getTo())
-                                                             .getDescription());
+                    Element currentNode = creator.create("state");
+                    creator.addAttr(currentNode, "name", tmpTransition.getTo());
+                    creator.addAttr(
+                        currentNode,
+                        "description",
+                        this.states.get(tmpTransition.getTo()).getDescription());
                     stateNode.appendChild(currentNode);
                 }
             }
+
+
+            // add old states
+            appendOldReachableStates(creator, stateNode, current);
         }
         parent.appendChild(stateNode);
     }
 
-    protected void createCurrentState(Element parent, Document document) {
-        Element stateNode = xmlUtilities.createArtifactElement(document,
-                "state");
-        stateNode.setAttribute("name", this.current.getID());
-        stateNode.setAttribute("description", this.current.getDescription());
+
+    /**
+     * Insert states which have been visited by this artifact into the xml
+     * document returned by {@link #describe(org.w3c.dom.Document,
+     * de.intevation.artifacts.CallContext)}
+     */
+    protected void appendOldReachableStates(
+        XMLUtils.ElementCreator creator,
+        Element                 parent,
+        State                   state
+    ) {
+        if (state == null)
+            return;
+
+        while (state != null) {
+            Element currentNode = creator.create("state");
+            creator.addAttr(currentNode, "name", state.getID());
+            creator.addAttr(currentNode, "description", state.getDescription());
+            parent.appendChild(currentNode);
+
+            state = state.getParent();
+        }
+    }
+
+
+    /**
+     * Insert the current state into the xml document returned by
+     * {@link #describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)}
+     */
+    protected void createCurrentState(
+        XMLUtils.ElementCreator creator,
+        Element                 parent,
+        Document                document
+    ) {
+        Element stateNode = creator.create("state");
+        creator.addAttr(stateNode, "name", this.current.getID());
+        creator.addAttr(stateNode, "description", this.current.getDescription());
         parent.appendChild(stateNode);
     }
 
-    protected void createModel(Element parent, Document document) {
-        Element modelNode = xmlUtilities.createArtifactElement(document,
-                "model");
+
+    protected void createModel(
+        XMLUtils.ElementCreator creator,
+        Element                 parent,
+        Document                document
+    ) {
+        Element modelNode = creator.create("model");
         if (this.current != null) {
             Collection<InputValue> inputValues = this.current
                     .getRequiredInputValues();
@@ -379,10 +762,9 @@
                 Iterator<InputValue> it = inputValues.iterator();
                 while (it.hasNext()) {
                     InputValue inputValue = it.next();
-                    Element inputNode = xmlUtilities.createArtifactElement(
-                            document, "input");
-                    inputNode.setAttribute("name", inputValue.getName());
-                    inputNode.setAttribute("type", inputValue.getType());
+                    Element inputNode = creator.create("input");
+                    creator.addAttr(inputNode, "name", inputValue.getName());
+                    creator.addAttr(inputNode, "type", inputValue.getType());
                     modelNode.appendChild(inputNode);
                 }
             }
@@ -390,21 +772,67 @@
         parent.appendChild(modelNode);
     }
 
-    protected void createUserInterface(Element parent, Document document,
-                                       CallMeta callMeta, String uuid) {
-        Element uiNode = xmlUtilities.createArtifactElement(document, "ui");
+    /**
+     * Append the user interface description to the document returned by
+     * {@link #describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)}
+     * @param creator XML element creator.
+     * @param parent New elements are appended to this node.
+     * @param document Current document.
+     * @param context CallContext
+     * @param uuid The uuid of the artifact.
+     */
+    protected void createUserInterface(
+        XMLUtils.ElementCreator creator,
+        Element                 parent,
+        Document                document,
+        CallContext             context,
+        String                  uuid
+    ) {
+        XMLUtils.ElementCreator xCreator = new XMLUtils.ElementCreator(
+            document,
+            XMLUtils.XFORM_URL,
+            XMLUtils.XFORM_PREFIX
+        );
+
+        Element uiNode     = creator.create("ui");
+        Element staticNode = creator.create("static");
+        Element dynamic    = creator.create("dynamic");
+
+        uiNode.appendChild(staticNode);
+        uiNode.appendChild(dynamic);
+
+        parent.appendChild(uiNode);
+
+        // append fis to dynamic part
+        appendFis(document, staticNode, context, product.getArtifactFactory());
 
         if (this.current != null) {
-            this.current.describe(document, uiNode, callMeta, uuid);
+            Element staticUI = createSelectBox(
+                creator, xCreator, document, context
+            );
+            staticNode.appendChild(staticUI);
+
+            this.current.describe(
+                document, uiNode, context, uuid
+            );
         }
-
-        parent.appendChild(uiNode);
     }
 
-    protected void createOutputs(Element parent, Document document) {
+
+    /**
+     * Append possible output targets to the document returned by
+     * {@link #describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)}
+     * @param creator Used to create xml elements.
+     * @param parent New elements are appended to this node.
+     * @param document The current document.
+     */
+    protected void createOutputs(
+        XMLUtils.ElementCreator creator,
+        Element                 parent,
+        Document                document
+    ) {
         log.debug("GNVArtifactBase.createOutputs");
-        Element outputsNode = xmlUtilities.createArtifactElement(document,
-                "outputs");
+        Element outputsNode = creator.create("outputs");
         if (this.current instanceof OutputState) {
             Collection<OutputMode> outputModes = ((OutputState) this.current)
                     .getOutputModes();
@@ -413,34 +841,51 @@
                 while (it.hasNext()) {
                     OutputMode outputMode = it.next();
                     log.debug("Write Outputnode for " + outputMode.toString());
-                    Element outputModeNode = xmlUtilities
-                            .createArtifactElement(document, "output");
-                    outputModeNode.setAttribute("name", outputMode.getName());
-                    outputModeNode.setAttribute("description", outputMode
-                            .getDescription());
-                    outputModeNode.setAttribute("mime-type", outputMode
-                            .getMimeType());
+                    Element outputModeNode = creator.create("output");
+                    creator.addAttr(
+                        outputModeNode, "name", outputMode.getName());
+                    creator.addAttr(
+                        outputModeNode, "description", outputMode.getDescription());
+                    creator.addAttr(
+                        outputModeNode, "mime-type", outputMode.getMimeType());
                     outputsNode.appendChild(outputModeNode);
 
                     Collection<InputValue> inputParameters = outputMode
                             .getInputParameters();
                     if (inputParameters != null) {
-                        Element inputParametersNode = xmlUtilities
-                                .createArtifactElement(document, "parameter");
+                        Element inputParametersNode = creator.create("parameter");
                         outputModeNode.appendChild(inputParametersNode);
                         Iterator<InputValue> it2 = inputParameters.iterator();
                         while (it2.hasNext()) {
                             InputValue inputValue = it2.next();
-                            Element inputParameterNode = xmlUtilities
-                                    .createArtifactElement(document,
-                                            "parameter");
+                            Element inputParameterNode =
+                                creator.create("parameter");
+                            creator.addAttr(
+                                inputParameterNode, "name", inputValue.getName());
+                            creator.addAttr(
+                                inputParameterNode, "type", inputValue.getType());
+                            creator.addAttr(
+                                inputParameterNode, "value", inputValue.getDefaultValue());
                             inputParametersNode.appendChild(inputParameterNode);
-                            inputParameterNode.setAttribute("name", inputValue
-                                    .getName());
-                            inputParameterNode.setAttribute("type", inputValue
-                                    .getType());
-                            inputParameterNode.setAttribute("value", inputValue
-                                    .getDefaultValue());
+                        }
+                    }
+
+                    // append export modes
+                    List<ExportMode> exportModes = outputMode.getExportModes();
+                    if (exportModes != null) {
+                        Element exports = creator.create("exports");
+                        outputModeNode.appendChild(exports);
+
+                        for (ExportMode exp: exportModes) {
+                            Element export = creator.create("export");
+                            creator.addAttr(
+                                export, "name", exp.getName());
+                            creator.addAttr(
+                                export, "description", exp.getDescription());
+                            creator.addAttr(
+                                export, "mime-type", exp.getMimeType());
+
+                            exports.appendChild(export);
                         }
                     }
                 }
@@ -451,19 +896,21 @@
         parent.appendChild(outputsNode);
     }
 
+    /**
+     * Parse input data from feed-document.
+     * @param document Feed-document
+     * @param xPath Path to input data.
+     * @return A collection with InputData objects.
+     */
     protected Collection<InputData> parseInputData(Document document,
                                                    String xPath) {
-        log.debug("GNVArtifactBase.parseInputData");
         HashMap<String, InputData> returnValue = null;
 
-        log.debug(new ArtifactXMLUtilities().writeDocument2String(document));
-
         NodeList inputElemets = (NodeList) XMLUtils.xpath(document, xPath,
-                XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);// Config.getNodeSetXPath(document,
-                                                                           // "");
+                XPathConstants.NODESET, ArtifactNamespaceContext.INSTANCE);
         if (inputElemets != null) {
-            returnValue = new HashMap<String, InputData>(inputElemets
-                    .getLength());
+            returnValue = new HashMap<String, InputData>();
+
             for (int i = 0; i < inputElemets.getLength(); i++) {
                 Element inputDataNode = (Element)inputElemets.item(i);
                 String name = inputDataNode.getAttribute("name");
@@ -485,8 +932,13 @@
     }
 
     /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#out(org.w3c.dom.Document,
-     *      java.io.OutputStream, de.intevation.artifacts.CallContext)
+     * Call an output target (e.g. chart, wms, etc.)
+     * @param format XML document which contains some further information about
+     * the desired output.
+     * @param outputStream Stream used for writing the output.
+     * @param context CallContext
+     * @throws IOException If an error occured while writing the result to the
+     * output stream.
      */
     @Override
     public void out(Document format, OutputStream outputStream,
@@ -497,7 +949,7 @@
             if (current != null && current instanceof OutputState) {
                 ((OutputState) current)
                         .out(format, this.parseInputData(
-                                format, "/action/out/params/input"),
+                                format, XPATH_OUTPUT_PARAMS),
                                 outputStream, super.identifier, context);
             }
         } catch (StateException e) {
@@ -506,8 +958,50 @@
         }
     }
 
-    protected String readOutputType(Document document) {
-        String value = Config.getStringXPath(document, "action/out/@name");
+
+    protected static String readOutputType(Document document) {
+        String value = XMLUtils.xpathString(
+            document, XPATH_OUTPUT_NAME, ArtifactNamespaceContext.INSTANCE);
         return value;
     }
+
+
+    /**
+     * The the current product.
+     * @param product New product.
+     */
+    public void setProduct(Product product) {
+        this.product = product;
+    }
+
+    /**
+     * Call endOfLife of parent class and the current state.
+     */
+    @Override
+    public void endOfLife(Object globalContext) {
+        super.endOfLife(globalContext);
+
+        if (current != null) {
+            current.endOfLife(globalContext);
+        }
+    }
+
+    /**
+     * Retrieves a map with given InputData which have been inserted into the
+     * current artifact before the parameterization began.
+     */
+    public Map<String, InputData> getPreSettings() {
+        return this.preSettings;
+    }
+
+    /**
+     * Set InputData which are used in later states.
+     */
+    public void setPreSettings(Map<String, InputData> preSettings) {
+        this.preSettings = preSettings;
+        if (this.current != null){
+            this.current.setPreSettings(preSettings);
+        }
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVArtifactFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts;
+
+import de.intevation.artifactdatabase.DefaultArtifactFactory;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+
+/**
+ * The GNV default implementation of <code>DefaultArtifactFactory</code>.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class GNVArtifactFactory extends DefaultArtifactFactory {
+
+    /**
+     *
+     */
+    public static final String XPATH_PRODUCT_FACTORY   = "artifact-factory";
+
+    private static Logger logger = Logger.getLogger(GNVArtifactFactory.class);
+
+    /**
+     * Constructor.
+     */
+    public GNVArtifactFactory() {
+    }
+
+    /**
+     *
+     * @param document
+     * @param factoryNode Contains necessary information about the desired
+     * factory.
+     */
+    @Override
+    public void setup(Document document, Node factoryNode) {
+        super.setup(document, factoryNode);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVDefaultArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts;
+
+import de.intevation.artifactdatabase.DefaultArtifact;
+import de.intevation.artifacts.common.utils.XMLUtils;
+
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * The default gnv artifact. The only thing defined here is a method to append
+ * the selected fis to the describe document.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class GNVDefaultArtifact extends DefaultArtifact {
+
+    private static Logger logger = Logger.getLogger(GNVDefaultArtifact.class);
+
+    /**
+     *
+     */
+    public static final String EXCEPTION_NO_INPUT = "no.input.data";
+
+
+    /**
+     * Constructor.
+     */
+    public GNVDefaultArtifact() {
+        super();
+    }
+
+
+    /**
+     * Append the selected fis to the describe document.
+     *
+     * @param document
+     * @param staticNode
+     * @param context
+     * @param fisName
+     */
+    protected void appendFis(
+        Document    document,
+        Element     staticNode,
+        CallContext context,
+        String      fisName
+    ) {
+        RessourceFactory resource = RessourceFactory.getInstance();
+        CallMeta callMeta         = (CallMeta) context.getMeta();
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            XMLUtils.XFORM_URL,
+            XMLUtils.XFORM_PREFIX
+        );
+
+        XMLUtils.ElementCreator artCreator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
+
+        Element selectNode = creator.create("select1");
+        artCreator.addAttr(selectNode, "fis", "true", true);
+
+        Element labelNode = creator.create("label");
+        labelNode.setTextContent(
+            resource.getRessource(callMeta.getLanguages(), "fis", "fis")
+        );
+
+        Element choicesNode = creator.create("choices");
+
+        Element itemNode = creator.create("item");
+        creator.addAttr(itemNode, "selected", "true");
+
+        Element choiceLabel = creator.create("label");
+        choiceLabel.setTextContent(resource.getRessource(
+            callMeta.getLanguages(),
+            fisName,
+            fisName
+        ));
+
+        Element choiceValue = creator.create("value");
+        choiceValue.setTextContent(fisName);
+
+        itemNode.appendChild(choiceLabel);
+        itemNode.appendChild(choiceValue);
+        choicesNode.appendChild(itemNode);
+
+        selectNode.appendChild(labelNode);
+        selectNode.appendChild(choicesNode);
+
+        staticNode.appendChild(selectNode);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/GNVProductArtifactFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.xpath.XPathConstants;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import de.intevation.artifactdatabase.DefaultArtifactFactory;
+import de.intevation.artifactdatabase.ProxyArtifact;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.GlobalContext;
+import de.intevation.gnv.artifacts.fis.SelectProductArtifact;
+import de.intevation.gnv.artifacts.fis.product.DefaultProduct;
+import de.intevation.gnv.state.DefaultInputData;
+
+/**
+ * This factory is called to create a {@link
+ * de.intevation.gnv.artifacts.fis.SelectProductArtifact} which lets the user
+ * select a product supported by the selected fis.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class GNVProductArtifactFactory extends DefaultArtifactFactory {
+
+    public static final String XPATH_REPLACE_NAME = "IDENTIFIER";
+
+    public static final String XPATH_PRODUCT_ARTIFACT =
+        "artifact-database/artifacts/artifact[@name='"+XPATH_REPLACE_NAME+"']";
+
+    public static final String XPATH_PRODUCT = "products/product";
+
+    public static final String XPATH_PRODUCT_NAME = "@name";
+
+    public static final String XPATH_PRODUCT_FACTORY = "artifact-factory";
+
+    public static final String XPATH_PRODUCT_PARAMETER = "parameters/parameter";
+
+    private Logger logger = Logger.getLogger(GNVProductArtifactFactory.class);
+
+    private Map productFactories;
+    private Map products;
+
+
+    /**
+     * Constructor.
+     */
+    public GNVProductArtifactFactory() {
+    }
+
+    /**
+     * Method to create an artifact. If the created artifact is from type
+     * <code>ProxyArtifact</code>, a further ProductSelectArtifact is created
+     * which becomes embedded into the <code>ProxyArtifact</code>.
+     * @param identifier UUID.
+     * @param context CallContext.
+     * @param data Some data.
+     * @return The created artifact.
+     */
+    @Override
+    public Artifact createArtifact(
+        String        identifier,
+        GlobalContext context,
+        CallMeta      meta,
+        Document      data
+    ) {
+        // create a SelectProductArtifact for initial product selection
+        Artifact artifact = super.createArtifact(identifier, context, meta, data);
+
+        if (artifact instanceof ProxyArtifact) {
+
+            SelectProductArtifact select = new SelectProductArtifact();
+            select.setProducts(products);
+            select.setup(identifier, this, context, meta, data);
+
+            ((ProxyArtifact) artifact).setProxied(select);
+        }
+
+        return artifact;
+    }
+
+
+    @Override
+    public void setup(Document document, Node factoryNode) {
+        super.setup(document, factoryNode);
+
+        String xpath  = XPATH_PRODUCT_ARTIFACT.replace(XPATH_REPLACE_NAME, name);
+        Node artifact = (Node) XMLUtils.xpath(
+            document, xpath, XPathConstants.NODE);
+
+        NodeList productNodes = (NodeList) XMLUtils.xpath(
+            artifact, XPATH_PRODUCT, XPathConstants.NODESET);
+
+        if (productNodes == null) {
+            logger.warn("No products found for fis: " + name);
+            return;
+        }
+
+        int productLength = productNodes.getLength();
+
+        if (productLength != 0) {
+            productFactories = new HashMap(productLength);
+            products         = new HashMap(productLength);
+
+            parseProductFactories(document, productNodes);
+        }
+    }
+
+
+    public ArtifactFactory getArtifactFactoryByName(String name) {
+        return (ArtifactFactory) productFactories.get(name);
+    }
+
+
+    protected void parseProductFactories(Document document, NodeList products) {
+        int items = products.getLength();
+
+        for(int i = 0; i < items; i++) {
+
+            try {
+                Node product = products.item(i);
+
+                String name = (String) XMLUtils.xpath(
+                    product, XPATH_PRODUCT_NAME, XPathConstants.STRING);
+
+                Node factoryNode = (Node) XMLUtils.xpath(
+                    product, XPATH_PRODUCT_FACTORY, XPathConstants.NODE);
+
+                String factoryClass = factoryNode.getTextContent().trim();
+
+                if (factoryClass == null || factoryClass.equals("")) {
+                    logger.warn("No artifact factory class found for " + name);
+                    continue;
+                }
+
+                Class cls               = Class.forName(factoryClass);
+                ArtifactFactory factory = (ArtifactFactory) cls.newInstance();
+                factory.setup(document, factoryNode);
+
+                productFactories.put(name, factory);
+                initializeProducts(product);
+            }
+            catch (ClassNotFoundException cnfe) {
+                logger.warn(cnfe, cnfe);
+            }
+            catch (InstantiationException ie) {
+                logger.warn(ie, ie);
+            }
+            catch (IllegalAccessException iae) {
+                logger.warn(iae, iae);
+            }
+        }
+    }
+
+
+    /**
+     * Initialize all products supported by the current fis.
+     */
+    protected void initializeProducts(Node productNode) {
+        String productName = (String) XMLUtils.xpath(
+            productNode, "@name", XPathConstants.STRING);
+
+        NodeList parameterNodes = (NodeList) XMLUtils.xpath(
+            productNode, XPATH_PRODUCT_PARAMETER, XPathConstants.NODESET
+        );
+
+        if (parameterNodes != null) {
+            int items = parameterNodes.getLength();
+            Collection inputParameter = new ArrayList(items);
+
+            for (int j = 0; j < items; j++) {
+                Node parameterNode = (Node) parameterNodes.item(j);
+                String name        = (String) XMLUtils.xpath(
+                    parameterNode, "@name", XPathConstants.STRING);
+                String value       = (String) XMLUtils.xpath(
+                    parameterNode, "@value", XPathConstants.STRING);
+
+                inputParameter.add(new DefaultInputData(name, value));
+            }
+
+            products.put(
+                productName,
+                new DefaultProduct(productName, inputParameter, this.name)
+            );
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/PreSettingArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts;
+
+import de.intevation.gnv.state.InputData;
+
+import java.util.Map;
+
+/**
+ * This artifact is used to be fed before the parameterization has started.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public interface PreSettingArtifact {
+
+
+    /**
+     *
+     * @return the InputData which have been inserted before parameterization
+     * has started.
+     */
+    Map<String,InputData> getPreSettings();
+
+    /**
+     *
+     * @param preSettings
+     */
+    void setPreSettings(Map<String,InputData> preSettings);
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,16 +1,31 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts.cache;
 
+import java.lang.management.ManagementFactory;
+
+import javax.management.MBeanServer;
+
 import net.sf.ehcache.Cache;
 import net.sf.ehcache.CacheManager;
 
+import net.sf.ehcache.management.ManagementService;
+
 import org.apache.log4j.Logger;
 
+import de.intevation.gnv.geobackend.base.query.cache.CacheCleaner;
+import de.intevation.gnv.state.cache.ThematicDataCacheCleaner;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The <code>CacheFactory</code> is used to initialize and retrieve Cache.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class CacheFactory {
 
@@ -27,11 +42,16 @@
     private static CacheFactory instance = null;
 
     /**
-     * 
+     * The manager of the Cache
      */
     private CacheManager cacheManager = null;
 
     /**
+     * The Cleaner of the Cache
+     */
+    private CacheCleaner cacheCleaner = null;
+
+    /**
      * Basic-Constructor of this Class
      */
     private CacheFactory() {
@@ -40,7 +60,7 @@
 
     /**
      * This Method provides an singleton Instance of this Class.
-     * 
+     *
      * @return an singleton Instance of this Class
      */
     public static CacheFactory getInstance() {
@@ -52,7 +72,7 @@
 
     /**
      * Getting the ConnectionPool
-     * 
+     *
      * @return the ConnectionPool
      */
     public Cache getCache() {
@@ -62,21 +82,26 @@
     /**
      * Initializes the ConnectionPool. Should only be called once on system
      * startup
-     * 
-     * @param properties
-     *            the Properties for the Individual Configuration of the
-     *            ConnectionPool
+     *
+     * @param configurationFileName
      */
     public void initializeCache(String configurationFileName) {
         if (cacheManager == null) {
             cacheManager = new CacheManager(configurationFileName);
             cacheManager.addCache(CACHENAME);
+
+            MBeanServer beanServer = ManagementFactory.getPlatformMBeanServer();
+            ManagementService.registerMBeans(
+                cacheManager, beanServer, false, false, false, true);
+
+            this.cacheCleaner = new ThematicDataCacheCleaner();
+            this.cacheCleaner.start();
         }
     }
 
     /**
      * Checks if the ConnectionPool has already been initialized.
-     * 
+     *
      * @return true if the ConnectionPool is initialized.
      */
     public boolean isInitialized() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/cache/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains classes used for data caching.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContext.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,23 +1,108 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
-package de.intevation.gnv.artifacts.context;
 
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
+package de.intevation.gnv.artifacts.context;
 
 import de.intevation.artifactdatabase.DefaultArtifactContext;
 
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Paint;
+
+import java.io.File;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This class defines some final fields used to store some meta information
+ * required during the  work with an artifact into a context object which is
+ * available in each request specified in
+ * <code>de.intevation.gnv.artifacts.Artifacts</code> and further methods called
+ * by those.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
-public class GNVArtifactContext extends DefaultArtifactContext {
+public class GNVArtifactContext
+extends      DefaultArtifactContext
+{
     /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(GNVArtifactContext.class);
 
+    public static final String CHART_TEMPLATE_KEY =
+        "gnv.chart.template";
+
+    public static final String HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES_KEY =
+        "gnv.horizontal.cross.section.profile.samples";
+
+    public static final String HORIZONTAL_CROSS_SECTION_SAMPLES_KEY =
+        "gnv.horizontal.cross.section.samples";
+
+    public static final String HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS_KEY =
+        "gnv.horizontal.cross.section.extrapolation.rounds";
+
+    public static final String
+        HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH_KEY =
+        "gnv.horizontal.cross.section.result.shapefile";
+
+    public static final File
+        DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH =
+        new File(System.getProperty("java.io.tmpdir"));
+
+    public static final Integer
+        DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES = Integer.valueOf(250);
+
+    public static final Integer
+        DEFAULT_HORIZONTAL_CROSS_SECTION_SAMPLES = Integer.valueOf(1024);
+
+    public static final Integer
+        DEFAULT_HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS = Integer.valueOf(0);
+
+    public static final String HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY =
+        "gnv.horizontal.cross.section.ground.interpolation";
+
+    public static final String DEFAULT_HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION =
+        "bilinear";
+
+    public static final String PALETTES_KEY =
+        "gnv.color.palettes";
+
+    public static final String VERTICAL_CROSS_SECTION_SAMPLES_KEY =
+        "gnv.vertical.cross.section.samples";
+
+    public static final Dimension DEFAULT_VERTICAL_CROSS_SECTION_SAMPLES =
+        new Dimension(1024, 768);
+
+    public static final String VERTICAL_CROSS_SECTION_FILTER_FACTORIES_KEY =
+        "gnv.vertical.cross.section.filter.factories";
+
+    public static final String VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY =
+        "gnv.vertical.cross.section.ground.interpolation";
+
+    public static final String DEFAULT_VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION =
+        "bilinear";
+
+    public static final String VERTICAL_CROSS_SECTION_GROUND_FILL_KEY =
+        "gnv.vertical.cross.section.ground.fill";
+
+    public static final String MAPSERVER_SERVER_PATH_KEY =
+        "mapserver.server.path";
+
+    public static final String MAPSERVER_MAP_PATH_KEY =
+        "mapserver.map.path";
+
+    public static final Paint DEFAULT_VERTICAL_CROSS_SECTION_GROUND_FILL =
+        new Color(0x7c8683);
+
     public GNVArtifactContext() {
         super();
         log.debug("GNVArtifactContext.Constructor");
@@ -27,5 +112,5 @@
         super(config);
         log.debug("GNVArtifactContext.Constructor(config)");
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/GNVArtifactContextFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,32 +1,60 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts.context;
 
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.artifacts.common.utils.XMLUtils;
+
+import de.intevation.artifacts.ArtifactContextFactory;
+import de.intevation.artifacts.GlobalContext;
+
+import de.intevation.gnv.artifacts.cache.CacheFactory;
+
+import de.intevation.gnv.chart.XMLChartTheme;
+
+import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
+
+import de.intevation.gnv.geobackend.config.Configuration;
+
+import de.intevation.gnv.raster.Filter;
+import de.intevation.gnv.raster.Palette;
+import de.intevation.gnv.raster.PaletteManager;
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Paint;
+
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.File;
 
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Properties;
 
 import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
 
-import de.intevation.artifactdatabase.Config;
-import de.intevation.artifacts.ArtifactContextFactory;
-import de.intevation.gnv.artifacts.cache.CacheFactory;
-import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
-import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory;
-import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
-import de.intevation.gnv.chart.XMLChartTheme;
-
-import de.intevation.artifactdatabase.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This factory class is used to create new GNVArtfactContext objects,
+ * initialize required components and put them into the created context object
+ * for being available in the application.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:iweinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class GNVArtifactContextFactory implements ArtifactContextFactory {
     /**
@@ -34,15 +62,101 @@
      */
     private static Logger log = Logger.getLogger(GNVArtifactContext.class);
 
-    public static final String XPATH_GEOBACKEND_CONFIGURATION = "artifact-database/geo-backend/backend-configuration";
-
-    public static final String XPATH_GEOBACKEND_QUERYCONFIGURATION = "artifact-database/geo-backend/query-configuration";
+    /**
+     *
+     */
+    public static final String XPATH_GEOBACKEND_CONFIGURATION =
+        "artifact-database/geo-backend";
 
-    private final static String CACHECONFIGNODEPATH = "/artifact-database/ehcache/configuration";
+    /**
+     *
+     */
+    public static final String XPATH_GEOBACKEND_QUERYCONFIGURATION =
+        "artifact-database/geo-backend/query-configuration";
 
-    private final static String CHARTCONFIGNODEPATH = "/artifact-database/charttemplate/configuration";
+    private final static String CACHECONFIGNODEPATH =
+        "/artifact-database/ehcache/configuration";
 
-    public final static String CHARTTEMPLATE = "template";
+    private final static String CHARTCONFIGNODEPATH =
+        "/artifact-database/gnv/charttemplate/configuration";
+
+    /**
+     *
+     */
+    public final static String PALETTES_PATH =
+        "/artifact-database/gnv/palettes";
+
+    /**
+     *
+     */
+    public final static String PALETTE_ITEMS =
+        "palette";
+
+    /**
+     *
+     */
+    public final static String HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES =
+        "/artifact-database/gnv/horizontal-cross-section-profile/samples/@number";
+
+    /**
+     *
+     */
+    public final static String HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION =
+        "/artifact-database/gnv/horizontal-cross-section/ground/@interpolation";
+
+    /**
+     *
+     */
+    public final static String HORIZONTAL_CROSS_SECTION_SAMPLES =
+        "/artifact-database/gnv/horizontal-cross-section/samples/@number";
+
+    /**
+     *
+     */
+    public final static String HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS =
+        "/artifact-database/gnv/horizontal-cross-section/extrapolation/@rounds";
+
+    /**
+     *
+     */
+    public final static String HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH =
+        "/artifact-database/gnv/shapefile-directory/@path";
+
+    /**
+     *
+     */
+    public final static String VERTICAL_CROSS_SECTION_SAMPLES =
+        "/artifact-database/gnv/vertical-cross-section/samples";
+
+    /**
+     *
+     */
+    public final static String VERTICAL_CROSS_SECTION_FILTERS =
+        "/artifact-database/gnv/vertical-cross-section/filters/filter";
+
+    /**
+     *
+     */
+    public final static String VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION =
+        "/artifact-database/gnv/vertical-cross-section/ground/@interpolation";
+
+    /**
+     *
+     */
+    public final static String VERTICAL_CROSS_SECTION_GROUND_FILL_COLOR =
+        "/artifact-database/gnv/vertical-cross-section/ground/@fill-color";
+
+    /**
+     *
+     */
+    public final static String XPATH_MAPSERVER_PATH =
+        "/artifact-database/mapserver/server/@path";
+
+    /**
+     *
+     */
+    public final static String XPATH_MAP_PATH =
+        "/artifact-database/gnv/map-generator/mapfile/@path";
 
     /**
      * Constructor
@@ -53,58 +167,36 @@
     }
 
     /**
+     * Create a new {@link GNVArtifactContext} object and initialize all
+     * components required by the application.
+     *
+     * @param config
+     * @return GNVArtifactContext
      * @see de.intevation.artifacts.ArtifactContextFactory#createArtifactContext(org.w3c.dom.Document)
      */
-    public Object createArtifactContext(Document config) {
+    public GlobalContext createArtifactContext(Document config) {
         GNVArtifactContext returnValue = null;
         try {
             log.debug("GNVArtifactContextFactory.createArtifactContext");
-            log.info("Initialisation of the Geo-BackendConnectionPool");
-            String backendConfigurationFile = Config.getStringXPath(config,
-                    XPATH_GEOBACKEND_CONFIGURATION);
-            backendConfigurationFile = Config.replaceConfigDir(backendConfigurationFile);
-            
-            Properties properties = getProperties(backendConfigurationFile);
-            ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
-            cpf.initializeConnectionPool(properties);
-
-            log.info("Initialisation of the QueryContainer");
-            String queryConfigurationFile = Config.getStringXPath(config,
-                    XPATH_GEOBACKEND_QUERYCONFIGURATION);
-            queryConfigurationFile = Config.replaceConfigDir(queryConfigurationFile);
-            
-            Properties queryProperties = getProperties(queryConfigurationFile);
-            QueryContainerFactory qcf = QueryContainerFactory.getInstance();
-            qcf.initializeQueryContainer(queryProperties);
 
-            log.info("Initialisation of the Cache");
-            String cacheConfigurationFile = Config.getStringXPath(config,
-                    CACHECONFIGNODEPATH);
-            cacheConfigurationFile = Config.replaceConfigDir(cacheConfigurationFile);
-            CacheFactory cf = CacheFactory.getInstance();
-            cf.initializeCache(cacheConfigurationFile);
+            configureGeoBackend(config);
 
-            log.info("Initialisation of chart template");
-            String chartConfigFile = Config.getStringXPath(
-                config, CHARTCONFIGNODEPATH
-            );
-            chartConfigFile = Config.replaceConfigDir(chartConfigFile);
-            log.debug("Parse xml configuration of " + chartConfigFile);
-
-            Document tmpl = XMLUtils.parseDocument(new File(chartConfigFile));
-            XMLChartTheme theme = new XMLChartTheme("XMLChartTheme");
-            if (tmpl != null) {
-                theme.applyXMLConfiguration(tmpl);
-            }
-            else {
-                log.error(
-                    "Cannot load chart template from '" +
-                    chartConfigFile + "'");
-            }
+            configureCache(config);
 
             returnValue = new GNVArtifactContext(config);
 
-            returnValue.put(CHARTTEMPLATE, theme);
+            configurePalettes(config, returnValue);
+
+            configureChartTemplate(config, returnValue);
+
+            configureHorizontalCrossSectionProfile(config, returnValue);
+
+            configureHorizontalCrossSection(config,returnValue);
+
+            configureVerticalCrossSection(config, returnValue);
+
+            configureMapserver(config, returnValue);
+
         } catch (FileNotFoundException e) {
             log.error(e, e);
         } catch (IOException e) {
@@ -115,15 +207,570 @@
         return returnValue;
     }
 
+    protected void configureGeoBackend(Document config)
+    throws FileNotFoundException, IOException, QueryContainerException
+    {
+        Configuration geoConf = Configuration.getInstance();
+        String configDir      = Config.getConfigDirectory().getAbsolutePath();
+        geoConf.init(config, configDir, Config.CONFIG_DIR_PLACEHOLDER);
+    }
+
     /**
-     * @param filePath
-     * @return
-     * @throws FileNotFoundException
-     * @throws IOException
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureVerticalCrossSection(
+        Document           config,
+        GNVArtifactContext context
+    ) {
+        log.info("configuration of vertical cross section");
+        configureVerticalCrossSectionSamples(config, context);
+        configureVerticalCrossSectionFilters(config, context);
+        configureVerticalCrossSectionGroundInterpolation(config, context);
+        configureVerticalCrossSectionGroundFillColor(config, context);
+    }
+
+
+    /**
+     *
+     * @param config
+     */
+    protected void configureCache(Document config) {
+        String cacheConfigurationFile = Config.getStringXPath(
+            config, CACHECONFIGNODEPATH);
+
+        if (cacheConfigurationFile != null
+        && !cacheConfigurationFile.equals(""))
+        {
+            log.info("Initialisation of the Cache");
+            cacheConfigurationFile = Config.replaceConfigDir(
+                cacheConfigurationFile);
+
+            CacheFactory cf = CacheFactory.getInstance();
+            cf.initializeCache(cacheConfigurationFile);
+        }
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureVerticalCrossSectionGroundFillColor(
+        Document           config,
+        GNVArtifactContext context
+    ) {
+        log.info("configuration of vertical cross section ground fill color");
+
+        String fillColor = Config.getStringXPath(
+            config,
+            VERTICAL_CROSS_SECTION_GROUND_FILL_COLOR);
+
+        Paint fill =
+            GNVArtifactContext.DEFAULT_VERTICAL_CROSS_SECTION_GROUND_FILL;
+
+        if (fillColor != null
+        && (fillColor = fillColor.trim()).length() != 0) {
+            try {
+                Color color = Color.decode(fillColor);
+                log.info("ground fill color: #" +
+                    Integer.toHexString(color.getRGB()));
+                fill = color;
+            }
+            catch (NumberFormatException nfe) {
+                log.error("'" + fillColor + "' is not a valid color");
+            }
+        }
+
+        context.put(
+            GNVArtifactContext
+                .VERTICAL_CROSS_SECTION_GROUND_FILL_KEY,
+            fill);
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureVerticalCrossSectionGroundInterpolation(
+        Document           config,
+        GNVArtifactContext context
+    ) {
+        log.info("configuration of vertical cross section ground interpolation");
+        String interpolation = Config.getStringXPath(
+            config,
+            VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION);
+
+        if (interpolation == null
+        || (interpolation = interpolation.trim()).length() == 0) {
+            interpolation = GNVArtifactContext
+                .DEFAULT_VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION;
+        }
+
+        log.info("ground interpolation: " + interpolation);
+
+        context.put(
+            GNVArtifactContext
+                .VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY,
+            interpolation);
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureVerticalCrossSectionFilters(
+        Document           config,
+        GNVArtifactContext context
+    ) {
+        log.info("configuration of vertical cross section filters");
+
+        NodeList filters = Config.getNodeSetXPath(
+            VERTICAL_CROSS_SECTION_FILTERS);
+
+        ArrayList<Filter.Factory> filterFactories =
+            new ArrayList<Filter.Factory>();
+
+        if (filters == null) {
+            log.warn("no filters found");
+        }
+        else {
+            for (int i = 0, N = filters.getLength(); i < N; ++i) {
+                Element filterElement = (Element)filters.item(i);
+                String factoryName = filterElement.getAttribute("factory");
+                if ((factoryName = factoryName.trim()).length() > 0) {
+                    try {
+                        Class clazz = Class.forName(factoryName);
+                        Filter.Factory filterFactory =
+                            (Filter.Factory)clazz.newInstance();
+                        filterFactories.add(filterFactory);
+                    }
+                    catch (ClassNotFoundException cnfe) {
+                        log.error("filter class not found", cnfe);
+                    }
+                    catch (InstantiationException ie) {
+                        log.error("cannot instantiate filter factory", ie);
+                    }
+                    catch (IllegalAccessException iae) {
+                        log.error("cannot access filter factory", iae);
+                    }
+                    catch (ClassCastException cce) {
+                        log.error("not a filter factory class", cce);
+                    }
+                }
+                else {
+                    log.error("No factory name given");
+                }
+            }
+        }
+
+        log.info("number of filters: " + filterFactories.size());
+
+        context.put(
+            GNVArtifactContext.VERTICAL_CROSS_SECTION_FILTER_FACTORIES_KEY,
+            Collections.unmodifiableList(filterFactories));
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureVerticalCrossSectionSamples(
+        Document           config,
+        GNVArtifactContext context
+    ) {
+        log.info("configuration of vertical cross section samples");
+
+        Element samples = (Element)Config.getNodeXPath(
+            VERTICAL_CROSS_SECTION_SAMPLES);
+
+        Dimension sampleSize = new Dimension(
+            GNVArtifactContext.DEFAULT_VERTICAL_CROSS_SECTION_SAMPLES);
+
+        if (samples == null) {
+            log.warn("no samples found");
+        }
+        else {
+            String widthString = samples.getAttribute("width");
+            if ((widthString = widthString.trim()).length() > 0) {
+                try {
+                    sampleSize.width = Math.max(1, Integer.parseInt(widthString));
+                }
+                catch (NumberFormatException nfe) {
+                    log.error("invalid value for width: '" + widthString + "'");
+                }
+            }
+            String heightString = samples.getAttribute("height");
+            if ((heightString = heightString.trim()).length() > 0) {
+                try {
+                    sampleSize.height = Math.max(1, Integer.parseInt(heightString));
+                }
+                catch (NumberFormatException nfe) {
+                    log.error("invalid value for height: '" + heightString + "'");
+                }
+            }
+        }
+        log.info("samples (width x height): " +
+            sampleSize.width + " x " + sampleSize.height);
+
+        context.put(
+            GNVArtifactContext.VERTICAL_CROSS_SECTION_SAMPLES_KEY,
+            sampleSize);
+
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureHorizontalCrossSectionProfile(
+        Document           config,
+        GNVArtifactContext context
+    )
+    {
+        log.info("configuration of horizontal cross section profile");
+
+        String numSamples = Config.getStringXPath(
+            config,
+            HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES);
+
+        Integer samples =
+            GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES;
+
+        if (numSamples == null) {
+            log.warn("No number of samples found.");
+        }
+        else {
+            try {
+                samples = Integer.valueOf(numSamples);
+            }
+            catch (NumberFormatException nfe) {
+                log.warn("Invalid integer for number of samples");
+            }
+        }
+
+        log.info("# horizontal cross section profile samples: " + samples);
+
+        context.put(
+            GNVArtifactContext.HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES_KEY,
+            samples);
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureHorizontalCrossSection(
+        Document           config,
+        GNVArtifactContext context
+    ) {
+        log.info("configuration of horizontal cross section");
+
+        configureHorizontalCrossSectionSamples(config, context);
+        configureHorizontalCrossSectionExtrapolation(config, context);
+        configureHorizontalCrossSectionResultShapeFilePath(config, context);
+        configureHorizontalCrossSectionGroundInterpolation(config, context);
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureHorizontalCrossSectionExtrapolation(
+        Document           config,
+        GNVArtifactContext context
+    )
+    {
+        log.info(
+            "configuration of horizontal cross section extrapolation");
+
+        String extrapolationRoundsValue = Config.getStringXPath(
+            config,
+            HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS);
+
+        Integer extrapolationRounds =
+            GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS;
+
+        if (extrapolationRoundsValue != null
+        && (extrapolationRoundsValue = extrapolationRoundsValue.trim()).length() > 0
+        ) {
+            try {
+                extrapolationRounds =
+                    Integer.valueOf(extrapolationRoundsValue);
+            }
+            catch (NumberFormatException nfe) {
+                log.error(
+                    "'" + extrapolationRoundsValue + "' is not a valid integer");
+            }
+        }
+
+        log.info("extrapolation rounds: " + extrapolationRounds);
+
+        context.put(
+            GNVArtifactContext
+                .HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS_KEY,
+            extrapolationRounds);
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureHorizontalCrossSectionGroundInterpolation(
+        Document           config,
+        GNVArtifactContext context
+    )
+    {
+        log.info(
+            "configuration of horizontal cross section ground interpolation");
+
+        String interpolation = Config.getStringXPath(
+            config,
+            HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION);
+
+        if (interpolation == null
+        || (interpolation = interpolation.trim()).length() == 0) {
+            interpolation = GNVArtifactContext
+                .DEFAULT_HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION;
+        }
+
+        log.info("ground interpolation: " + interpolation);
+
+        context.put(
+            GNVArtifactContext
+                .HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY,
+            interpolation);
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureHorizontalCrossSectionResultShapeFilePath(
+        Document           config,
+        GNVArtifactContext context
+    )
+    {
+        log.info(
+            "configuration of horizontal cross section result shape file path");
+
+        File dir =
+            GNVArtifactContext.
+            DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH;
+
+        String path = Config.getStringXPath(
+            config,
+            HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH);
+
+        if (path != null && (path = path.trim()).length() > 0) {
+            dir = new File(Config.replaceConfigDir(path));
+        }
+        else {
+            log.warn("No 'result-shapefile-directory' given");
+        }
+
+        log.info("writing shape files to '"
+            + dir.getAbsolutePath() + "'");
+
+        context.put(
+            GNVArtifactContext
+                .HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH_KEY,
+            dir);
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureHorizontalCrossSectionSamples(
+        Document           config,
+        GNVArtifactContext context
+    )
+    {
+        log.info("configuration of horizontal cross section samples");
+        String numSamples = Config.getStringXPath(
+            config,
+            HORIZONTAL_CROSS_SECTION_SAMPLES);
+
+        Integer samples =
+            GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_SAMPLES;
+
+        if (numSamples == null) {
+            log.warn("No number of samples found.");
+        }
+        else {
+            try {
+                samples = Integer.valueOf(numSamples);
+            }
+            catch (NumberFormatException nfe) {
+                log.warn("Invalid integer for number of samples");
+            }
+        }
+
+        log.info("# horizontal cross section profile samples: " + samples);
+
+        context.put(
+            GNVArtifactContext.HORIZONTAL_CROSS_SECTION_SAMPLES_KEY,
+            samples);
+    }
+
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureChartTemplate(
+        Document           config,
+        GNVArtifactContext context
+    ) {
+        log.info("Initialisation of chart template");
+        String chartConfigFile = Config.getStringXPath(
+            config, CHARTCONFIGNODEPATH
+        );
+
+        XMLChartTheme theme = new XMLChartTheme("XMLChartTheme");
+
+        if (chartConfigFile == null) {
+            log.warn("no configuration file for chart template found");
+        }
+        else {
+            chartConfigFile = Config.replaceConfigDir(chartConfigFile);
+            log.debug("Parse xml configuration of " + chartConfigFile);
+
+            Document tmpl = XMLUtils.parseDocument(new File(chartConfigFile));
+            if (tmpl != null) {
+                theme.applyXMLConfiguration(tmpl);
+            }
+            else {
+                log.error(
+                    "Cannot load chart template from '" +
+                    chartConfigFile + "'");
+            }
+        }
+
+        context.put(GNVArtifactContext.CHART_TEMPLATE_KEY, theme);
+    }
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configurePalettes(
+        Document           config,
+        GNVArtifactContext context
+    ) {
+        log.info("configure palettes");
+
+        HashMap<Integer, PaletteManager> palettes = new HashMap();
+
+        Element node = (Element)Config.getNodeXPath(config, PALETTES_PATH);
+
+        if (node == null) {
+            log.error("No palettes found");
+        }
+        else {
+            NodeList pals = node.getElementsByTagName(PALETTE_ITEMS);
+            for (int i = 0, N = pals==null?0:pals.getLength(); i < N; ++i) {
+                Element pal = (Element)pals.item(i);
+                String name         = pal.getAttribute("name");
+                String description  = pal.getAttribute("description");
+                String filename     = pal.getAttribute("file");
+                String parameterIds = pal.getAttribute("parameter-ids");
+
+                if (name == null || (name = name.trim()).length() == 0) {
+                    log.error("Palette has no 'name' attribute.");
+                }
+                else if (filename == null
+                || (filename = filename.trim()).length() == 0) {
+                    log.error("Palette '" + name + "' has no 'file' attribute.");
+                }
+                else if (parameterIds == null
+                || (parameterIds = parameterIds.trim()).length() == 0) {
+                    log.error("no parameter ids given for '" + name + "'");
+                }
+                else {
+                    ArrayList<Integer> ids = new ArrayList<Integer>();
+                    for (String idString: parameterIds.split("[\t ,]+")) {
+                        try {
+                            ids.add(Integer.valueOf(idString));
+                        }
+                        catch (NumberFormatException nfe) {
+                            log.error(
+                                "parameter id '" + idString + "' is integer");
+                        }
+                    }
+                    filename = Config.replaceConfigDir(filename);
+                    Document document = XMLUtils.parseDocument(
+                        new File(filename));
+                    if (document == null) {
+                        log.error("Cannot load palette file '" +
+                            filename + "'");
+                    }
+                    else {
+                        PaletteManager manager = new PaletteManager(
+                            name,
+                            description,
+                            new Palette(document));
+                        for (Integer id: ids) {
+                            palettes.put(id, manager);
+                        }
+                    }
+                }
+            } // for all palettes
+        }
+
+        context.put(GNVArtifactContext.PALETTES_KEY, palettes);
+    }
+
+
+    /**
+     *
+     * @param config
+     * @param context
+     */
+    protected void configureMapserver(
+        Document           config,
+        GNVArtifactContext context
+    ) {
+        log.info("read configuration of mapserver.");
+
+        String serverPath = (String) Config.getStringXPath(
+            config, XPATH_MAPSERVER_PATH);
+
+        String mapPath = (String) Config.getStringXPath(
+            config, XPATH_MAP_PATH);
+        mapPath        = Config.replaceConfigDir(mapPath);
+
+        if (serverPath != null && mapPath != null) {
+            context.put(GNVArtifactContext.MAPSERVER_SERVER_PATH_KEY,serverPath);
+            context.put(GNVArtifactContext.MAPSERVER_MAP_PATH_KEY, mapPath);
+        }
+    }
+
+    /**
+     * Read some properties from config file specified by <code>filePath</code>.
+     *
+     * @param filePath Path to a cofig file.
+     * @return Properties contained in <code>filePath</code>.
+     * @throws FileNotFoundException if file specified by filePath is not
+     * existing.
+     * @throws IOException if an error occured while reading from file.
      */
     private Properties getProperties(String filePath)
-                                                     throws FileNotFoundException,
-                                                     IOException {
+    throws FileNotFoundException, IOException
+    {
         InputStream inputStream = null;
         try {
             inputStream = new FileInputStream(filePath);
@@ -139,3 +786,4 @@
         }
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/context/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Support for context objects that store data items used in the GNV in different
+places across the whole application.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/FISArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,478 +0,0 @@
-/**
- *
- */
-package de.intevation.gnv.artifacts.fis;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-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.Config;
-import de.intevation.artifactdatabase.DefaultArtifact;
-import de.intevation.artifactdatabase.XMLUtils;
-import de.intevation.artifacts.Artifact;
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.artifacts.CallContext;
-import de.intevation.artifacts.CallMeta;
-import de.intevation.gnv.artifacts.GNVArtifactBase;
-import de.intevation.gnv.artifacts.context.GNVArtifactContext;
-import de.intevation.gnv.artifacts.fis.product.DefaultProduct;
-import de.intevation.gnv.artifacts.fis.product.Product;
-import de.intevation.gnv.artifacts.ressource.RessourceFactory;
-import de.intevation.gnv.state.DefaultInputData;
-import de.intevation.gnv.state.InputData;
-import de.intevation.gnv.utils.ArtifactFactoryUtilities;
-import de.intevation.gnv.utils.ArtifactXMLUtilities;
-
-/**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
- */
-public class FISArtifact extends DefaultArtifact {
-
-    /**
-     * the logger, used to log exceptions and additonaly information
-     */
-    private static Logger log = Logger.getLogger(GNVArtifactBase.class);
-    /**
-     * The UID of this Class
-     */
-    private static final long serialVersionUID = 2874044542701727083L;
-
-    /**
-     * The Identifier for the Replacement of the Artifactname
-     */
-    public static final String XPATH_IDENTIFIER_REPLACE = "IDENTIFIER";
-
-    /**
-     * The XPATH to the XML-Fragment that should be used for the Configuration
-     */
-    public static final String XPATH_ARTIFACT_CONFIGURATION = "/artifact-database/artifacts/artifact[@name='"
-                                                              + XPATH_IDENTIFIER_REPLACE
-                                                              + "']";
-
-    /**
-     * The Name of the Artifact
-     */
-    private String name = null;
-
-    private Map<String, Product> products = null;
-
-    private Artifact productArtifact = null;
-
-    private Product current = null;
-
-    private ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
-
-    /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#advance(org.w3c.dom.Document,
-     *      de.intevation.artifacts.CallContext)
-     */
-    @Override
-    public Document advance(Document target, CallContext context) {
-
-        Document result = null;
-        if (this.productArtifact == null) {
-            if (this.current != null) {
-
-                String uuid = Config.getStringXPath(target,
-                        "action/uuid/@value");
-                String hash = Config.getStringXPath(target,
-                        "action/hash/@value");
-                this.productArtifact = this.current.getArtifactFactory()
-                        .createArtifact(uuid, context);
-                
-                Document feedDocument = xmlUtilities.reInitDocument(this
-                        .createFeedProductArtifactDocument(uuid, hash));
-                log.debug("Feed ==> "
-                          + this.xmlUtilities
-                                  .writeDocument2String(feedDocument));
-                this.productArtifact.feed(feedDocument, context);
-                result = ((GNVArtifactBase)this.productArtifact).initialize(context);
-            } else {
-                String msg = "Artifact is not configured properly. Call feed first.";
-                log.error(msg);
-                result = new ArtifactXMLUtilities().createExceptionReport(msg,
-                        XMLUtils.newDocument());
-            }
-        } else {
-            result = this.productArtifact.advance(target, context);
-        }
-        return result;
-    }
-    
-    private Document createDescribeRequestBody(String uuid, 
-                                               String hash,
-                                               boolean includeUI){
-        Document document = XMLUtils.newDocument();
-        
-        Element rootNode = xmlUtilities.createArtifactElement(document,"action");
-        document.appendChild(rootNode);
-        
-        Element typeNode = this.xmlUtilities.createArtifactElement(document, "type");
-        typeNode.setAttribute("name", "describe");
-        rootNode.appendChild(typeNode);
-        
-        Element uuidNode = this.xmlUtilities.createArtifactElement(document, "uuid");
-        uuidNode.setAttribute("value",uuid);
-        rootNode.appendChild(uuidNode);
-        
-        Element hashNode = this.xmlUtilities.createArtifactElement(document, "hash");
-        hashNode.setAttribute("value", hash);
-        rootNode.appendChild(hashNode);
-        
-        Element includeUINode =  this.xmlUtilities.createArtifactElement(document, "include-ui");
-        includeUINode.setTextContent(""+includeUI);
-        rootNode.appendChild(includeUINode);
-        
-        return document;
-    }
-
-    private Document createAdvanceProductArtifactDocument(String uuid,
-                                                          String hash,
-                                                          String targetName) {
-        Document document = XMLUtils.newDocument();
-        Element rootNode = xmlUtilities.createArtifactElement(document,
-                "action");
-
-        Element typeNode = xmlUtilities.createArtifactElement(document, "type");
-        typeNode.setAttribute("name", "advanve");
-        rootNode.appendChild(typeNode);
-
-        Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid");
-        uuidNode.setAttribute("value", uuid);
-        rootNode.appendChild(uuidNode);
-
-        Element hashNode = xmlUtilities.createArtifactElement(document, "hash");
-        hashNode.setAttribute("value", hash);
-        rootNode.appendChild(hashNode);
-        Element targetNode = xmlUtilities.createArtifactElement(document,
-                "target");
-        targetNode.setAttribute("name", targetName);
-        rootNode.appendChild(targetNode);
-
-        document.appendChild(rootNode);
-        return document;
-    }
-
-    private Document createFeedProductArtifactDocument(String uuid, String hash) {
-        Document document = XMLUtils.newDocument();
-        Element rootNode = xmlUtilities.createArtifactElement(document,
-                "action");
-
-        Element typeNode = xmlUtilities.createArtifactElement(document, "type");
-        typeNode.setAttribute("name", "feed");
-        rootNode.appendChild(typeNode);
-
-        Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid");
-        uuidNode.setAttribute("value", uuid);
-        rootNode.appendChild(uuidNode);
-
-        Element hashNode = xmlUtilities.createArtifactElement(document, "hash");
-        hashNode.setAttribute("value", hash);
-        rootNode.appendChild(hashNode);
-
-        Element dataNode = xmlUtilities.createArtifactElement(document, "data");
-        rootNode.appendChild(dataNode);
-
-        Collection<InputData> parameter = this.current.getParameter();
-        if (parameter != null) {
-            Iterator<InputData> parameterIt = parameter.iterator();
-            while (parameterIt.hasNext()) {
-                InputData inputData = parameterIt.next();
-                Element inputNode = xmlUtilities.createArtifactElement(
-                        document, "input");
-                inputNode.setAttribute("name", inputData.getName());
-                inputNode.setAttribute("value", inputData.getValue());
-                dataNode.appendChild(inputNode);
-            }
-        }
-        document.appendChild(rootNode);
-        return document;
-
-    }
-
-    /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)
-     */
-    @Override
-    public Document describe(Document data, CallContext context) {
-        if (this.productArtifact == null) {
-            return this.createDescibeOutput(context.getMeta());
-        } else {
-            Document document = this.productArtifact.describe(data,context);
-            document = new ArtifactXMLUtilities().reInitDocument(document);
-            Node staticNode = Config
-                    .getNodeXPath(document, "/result/ui/static");
-            if (staticNode != null) {
-                Node staticUI = this.createSelectBox(document, context
-                        .getMeta());
-                staticNode.insertBefore(staticUI, staticNode.getFirstChild());
-            }
-            return document;
-        }
-    }
-
-
-    /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#feed(org.w3c.dom.Document,
-     *      java.lang.Object)
-     */
-    @Override
-    public Document feed(Document target, CallContext context) {
-        log.debug("FISArtifact.feed");
-        Document result = null;
-        if (this.productArtifact == null) {
-            String productName = Config.getStringXPath(target,
-                    "action/data/input[@name='product']/@value");
-            log.debug("Looking for ProductArtifact " + productName);
-            if (this.products.containsKey(productName)) {
-                this.current = this.products.get(productName);
-                result = new ArtifactXMLUtilities().createSuccessReport(
-                        "Feed success New ProductArtifact created", XMLUtils
-                                .newDocument());
-            } else {
-                String msg = "Product does not exists for " + productName;
-                log.error(msg);
-                result = new ArtifactXMLUtilities().createExceptionReport(msg,
-                        XMLUtils.newDocument());
-            }
-        } else {
-            log.debug("Feed a Productartifact");
-            result = this.productArtifact.feed(target, context);
-        }
-        return result;
-    }
-
-    /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#out(org.w3c.dom.Document,
-     *      java.lang.Object)
-     */
-    @Override
-    public void out(Document format, OutputStream outputStream,
-                    CallContext context) throws IOException {
-        if (this.productArtifact != null) {
-            this.productArtifact.out(format, outputStream, context);
-        }
-    }
-
-    /**
-     * Constructor
-     */
-    public FISArtifact() {
-        super();
-    }
-
-    /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#setup(java.lang.String,
-     *      de.intevation.artifacts.ArtifactFactory, java.lang.Object)
-     */
-    @Override
-    public void setup(String identifier, ArtifactFactory factory, Object context) {
-        log.debug("FISArtifact.setup");
-        this.name = factory.getName();
-        super.setup(identifier, factory, context);
-        if (context instanceof GNVArtifactContext) {
-            GNVArtifactContext gnvContext = (GNVArtifactContext) context;
-            Document doc = gnvContext.getConfig();
-            Node artifactNode = this.getConfigurationFragment(doc);
-
-            NodeList products = Config.getNodeSetXPath(artifactNode,
-                    "products/product");
-            if (products != null) {
-                this.products = new HashMap<String, Product>(products
-                        .getLength());
-                
-                for (int i = 0; i < products.getLength(); i++) {
-                    Element productNode = (Element)products.item(i);
-                    String productName = productNode.getAttribute("name");
-                    NodeList parameterNodes = Config.getNodeSetXPath(
-                            productNode, "parameters/parameter");
-                    Collection<InputData> parameter = null;
-                    if (parameterNodes != null) {
-                        parameter = new ArrayList<InputData>(parameterNodes
-                                .getLength());
-                        for (int j = 0; j < parameterNodes.getLength(); j++) {
-                            Element parameterNode = (Element)parameterNodes.item(j);
-                            String name = parameterNode.getAttribute("name");
-                            String value = parameterNode.getAttribute("value");
-                            parameter.add(new DefaultInputData(name, value));
-                        }
-                    }
-                    Node artifactFactoryNode = Config.getNodeXPath(productNode,
-                            "artifact-factory");
-                    ArtifactFactory artifactFactory = new ArtifactFactoryUtilities()
-                            .createArtitfactFactor(doc, artifactFactoryNode);
-                    this.products.put(productName, new DefaultProduct(
-                            productName, parameter, artifactFactory));
-                }
-            }
-        }
-    }
-
-    protected Node getConfigurationFragment(Document document) {
-        log.debug("GNVArtifactBase.getConfigurationFragment");
-        String xpathQuery = XPATH_ARTIFACT_CONFIGURATION.replaceAll(
-                XPATH_IDENTIFIER_REPLACE, this.name);
-        log.debug(xpathQuery);
-        return Config.getNodeXPath(document, xpathQuery);
-    }
-
-    protected Document createDescibeOutput(CallMeta callMeta) {
-        log.debug("GNVArtifactBase.createDescibeOutput");
-        Document document = XMLUtils.newDocument();
-        Element rootNode = this.createRootNode(document);
-        this.createHeader(rootNode, document, "describe");
-        this.createOutputs(rootNode, document);
-        this.createCurrentState(rootNode, document);
-        this.createReachableStates(rootNode, document);
-        this.createModel(rootNode, document);
-        this.createUserInterface(rootNode, document, callMeta);
-
-        return document;
-    }
-
-    protected Element createRootNode(Document document) {
-        Element rootNode = xmlUtilities.createArtifactElement(document,
-                "result");
-        document.appendChild(rootNode);
-        return rootNode;
-    }
-
-    protected void createHeader(Element parent, Document document,
-                                String documentType) {
-        Element typeNode = xmlUtilities.createArtifactElement(document, "type");
-        typeNode.setAttribute("name", documentType);
-        parent.appendChild(typeNode);
-
-        Element uuidNode = xmlUtilities.createArtifactElement(document, "uuid");
-        uuidNode.setAttribute("value", super.identifier);
-        parent.appendChild(uuidNode);
-
-        Element hashNode = xmlUtilities.createArtifactElement(document, "hash");
-        hashNode.setAttribute("value", this.hash());
-        parent.appendChild(hashNode);
-
-    }
-
-    protected void createReachableStates(Element parent, Document document) {
-        Element stateNode = xmlUtilities.createArtifactElement(document,
-                "reachable-states");
-        if (this.products != null) {
-            Iterator<Product> products = this.products.values().iterator();
-            while (products.hasNext()) {
-                Product product = products.next();
-                Element currentNode = xmlUtilities.createArtifactElement(
-                        document, "state");
-                currentNode.setAttribute("name", product.getName());
-                currentNode.setAttribute("description", product.getName());
-                stateNode.appendChild(currentNode);
-            }
-        }
-        parent.appendChild(stateNode);
-    }
-
-    protected void createCurrentState(Element parent, Document document) {
-        Element stateNode = xmlUtilities.createArtifactElement(document,
-                "state");
-        stateNode.setAttribute("name", "choose-product");
-        stateNode.setAttribute("description",
-                "Initialer Stand Auswahl des products");
-        parent.appendChild(stateNode);
-    }
-
-    protected void createModel(Element parent, Document document) {
-        Element modelNode = xmlUtilities.createArtifactElement(document,
-                "model");
-
-        Element inputNode = xmlUtilities.createArtifactElement(document,
-                "input");
-        inputNode.setAttribute("name", "product");
-        inputNode.setAttribute("type", "String");
-        modelNode.appendChild(inputNode);
-
-        parent.appendChild(modelNode);
-    }
-
-    protected void createUserInterface(Element parent, Document document,
-                                       CallMeta callMeta) {
-        Element uiNode = xmlUtilities.createArtifactElement(document, "ui");
-        ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
-        Node dynamic = xmlUtilities.createArtifactElement(document, "dynamic");
-        uiNode.appendChild(dynamic);
-        if (this.products != null && !this.products.isEmpty()) {
-            Element selectNode = createSelectBox(document, callMeta);
-
-            dynamic.appendChild(selectNode);
-        }
-
-        parent.appendChild(uiNode);
-    }
-
-    /**
-     * @param document
-     * @param xmlUtilities
-     * @return
-     */
-    private Element createSelectBox(Document document, CallMeta callMeta) {
-
-        ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
-        String selectboxName = "product";
-        Iterator<Product> it = this.products.values().iterator();
-        Element selectNode = xmlUtilities.createXFormElement(document,
-                "select1");
-        selectNode.setAttribute("ref", selectboxName);
-
-        Element lableNode = xmlUtilities.createXFormElement(document, "label");
-        lableNode.setTextContent(RessourceFactory.getInstance().getRessource(
-                callMeta.getLanguages(), selectboxName, selectboxName));
-        selectNode.appendChild(lableNode);
-        Element choiceNode = xmlUtilities.createXFormElement(document,
-                "choices");
-        selectNode.appendChild(choiceNode);
-        while (it.hasNext()) {
-            Product p = it.next();
-            Element itemNode = xmlUtilities
-                    .createXFormElement(document, "item");
-
-            if (this.current != null
-                && this.current.getName().equals(p.getName())) {
-                itemNode.setAttribute("selected", "true");
-            }
-
-            Element choiceLableNode = xmlUtilities.createXFormElement(document,
-                    "label");
-            choiceLableNode.setTextContent(RessourceFactory.getInstance()
-                    .getRessource(callMeta.getLanguages(), p.getName(),
-                            p.getName()));
-            itemNode.appendChild(choiceLableNode);
-
-            Element choicValueNode = xmlUtilities.createXFormElement(document,
-                    "value");
-            choicValueNode.setTextContent(p.getName());
-            itemNode.appendChild(choicValueNode);
-
-            choiceNode.appendChild(itemNode);
-
-        }
-        return selectNode;
-    }
-
-    protected void createOutputs(Element parent, Document document) {
-        log.debug("GNVArtifactBase.createOutputs");
-        Element outputsNode = xmlUtilities.createArtifactElement(document,
-                "outputs");
-        parent.appendChild(outputsNode);
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/SelectProductArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,527 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.fis;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+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.ProxyArtifact;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.GlobalContext;
+import de.intevation.gnv.artifacts.GNVArtifactBase;
+import de.intevation.gnv.artifacts.GNVDefaultArtifact;
+import de.intevation.gnv.artifacts.GNVProductArtifactFactory;
+import de.intevation.gnv.artifacts.PreSettingArtifact;
+import de.intevation.gnv.artifacts.fis.product.Product;
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+import de.intevation.gnv.state.DefaultInputData;
+import de.intevation.gnv.state.InputData;
+
+/**
+ * This artifact is used to handle to input/output at the beginning of a
+ * parameterization when no product has been selected so far. After the user
+ * having selected a product, this artifact is replaced by a concrete product
+ * artifact.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class SelectProductArtifact extends GNVDefaultArtifact {
+
+    /**
+     * THE UID of this Class.
+     */
+    private static final long serialVersionUID = -7952357683127758677L;
+
+    /**
+     * Path to uuid.
+     */
+    public static final String XPATH_UUID = "art:action/art:uuid/@value";
+
+    /**
+     * Path to hash.
+     */
+    public static final String XPATH_HASH = "art:action/art:hash/@value";
+
+    /**
+     * Path to selected product.
+     */
+    public static final String XPATH_INPUT_DATA_VALUE =
+        "art:action/art:data/art:input[@name='product']/@value";
+
+    /**
+     * Path to parameters required by the factory.
+     */
+    public static final String XPATH_SETUP_PARAMETER_NODES =
+        "/art:action/art:factory/art:parameter";
+
+    public static final String XFORM_URL    = "http://www.w3.org/2002/xforms";
+
+    /**
+     * Prefix used in the user interface description part of the describe
+     * document.
+     */
+    public static final String XFORM_PREFIX = "xform";
+
+    private static Logger log = Logger.getLogger(SelectProductArtifact.class);
+
+    private Map      products;
+    private Product  current;
+    private Artifact artifact;
+    private String   name;
+
+    private Map<String, InputData> preSettings = null;
+
+    /**
+     * Constructor.
+     */
+    public SelectProductArtifact() {
+        super();
+    }
+
+
+    /**
+     * Initialize this artifact and parse all required information from <code>
+     * data</code> document.
+     *
+     * @param identifier
+     * @param factory
+     * @param context
+     * @param data
+     */
+    @Override
+    public void setup(
+        String          identifier,
+        ArtifactFactory factory,
+        Object          context,
+        CallMeta        meta,
+        Document        data
+    ) {
+        log.debug("SelectProductArtifact.setup()");
+        super.setup(identifier, factory, context, meta, data);
+        this.name = factory.getName();
+
+        // Read the Parameters that should be used for the setup from the
+        // Data-XML.Document.
+        NodeList parameterNodes = (NodeList) XMLUtils.xpath(data,
+                XPATH_SETUP_PARAMETER_NODES,
+                XPathConstants.NODESET,
+                ArtifactNamespaceContext.INSTANCE);
+        if (parameterNodes != null && parameterNodes.getLength() > 0){
+            this.preSettings = new HashMap<String, InputData>();
+            for (int i = 0; i < parameterNodes.getLength(); i++){
+                Element parameterNode = (Element)parameterNodes.item(i);
+                String name = parameterNode.getAttribute("name");
+                String value = parameterNode.getAttribute("value");
+                log.debug("Name:  "+name);
+                log.debug("Value: "+value);
+                InputData inputData = this.preSettings.get(name);
+                if (inputData == null){
+                    inputData = new DefaultInputData(name, value);
+                    this.preSettings.put(name, inputData);
+                }else{
+                    inputData.concartValue(value);
+                }
+            }
+        }
+
+    }
+
+
+    /**
+     *
+     * @param products Insert a bunch of products.
+     */
+    public void setProducts(Map products) {
+        this.products = products;
+    }
+
+
+    /**
+     * Search for a selected product and create a new concrecte product artifact
+     * with this information.
+     *
+     * @param target Document which contains the selected product.
+     * @param context CallContext.
+     * @return Error or success message.
+     */
+    @Override
+    public Document feed(Document target, CallContext context) {
+        log.debug("SelectProductArtifact.feed()");
+
+        if (artifact == null) {
+            Document document    = XMLUtils.newDocument();
+            String   productName = XMLUtils.xpathString(
+                target,
+                XPATH_INPUT_DATA_VALUE,
+                ArtifactNamespaceContext.INSTANCE
+            );
+
+            current = (Product) products.get(productName);
+
+            String reportNode = null;
+            String resultNode = null;
+            String msg        = null;
+
+            if (current != null) {
+                reportNode = "result";
+                resultNode = "success";
+                msg        = "Feed was successfully. New Artifact created.";
+            }
+            else {
+                reportNode = "exceptionreport";
+                resultNode = "exception";
+                msg        = "Product does not exist.";
+            }
+
+            XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+                document,
+                ArtifactNamespaceContext.NAMESPACE_URI,
+                ArtifactNamespaceContext.NAMESPACE_PREFIX
+            );
+
+            Element report  = creator.create(reportNode);
+            Element success = creator.create(resultNode);
+            success.setTextContent(msg);
+            report.appendChild(success);
+            document.appendChild(report);
+
+            return document;
+        }
+        else {
+            return artifact.feed(target, context);
+        }
+    }
+
+
+    /**
+     * If {@link #feed(org.w3c.dom.Document, de.intevation.artifacts.CallContext)}
+     * was sucessfully called before, this artifact is replaced with a concrete
+     * product artifact.
+     *
+     * @param target The advance document.
+     * @param context The CallContext.
+     * @return a document with an error or success message.
+     */
+    @Override
+    public Document advance(Document target, CallContext context) {
+        log.debug("SelectProductArtifact.advance()");
+
+        if (artifact != null) {
+            Document result = artifact.advance(target, context);
+            context.putContextValue(ProxyArtifact.REPLACE_PROXY, artifact);
+            return result;
+        }
+
+        Document result = XMLUtils.newDocument();
+        if (current == null) {
+            // artifact needs to be feeded first
+            String msg = "Artifact is not configured properly. Call 'feed' fist.";
+            log.error(msg);
+
+            XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+                result,
+                ArtifactNamespaceContext.NAMESPACE_URI,
+                ArtifactNamespaceContext.NAMESPACE_PREFIX
+            );
+
+            Element report = creator.create("exceptionreport");
+            Element exception = creator.create("exception");
+            exception.setTextContent(msg);
+            report.appendChild(exception);
+            result.appendChild(report);
+
+            return result;
+        }
+
+        String uuid = XMLUtils.xpathString(
+            target, XPATH_UUID, ArtifactNamespaceContext.INSTANCE
+        );
+
+        String hash = XMLUtils.xpathString(
+            target, XPATH_HASH, ArtifactNamespaceContext.INSTANCE
+        );
+
+        // fetch ArtifactFactory from context and create a new Artifact
+        ArtifactFactory factory = context.getDatabase()
+            .getInternalArtifactFactory(this.name);
+        factory                 = ((GNVProductArtifactFactory)factory)
+            .getArtifactFactoryByName(current.getName());
+        artifact = factory.createArtifact(
+            uuid,
+            (GlobalContext) context.globalContext(),
+            context.getMeta(),
+            null);
+
+
+        if (this.preSettings != null && artifact instanceof PreSettingArtifact){
+            ((PreSettingArtifact)artifact).setPreSettings(this.preSettings);
+        }
+
+        artifact.feed(feedDocument(uuid, hash), context);
+
+        result = ((GNVArtifactBase) artifact).initialize(context);
+        if (artifact instanceof GNVArtifactBase) {
+            ((GNVArtifactBase) artifact).setProduct(current);
+        }
+        context.putContextValue(ProxyArtifact.REPLACE_PROXY, artifact);
+        return result;
+    }
+
+
+    /**
+     * Create a describe document including the user interface description. The
+     * user gets the choice to select a product supported by the current fis.
+     *
+     * @param data The describe document.
+     * @param context The CallContext.
+     * @return A document with an error or success message.
+     */
+    @Override
+    public Document describe(Document data, CallContext context) {
+        log.debug("SelectProductArtifact.describe()");
+
+        // create root node
+        Document document               = XMLUtils.newDocument();
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
+
+        Element rootNode = creator.create("result");
+        Element typeNode = creator.create("type");
+        creator.addAttr(typeNode, "name", "describe");
+        rootNode.appendChild(typeNode);
+
+        Element uuidNode = creator.create("uuid");
+        creator.addAttr(uuidNode, "value", super.identifier);
+        rootNode.appendChild(uuidNode);
+
+        Element hashNode = creator.create("hash");
+        creator.addAttr(hashNode, "value", hash());
+        rootNode.appendChild(hashNode);
+
+        // create output node
+        Element out = creator.create("outputs");
+        rootNode.appendChild(out);
+
+        // create current state
+        Element state = creator.create("state");
+        creator.addAttr(state, "name", "choose-product");
+        creator.addAttr(state, "description", "Auswahl des Produktes.");
+        rootNode.appendChild(state);
+
+        // create reachable states
+        Element rStates = creator.create("reachable-states");
+        appendProducts(document, rStates, context);
+        rootNode.appendChild(rStates);
+
+        // create model
+        Element model = creator.create("model");
+        Element input = creator.create("input");
+        creator.addAttr(input, "name", "product");
+        creator.addAttr(input, "type", "String");
+        model.appendChild(input);
+        rootNode.appendChild(model);
+
+        // create ui
+        Element ui         = creator.create("ui");
+        Element staticNode = creator.create("static");
+        Element dynamic    = creator.create("dynamic");
+
+        appendFis(document, staticNode, context, this.name);
+        appendSelectProducts(document, dynamic, context.getMeta());
+        ui.appendChild(staticNode);
+        ui.appendChild(dynamic);
+        rootNode.appendChild(ui);
+
+        document.appendChild(rootNode);
+
+        return document;
+    }
+
+
+    /**
+     *
+     * @param document
+     * @param out
+     * @param context
+     * @throws IOException
+     */
+    @Override
+    public void out(Document document, OutputStream out, CallContext context)
+    throws IOException
+    {
+        log.debug("SelectProductArtifact.out()");
+        if (artifact != null) {
+            artifact.out(document, out, context);
+        }
+    }
+
+
+    /**
+     * Append products to the describe document.
+     *
+     * @param document The describe document.
+     * @param parent The node the products should be appended to.
+     * @param context The CallContext object.
+     */
+    protected void appendProducts(
+        Document document,
+        Node     parent,
+        Object   context
+    ) {
+        if (products != null && !products.isEmpty()){
+            Iterator iter = products.values().iterator();
+
+            XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+                document,
+                ArtifactNamespaceContext.NAMESPACE_URI,
+                ArtifactNamespaceContext.NAMESPACE_PREFIX
+            );
+
+            while(iter.hasNext()) {
+                Product prod = (Product) iter.next();
+                String  name = prod.getName();
+
+                Element current = creator.create("state");
+                creator.addAttr(current, "name", name);
+                creator.addAttr(current, "description", name);
+                parent.appendChild(current);
+            }
+        }
+    }
+
+
+    /**
+     * Append the product select box to the user interface description of the
+     * describe document.
+     *
+     * @param document The describe document.
+     * @param node The node the products should be appended to.
+     * @param callMeta The CallMeta object.
+     */
+    protected void appendSelectProducts(
+        Document document,
+        Node     node,
+        CallMeta callMeta
+    ) {
+        RessourceFactory ressource = RessourceFactory.getInstance();
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            XFORM_URL,
+            XFORM_PREFIX
+        );
+
+        String  selectboxName = "product";
+        Element selectNode    = creator.create("select1");
+        creator.addAttr(selectNode, "ref", selectboxName);
+
+        Element lableNode = creator.create("label");
+        lableNode.setTextContent(ressource.getRessource(callMeta.getLanguages(),
+                selectboxName,
+                selectboxName
+            )
+        );
+
+        Element choiceNode = creator.create("choices");
+        selectNode.appendChild(lableNode);
+        selectNode.appendChild(choiceNode);
+        if (products != null && !products.isEmpty()){
+            Iterator it = products.values().iterator();
+            while (it.hasNext()) {
+                Product p               = (Product) it.next();
+                Element itemNode        = creator.create("item");
+                Element choiceLableNode = creator.create("label");
+                choiceLableNode.setTextContent(ressource.getRessource(
+                    callMeta.getLanguages(),
+                    p.getName(),
+                    p.getName()
+                ));
+                itemNode.appendChild(choiceLableNode);
+
+                Element choiceValueNode = creator.create("value");
+                choiceValueNode.setTextContent(p.getName());
+                itemNode.appendChild(choiceValueNode);
+                choiceNode.appendChild(itemNode);
+            }
+        }
+
+        node.appendChild(selectNode);
+    }
+
+
+    /**
+     * Create a feed document.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @param hash The hash of the current artifact.
+     * @return the feed document.
+     */
+    protected Document feedDocument(String uuid, String hash) {
+        Document document = XMLUtils.newDocument();
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
+        Element  rootNode = creator.create("action");
+
+        Element typeNode = creator.create("type");
+        creator.addAttr(typeNode, "name", "feed");
+        rootNode.appendChild(typeNode);
+
+        Element uuidNode = creator.create("uuid");
+        creator.addAttr(uuidNode, "value", uuid);
+        rootNode.appendChild(uuidNode);
+
+        Element hashNode = creator.create("hash");
+        creator.addAttr(hashNode, "value", hash);
+        rootNode.appendChild(hashNode);
+
+        Element dataNode = creator.create("data");
+        rootNode.appendChild(dataNode);
+
+        Collection<InputData> parameter = this.current.getParameter();
+        if (parameter != null) {
+            Iterator<InputData> parameterIt = parameter.iterator();
+
+            while (parameterIt.hasNext()) {
+                InputData inputData = parameterIt.next();
+
+                Element inputNode = creator.create("input");
+                creator.addAttr(inputNode, "name", inputData.getName());
+                creator.addAttr(inputNode, "value", inputData.getValue());
+                dataNode.appendChild(inputNode);
+            }
+        }
+        document.appendChild(rootNode);
+        return document;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains classes providing a special artifact used after a fis is
+selected and the user needs to choose a concrete product.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/product/DefaultProduct.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,16 +1,22 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts.fis.product;
 
+import de.intevation.gnv.state.InputData;
+
 import java.util.Collection;
 
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.gnv.state.InputData;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the default implementation of <code>Product</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class DefaultProduct implements Product {
 
@@ -23,42 +29,46 @@
 
     private Collection<InputData> parameter = null;
 
-    private ArtifactFactory artifactFactory = null;
+    private String artifactFactory = null;
 
     /**
      * Constructor
-     * 
-     * @param name
-     * @param parameter
-     * @param artifactFactory
+     *
+     * @param name The name of this product.
+     * @param parameter Required parameters for this product.
+     * @param artifactFactory The artifact factory.
      */
-    public DefaultProduct(String name, Collection<InputData> parameter,
-                          ArtifactFactory artifactFactory) {
+    public DefaultProduct(
+        String                name,
+        Collection<InputData> parameter,
+        String                artifactFactory
+    ) {
         super();
-        this.name = name;
-        this.parameter = parameter;
+        this.name            = name;
+        this.parameter       = parameter;
         this.artifactFactory = artifactFactory;
     }
 
     /**
-     * @see de.intevation.gnv.artifacts.fis.product.Product#getName()
+     * @return the name if this product.
      */
     public String getName() {
         return this.name;
     }
 
     /**
-     * @see de.intevation.gnv.artifacts.fis.product.Product#getParameter()
+     * @return the input data.
      */
     public Collection<InputData> getParameter() {
         return this.parameter;
     }
 
     /**
-     * @see de.intevation.gnv.artifacts.fis.product.Product#getArtifactFactory()
+     * @return the artifact factory.
      */
-    public ArtifactFactory getArtifactFactory() {
+    public String getArtifactFactory() {
         return this.artifactFactory;
     }
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/product/Product.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/product/Product.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,23 +1,48 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts.fis.product;
 
+import de.intevation.gnv.state.InputData;
+
 import java.io.Serializable;
+
 import java.util.Collection;
 
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.gnv.state.InputData;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the interface description of <code>Product</code>. Currently, there
+ * are three methods defined:<br>
+ * <ol>
+ *  <li>getName(): retrieves the name of the <code>Product</code></li>
+ *  <li>getParameter(): retrieves a collection of required parameters.</li>
+ *  <li>getArtifactFactory(): retrieves the factory used to create this artifact.
+ *  </li>
+ * </ol>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface Product extends Serializable {
 
+    /**
+     *
+     * @return The name of this product.
+     */
     public String getName();
 
+    /**
+     *
+     * @return All required parameters for parameterization.
+     */
     public Collection<InputData> getParameter();
 
-    public ArtifactFactory getArtifactFactory();
+    /**
+     *
+     * @return The artifact factory used to create the current artifact.
+     */
+    public String getArtifactFactory();
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/fis/product/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Classes and interfaces representing a product (eg 'Horizontalschnitt',
+'Horizontalprofil', 'Vertikalprofil', 'Profilschnitt', 'Zeitserien').
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Map user workflows to software components using classes and interfaces in this
+package.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/RessourceFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,27 +1,32 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts.ressource;
 
+import de.intevation.artifacts.PreferredLocale;
+
 import java.io.BufferedReader;
-import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.io.IOException;
+
 import java.util.ArrayList;
+import java.util.List;
 import java.util.Locale;
-import java.util.List;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
 import org.apache.log4j.Logger;
 
-import de.intevation.artifacts.PreferredLocale;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class RessourceFactory {
 
@@ -55,7 +60,7 @@
 
     /**
      * This Method provides an singleton Instance of this Class.
-     * 
+     *
      * @return an singleton Instance of this Class
      */
     public static synchronized RessourceFactory getInstance() {
@@ -132,13 +137,10 @@
 
     /**
      * Deliveres the translated Value for an Key to an given Language
-     * 
-     * @param locale
-     *            The choosen locale
-     * @param key
-     *            the key
-     * @param defaultValue
-     *            the Value that should be returned.
+     *
+     * @param preferredLocales
+     * @param key the key
+     * @param defaultValue the Value that should be returned.
      * @return the translated Value
      */
     public String getRessource(PreferredLocale[] preferredLocales, String key,
@@ -151,6 +153,14 @@
     }
 
 
+    /**
+     * Deliveres the language specific value for the given <code>key</code>
+     *
+     * @param locale
+     * @param key
+     * @param defaultVal
+     * @return language specific string.
+     */
     public String getRessource(Locale locale, String key, String defaultVal) {
         if (key == null || locale == null)
             return defaultVal;
@@ -169,3 +179,4 @@
         }
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/ressource/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Classes to handle working with resources.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/MetaDataService.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,462 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.services;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+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 com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.io.ParseException;
+import com.vividsolutions.jts.io.WKTReader;
+
+import de.intevation.artifactdatabase.DefaultService;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.GlobalContext;
+import de.intevation.artifacts.ServiceFactory;
+import de.intevation.gnv.artifacts.services.requestobjects.DefaultFIS;
+import de.intevation.gnv.artifacts.services.requestobjects.DefaultLayer;
+import de.intevation.gnv.artifacts.services.requestobjects.DefaultMapService;
+import de.intevation.gnv.artifacts.services.requestobjects.DefaultParameter;
+import de.intevation.gnv.artifacts.services.requestobjects.FIS;
+import de.intevation.gnv.artifacts.services.requestobjects.Layer;
+import de.intevation.gnv.artifacts.services.requestobjects.MapService;
+import de.intevation.gnv.artifacts.services.requestobjects.Parameter;
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.query.QueryExecutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+import de.intevation.gnv.utils.ArtifactXMLUtilities;
+
+/**
+ * This Class Provides the Functionality to return only those
+ * Artifacfactories which fulfill the conditions of the Request.
+ *
+ * This Service is used to implement the Functionality of the MV-GNV-Interface
+ * by looking if an Region of an FIS is intersecting the Area which is send
+ * during the Request or which FIS belongs to the requested MapServices.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class MetaDataService extends DefaultService {
+
+    /**
+     * the logger, used to log exceptions and additionally information
+     */
+    private static Logger log = Logger.getLogger(MetaDataService.class);
+
+
+    private final static String FIS_REGION_QUERY_ID =
+                                      "mapviewer_interface_fis_region";
+    private final static String MAPSERVICES_HAS_FIS_QUERY_ID =
+                                      "mapviewer_interface_mapservices_has_fis";
+    private final static String MAPSERVICES_HAS_PARAMETER_QUERY_ID =
+                                "mapviewer_interface_mapservices_has_parameter";
+
+    private final static String MAPSERVICES_HAS_PARAMETER_USING_LAYER_QUERY_ID =
+        "mapviewer_interface_mapservices_has_parameter_using_layer";
+
+    private static String ATTRIBUTE_ID = "id";
+    private static String ATTRIBUTE_NAME = "name";
+    private static String ATTRIBUTE_TYPE = "type";
+    private static String ATTRIBUTE_URL = "url";
+    private static String ATTRIBUTE_GROUPLAYER = "isgrouplayer";
+    private static String ATTRIBUTE_PARENTID = "parentid";
+    private static String ATTRIBUTE_SRS = "srs";
+
+
+    private static String XPATH_LOACTION_NODE = "art:GetMetaData/art:location";
+    private static String XPATH_MAPSERVICES_NODESET = "art:GetMetaData/" +
+                                                      "art:mapservices/" +
+                                                      "art:mapservice";
+    private static String XPATH_LAYER_NODESET = "art:layer";
+
+    /**
+     * The UID of this Class.
+     */
+    private static final long serialVersionUID = -8446483887497236372L;
+
+    /**
+     * Constructor
+     */
+    public MetaDataService() {
+        super();
+    }
+
+    @Override
+    public Document process(
+        Document      data,
+        GlobalContext globalContext,
+        CallMeta      callMeta
+    ) {
+        log.debug("MetaDataService.process");
+        Document document = null;
+        try {
+            Geometry g = this.parseGeometry(data);
+            Collection<MapService> mapServices = this.parseMapServices(data);
+            Collection<FIS> resultFIS = this.unionFIS(this.getFIS(g),
+                                                      this.getFIS(mapServices));
+            document = XMLUtils.newDocument();
+            this.writeFIS2Document(document, resultFIS);
+            log.debug(ArtifactXMLUtilities.writeDocument2String(document));
+        } catch (MetaDataServiceException e) {
+            log.error(e,e);
+            document = ArtifactXMLUtilities
+                          .createExceptionReport(e.getMessage(), document);
+        }
+        return document;
+    }
+
+    private Geometry parseGeometry(Document data)
+                                   throws MetaDataServiceException{
+        log.debug("MetaDataService.parseGeometry");
+
+        Element locationNode = (Element) XMLUtils.xpath(
+                data,
+                XPATH_LOACTION_NODE,
+                XPathConstants.NODE,
+                ArtifactNamespaceContext.INSTANCE
+            );
+        Geometry returnValue = null;
+        if (locationNode != null) {
+            String srs = locationNode.getAttribute(ATTRIBUTE_SRS);
+            // TODO: use SRS to transform the Geometry to target-System.
+            String geometryValue = locationNode.getTextContent();
+            if (geometryValue != null){
+                try {
+                    returnValue = new WKTReader().read(geometryValue);
+                } catch (ParseException e) {
+                    log.error(e,e);
+                    throw new MetaDataServiceException("The given Geometry" +
+                                                       "String is not a " +
+                                                       "valid WKT.");
+                }
+            }
+        }
+        return returnValue;
+    }
+
+    private Collection<MapService> parseMapServices(Document data){
+        log.debug("MetaDataService.parseMapServices");
+
+        NodeList mapServices = (NodeList) XMLUtils.xpath(data,
+                                             XPATH_MAPSERVICES_NODESET,
+                                             XPathConstants.NODESET,
+                                             ArtifactNamespaceContext.INSTANCE);
+        Collection<MapService> returnValue = null;
+        if (mapServices != null){
+            returnValue = new ArrayList<MapService>(mapServices.getLength());
+            for (int i = 0; i < mapServices.getLength(); i++){
+                Element mapServiceNode = (Element)mapServices.item(i);
+                String id = mapServiceNode.getAttribute(ATTRIBUTE_ID);
+                String type = mapServiceNode.getAttribute(ATTRIBUTE_TYPE);
+                String url = mapServiceNode.getAttribute(ATTRIBUTE_URL);
+                Collection<Layer> layer = null;
+
+                NodeList layerNodes = (NodeList) XMLUtils.xpath(mapServiceNode,
+                                            XPATH_LAYER_NODESET,
+                                            XPathConstants.NODESET,
+                                            ArtifactNamespaceContext.INSTANCE);
+                if (layerNodes != null){
+                    layer = new ArrayList<Layer>(layerNodes.getLength());
+                    for (int j = 0; j < layerNodes.getLength(); j++){
+                        Element layerNode = (Element)layerNodes.item(j);
+                        String layerId = layerNode.getAttribute(ATTRIBUTE_ID);
+                        String layerName = layerNode.getAttribute(ATTRIBUTE_NAME);
+                        boolean isGroupLayer =
+                                      Boolean.parseBoolean(layerNode
+                                                      .getAttribute(
+                                                         ATTRIBUTE_GROUPLAYER));
+                        String parentId = layerNode
+                                              .getAttribute(ATTRIBUTE_PARENTID);
+
+                        layer.add(new DefaultLayer(layerId,
+                                                   layerName,
+                                                   isGroupLayer,
+                                                   parentId));
+                    }
+                }
+                MapService mapService = new DefaultMapService(id, layer,
+                                                              type, url);
+                returnValue.add(mapService);
+
+            }
+        }
+        return returnValue;
+    }
+
+    private Collection<FIS> unionFIS(Collection<FIS> fromGeometry,
+                                        Collection<FIS> fromMapservices){
+        log.debug("MetaDataService.unionFIS");
+        Collection<FIS> returnValue = null;
+        if (fromGeometry == null || fromGeometry.isEmpty()){
+            returnValue = fromMapservices;
+        }else if (fromMapservices == null || fromMapservices.isEmpty()){
+            returnValue = fromGeometry;
+        }else{
+
+            returnValue = new ArrayList<FIS>();
+            Iterator<FIS> it = fromMapservices.iterator();
+            while (it.hasNext()){
+                FIS fis = it.next();
+                if (fromGeometry.contains(fis)){
+                    returnValue.add(fis);
+                }
+            }
+        }
+        return returnValue;
+    }
+
+    /**
+     * Puts the retrieved FIS into the given XML-Document.
+     * @param document the Document where the FIS should be put in.
+     * @param fis the retrieved FIS which should be written into
+     *            the XML-Document.
+     */
+    private void writeFIS2Document(Document document, Collection<FIS> fis){
+
+        if (fis != null){
+            Iterator<FIS> it = fis.iterator();
+            XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+                    document,
+                    ArtifactNamespaceContext.NAMESPACE_URI,
+                    ArtifactNamespaceContext.NAMESPACE_PREFIX
+                );
+            Node rootNode = creator.create("result");
+            document.appendChild(rootNode);
+
+            Node factoriesNode = creator.create("factories");
+            rootNode.appendChild(factoriesNode);
+            while (it.hasNext()){
+                FIS tmpFIS = it.next();
+                Element fisNode = creator.create("factory");
+                fisNode.setAttribute("art:name",tmpFIS.getID());
+
+                Collection<Parameter> parameter = tmpFIS.getParameter();
+
+                if(parameter != null){
+                    Iterator<Parameter> pit = parameter.iterator();
+                    while (pit.hasNext()){
+                        Parameter p = pit.next();
+                        Element parameterNode = creator.create("parameter");
+                        parameterNode.setAttribute(ATTRIBUTE_ID, p.getID());
+                        parameterNode.setAttribute(ATTRIBUTE_NAME, p.getName());
+                        fisNode.appendChild(parameterNode);
+                    }
+                }
+                factoriesNode.appendChild(fisNode);
+            }
+        }
+    }
+
+    /**
+     * Returns all FIS which Areas is intersected by this given Geometry
+     * @param g the Geometry which should be used to determine the FIS.
+     * @return all FIS which Areas is intersected by this given Geometry
+     * @throws MetaDataServiceException
+     */
+    protected Collection<FIS> getFIS(Geometry g)
+                                        throws MetaDataServiceException{
+        log.debug("MetaDataService.getFIS ==> Geometry");
+        Collection<FIS> resultValue = null;
+        if (g != null){
+            try {
+                QueryExecutor queryExecutor = QueryExecutorFactory
+                                               .getInstance()
+                                               .getQueryExecutor();
+                Collection<Result> result = queryExecutor.executeQuery(FIS_REGION_QUERY_ID,
+                                                    new String[]{g.toString()});
+
+                if (result != null){
+                    resultValue = new ArrayList<FIS>(result.size());
+                    Iterator<Result> it = result.iterator();
+                    while (it.hasNext()){
+                        Result value = it.next();
+                        String fis_id = value.getString(0).trim();
+                        resultValue.add(new DefaultFIS(fis_id));
+                    }
+                }
+            } catch (QueryException e) {
+                log.error(e,e);
+                throw new MetaDataServiceException("Cannot Query FIS from DB.");
+            }
+        }
+        return resultValue;
+    }
+
+    /**
+     * Returns all FIS which were represented by the given Mapservices
+     * @param mapServices the Mapservices which should determine the FIS.
+     * @return all FIS which where represented my the given Mapservices.
+     * @throws MetaDataServiceException
+     */
+    protected Collection<FIS> getFIS(Collection<MapService> mapServices)
+                                              throws MetaDataServiceException{
+        log.debug("MetaDataService.getFIS ==> MapServices");
+        Collection<FIS> resultValue = null;
+        if (mapServices != null && !mapServices.isEmpty()){
+            try {
+
+                String mapServiceNames = "";
+                Iterator<MapService> mit = mapServices.iterator();
+                while(mit.hasNext()){
+                    if (mapServiceNames.length() > 0){
+                        mapServiceNames += " , ";
+                    }
+                    mapServiceNames += "'"+mit.next().getID()+"'";
+                }
+
+                QueryExecutor queryExecutor = QueryExecutorFactory
+                                               .getInstance()
+                                               .getQueryExecutor();
+                Collection<Result> result = queryExecutor.executeQuery(
+                                                  MAPSERVICES_HAS_FIS_QUERY_ID,
+                                                  new String[]{mapServiceNames});
+                if (result != null){
+                    resultValue = new ArrayList<FIS>(result.size());
+                    Iterator<Result> it = result.iterator();
+                    while (it.hasNext()){
+                        Result value = it.next();
+                        String fisId = value.getString(0).trim();
+                        String mapServiceID = value.getString(1).trim();
+
+                        // FIRST LOOK IF ONE MAPSERVICE REPRESENTS ONLY ONE PARAM
+                        Collection<Result> result2 = queryExecutor.executeQuery(
+                                MAPSERVICES_HAS_PARAMETER_QUERY_ID,
+                                new String[]{"'"+mapServiceID+"'"});
+                        Collection<Parameter> parameter = null;
+                        if (result2 != null && result2.size() == 1){
+                            Iterator<Result> it2 = result2.iterator();
+                            parameter = new ArrayList<Parameter>(1);
+                            while (it2.hasNext()){
+                                Result parameterValue = it2.next();
+                                String parameterID = parameterValue.getString(0)
+                                                                   .trim();
+                                parameter.add(new DefaultParameter(parameterID,
+                                                                   parameterID));
+                            }
+                        }else{
+                            // IF FALSE LOOK IF THE GIVEN LAYERs TO AN MAPSERVICE
+                            // REPRESENTS DIFFERENT PARAMS
+                            MapService service = this.getMapService(mapServices,
+                                                                    mapServiceID);
+                            Collection<Layer> layer = service.getLayer();
+                            if (layer != null && !layer.isEmpty()){
+                                String layerQueryString =
+                                    this.createLayerQueryString(layer);
+                                Collection<Result> parameterResult =
+                                    queryExecutor.executeQuery(
+                                        MAPSERVICES_HAS_PARAMETER_USING_LAYER_QUERY_ID,
+                                        new String[]{"'"+mapServiceID+"'",
+                                                     layerQueryString});
+                                if (parameterResult != null &&
+                                    !parameterResult.isEmpty()){
+                                    Iterator<Result> it2 = parameterResult.iterator();
+                                    parameter = new ArrayList<Parameter>(parameterResult.size());
+                                    while (it2.hasNext()){
+                                        Result parameterValue = it2.next();
+                                        String parameterID = parameterValue.getString(0)
+                                                                           .trim();
+                                        parameter.add(new DefaultParameter(parameterID,
+                                                                           parameterID));
+                                    }
+                                }
+                            }
+
+                        }
+
+                        FIS fis = this.getFIS(resultValue, fisId);
+                        if (fis != null){
+                            if (parameter != null){
+                                fis.addParameter(parameter);
+                            }
+                        }else{
+                            resultValue.add(new DefaultFIS(fisId, parameter));
+                        }
+                    }
+                }
+            } catch (QueryException e) {
+                log.error(e,e);
+                throw new MetaDataServiceException("Cannot Query FIS from DB.");
+            }
+
+        }
+        return resultValue;
+    }
+
+
+    private FIS getFIS (Collection<FIS> fis, String fisId){
+
+        Iterator<FIS> it = fis.iterator();
+        while(it.hasNext()){
+            FIS tmpFIS = it.next();
+            if (tmpFIS.getID().equals(fisId)){
+                return tmpFIS;
+            }
+        }
+        return null;
+    }
+
+    private MapService getMapService(Collection<MapService> mapServices,
+                                     String mapServiceID){
+        log.debug("MetaDataService.getMapService");
+        Iterator<MapService> it = mapServices.iterator();
+        while (it.hasNext()){
+            MapService service = it.next();
+            if (service.getID().equals(mapServiceID)){
+                return service;
+            }
+        }
+        return null;
+    }
+
+    private String createLayerQueryString(Collection<Layer> layer){
+        log.debug("MetaDataService.createLayerQueryString");
+        StringBuffer sb = new StringBuffer();;
+        Iterator<Layer> it = layer.iterator();
+        synchronized (sb) {
+            while (it.hasNext()){
+                Layer l = it.next();
+                if (!l.isGroupLayer()){
+                    sb.append(l.getID());
+                    if (it.hasNext()){
+                        sb.append(" , ");
+                    }
+                }
+
+            }
+        }
+        String returnValue = sb.toString();
+        if (returnValue.endsWith(" , ")){
+            returnValue = returnValue.substring(0,returnValue
+                                                  .lastIndexOf(","))
+                                                  .trim();
+        }
+        return returnValue;
+    }
+
+    @Override
+    public void setup(ServiceFactory factory, GlobalContext globalContext) {
+        log.debug("MetaDataService.setup");
+        super.setup(factory, globalContext);
+        // TODO: Perhaps it is necessary to init the QueryIds here.
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/MetaDataServiceException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.services;
+
+/**
+ * ExceprionClass for MetaDataServices.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class MetaDataServiceException extends Exception {
+
+    /**
+     * The UID of this Class
+     */
+    private static final long serialVersionUID = -7489185270678994565L;
+
+    /**
+     * Constructor
+     */
+    public MetaDataServiceException() {
+        super();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     */
+    public MetaDataServiceException(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     */
+    public MetaDataServiceException(Throwable arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     */
+    public MetaDataServiceException(String arg0, Throwable arg1) {
+        super(arg0, arg1);
+    }
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package provides Classes which Implements the Interface 
+de.intevation.artifactdatabase.Service
+to provide different Services offered by the ArtifactDatabase.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultFIS.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.services.requestobjects;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * The default implementation of <code>Fis</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class DefaultFIS implements FIS {
+
+    /**
+     * The ID of the FIS
+     */
+    private String id = null;
+
+    /**
+     * The Parameter which belongs to the FIS.
+     */
+    private Collection<Parameter> parameter = null;
+
+    /**
+     * Constructor
+     *
+     * @param id The id for this fis.
+     */
+    public DefaultFIS(String id){
+        super();
+        this.id = id;
+    }
+    /**
+     * Constructor
+     * @param id The id for this fis.
+     * @param parameter A collection of parameters.
+     */
+    public DefaultFIS(String id, Collection<Parameter> parameter) {
+        this(id);
+        this.parameter = parameter;
+    }
+
+
+    public String getID() {
+        return this.id;
+    }
+
+    public Collection<Parameter> getParameter() {
+        return this.parameter;
+    }
+
+    /**
+     * Two objects are equal if they have the same id.
+     *
+     * @param arg0 Object which is checked for equality.
+     * @return True, if both objects are equal, otherwise false.
+     */
+    @Override
+    public boolean equals(Object arg0) {
+        boolean returnValue = false;
+        if (arg0 instanceof FIS){
+            returnValue = this.id.equals(((FIS)arg0).getID());
+        }
+        return returnValue;
+    }
+
+    /**
+     * Creates a hash code using the id and the given parameters.
+     *
+     * @return A hash code.
+     */
+    @Override
+    public int hashCode() {
+        int hash = 7;
+        hash = 47 * hash + (this.id != null ? this.id.hashCode() : 0);
+        hash = 47 * hash + (this.parameter != null ? this.parameter.hashCode() : 0);
+        return hash;
+    }
+
+    /**
+     * @param parameter Collection of parameters.
+     */
+    public void addParameter(Collection<Parameter> parameter) {
+        if (this.parameter != null){
+            Iterator<Parameter> it = parameter.iterator();
+            while (it.hasNext()){
+                Parameter tmpParameter = it.next();
+                if (!this.parameter.contains(tmpParameter)){
+                    this.parameter.add(tmpParameter);
+                }
+            }
+        }else{
+            this.parameter = parameter;
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultLayer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.services.requestobjects;
+
+/**
+ * The  default Implementation of <code>Layer</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class DefaultLayer implements Layer {
+
+    /**
+     * The id of the Layer
+     */
+    private String id = null;
+
+    /**
+     * The name of the Layer
+     */
+    private String name = null;
+
+    /**
+     * Flag which defines if the Layer is a GroupLayer
+     */
+    private boolean groupLayer = false;
+
+    /**
+     * The ID of the Parentlayer or null if the Layer is a Rootlayer
+     */
+    private String parentId = null;
+
+    /**
+     * Constructor
+     * @param id The id of this layer.
+     * @param name The name of this layer.
+     * @param groupLayer A boolean property to define this layer as group layer.
+     * @param parentId The id of the parent layer.
+     */
+    public DefaultLayer(String id,String name,
+                        boolean groupLayer,String parentId) {
+        this.id = id;
+        this.name = name;
+        this.groupLayer = groupLayer;
+        this.parentId = parentId;
+    }
+
+    public String getID() {
+        return this.id;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public boolean isGroupLayer() {
+        return this.groupLayer;
+    }
+
+    public String parentID() {
+        return this.parentId;
+    }
+
+    /**
+     * This methods returns this layer as string.
+     *
+     * @return this layer as string.
+     */
+    @Override
+    public String toString() {
+        return "ID: "+ this.id + " Name: "+this.name+
+               " IsGroupLayer: "+this.groupLayer+
+               " ParentID: "+this.parentId;
+    }
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultMapService.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.services.requestobjects;
+
+import java.util.Collection;
+
+/**
+ * The default Implementation of <code>MapService</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class DefaultMapService implements MapService {
+
+    /**
+     * The id of the Mapservice
+     */
+    private String id = null;
+
+    /**
+     * The Layer which belongs to the Mapservice
+     */
+    private Collection<Layer> layer = null;
+
+    /**
+     * The Type of the Mapservice
+     */
+    private String type = null;
+
+    /**
+     * The Url under which the Mapservice could be accessed.
+     */
+    private String url = null;
+
+    /**
+     * Constructor
+     * @param id The id of this service.
+     * @param type The type of  this service.
+     * @param layer The layers available in this service.
+     * @param url The url used to call this service.
+     */
+    public DefaultMapService(String id, Collection<Layer> layer,
+                             String type, String url) {
+        super();
+        this.id = id;
+        this.layer = layer;
+        this.type = type;
+        this.url = url;
+    }
+
+    public String getID() {
+        return this.id;
+    }
+
+    public Collection<Layer> getLayer() {
+        return this.layer;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+
+    public String getURL() {
+        return this.url;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/DefaultParameter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.services.requestobjects;
+
+/**
+ * The default Implementation of <code>Parameter</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class DefaultParameter implements Parameter {
+
+
+    /**
+     * The id of the Parameter
+     */
+    private String id = null;
+
+    /**
+     * The name of the Parameter
+     */
+    private String name = null;
+
+    /**
+     * Constructor
+     * @param id The id of this parameter.
+     * @param name The name of this parameter.
+     */
+    public DefaultParameter(String id, String name) {
+        super();
+        this.id = id;
+        this.name = name;
+    }
+
+    public String getID() {
+        return this.id;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/FIS.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.services.requestobjects;
+
+import java.util.Collection;
+
+/**
+ * This is the interface description for a fis. Currently, there are three
+ * methods defined which need to be implemented by concrete classes:<br>
+ * <ol>
+ *  <li>getID(): Returns the id of this fis.</li>
+ *  <li>getParameter(): Returns a collection of parameter.</li>
+ *  <li>addParameter(Collection<Parameter>): Adds a parameter collection to this
+ * fis.</li>
+ * </ol>
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public interface FIS {
+
+    /**
+     * Returns the id of this FIS
+     * @return the id of this fis.
+     */
+    String getID();
+
+    /**
+     * Returns a collection of Parameters which belongs to the FIS.
+     * @return a collection of parameters.
+     */
+    Collection<Parameter> getParameter();
+
+    /**
+     * Add a collection of parameters to this fis.
+     *
+     * @param parameter Some parameters.
+     */
+    void addParameter(Collection<Parameter> parameter);
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Layer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.services.requestobjects;
+
+/**
+ * This is the inteface description of  a <code>Layer</code>. Currently, there
+ * are four methods defined here:<br>
+ * <ol>
+ *  <li>getName(): Returns the name of this layer.</li>
+ *  <li>getID(): Returns the id of this layer.</li>
+ *  <li>isGroupLayer(): Returns true, if this layer contains child layers.</li>
+ *  <li>parentID(): Returns the id of the parent layer if this layer is a
+ *   group layer.</li>
+ * </ol>
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public interface Layer {
+
+    /**
+     * Returns the name of this layer.
+     * @return the name of this layer.
+     */
+    String getName();
+
+    /**
+     * Returns the id of this layer.
+     * @return the id of this layer.
+     */
+    String getID();
+
+    /**
+     * Returns true if the Layer is an GroupLayer
+     * @return true, if this layer is a group layer - otherwise false.
+     */
+    boolean isGroupLayer();
+
+    /**
+     * Returned the ID of the Parent Layer.
+     * Only if the Layer is a Child-Layer.
+     * If this Layer is an Root-Layer null will be returned.
+     * @return the id of the parent.
+     */
+    String parentID();
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/MapService.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.services.requestobjects;
+
+import java.util.Collection;
+
+/**
+ * This is the interface description of <code>MapService</code>. Currently,
+ * there are four methods defined:<br>
+ * <ol>
+ *  <li>getID(): Returns the id of this service.</li>
+ *  <li>getURL(): Returns the url used to call this service.</li>
+ *  <li>getType(): Returns the service type.</li>
+ *  <li>getLayer(): Returns a collection of layers contained in this service.
+ *  </li>
+ * </ol>
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public interface MapService {
+
+
+    /**
+     * Returns the id of this Service.
+     * @return the id of this service.
+     */
+    String getID();
+
+    /**
+     * Returns the Url under which this service is available.
+     * @return the url under which this service is available.
+     */
+    String getURL();
+
+    /**
+     * Returns the service type
+     * @return the service type.
+     */
+    String getType();
+
+    /**
+     * Returns the Layer which belongs to this Service.
+     * @return a collection of layers contained in this service.
+     */
+    Collection<Layer> getLayer();
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/Parameter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.services.requestobjects;
+
+/**
+ * This is the interface description of <code>Parameter</code>. Currently, there
+ * are two methods defined:<br>
+ * <ol>
+ *  <li>getName(): Returns the name of this parameter.</li>
+ *  <li>getID(): Returns the id of this parameter.</li>
+ * </ol>
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public interface Parameter {
+
+    /**
+     * The Name of this Parameter
+     * @return the name of this parameter.
+     */
+    String getName();
+    /**
+     * The ID of this Parameter
+     * @return the id of this parameter.
+     */
+    String getID();
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/services/requestobjects/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package provides Interfaces and Classes which are required to represent the 
+Objects which are required to handle all Servicerequests which are defined in the
+Parentpackage.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractChart.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractChart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,31 +1,90 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.chart;
 
 import java.util.Collection;
 import java.util.Locale;
 
+import org.jfree.chart.ChartTheme;
 import org.jfree.chart.JFreeChart;
-import org.jfree.chart.ChartTheme;
 
 /**
- * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
+ * Abstract chart class to define the basic fields used for chart creation.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public abstract class AbstractChart
 implements            Chart
 {
+    /**
+     * JFreeChart object. Created after {@link #generateChart()} is called.
+     */
     protected JFreeChart  chart;
+
+    /**
+     * Field storing the visibility of lines in the chart plot.
+     */
     protected boolean     linesVisible;
+
+    /**
+     * Field storing the visibility of points in the chart plot.
+     */
     protected boolean     shapesVisible;
 
+    /**
+     * Locale object used for i18n support.
+     */
     protected Locale      locale;
 
+    /**
+     * ChartLabels
+     */
     protected ChartLabels labels;
+
+    /**
+     * ChartTheme
+     */
     protected ChartTheme  theme;
+
+    /**
+     * Collection which contains a bunch of parameters.
+     */
     protected Collection  parameters;
+
+    /**
+     * Collection which contains a bunch of measurements.
+     */
     protected Collection  measurements;
+
+    /**
+     * Collection which contains all data objects used to be displayed in the
+     * chart. It contains different series and different datasets which is not
+     * very elegant.
+     */
     protected Collection  resultSet;
+
+    /**
+     * Collection which contains a bunch of date objects.
+     */
     protected Collection  dates;
+
+    /**
+     * Collection which contains a bunch of time gap definitions used to
+     * detect gaps in timeseries charts.
+     */
     protected Collection  timeGaps;
 
+    /**
+     * Abstract method which needs to be implemented by concrete subclasses.
+     * This method triggers the JFreeChart creation process. After calling this
+     * method {@link #chart} should be a valid <code>JFreeChart</code> object.
+     */
     public abstract JFreeChart generateChart();
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=latin1 :
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractHistogram.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.chart;
+
+import java.util.Locale;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.ChartFactory;
+import org.jfree.chart.ChartTheme;
+import org.jfree.chart.JFreeChart;
+
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.TickUnitSource;
+
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.plot.XYPlot;
+
+import org.jfree.chart.renderer.xy.XYBarRenderer;
+
+/**
+ * This abstract class defines some methods to adjust chart settings after its
+ * creation.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public abstract class AbstractHistogram
+implements            Chart
+{
+    /**
+     * Logger used for logging with Apache log4j.
+     */
+    private Logger logger = Logger.getLogger(AbstractHistogram.class);
+
+    /**
+     * JFreeChart chart stored at this place after chart creation.
+     */
+    protected JFreeChart  chart;
+
+    /**
+     * Labels used for chart title, subtitle, axis description.
+     */
+    protected ChartLabels labels;
+
+    /**
+     * Theme which is used to adjust the styling of this chart.
+     */
+    protected ChartTheme  theme;
+
+    /**
+     * Raw data which should be displayed in the chart.
+     */
+    protected Object[]    data;
+
+    /**
+     * Locale object used for i18n support.
+     */
+    protected Locale     locale;
+
+
+    /**
+     * Constructor for creating histogram charts.
+     *
+     * @param labels See {@link #labels}
+     * @param data See {@link #data}
+     * @param theme See {@link #theme}
+     */
+    public AbstractHistogram(
+        ChartLabels labels, Object[] data, ChartTheme theme
+    ) {
+        this.labels = labels;
+        this.data   = data;
+        this.theme  = theme;
+    }
+
+
+    /**
+     * @see de.intevation.gnv.chart.Chart#generateChart()
+     */
+    public JFreeChart generateChart() {
+
+        if (chart != null)
+            return chart;
+
+        chart = ChartFactory.createHistogram(
+            labels.getTitle(),
+            labels.getDomainAxisLabel(),
+            labels.getRangeAxisLabel(),
+            null,
+            PlotOrientation.VERTICAL,
+            true,
+            false,
+            false);
+
+        applyDatasets();
+
+        theme.apply(chart);
+        adjustPlot();
+        adjustDomainAxis(chart);
+        adjustRangeAxis(chart);
+
+        return chart;
+    }
+
+
+    /**
+     * Method to do some changes in plot settings.
+     */
+    protected void adjustPlot() {
+        XYPlot plot = (XYPlot) chart.getPlot();
+        XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
+
+        renderer.setShadowVisible(false);
+        renderer.setSeriesVisibleInLegend(0, false);
+    }
+
+
+    protected void adjustDomainAxis(JFreeChart chart) {
+        XYPlot plot           = (XYPlot) chart.getPlot();
+        NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
+
+        TickUnitSource tus    = domainAxis.createStandardTickUnits(locale);
+        domainAxis.setStandardTickUnits(tus);
+    }
+
+
+    protected void adjustRangeAxis(JFreeChart chart) {
+        XYPlot plot           = (XYPlot) chart.getPlot();
+        NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
+
+        TickUnitSource tus    = rangeAxis.createStandardTickUnits(locale);
+        rangeAxis.setStandardTickUnits(tus);
+    }
+
+
+
+
+    /**
+     * This method needs to be implemented by subclasses and should add valid
+     * <code>HistogramDataset</code> objects to the created chart. It is called
+     * by {@link #generateChart} after chart creation.
+     */
+    protected abstract void applyDatasets();
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AbstractXYLineChart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,8 +1,23 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.chart;
 
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+
 import java.awt.Color;
+
 import java.awt.geom.Ellipse2D;
+
 import java.text.NumberFormat;
+
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Locale;
@@ -10,55 +25,130 @@
 
 import org.apache.log4j.Logger;
 
+import org.jfree.chart.ChartFactory;
 import org.jfree.chart.JFreeChart;
-import org.jfree.chart.ChartFactory;
+
 import org.jfree.chart.axis.Axis;
+import org.jfree.chart.axis.AxisLocation;
 import org.jfree.chart.axis.NumberAxis;
 import org.jfree.chart.axis.NumberTickUnit;
-import org.jfree.chart.axis.AxisLocation;
+
 import org.jfree.chart.plot.PlotOrientation;
 import org.jfree.chart.plot.XYPlot;
+
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
+
 import org.jfree.chart.title.TextTitle;
-import org.jfree.data.xy.XYDataset;
+
 import org.jfree.data.Range;
+
 import org.jfree.data.general.Series;
 
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import org.jfree.data.xy.XYDataset;
 
+import org.jfree.ui.RectangleInsets;
 
 /**
- * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
+ * This abstract class defines some methods to adjust chart settings after its
+ * creation.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public abstract class AbstractXYLineChart
 extends               AbstractChart
 {
+    /**
+     * Constant field used to expand the area between data and chart border. Its
+     * value is {@value}.<br>
+     * A value of 0.05 equals 5 percent.
+     */
     public static final double LOWER_MARGIN = 0.05D;
+
+    /**
+     * Constant field used to expand the area between data and chart border. Its
+     * value is {@value}.<br>
+     * A value of 0.05 equals 5 percent.
+     */
     public static final double UPPER_MARGIN = 0.05D;
 
+    /**
+     * Logger used to log with log4j.
+     */
     private static Logger log      = Logger.getLogger(AbstractXYLineChart.class);
 
+    /**
+     * Field of supported colors used for lines and data points in charts.
+     */
     protected static Color[] COLOR = {
         Color.black, Color.red, Color.green, Color.blue, Color.yellow,
         Color.gray, Color.orange, Color.pink, Color.cyan
     };
 
+    /**
+     * Static field to remember the index of the previously used color.
+     */
     protected static int nextColor = 0;
 
+    /**
+     * Default <code>PlotOrientation</code>.
+     */
     protected PlotOrientation PLOT_ORIENTATION = PlotOrientation.VERTICAL;
 
-    /** Map to store datasets for each parameter */
+    /**
+     * Map to store datasets for each parameter.
+     */
     protected Map datasets;
 
-    /** Map to store max ranges of each parameter (axis.setAutoRange(true)
+    /**
+     * Map to store max ranges of each parameter (axis.setAutoRange(true)
      * doesn't seem to work */
     protected Map ranges;
 
+    /**
+     * This method is called by <code>Chart</code> to bring the data into the
+     * right form fitting to JFreeChart objects.
+     */
     protected abstract void initData();
+
+    /**
+     * Add a value of <code>row</code> to <code>series</code>.
+     *
+     * @param row <code>Result</code> Object returned from database. Contains
+     * a value used to add to <code>series</code>
+     * @param series A JFreeChart Series object.
+     */
     protected abstract void addValue(Result row, Series series);
+
+    /**
+     * Add <code>series</code> to JFreeChart's Dataset object currently which is
+     * processing.
+     *
+     * @param series Series to add.
+     * @param label Label used show in legend.
+     * @param idx Currently not used.
+     */
     protected abstract void addSeries(Series series, String label, int idx);
+
+    /**
+     * Abstract method which is called by <code>Chart</code> interface after
+     * chart creation. It turns an axis' label into a locale specific format.
+     *
+     * @param axis Axis to adjust.
+     * @param locale java.util.Locale object used specify the format.
+     */
     protected abstract void localizeDomainAxis(Axis axis, Locale locale);
+
+    /**
+     * Abstract method to create a label for a series of parameters.
+     *
+     * @param breakPoint1 Identifier returned from database. These identifier
+     * are used to identify the results from database which are all stored in
+     * one big java.util.Collection.
+     * @param breakPoint2 Identifier returned from database.
+     * @param breakPoint3 Identifier returned from database.
+     *
+     * @return Concatinated string of parameter name and measurement.
+     */
     protected abstract String createSeriesName(
         String breakPoint1,
         String breakPoint2,
@@ -66,6 +156,9 @@
     );
 
 
+    /**
+     * @see de.intevation.gnv.chart.Chart#generateChart()
+     */
     public JFreeChart generateChart() {
         log.debug("generate XYLineChart");
         nextColor = 0;
@@ -100,6 +193,15 @@
     }
 
 
+    /**
+     * Method used to adjust the axes after chart generation. Methods for i18n
+     * support ({@link #localizeDomainAxis} and {@link #localizeRangeAxis}) are
+     * called and axes of this series are expanded.
+     *
+     * @param seriesKey Identifier of an axis which have to be adjusted.
+     * @param idx Set the axis identified by <code>seriesKey</code> to position
+     * <code>idx</code>.
+     */
     protected void prepareAxis(String seriesKey, int idx) {
         log.debug("prepare axis of xychart");
 
@@ -112,8 +214,19 @@
 
         // litte workarround to adjust the max range of axes.
         // NumberAxis.setAutoRange(true) doesn't seem to work properly.
-        Range yRange     = (Range) ranges.get(seriesKey);
-        yAxis.setRange(Range.expand(yRange, LOWER_MARGIN, UPPER_MARGIN));
+        Range yRange = (Range) ranges.get(seriesKey);
+        double lo    = yRange.getLowerBound();
+        double hi    = yRange.getUpperBound();
+
+        if (lo == hi) {
+            yRange = new Range(
+                lo - (lo / 100 * LOWER_MARGIN),
+                hi + (hi / 100 * UPPER_MARGIN));
+        }
+        else {
+            yRange = Range.expand(yRange, LOWER_MARGIN, UPPER_MARGIN);
+        }
+        yAxis.setRange(yRange);
         log.debug("Max Range of dataset is: " + yRange.toString());
 
         if (seriesKey.contains("richtung")) {
@@ -133,9 +246,21 @@
             plot.setRangeAxisLocation(idx, AxisLocation.BOTTOM_OR_RIGHT);
         else
             plot.setRangeAxisLocation(idx, AxisLocation.BOTTOM_OR_LEFT);
+
+        plot.mapDatasetToRangeAxis(idx, idx);
     }
 
 
+    /**
+     * Method to adjust the rendering of a series in a chart. Line color and
+     * symbols of vertices are configured here.
+     *
+     * @param idx Position of the renderer.
+     * @param seriesCount Maximum number of series in this chart.
+     * @param renderLines Lines are displayed if true, otherwise they are not.
+     * @param renderShapes Vertices are displayed if true, otherwise they are
+     * not.
+     */
     protected void adjustRenderer(
         int     idx,
         int     seriesCount,
@@ -158,21 +283,44 @@
 
         for (int i = 0; i < seriesCount; i++) {
             renderer.setSeriesShape(i, renderer.getSeriesShape(0));
-            renderer.setSeriesPaint(i, COLOR[nextColor%COLOR.length]);
+            renderer.setSeriesPaint(i, COLOR[nextColor() % COLOR.length]);
             renderer.setSeriesShapesVisible(i, renderShapes);
             renderer.setSeriesLinesVisible(i, renderLines);
-            nextColor++;
         }
         plot.setRenderer(idx, renderer);
     }
 
 
+    /**
+     * @return Index of the next color
+     */
+    protected static synchronized int nextColor() {
+        return nextColor++;
+    }
+
+
+    /**
+     * Method to adjust the plot rendering. Disable horizontal grid lines if
+     * <code>plot</code> contains only a single y-axis.
+     *
+     * @param plot JFreeChart Plot object to be adjusted.
+     */
     protected void adjustPlot(XYPlot plot) {
         if (plot.getRangeAxisCount() > 1)
             plot.setRangeGridlinesVisible(false);
+
+        plot.setAxisOffset(new RectangleInsets(0, 0, 0, 15));
     }
 
 
+    /**
+     * Abstract method which is called after chart creation. It turns an
+     * axis' label into a locale specific format.
+     *
+     * @param axis Axis to adjust.
+     * @param locale java.util.Locale object used specify the format.
+     *
+     */
     protected void localizeRangeAxis(Axis axis, Locale locale) {
         if (locale == null)
             return;
@@ -187,6 +335,13 @@
     }
 
 
+    /**
+     * Return the maximum y-range of <code>dataset</code>.
+     *
+     * @param dataset Dataset to be scaned.
+     *
+     * @return JFreeChart Range object containing min and max y-value.
+     */
     public Range getMaxRangeOfDataset(XYDataset dataset) {
         int    seriesCount = dataset.getSeriesCount();
         double upper       = Double.NEGATIVE_INFINITY;
@@ -210,6 +365,15 @@
     }
 
 
+    /**
+     * Return the maximum y-range of <code>dataset</code> with a margin of
+     * <code>percent</code> percent.
+     *
+     * @param dataset Dataset to be scaned.
+     * @param percent Percent used to expand the range.
+     * @return JFreeChart Range object containing min and max y-value with a
+     * margin.
+     */
     public Range getMaxRangeOfDatasetWithMargin(
         XYDataset dataset,
         double    percent
@@ -223,6 +387,13 @@
     }
 
 
+    /**
+     * Method to find a parameter specified by its value.
+     *
+     * @param label Search string.
+     *
+     * @return Value of a parameter with the given label.
+     */
     protected String findParameter(String label) {
         Iterator iter = parameters.iterator();
 
@@ -238,6 +409,14 @@
     }
 
 
+    /**
+     * Method to find a description of a given collection of values.
+     *
+     * @param values Collection to be scaned.
+     * @param id Identifier and search string of the searched value.
+     *
+     * @return title
+     */
     protected String findValueTitle(Collection values, String id) {
         log.debug("find description of dataset");
 
@@ -254,7 +433,16 @@
     }
 
 
-    protected void storeMaxRange(double value, String parameter) {
+    /**
+     * Method to store the maximum range. Since we need to adjust the range of
+     * each range axis, we have to memorize its range - each parameter uses an
+     * own range axis.
+     *
+     * @param ranges Map where ranges of each axis will be stored in.
+     * @param value A given value on an axis.
+     * @param parameter Parameter name which belongs to <code>value</code>.
+     */
+    protected void storeMaxRange(Map ranges, double value, String parameter) {
         Range  range     = null;
 
         range = ranges.containsKey(parameter)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/AdvancedHistogramDataset.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,516 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.chart;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.data.general.DatasetChangeEvent;
+import org.jfree.data.xy.AbstractIntervalXYDataset;
+import org.jfree.data.xy.IntervalXYDataset;
+
+import org.jfree.data.statistics.HistogramType;
+import org.jfree.data.statistics.HistogramBin;
+
+import org.jfree.util.ObjectUtilities;
+import org.jfree.util.PublicCloneable;
+
+/**
+ * This class extends the functionality of the internal JFreeChart class
+ * <code>HistogramDataset</code>. <code>AdvancedHistogramDataset</code> takes
+ * the number of bins OR a bin width. It is mainly a copy of this class. The
+ * reason why there is no inheritance from JFreeChart's internal class is,
+ * that basic attributes have private access there.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class AdvancedHistogramDataset
+extends      AbstractIntervalXYDataset
+implements   IntervalXYDataset, Cloneable, PublicCloneable, Serializable
+{
+    /** A list of maps. */
+    protected List list;
+
+    /** The histogram type. */
+    protected HistogramType type;
+
+    /** The width of a single bin. */
+    protected double binWidth = -1;
+
+    /** The number of bins. */
+    protected int bins = -1;
+
+    /** The logger */
+    private static Logger logger =
+        Logger.getLogger(AdvancedHistogramDataset.class);
+
+
+    /**
+     * Creates a new (empty) dataset with a default type of
+     * {@link HistogramType}.FREQUENCY.
+     */
+    public AdvancedHistogramDataset() {
+        this.list = new ArrayList();
+        this.type = HistogramType.FREQUENCY;
+    }
+
+    /**
+     * Creates a new (empty) dataset with a default type of
+     * {@link HistogramType}.FREQUENCY.
+     */
+    public AdvancedHistogramDataset(int bins, double binWidth) {
+        this.list     = new ArrayList();
+        this.type     = HistogramType.FREQUENCY;
+        this.bins     = bins;
+        this.binWidth = binWidth;
+    }
+
+    /**
+     * Returns the histogram type.
+     *
+     * @return The type (never <code>null</code>).
+     */
+    public HistogramType getType() {
+        return this.type;
+    }
+
+    /**
+     * Sets the histogram type and sends a {@link DatasetChangeEvent} to all
+     * registered listeners.
+     *
+     * @param type  the type (<code>null</code> not permitted).
+     */
+    public void setType(HistogramType type) {
+        if (type == null) {
+            throw new IllegalArgumentException("Null 'type' argument");
+        }
+        this.type = type;
+        notifyListeners(new DatasetChangeEvent(this, this));
+    }
+
+    /**
+     * Adds a series to the dataset, using the specified number of bins.
+     *
+     * @param key  the series key (<code>null</code> not permitted).
+     * @param values the values (<code>null</code> not permitted).
+     */
+    public void addSeries(Comparable key, double[] values) {
+        double minimum = getMinimum(values);
+        double maximum = getMaximum(values);
+        addSeries(key, values, minimum, maximum);
+    }
+
+    /**
+     * Adds a series to the dataset. Any data value less than minimum will be
+     * assigned to the first bin, and any data value greater than maximum will
+     * be assigned to the last bin.  Values falling on the boundary of
+     * adjacent bins will be assigned to the higher indexed bin.
+     *
+     * @param key  the series key (<code>null</code> not permitted).
+     * @param values  the raw observations.
+     * @param bins  the number of bins (must be at least 1).
+     * @param minimum  the lower bound of the bin range.
+     * @param maximum  the upper bound of the bin range.
+     */
+    public void addSeries(Comparable key,
+                          double[] values,
+                          double minimum,
+                          double maximum) {
+
+        if (key == null) {
+            throw new IllegalArgumentException("Null 'key' argument.");
+        }
+        if (values == null) {
+            throw new IllegalArgumentException("Null 'values' argument.");
+        }
+        if (bins <= 0 && binWidth <= 0) {
+            throw new IllegalArgumentException(
+                "We need at least a bin width or the number of bins.");
+        }
+
+        // There is a binWidth given to calculate the number of bins in this
+        // case
+        if (bins <= 0) {
+            double tmp = (maximum - minimum) / binWidth;
+            bins       = (int) tmp;
+            bins       = tmp % 1 > 0 ? bins + 1 : bins;
+
+            double overlap = minimum + bins * binWidth - maximum;
+            tmp            = minimum;
+            minimum -= overlap / 2;
+
+            logger.debug("There is an overlap of " + overlap);
+            logger.info("The lower bound is moved left from "
+                + tmp + " to " + minimum);
+
+            tmp      = maximum;
+            maximum += overlap / 2;
+            logger.info("The upper bound is moved right from "
+                + tmp + " to " + maximum);
+        }
+
+        if (bins <= 0) {
+            bins = 1;
+        }
+
+        // in this case, there is a number of bins given, so we need to
+        // calculate the width of a single bin
+        if (binWidth <= 0)
+            binWidth = (maximum - minimum) / bins;
+
+        logger.info("bin width: " + binWidth);
+        logger.info("number of bins: " + bins);
+
+        double lower = minimum;
+        double upper;
+        List binList = new ArrayList(bins);
+        for (int i = 0; i < bins; i++) {
+            HistogramBin bin;
+            // make sure bins[bins.length]'s upper boundary ends at maximum
+            // to avoid the rounding issue. the bins[0] lower boundary is
+            // guaranteed start from min
+            if (i == bins - 1) {
+                bin = new HistogramBin(lower, maximum);
+            }
+            else {
+                upper = minimum + (i + 1) * binWidth;
+                bin = new HistogramBin(lower, upper);
+                lower = upper;
+            }
+            binList.add(bin);
+        }
+        // fill the bins
+        for (int i = 0; i < values.length; i++) {
+            int binIndex = bins - 1;
+            if (values[i] < maximum) {
+                double fraction = (values[i] - minimum) / (maximum - minimum);
+                if (fraction < 0.0) {
+                    fraction = 0.0;
+                }
+                binIndex = (int) (fraction * bins);
+                // rounding could result in binIndex being equal to bins
+                // which will cause an IndexOutOfBoundsException - see bug
+                // report 1553088
+                if (binIndex >= bins) {
+                    binIndex = bins - 1;
+                }
+            }
+            HistogramBin bin = (HistogramBin) binList.get(binIndex);
+            bin.incrementCount();
+        }
+        // generic map for each series
+        Map map = new HashMap();
+        map.put("key", key);
+        map.put("bins", binList);
+        map.put("values.length", new Integer(values.length));
+        map.put("bin width", new Double(binWidth));
+        this.list.add(map);
+    }
+
+    /**
+     * Returns the minimum value in an array of values.
+     *
+     * @param values  the values (<code>null</code> not permitted and
+     *                zero-length array not permitted).
+     *
+     * @return The minimum value.
+     */
+    private double getMinimum(double[] values) {
+        if (values == null || values.length < 1) {
+            throw new IllegalArgumentException(
+                    "Null or zero length 'values' argument.");
+        }
+        double min = Double.MAX_VALUE;
+        for (int i = 0; i < values.length; i++) {
+            if (values[i] < min) {
+                min = values[i];
+            }
+        }
+        return min;
+    }
+
+    /**
+     * Returns the maximum value in an array of values.
+     *
+     * @param values  the values (<code>null</code> not permitted and
+     *                zero-length array not permitted).
+     *
+     * @return The maximum value.
+     */
+    private double getMaximum(double[] values) {
+        if (values == null || values.length < 1) {
+            throw new IllegalArgumentException(
+                    "Null or zero length 'values' argument.");
+        }
+        double max = -Double.MAX_VALUE;
+        for (int i = 0; i < values.length; i++) {
+            if (values[i] > max) {
+                max = values[i];
+            }
+        }
+        return max;
+    }
+
+    /**
+     * Returns the bins for a series.
+     *
+     * @param series  the series index (in the range <code>0</code> to
+     *     <code>getSeriesCount() - 1</code>).
+     *
+     * @return A list of bins.
+     *
+     * @throws IndexOutOfBoundsException if <code>series</code> is outside the
+     *     specified range.
+     */
+    List getBins(int series) {
+        Map map = (Map) this.list.get(series);
+        return (List) map.get("bins");
+    }
+
+    /**
+     * Returns the total number of observations for a series.
+     *
+     * @param series  the series index.
+     *
+     * @return The total.
+     */
+    private int getTotal(int series) {
+        Map map = (Map) this.list.get(series);
+        return ((Integer) map.get("values.length")).intValue();
+    }
+
+    /**
+     * Returns the bin width for a series.
+     *
+     * @param series  the series index (zero based).
+     *
+     * @return The bin width.
+     */
+    private double getBinWidth(int series) {
+        if (binWidth > 0)
+            return binWidth;
+
+        Map map = (Map) this.list.get(series);
+        return ((Double) map.get("bin width")).doubleValue();
+    }
+
+    /**
+     * Returns the number of series in the dataset.
+     *
+     * @return The series count.
+     */
+    public int getSeriesCount() {
+        return this.list.size();
+    }
+
+    /**
+     * Returns the key for a series.
+     *
+     * @param series  the series index (in the range <code>0</code> to
+     *     <code>getSeriesCount() - 1</code>).
+     *
+     * @return The series key.
+     *
+     * @throws IndexOutOfBoundsException if <code>series</code> is outside the
+     *     specified range.
+     */
+    public Comparable getSeriesKey(int series) {
+        Map map = (Map) this.list.get(series);
+        return (Comparable) map.get("key");
+    }
+
+    /**
+     * Returns the number of data items for a series.
+     *
+     * @param series  the series index (in the range <code>0</code> to
+     *     <code>getSeriesCount() - 1</code>).
+     *
+     * @return The item count.
+     *
+     * @throws IndexOutOfBoundsException if <code>series</code> is outside the
+     *     specified range.
+     */
+    public int getItemCount(int series) {
+        return getBins(series).size();
+    }
+
+    /**
+     * Returns the X value for a bin.  This value won't be used for plotting
+     * histograms, since the renderer will ignore it.  But other renderers can
+     * use it (for example, you could use the dataset to create a line
+     * chart).
+     *
+     * @param series  the series index (in the range <code>0</code> to
+     *     <code>getSeriesCount() - 1</code>).
+     * @param item  the item index (zero based).
+     *
+     * @return The start value.
+     *
+     * @throws IndexOutOfBoundsException if <code>series</code> is outside the
+     *     specified range.
+     */
+    public Number getX(int series, int item) {
+        List bins        = getBins(series);
+        HistogramBin bin = (HistogramBin) bins.get(item);
+        double x         = (bin.getStartBoundary() + bin.getEndBoundary()) / 2.;
+        return new Double(x);
+    }
+
+    /**
+     * Returns the y-value for a bin (calculated to take into account the
+     * histogram type).
+     *
+     * @param series  the series index (in the range <code>0</code> to
+     *     <code>getSeriesCount() - 1</code>).
+     * @param item  the item index (zero based).
+     *
+     * @return The y-value.
+     *
+     * @throws IndexOutOfBoundsException if <code>series</code> is outside the
+     *     specified range.
+     */
+    public Number getY(int series, int item) {
+        List bins        = getBins(series);
+        HistogramBin bin = (HistogramBin) bins.get(item);
+        double total     = getTotal(series);
+        double binWidth  = getBinWidth(series);
+
+        if (this.type == HistogramType.FREQUENCY) {
+            return new Double(bin.getCount());
+        }
+        else if (this.type == HistogramType.RELATIVE_FREQUENCY) {
+            return new Double(bin.getCount() / total);
+        }
+        else if (this.type == HistogramType.SCALE_AREA_TO_1) {
+            return new Double(bin.getCount() / (binWidth * total));
+        }
+        else { // pretty sure this shouldn't ever happen
+            throw new IllegalStateException();
+        }
+    }
+
+    /**
+     * Returns the start value for a bin.
+     *
+     * @param series  the series index (in the range <code>0</code> to
+     *     <code>getSeriesCount() - 1</code>).
+     * @param item  the item index (zero based).
+     *
+     * @return The start value.
+     *
+     * @throws IndexOutOfBoundsException if <code>series</code> is outside the
+     *     specified range.
+     */
+    public Number getStartX(int series, int item) {
+        List bins = getBins(series);
+        HistogramBin bin = (HistogramBin) bins.get(item);
+        return new Double(bin.getStartBoundary());
+    }
+
+    /**
+     * Returns the end value for a bin.
+     *
+     * @param series  the series index (in the range <code>0</code> to
+     *     <code>getSeriesCount() - 1</code>).
+     * @param item  the item index (zero based).
+     *
+     * @return The end value.
+     *
+     * @throws IndexOutOfBoundsException if <code>series</code> is outside the
+     *     specified range.
+     */
+    public Number getEndX(int series, int item) {
+        List bins = getBins(series);
+        HistogramBin bin = (HistogramBin) bins.get(item);
+        return new Double(bin.getEndBoundary());
+    }
+
+    /**
+     * Returns the start y-value for a bin (which is the same as the y-value,
+     * this method exists only to support the general form of the
+     * {@link IntervalXYDataset} interface).
+     *
+     * @param series  the series index (in the range <code>0</code> to
+     *     <code>getSeriesCount() - 1</code>).
+     * @param item  the item index (zero based).
+     *
+     * @return The y-value.
+     *
+     * @throws IndexOutOfBoundsException if <code>series</code> is outside the
+     *     specified range.
+     */
+    public Number getStartY(int series, int item) {
+        return getY(series, item);
+    }
+
+    /**
+     * Returns the end y-value for a bin (which is the same as the y-value,
+     * this method exists only to support the general form of the
+     * {@link IntervalXYDataset} interface).
+     *
+     * @param series  the series index (in the range <code>0</code> to
+     *     <code>getSeriesCount() - 1</code>).
+     * @param item  the item index (zero based).
+     *
+     * @return The Y value.
+     *
+     * @throws IndexOutOfBoundsException if <code>series</code> is outside the
+     *     specified range.
+     */
+    public Number getEndY(int series, int item) {
+        return getY(series, item);
+    }
+
+    /**
+     * Tests this dataset for equality with an arbitrary object.
+     *
+     * @param obj  the object to test against (<code>null</code> permitted).
+     *
+     * @return A boolean.
+     */
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        }
+        if (!(obj instanceof AdvancedHistogramDataset)) {
+            return false;
+        }
+        AdvancedHistogramDataset that = (AdvancedHistogramDataset) obj;
+        if (!ObjectUtilities.equal(this.type, that.type)) {
+            return false;
+        }
+        if (!ObjectUtilities.equal(this.list, that.list)) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Returns a clone of the dataset.
+     *
+     * @return A clone of the dataset.
+     *
+     * @throws CloneNotSupportedException if the object cannot be cloned.
+     */
+    public Object clone() throws CloneNotSupportedException {
+        AdvancedHistogramDataset clone = (AdvancedHistogramDataset) super.clone();
+        int seriesCount = getSeriesCount();
+        clone.list = new java.util.ArrayList(seriesCount);
+        for (int i = 0; i < seriesCount; i++) {
+            clone.list.add(new HashMap((Map) this.list.get(i)));
+        }
+        return clone;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/Chart.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/Chart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,12 +1,32 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.chart;
 
+import java.io.Serializable;
+
 import org.jfree.chart.JFreeChart;
 
-
 /**
- * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
+ * The <code>Chart</code> interface should be implemented by each type of chart.
+ * The class must implement a method <code>generateChart</code> which returns a
+ * JFreeChart object.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public interface Chart {
-    
+public interface Chart
+extends          Serializable
+{
+    /**
+     * This method is used to create a JFreeChart of this object.
+     *
+     * @return JFreeChart object.
+     */
     public JFreeChart generateChart();
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartLabels.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartLabels.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,68 +1,148 @@
-/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
- * All rights reserved
- *
- * $Id: ChartLabels.java,v 1.1 2007/12/10 13:57:13 drewnak Exp $
- *
- * created by:      drewnak
- * created at :     10.12.2007
- * created at :     11:48:39
- *
- * modified by:     $Author: drewnak $
- * modified at:     $Date: 2007/12/10 13:57:13 $
- */
-package de.intevation.gnv.chart;
-
-/**
- * @author drewnak
- * @author Tim Englich <tim.englich@intevation.de> Changes and codecleanup
- */
-public class ChartLabels {
-    /**
-     * 
-     */
-    private String title;
-
-    /**
-     *
-     */
-    private String subtitle;
-
-    /**
-     * 
-     */
-    private String domainAxisLabel;
-
-    /**
-     * Constructor
-     * 
-     * @param title
-     * @param domainAxisLabel
-     */
-    public ChartLabels(String title, String subtitle, String domainAxisLabel) {
-        this.title           = title;
-        this.subtitle        = subtitle;
-        this.domainAxisLabel = domainAxisLabel;
-    }
-
-    /**
-     * @return the title
-     */
-    public String getTitle() {
-        return this.title;
-    }
-
-
-    /**
-     * @return the subtitle
-     */
-    public String getSubtitle() {
-        return subtitle;
-    }
-
-    /**
-     * @return the timeAxisLabel
-     */
-    public String getDomainAxisLabel() {
-        return this.domainAxisLabel;
-    }
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
+ * All rights reserved
+ *
+ * $Id: ChartLabels.java,v 1.1 2007/12/10 13:57:13 drewnak Exp $
+ *
+ * created by:      drewnak
+ * created at :     10.12.2007
+ * created at :     11:48:39
+ *
+ * modified by:     $Author: drewnak $
+ * modified at:     $Date: 2007/12/10 13:57:13 $
+ */
+package de.intevation.gnv.chart;
+
+/**
+ * This class stores some strings used for decorating charts (e.g. title,
+ * subtitle, etc).
+ *
+ * @author drewnak
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> Changes and codecleanup
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ChartLabels {
+    /**
+     *
+     */
+    private String title;
+
+    /**
+     *
+     */
+    private String subtitle;
+
+    /**
+     *
+     */
+    private String domainAxisLabel;
+
+    /**
+     *
+     */
+    private String rangeAxisLabel;
+
+    /**
+     *
+     */
+    private String parameterName;
+
+
+    /**
+     * Constructor
+     *
+     * @param title Title
+     * @param subtitle Subtitle
+     * @param domainAxisLabel X-axis label
+     */
+    public ChartLabels(String title, String subtitle, String domainAxisLabel) {
+        this(title, subtitle, domainAxisLabel, null);
+    }
+
+    /**
+     * Constructor
+     *
+     * @param title Title
+     * @param subtitle Subtitle
+     * @param domainAxisLabel X-axis label
+     * @param rangeAxisLabel Y-axis label
+     */
+    public ChartLabels(
+        String title,
+        String subtitle,
+        String domainAxisLabel,
+        String rangeAxisLabel
+    ) {
+        this(title, subtitle, domainAxisLabel, rangeAxisLabel, null);
+    }
+
+
+    /**
+     * Constructor
+     *
+     * @param title Title
+     * @param subtitle Subtitle
+     * @param domainAxisLabel X-axis label
+     * @param rangeAxisLabel Y-axis label
+     * @param parameterName Name of a given parameter in the chart.
+     */
+    public ChartLabels(
+        String title,
+        String subtitle,
+        String domainAxisLabel,
+        String rangeAxisLabel,
+        String parameterName
+    ) {
+        this.title           = title;
+        this.subtitle        = subtitle;
+        this.domainAxisLabel = domainAxisLabel;
+        this.rangeAxisLabel  = rangeAxisLabel;
+        this.parameterName   = parameterName;
+    }
+
+    /**
+     * @return the title
+     */
+    public String getTitle() {
+        return this.title;
+    }
+
+
+    /**
+     * @return the subtitle
+     */
+    public String getSubtitle() {
+        return subtitle;
+    }
+
+    /**
+     * @return the timeAxisLabel
+     */
+    public String getDomainAxisLabel() {
+        return this.domainAxisLabel;
+    }
+
+
+    /**
+     * @return the y-axis label
+     */
+    public String getRangeAxisLabel() {
+        return this.rangeAxisLabel;
+    }
+
+
+    /**
+     * @return the parameter name
+     */
+    public String getParameterName() {
+        return this.parameterName;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/ChartStyle.java	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,170 +0,0 @@
-/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
- * All rights reserved
- *
- * $Id: ChartStyle.java,v 1.2 2007/12/21 12:31:15 blume Exp $
- *
- * created by:      drewnak
- * created at :     10.12.2007
- * created at :     13:07:44
- *
- * modified by:     $Author: blume $
- * modified at:     $Date: 2007/12/21 12:31:15 $
- */
-package de.intevation.gnv.chart;
-
-import java.awt.Color;
-import java.awt.Dimension;
-
-/**
- * @author drewnak
- */
-public class ChartStyle {
-
-    private Color mCanvasColor;
-    private Color mPlotBackgroundColor;
-    private Color mDomainGridlineColor;
-    private Color mRangeGridlineColor;
-    private boolean mDomainCrosshairVisible;
-    private boolean mRangeCrosshairVisible;
-    private Insets mAxisOffset;
-    private boolean mOverrideDefaultChartWidth = false;
-    private Dimension mChartSize;
-
-    private boolean mUseUpperDataLevel = false;
-    private boolean mUseLowerDataLevel = false;
-    private int mUpperLevel;
-    private int mLowerLevel;
-
-    /**
-     * @param pCanvasColor
-     * @param pPlotBackgroundColor
-     * @param pDomainGridlineColor
-     * @param pRangeGridlineColor
-     * @param pDomainCrosshairVisible
-     * @param pRangeCrosshairVisible
-     * @param pAxisOffset
-     */
-    public ChartStyle(Color pCanvasColor, Color pPlotBackgroundColor,
-                      Color pDomainGridlineColor, Color pRangeGridlineColor,
-                      boolean pDomainCrosshairVisible,
-                      boolean pRangeCrosshairVisible, Insets pAxisOffset,
-                      Dimension pChartSize) {
-        super();
-        mCanvasColor = pCanvasColor;
-        mPlotBackgroundColor = pPlotBackgroundColor;
-        mDomainGridlineColor = pDomainGridlineColor;
-        mRangeGridlineColor = pRangeGridlineColor;
-        mDomainCrosshairVisible = pDomainCrosshairVisible;
-        mRangeCrosshairVisible = pRangeCrosshairVisible;
-        mAxisOffset = pAxisOffset;
-        mChartSize = pChartSize;
-    }
-
-    public Color getCanvasColor() {
-        return mCanvasColor;
-    }
-
-    public void setCanvasColor(Color pCanvasColor) {
-        mCanvasColor = pCanvasColor;
-    }
-
-    public Color getDomainGridlineColor() {
-        return mDomainGridlineColor;
-    }
-
-    public void setDomainGridlineColor(Color pDomainGridlineColor) {
-        mDomainGridlineColor = pDomainGridlineColor;
-    }
-
-    public Color getRangeGridlineColor() {
-        return mRangeGridlineColor;
-    }
-
-    public void setRangeGridlineColor(Color pRangeGridlineColor) {
-        mRangeGridlineColor = pRangeGridlineColor;
-    }
-
-    public boolean isDomainCrosshairVisible() {
-        return mDomainCrosshairVisible;
-    }
-
-    public void setDomainCrosshairVisible(boolean pDomainCrosshairVisible) {
-        mDomainCrosshairVisible = pDomainCrosshairVisible;
-    }
-
-    public boolean isRangeCrosshairVisible() {
-        return mRangeCrosshairVisible;
-    }
-
-    public void setRangeCrosshairVisible(boolean pRangeCrosshairVisible) {
-        mRangeCrosshairVisible = pRangeCrosshairVisible;
-    }
-
-    public Insets getAxisOffset() {
-        return mAxisOffset;
-    }
-
-    public void setAxisOffset(Insets pAxisOffset) {
-        mAxisOffset = pAxisOffset;
-    }
-
-    public Color getPlotBackgroundColor() {
-        return mPlotBackgroundColor;
-    }
-
-    public void setPlotBackgroundColor(Color pPlotBackgroundColor) {
-        mPlotBackgroundColor = pPlotBackgroundColor;
-    }
-
-    public Dimension getChartSize() {
-        return mChartSize;
-    }
-
-    public void setChartSize(Dimension pChartSize) {
-        mChartSize = pChartSize;
-    }
-
-    public boolean isOverrideDefaultChartWidth() {
-        return mOverrideDefaultChartWidth;
-    }
-
-    public void setOverrideDefaultChartWidth(boolean pOverrideDefaultChartWidth) {
-        mOverrideDefaultChartWidth = pOverrideDefaultChartWidth;
-    }
-
-    public void setNewChartWidth(int pNewChartWidth) {
-        mChartSize.setSize(pNewChartWidth, mChartSize.getHeight());
-    }
-
-    public boolean isUseUpperDataLevel() {
-        return mUseUpperDataLevel;
-    }
-
-    public void setUseUpperDataLevel(boolean pUseUpperDataLevel) {
-        mUseUpperDataLevel = pUseUpperDataLevel;
-    }
-
-    public boolean isUseLowerDataLevel() {
-        return mUseLowerDataLevel;
-    }
-
-    public void setUseLowerDataLevel(boolean pUseLowerDataLevel) {
-        mUseLowerDataLevel = pUseLowerDataLevel;
-    }
-
-    public int getUpperLevel() {
-        return mUpperLevel;
-    }
-
-    public void setUpperLevel(int pUpperLevel) {
-        mUpperLevel = pUpperLevel;
-    }
-
-    public int getLowerLevel() {
-        return mLowerLevel;
-    }
-
-    public void setLowerLevel(int pLowerLevel) {
-        mLowerLevel = pLowerLevel;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/DefaultHistogram.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.chart;
+
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.ChartTheme;
+
+import org.jfree.chart.plot.XYPlot;
+
+/**
+ * Default implementation of {@link de.intevation.gnv.chart.AbstractHistogram}.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class DefaultHistogram
+extends      AbstractHistogram
+{
+    /**
+     * Default bin count.
+     * TODO find a better default value
+     */
+    public static final int DEFAULT_BINS = 15;
+
+    /**
+     * Constant field for limitating the number of bin in a single histogram.
+     */
+    public static final int MAXIMAL_BINS = 20;
+
+    /**
+     * Default key to retrieve the number of bins from {@link
+     * #requestParameter}.
+     */
+    public static final String REQUEST_KEY_BIN_COUNT   = "bincount";
+
+    /**
+     * Default key to retrieve the width of a single bin from {@link
+     * #requestParameter}.
+     */
+    public static final String REQUEST_KEY_BIN_WIDTH   = "binwidth";
+
+    /**
+     * Default key to retrieve the chart width from {@link #requestParameter}.
+     */
+    public static final String REQUEST_KEY_CHART_WIDTH = "width";
+
+    /**
+     * Default key to retrieve the object from {@link #requestParameter}. It
+     * defines which value this chart has to be used for bin calculation. You
+     * can either adjust the number of bins or the width of a single bin.
+     */
+    public static final String REQUEST_KEY_BIN_CHOICE  = "bintype";
+
+    /**
+     * Logger used for logging with log4j.
+     */
+    private static Logger logger = Logger.getLogger(DefaultHistogram.class);
+
+    /**
+     * Object storing some further parameter used for chart settings.
+     */
+    protected Map requestParameter;
+
+    protected double[] minmax = null;
+
+
+    /**
+     * Constructor to create DefaultHistogram objects.
+     *
+     * @param labels Labels to decorate this chart.
+     * @param data Raw data to be displayed in histogram.
+     * @param theme Theme used to adjust the chart look.
+     * @param requestParameter Object which serves some further settings.
+     */
+    public DefaultHistogram(
+        ChartLabels labels, Object[] data, ChartTheme theme, Map requestParameter
+    ) {
+        super(labels, data, theme);
+        this.requestParameter = requestParameter;
+        this.locale           = (Locale) requestParameter.get("locale");
+    }
+
+
+    @Override
+    protected void applyDatasets() {
+        XYPlot plot = (XYPlot) chart.getPlot();
+
+        // prepare data and create add them to histogram dataset
+        String   name   = (String)   data[0];
+        double[] values = toDouble((Double[]) data[1]);
+
+        double binWidth = getBinWidth(values);
+        int    binCount = getBinCount();
+
+        AdvancedHistogramDataset dataset =
+            new AdvancedHistogramDataset(binCount, binWidth);
+        dataset.addSeries(name, values);
+
+        plot.setDataset(0, dataset);
+    }
+
+
+    /**
+     * Method which scans the hole bunch of values and returns an array with
+     * contains min and max value. Min value is stored at position 0, max value
+     * is stored at position 1 in that array.
+     *
+     * @param values Array which contains all values
+     *
+     * @return Array which contains min and max value
+     */
+    protected double[] getMinMax(double[] values) {
+        if (minmax != null)
+            return minmax;
+
+        double[] minmax = new double[2];
+        minmax[0] = Double.MAX_VALUE;
+        minmax[1] = Double.MIN_VALUE;
+
+        int length = values.length;
+        for (int i = 0; i < length; i++) {
+            minmax[0] = values[i] < minmax[0] ? values[i] : minmax[0];
+            minmax[1] = values[i] > minmax[1] ? values[i] : minmax[1];
+        }
+
+        this.minmax = minmax;
+
+        return minmax;
+    }
+
+
+    /**
+     * Turn a Double[] into a double[].
+     *
+     * @param array Doube[]
+     *
+     * @return double[]
+     */
+    protected double[] toDouble(Double[] array) {
+        int length      = array.length;
+        double[] values = new double[length];
+
+        for(int i = 0; i < length; i++) {
+            values[i] = array[i].doubleValue();
+        }
+
+        return values;
+    }
+
+
+    /**
+     * Method to retrieve the number of bins.
+     *
+     * @return the number of bins that is specified in <i>requestParameter</i>
+     * or -1 if the number of bins is not the dominant value to calculate the
+     * width of a single bin.
+     */
+    protected int getBinCount() {
+        // Return -1 to trigger a calculation of the number of bins in
+        // AdvancedHistogramDataset if the user chose the bin width as dominant
+        // value.
+        String choice = (String) requestParameter.get(REQUEST_KEY_BIN_CHOICE);
+        if (choice != null && choice.equalsIgnoreCase(REQUEST_KEY_BIN_WIDTH)) {
+            return -1;
+        }
+
+        int    bins  = -1;
+        String param = (String) requestParameter.get(REQUEST_KEY_BIN_COUNT);
+
+        try {
+            bins = Integer.parseInt(param);
+            bins = bins <= 0 ? DEFAULT_BINS : bins;
+            bins = bins >  MAXIMAL_BINS ? MAXIMAL_BINS : bins;
+
+            return bins;
+        }
+        catch (NumberFormatException nfe) {
+            logger.warn("Invalid number of bins for histogram chart: " + param);
+            logger.warn("Return default bins: " + DEFAULT_BINS);
+
+            return DEFAULT_BINS;
+        }
+    }
+
+
+    /**
+     * Serves width of a single bin.
+     *
+     * @param values All values in this histogram
+     *
+     * @return The bin width that is given in <i>requestParameter</i> or -1 if
+     * the bin width is not the dominant value for calculating the number of
+     * bins in the histogram.
+     */
+    protected double getBinWidth(double[] values) {
+        // Return -1 to trigger a calculation of the bin width in
+        // AdvancedHistogramDataset if the user chose the number of bins as
+        // dominant value.
+        String choice = (String) requestParameter.get(REQUEST_KEY_BIN_CHOICE);
+        if (choice == null || !choice.equalsIgnoreCase(REQUEST_KEY_BIN_WIDTH)) {
+            return -1;
+        }
+
+        int    bins  = -1;
+        String param = (String) requestParameter.get(REQUEST_KEY_BIN_WIDTH);
+
+        double[] minmax     = getMinMax(values);
+        double   totalWidth = minmax[1] - minmax[0];
+        double   binWidth   = Double.parseDouble(param);
+
+        double tmpBins = totalWidth / binWidth;
+
+        bins = (int) Math.round(tmpBins);
+        bins = bins <= 0 ? DEFAULT_BINS : bins;
+
+        // the calculated number of bins with the given width exceed the maximum
+        // number of bins.
+        if (bins > MAXIMAL_BINS) {
+            return totalWidth / (MAXIMAL_BINS);
+        }
+
+        return binWidth;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalCrossProfileChart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,24 +1,53 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.chart;
 
+import de.intevation.gnv.geobackend.base.Result;
+
 import java.util.Collection;
 import java.util.Locale;
 
-import de.intevation.gnv.chart.ChartLabels;
-import de.intevation.gnv.geobackend.base.Result;
-
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.ChartTheme;
+
 import org.jfree.data.general.Series;
 
 /**
- * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
+ * Implementation to create a special type of horizontal profile charts.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class HorizontalCrossProfileChart
 extends      HorizontalProfileChart
 {
+    /**
+     * Logger used for logging with log4j.
+     */
     private static Logger log = Logger.getLogger(HorizontalCrossProfileChart.class);
 
+    /**
+     * Constructor to create HorizontalCrossProfileChart objects.
+     *
+     * @param labels Labels used to be displayed in title, subtitle and so on.
+     * @param theme ChartTheme used to adjust the rendering of this chart.
+     * @param parameters Collection containing a bunch of parameters.
+     * @param measurements Collection containing a bunch of measurements.
+     * @param dates Collection containing a bunch of date objects.
+     * @param result Collection containing a bunch of <code>Result</code>
+     * objects which contain the actual data items to be displayed.
+     * @param timeGaps Collection with timegap definitions.
+     * @param locale Locale used to specify the format of labels, numbers, ...
+     * @param linesVisible Render lines between data points if true, otherwise
+     * not.
+     * @param shapesVisible Render vertices as points if true, otherwise not.
+     */
     public HorizontalCrossProfileChart(
         ChartLabels labels,
         ChartTheme  theme,
@@ -46,6 +75,13 @@
     }
 
 
+    /**
+     * Method for gap detection. Nothing is done here, because in this type of
+     * chart no gap detection takes place.
+     *
+     * @see de.intevation.gnv.chart.HorizontalProfileChart#gapDetection(Result[],
+     * Series, int, int)
+     */
     @Override
     protected void gapDetection(
         Result[] results,
@@ -53,10 +89,7 @@
         int      startPos,
         int      endPos
     ) {
-        log.warn(
-            "No gap detection for horizontalcrossprofile charts " + 
-            "implemented yet."
-        );
+        // nothing to do here, gap detection is done in interpolation
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,36 +1,86 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.chart;
 
+import com.vividsolutions.jts.geom.Point;
+
+import com.vividsolutions.jts.io.ParseException;
+import com.vividsolutions.jts.io.WKTReader;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.utils.DistanceCalculator;
+
 import java.util.Collection;
 import java.util.Locale;
-
-import com.vividsolutions.jts.geom.Point;
-import com.vividsolutions.jts.io.WKTReader;
-import com.vividsolutions.jts.io.ParseException;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.ChartTheme;
+
+import org.jfree.chart.axis.Axis;
+import org.jfree.chart.axis.AxisLocation;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.NumberTickUnit;
+
 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.XYSeries;
 
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.utils.DistanceCalculator;
-
-
 /**
- * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
+ * This class is used to create xy-charts of horizontal profiles.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class HorizontalProfileChart
 extends      VerticalProfileChart
 {
+    /**
+     * Logger used for logging with log4j.
+     */
     private static Logger log = Logger.getLogger(HorizontalProfileChart.class);
 
+    /**
+     * <code>WKTReader</code> used to turn wkt strings into geometries.
+     */
     private static WKTReader wktReader = new WKTReader();
-    private        Point     lastPoint;
-    private        double    distance;
 
+    /**
+     * The first point in a HorizontalProfileChart. It is used to calculate the
+     * distance between the currently processed point an the start.
+     */
+    protected Point lastPoint;
 
+    protected double distance = 0d;
+
+    /**
+     * Constructor used to create horizontal profile charts.
+     *
+     * @param labels Labels used to be displayed in title, subtitle and so on.
+     * @param theme ChartTheme used to adjust the rendering of this chart.
+     * @param parameters Collection containing a bunch of parameters.
+     * @param measurements Collection containing a bunch of measurements.
+     * @param dates Collection containing a bunch of date objects.
+     * @param result Collection containing a bunch of <code>Result</code>
+     * objects which contain the actual data items to be displayed.
+     * @param timeGaps Collection with timegap definitions.
+     * @param locale Locale used to specify the format of labels, numbers, ...
+     * @param linesVisible Render lines between data points if true, otherwise
+     * not.
+     * @param shapesVisible Render vertices as points if true, otherwise not.
+     */
     public HorizontalProfileChart(
         ChartLabels labels,
         ChartTheme  theme,
@@ -56,10 +106,22 @@
             shapesVisible
         );
         this.PLOT_ORIENTATION = PlotOrientation.VERTICAL;
-        this.distance         = 0;
     }
 
 
+    @Override
+    protected Object getValue(Result row) {
+        try {
+            return (Point) wktReader.read(row.getString("SHAPE"));
+        }
+        catch(ParseException pe) {
+            log.warn("No data found while parsing.");
+            return null;
+        }
+    }
+
+
+    @Override
     protected void gapDetection(
         Result[] results,
         Series   series,
@@ -93,19 +155,22 @@
     }
 
 
+    @Override
     protected void addValue(Result row, Series series) {
         try {
             Point point = (Point) wktReader.read(row.getString("SHAPE"));
-            if (lastPoint != null)
-                distance = distance + DistanceCalculator.calculateDistance(
+            if (lastPoint != null) {
+                distance += DistanceCalculator.calculateDistance(
                     lastPoint, point
                 );
-            lastPoint = point;
+            }
 
             ((XYSeries) series).add(
                 distance,
                 row.getDouble("YORDINATE")
             );
+
+            lastPoint = point;
         }
         catch(ParseException pe) {
             log.warn("No data found while parsing.");
@@ -113,15 +178,84 @@
     }
 
 
+    @Override
     protected void addSeries(Series series, String label, int idx) {
         super.addSeries(series, label, idx);
 
-        // reset values used by current series for next series
+        // reset lastPoint and distance of the last series
         lastPoint = null;
         distance  = 0;
     }
 
 
+    @Override
+    protected void prepareAxis(String seriesKey,int idx) {
+        log.debug("prepare axis of xychart");
+
+        XYPlot plot      = chart.getXYPlot();
+        Axis xAxis       = plot.getDomainAxis();
+        NumberAxis yAxis = new NumberAxis(seriesKey);
+
+        localizeDomainAxis(xAxis, locale);
+        localizeRangeAxis(yAxis, locale);
+
+        // litte workarround to adjust the max range of axes.
+        // NumberAxis.setAutoRange(true) doesn't seem to work properly.
+        Range yRange = (Range) ranges.get(seriesKey);
+        double lo    = yRange.getLowerBound();
+        double hi    = yRange.getUpperBound();
+
+        // XXX Special case: only a single value in this chart.
+        // JFreeChart doesn't expand this range, because its length is 0.
+        if (lo == hi) {
+            yRange = new Range(
+                lo - (lo / 100 * LOWER_MARGIN),
+                hi + (hi / 100 * UPPER_MARGIN));
+        }
+        else {
+            yRange = Range.expand(yRange, LOWER_MARGIN, UPPER_MARGIN);
+        }
+
+        yAxis.setRange(yRange);
+        log.debug("Max Range of dataset is: " + yRange.toString());
+
+        if (seriesKey.contains("richtung")) {
+            yAxis.setTickUnit(new NumberTickUnit(30.0));
+            yAxis.setUpperBound(360.0);
+            yAxis.setLowerBound(0.0);
+        }
+        else {
+            yAxis.setFixedDimension(10.0);
+            yAxis.setAutoRangeIncludesZero(false);
+        }
+
+        plot.setRangeAxis(idx, yAxis);
+        yAxis.configure();
+
+        if (idx % 2 != 0)
+            plot.setRangeAxisLocation(idx, AxisLocation.BOTTOM_OR_RIGHT);
+        else
+            plot.setRangeAxisLocation(idx, AxisLocation.BOTTOM_OR_LEFT);
+
+        plot.mapDatasetToRangeAxis(idx, idx);
+    }
+
+
+    @Override
+    protected void prepareRangeAxis(String seriesKey, int idx) {
+        return;
+        // do nothing here
+    }
+
+
+    @Override
+    protected void storeMaxValue(Map values, Object value, String parameter) {
+        return;
+        // do nothing here
+    }
+
+
+    @Override
     protected String createSeriesName(
         String breakPoint1,
         String breakPoint2,
@@ -137,6 +271,7 @@
     }
 
 
+    @Override
     protected void addGapsOnGrid(
         Result[] results,
         Series   series,
@@ -148,36 +283,41 @@
             results[startPos+1]
         );
 
-        double range        = 0;
-        double distance     = 0;
         int    last         = 0;
         int    current      = 0;
         Point  lastPoint    = null;
         Point  currentPoint = null;
 
+        double distance    = 0;
+        double distanceOld = 0;
         for (int i = startPos+1; i < endPos; i++) {
             try {
                 last         = results[i-1].getInteger(axis);
                 lastPoint    = getPoint(results[i-1]);
                 current      = results[i].getInteger(axis);
                 currentPoint = getPoint(results[i]);
-                distance     = DistanceCalculator.calculateDistance(
+
+                distanceOld  = distance;
+                distance    += DistanceCalculator.calculateDistance(
                     lastPoint,
-                    currentPoint
-                );
+                    currentPoint);
 
                 boolean detected = gridDetection(last, current);
 
-                if (detected) {
-                    log.debug(
-                        "Gap detected on grid between " + range +
-                        " and " + (range+distance)
-                    );
-
-                    ((XYSeries) series).add(range+0.0001, null);
+                if (log.isDebugEnabled()) {
+                    log.debug("Last point: " + lastPoint.toString());
+                    log.debug("Current point: " + currentPoint.toString());
+                    log.debug("Current distance from start: " + distance);
                 }
 
-                range += distance;
+                if (detected) {
+                    log.info(
+                        "Gap detected on grid between " + distanceOld +
+                        " and " + distance);
+
+                    ((XYSeries) series).add(distance-1d, null);
+                    ((XYSeries) series).add(distanceOld+1d, null);
+                }
             }
             catch (ParseException pe) {
                 log.warn("Error while parsing point for gap detection.", pe);
@@ -186,6 +326,17 @@
     }
 
 
+    /**
+     * Method to add gaps between two data points. The real detection is done by
+     * {@link #simpleDetection} and {@link #specialDetection}.
+     *
+     * @param results All data points in this dataset.
+     * @param series Series to be processed.
+     * @param startValue <code>Point</code> where the scan for gaps should begin.
+     * @param endValue <code>Point</code> where the scan should end.
+     * @param startPos Start position of this series in <code>results</code>.
+     * @param endPos End position of a series in <code>results</code>
+     */
     protected void addGaps(
         Result[] results,
         Series   series,
@@ -236,6 +387,21 @@
     }
 
 
+    /**
+     * Simple method to detect gaps. A gap is detected if the delta between two
+     * data points (current, last) is bigger than <code>PERCENTAGE</code> percent
+     * of delta of start and end.
+     * <br>
+     * (smallDelta &gt; delta / 100 * PERCENTAGE)
+     *
+     * @param start First data point in a series
+     * @param end Last data point in a series
+     * @param last Left point
+     * @param current Right point
+     *
+     * @return true, if a gap is detected between last and current - otherwise
+     * false.
+     */
     protected boolean simpleDetection(
         Point start,
         Point end,
@@ -249,6 +415,22 @@
     }
 
 
+    /**
+     * Method to detect gaps between two data points. Following formula is used
+     * for detection:<br>
+     * smallDelta &gt; (3.0 / (count - 1) * delta)<br>
+     * smallDelta = distance between <code>current</code> and <code>last</code>
+     * <br>
+     * delta = distance between <code>start</code> and <code>end</code>
+     *
+     * @param start First data point in a series
+     * @param end Last data point in a series
+     * @param last Left point
+     * @param current Right point
+     * @param count Number of datapoints
+     * @return true, if a gap is detected between last and current - otherwise
+     * false.
+     */
     protected boolean specialDetection(
         Point start,
         Point end,
@@ -266,6 +448,7 @@
         return (smallDelta > (3.0 / (count - 1) * delta));
     }
 
+
     @Override
     protected String getDependendAxisName(Result first, Result second) {
         if (first.getInteger("IPOSITION") == second.getInteger("IPOSITION"))
@@ -274,6 +457,15 @@
         return "IPOSITION";
     }
 
+    /**
+     * This method returns a point from a given wkt string stored in
+     * <code>result</code>.
+     *
+     * @param result <code>Result</code> object which contains the wkt string.
+     * The wkt string needs to be available under the key SHAPE.
+     *
+     * @return Point representation of wkt string.
+     */
     private Point getPoint(Result result)
     throws ParseException
     {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileVectorChart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.chart;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.ChartTheme;
+
+import org.jfree.chart.plot.XYPlot;
+
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+
+/**
+ * This class is used to create xy charts of vertical profiles.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class HorizontalProfileVectorChart
+extends      HorizontalProfileChart
+{
+    private static Logger logger =
+        Logger.getLogger(HorizontalProfileVectorChart.class);
+
+
+    public HorizontalProfileVectorChart(
+        ChartLabels labels,
+        ChartTheme  theme,
+        Collection  parameters,
+        Collection  measurements,
+        Collection  dates,
+        Collection  result,
+        Collection  timeGaps,
+        Locale      locale,
+        boolean     linesVisible,
+        boolean     shapesVisible
+    ) {
+        super(labels, theme, parameters, measurements, dates, result,
+              timeGaps, locale, linesVisible, shapesVisible);
+    }
+
+
+    @Override
+    protected void initData() {
+        Iterator iter         = resultSet.iterator();
+        Result     row        = null;
+        String     seriesName = null;
+        XYSeries   series     = null;
+
+        int  idx       = 0;
+        int  startPos  = 0;
+        int  endPos    = 0;
+
+        double startValue = 0;
+        double endValue   = 0;
+
+        ResultDescriptor rd = null;
+        int idxSeries       = -1;
+        int idxX            = -1;
+        int idxY            = -1;
+
+        Result[] results =
+            (Result[]) resultSet.toArray(new Result[resultSet.size()]);
+
+        while (iter.hasNext()) {
+            row = (Result) iter.next();
+
+            if (rd == null) {
+                rd        = row.getResultDescriptor();
+                idxSeries = rd.getColumnIndex("SERIES");
+                idxX      = rd.getColumnIndex("XORDINATE");
+                idxY      = rd.getColumnIndex("YORDINATE");
+            }
+
+            if (!row.getString(idxSeries).equals(seriesName)) {
+                logger.debug("prepare data/plot for next dataset.");
+
+                if (series != null) {
+                    gapDetection(results, series, startPos, endPos);
+                    addSeries(series, seriesName, idx);
+
+                    startPos = endPos + 1;
+                }
+
+                seriesName = row.getString(idxSeries);
+
+                logger.debug("next data is '" + seriesName + "'");
+                series = new XYSeries(seriesName);
+            }
+
+            addValue(row, series);
+            Object x = getValue(row);
+            Double y = row.getDouble(idxY);
+            if (x != null && y != null) {
+                storeMaxRange(ranges, y, seriesName);
+                storeMaxValue(values, x, seriesName);
+            }
+
+            endPos++;
+        }
+
+        if (results.length == 0)
+            return;
+
+        gapDetection(results, series, startPos, endPos);
+        addSeries(series, seriesName, idx);
+
+        addDatasets();
+    }
+
+
+    @Override
+    protected void addDatasets() {
+        XYPlot     plot = chart.getXYPlot();
+        int        idx  = 0;
+
+        XYSeriesCollection sc  = null;
+        Iterator           iter = datasets.keySet().iterator();
+
+        while (iter.hasNext()) {
+            String key = (String) iter.next();
+            sc  = (XYSeriesCollection)datasets.get(key);
+            plot.setDataset(idx, sc );
+            logger.debug("Added " + key + " parameter to plot.");
+            prepareAxis(key, idx);
+            adjustRenderer(
+                idx++,
+                sc.getSeriesCount(),
+                linesVisible,
+                shapesVisible
+            );
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/Insets.java	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
- * All rights reserved
- *
- * $Id: Insets.java,v 1.1 2007/12/10 13:57:13 drewnak Exp $
- *
- * created by:      drewnak
- * created at :     10.12.2007
- * created at :     13:31:12
- *
- * modified by:     $Author: drewnak $
- * modified at:     $Date: 2007/12/10 13:57:13 $
- */
-package de.intevation.gnv.chart;
-
-public class Insets {
-    public double mUpper;
-    public double mLower;
-    public double mLeft;
-    public double mRight;
-
-    /**
-     * @param pUpper
-     * @param pLower
-     * @param pLeft
-     * @param pRight
-     */
-    public Insets(double pUpper, double pLeft, double pLower, double pRight) {
-        super();
-        mUpper = pUpper;
-        mLower = pLower;
-        mLeft = pLeft;
-        mRight = pRight;
-    }
-}
\ No newline at end of file
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesChart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,48 +1,108 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.chart;
 
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+
+import de.intevation.gnv.timeseries.gap.TimeGap;
+
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
+
 import java.util.Collection;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
+import java.util.TimeZone;
 
 import org.apache.log4j.Logger;
 
+import org.jfree.chart.ChartFactory;
 import org.jfree.chart.ChartTheme;
-import org.jfree.chart.ChartFactory;
+
 import org.jfree.chart.axis.Axis;
 import org.jfree.chart.axis.DateAxis;
-import org.jfree.chart.plot.XYPlot;
+import org.jfree.chart.axis.DateTickUnit;
+import org.jfree.chart.axis.DateTickUnitType;
+import org.jfree.chart.axis.TickUnitSource;
+import org.jfree.chart.axis.TickUnits;
+import org.jfree.chart.axis.ValueAxis;
+
 import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.plot.XYPlot;
+
 import org.jfree.data.general.Series;
+
+import org.jfree.data.time.Minute;
 import org.jfree.data.time.TimeSeries;
-import org.jfree.data.time.Minute;
 import org.jfree.data.time.TimeSeriesCollection;
 
-import de.intevation.gnv.artifacts.ressource.RessourceFactory;
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.describedata.KeyValueDescibeData;
-import de.intevation.gnv.timeseries.gap.TimeGap;
-
-
 /**
- * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
+ * This class is used to create timeseries charts. The domain axis contains
+ * multiple date/time objects.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class TimeSeriesChart
 extends      AbstractXYLineChart
 {
 
-    private static final String DATE_FORMAT = "chart.timeseries.date.format";
-
+    /**
+     * Constant format which can be useful to format date items. Value is
+     * {@value}.
+     */
     public static final String DEFAULT_DATE_FORMAT = "dd-MMM-yyyy";
 
-    private static final long   NO_TIME_GAP = Long.MAX_VALUE - 1000;
+    /**
+     * Constant field used if no gap detection should be done here. This field
+     * is used in @see #getTimeGapValue. Value is {@value}.
+     */
+    public static final long   NO_TIME_GAP = Long.MAX_VALUE - 1000;
 
+    /**
+     * Percentage used for gap detection. Its value is {@value}.
+     */
+    public static int    GAP_SIZE    = 5; // in percent
+
+    /**
+     * Logger used for logging with log4j.
+     */
     private static Logger log = Logger.getLogger(TimeSeriesChart.class);
 
+    static {
+        /* The percentage defining the width of a gap should be configured in
+         * conf.xml instead of being configured in a system property */
+        GAP_SIZE = Integer.getInteger("chart.gap.percentage", GAP_SIZE);
+    }
 
+
+    /**
+     * Constructor used to create <code>TimeSeries</code> charts.
+     *
+     * @param labels Labels used to be displayed in title, subtitle and so on.
+     * @param theme ChartTheme used to adjust the rendering of this chart.
+     * @param parameters Collection containing a bunch of parameters.
+     * @param measurements Collection containing a bunch of measurements.
+     * @param dates Collection containing a bunch of date objects.
+     * @param result Collection containing a bunch of <code>Result</code>
+     * objects which contain the actual data items to be displayed.
+     * @param timeGaps Collection with timegap definitions.
+     * @param locale Locale used to specify the format of labels, numbers, ...
+     * @param linesVisible Render lines between data points if true, otherwise
+     * not.
+     * @param shapesVisible Render vertices as points if true, otherwise not.
+     */
     public TimeSeriesChart(
         ChartLabels labels,
         ChartTheme  theme,
@@ -71,6 +131,10 @@
     }
 
 
+    /**
+     * see de.intevation.gnv.chart.AbstractXYLineChart#initChart()
+     */
+    @Override
     protected void initChart() {
         chart = ChartFactory.createTimeSeriesChart(
             labels.getTitle(),
@@ -81,9 +145,16 @@
             false,
             false
         );
+
+        XYPlot plot = (XYPlot) chart.getPlot();
+        plot.setDomainAxis(0, new DateAxis(
+            labels.getDomainAxisLabel(), TimeZone.getDefault(), locale));
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#initData()
+     */
     protected void initData() {
         log.debug("init data for timeseries chart");
 
@@ -143,20 +214,25 @@
             }
 
             addValue(row, series);
-            storeMaxRange(row.getDouble("YORDINATE"), parameter);
+            storeMaxRange(ranges, row.getDouble("YORDINATE"), parameter);
             endPos++;
         }
 
-        // add the last dataset if existing to plot and prepare its axis
-        startDate = results[startPos].getDate("XORDINATE");
-        endDate = results[endPos-1].getDate("XORDINATE");
-        addGaps(results, series, startDate, endDate, startPos, endPos);
-        addSeries(series, parameter, idx);
+        if (startPos < results.length && endPos-1 < results.length) {
+            // add the last dataset if existing to plot and prepare its axis
+            startDate = results[startPos].getDate("XORDINATE");
+            endDate = results[endPos-1].getDate("XORDINATE");
+            addGaps(results, series, startDate, endDate, startPos, endPos);
+            addSeries(series, parameter, idx);
+        }
 
         addDatasets();
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#addValue(Result, Series)
+     */
     protected void addValue(Result row, Series series) {
         ((TimeSeries) series).addOrUpdate(
             new Minute(row.getDate("XORDINATE")),
@@ -165,6 +241,11 @@
     }
 
 
+    /**
+     * @param parameter
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#addSeries(Series,
+     * String, int)
+     */
     protected void addSeries(Series series, String parameter, int idx) {
         log.debug("add series (" + parameter + ")to timeseries chart");
 
@@ -185,6 +266,10 @@
     }
 
 
+    /**
+     * Method to add processed datasets to plot. Each dataset is adjusted using
+     * <code>prepareAxis</code> and <code>adjustRenderer</code> methods.
+     */
     protected void addDatasets() {
         Iterator   iter = parameters.iterator();
         XYPlot     plot = chart.getXYPlot();
@@ -213,26 +298,173 @@
     }
 
 
+    /**
+     * @param locale
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#localizeDomainAxis(Axis,
+     * Locale)
+     */
     protected void localizeDomainAxis(Axis axis, Locale locale) {
-        if (locale == null)
-            return;
-
-        log.debug(
-            "Set language of axis [" + axis.getLabel() + "] " +
-            "to " + locale.toString()
-        );
-
-        String dateFormat = getMessage(locale, DATE_FORMAT,DEFAULT_DATE_FORMAT);
-        DateFormat format = new SimpleDateFormat(dateFormat, locale);
-        ((DateAxis) axis).setDateFormatOverride(format);
+        ((ValueAxis)axis).setStandardTickUnits(createStandardDateTickUnits(
+            TimeZone.getDefault(),
+            locale));
     }
 
 
+    /**
+     * @param zone
+     * @param locale
+     * @return TickUnitSource
+     * @see org.jfree.chart.axis.DateAxis#createStandardDateTickUnits(TimeZone,
+     * Locale)
+     */
+    public static TickUnitSource createStandardDateTickUnits(
+        TimeZone zone,
+        Locale locale)
+    {
+        /*
+         * This method have been copied from JFreeChart's DateAxis class.
+         * DateFormat objects are hard coded in DateAxis and cannot be adjusted.
+         */
+        if (zone == null) {
+            throw new IllegalArgumentException("Null 'zone' argument.");
+        }
+        if (locale == null) {
+            throw new IllegalArgumentException("Null 'locale' argument.");
+        }
+        TickUnits units = new TickUnits();
+
+        // date formatters
+        DateFormat f1 = new SimpleDateFormat("HH:mm:ss.SSS", locale);
+        DateFormat f2 = new SimpleDateFormat("HH:mm:ss", locale);
+        DateFormat f3 = new SimpleDateFormat("HH:mm", locale);
+        DateFormat f4 = new SimpleDateFormat("d-MMM, HH:mm", locale);
+        DateFormat f5 = new SimpleDateFormat("d-MMM yyyy", locale);
+        DateFormat f6 = new SimpleDateFormat("MMM-yyyy", locale);
+        DateFormat f7 = new SimpleDateFormat("yyyy", locale);
+
+        f1.setTimeZone(zone);
+        f2.setTimeZone(zone);
+        f3.setTimeZone(zone);
+        f4.setTimeZone(zone);
+        f5.setTimeZone(zone);
+        f6.setTimeZone(zone);
+        f7.setTimeZone(zone);
+
+        // milliseconds
+        units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 1, f1));
+        units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 5,
+                DateTickUnitType.MILLISECOND, 1, f1));
+        units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 10,
+                DateTickUnitType.MILLISECOND, 1, f1));
+        units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 25,
+                DateTickUnitType.MILLISECOND, 5, f1));
+        units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 50,
+                DateTickUnitType.MILLISECOND, 10, f1));
+        units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 100,
+                DateTickUnitType.MILLISECOND, 10, f1));
+        units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 250,
+                DateTickUnitType.MILLISECOND, 10, f1));
+        units.add(new DateTickUnit(DateTickUnitType.MILLISECOND, 500,
+                DateTickUnitType.MILLISECOND, 50, f1));
+
+        // seconds
+        units.add(new DateTickUnit(DateTickUnitType.SECOND, 1,
+                DateTickUnitType.MILLISECOND, 50, f2));
+        units.add(new DateTickUnit(DateTickUnitType.SECOND, 5,
+                DateTickUnitType.SECOND, 1, f2));
+        units.add(new DateTickUnit(DateTickUnitType.SECOND, 10,
+                DateTickUnitType.SECOND, 1, f2));
+        units.add(new DateTickUnit(DateTickUnitType.SECOND, 30,
+                DateTickUnitType.SECOND, 5, f2));
+
+        // minutes
+        units.add(new DateTickUnit(DateTickUnitType.MINUTE, 1,
+                DateTickUnitType.SECOND, 5, f3));
+        units.add(new DateTickUnit(DateTickUnitType.MINUTE, 2,
+                DateTickUnitType.SECOND, 10, f3));
+        units.add(new DateTickUnit(DateTickUnitType.MINUTE, 5,
+                DateTickUnitType.MINUTE, 1, f3));
+        units.add(new DateTickUnit(DateTickUnitType.MINUTE, 10,
+                DateTickUnitType.MINUTE, 1, f3));
+        units.add(new DateTickUnit(DateTickUnitType.MINUTE, 15,
+                DateTickUnitType.MINUTE, 5, f3));
+        units.add(new DateTickUnit(DateTickUnitType.MINUTE, 20,
+                DateTickUnitType.MINUTE, 5, f3));
+        units.add(new DateTickUnit(DateTickUnitType.MINUTE, 30,
+                DateTickUnitType.MINUTE, 5, f3));
+
+        // hours
+        units.add(new DateTickUnit(DateTickUnitType.HOUR, 1,
+                DateTickUnitType.MINUTE, 5, f3));
+        units.add(new DateTickUnit(DateTickUnitType.HOUR, 2,
+                DateTickUnitType.MINUTE, 10, f3));
+        units.add(new DateTickUnit(DateTickUnitType.HOUR, 4,
+                DateTickUnitType.MINUTE, 30, f3));
+        units.add(new DateTickUnit(DateTickUnitType.HOUR, 6,
+                DateTickUnitType.HOUR, 1, f3));
+        units.add(new DateTickUnit(DateTickUnitType.HOUR, 12,
+                DateTickUnitType.HOUR, 1, f4));
+
+        // days
+        units.add(new DateTickUnit(DateTickUnitType.DAY, 1,
+                DateTickUnitType.HOUR, 1, f5));
+        units.add(new DateTickUnit(DateTickUnitType.DAY, 2,
+                DateTickUnitType.HOUR, 1, f5));
+        units.add(new DateTickUnit(DateTickUnitType.DAY, 7,
+                DateTickUnitType.DAY, 1, f5));
+        units.add(new DateTickUnit(DateTickUnitType.DAY, 15,
+                DateTickUnitType.DAY, 1, f5));
+
+        // months
+        units.add(new DateTickUnit(DateTickUnitType.MONTH, 1,
+                DateTickUnitType.DAY, 1, f6));
+        units.add(new DateTickUnit(DateTickUnitType.MONTH, 2,
+                DateTickUnitType.DAY, 1, f6));
+        units.add(new DateTickUnit(DateTickUnitType.MONTH, 3,
+                DateTickUnitType.MONTH, 1, f6));
+        units.add(new DateTickUnit(DateTickUnitType.MONTH, 4,
+                DateTickUnitType.MONTH, 1, f6));
+        units.add(new DateTickUnit(DateTickUnitType.MONTH, 6,
+                DateTickUnitType.MONTH, 1, f6));
+
+        // years
+        units.add(new DateTickUnit(DateTickUnitType.YEAR, 1,
+                DateTickUnitType.MONTH, 1, f7));
+        units.add(new DateTickUnit(DateTickUnitType.YEAR, 2,
+                DateTickUnitType.MONTH, 3, f7));
+        units.add(new DateTickUnit(DateTickUnitType.YEAR, 5,
+                DateTickUnitType.YEAR, 1, f7));
+        units.add(new DateTickUnit(DateTickUnitType.YEAR, 10,
+                DateTickUnitType.YEAR, 1, f7));
+        units.add(new DateTickUnit(DateTickUnitType.YEAR, 25,
+                DateTickUnitType.YEAR, 5, f7));
+        units.add(new DateTickUnit(DateTickUnitType.YEAR, 50,
+                DateTickUnitType.YEAR, 10, f7));
+        units.add(new DateTickUnit(DateTickUnitType.YEAR, 100,
+                DateTickUnitType.YEAR, 20, f7));
+
+        return units;
+    }
+
+
+    /**
+     * Method to get a message from resource bundle.
+     *
+     * @param locale Locale used to specify the resource bundle.
+     * @param key Key to specify the required message.
+     * @param def Default string if resource is not existing.
+     *
+     * @return Message
+     */
     protected String getMessage(Locale locale, String key, String def) {
         return RessourceFactory.getInstance().getRessource(locale, key, def);
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#createSeriesName(String,
+     * String, String)
+     */
     protected String createSeriesName(
         String breakPoint1,
         String breakPoint2,
@@ -246,6 +478,17 @@
     }
 
 
+    /**
+     * Method to add gaps between two data points. The max valid space between
+     * two data points is calculated by <code>calculateGapSize</code>.
+     *
+     * @param results All data points in this dataset.
+     * @param series Series to be processed.
+     * @param startDate Date item where the scan for gaps should begin.
+     * @param endDate Date item where the scan should end.
+     * @param startPos Start position of this series in <code>results</code>.
+     * @param endPos End position of a series in <code>results</code>
+     */
     protected void addGaps(
         Result[] results,
         Series   series,
@@ -259,6 +502,20 @@
             startDate, endDate, startPos, endPos, gapID
         );
 
+        if (log.isDebugEnabled()) {
+            log.debug("*****************************************************");
+            log.debug("Values of gap detection.");
+            log.debug("Start date: " + startDate.toString());
+            log.debug("End date: " + endDate.toString());
+            long diff = endDate.getTime() - startDate.getTime();
+            log.debug("Time difference (in ms): " + diff);
+            log.debug("Time difference (in h): " + (diff/(1000*60*60)));
+            log.debug("Configured gap size (in %): " + GAP_SIZE);
+            log.debug("Calculated gap size (in ms): " + maxDiff);
+            log.debug("Calculated gap size (in h): " + (maxDiff/(1000*60*60)));
+            log.debug("*****************************************************");
+        }
+
         Date last = startDate;
         for (int i = startPos+1; i < endPos; i++) {
             Result res = results[i];
@@ -279,6 +536,19 @@
     }
 
 
+    /**
+     * Method to calculate the max space between two data points.
+     *
+     * @param start First date
+     * @param end Last date
+     * @param startPos Start position of the current series in the collection
+     * containing the bunch of series.
+     * @param endPos End position of the current series in the collection
+     * containing the bunch of series.
+     * @param gapID Gap id used to specify the time intervals.
+     *
+     * @return Min size of a gap.
+     */
     protected long calculateGapSize(
         Date start,
         Date end,
@@ -286,7 +556,7 @@
         int  endPos,
         int  gapID
     ){
-        long maxGap   = (end.getTime() - start.getTime()) / 20;
+        long maxGap   = (end.getTime() - start.getTime()) / 100 * GAP_SIZE;
         long interval = getTimeGapValue(start, end, startPos, endPos, gapID);
 
         if (maxGap < interval)
@@ -296,6 +566,19 @@
     }
 
 
+    /**
+     * Determine the interval size between two data points.
+     *
+     * @param dStart Start date
+     * @param dEnd End date
+     * @param pStart Index of start point in series used to specify the total
+     * amount of date items.
+     * @param pEnd Index of end point in series used to specify the total amount
+     * of date items.
+     * @param gapID Gap id used to determine gaps configured in a xml document.
+     *
+     * @return Interval size between two data points.
+     */
     protected long getTimeGapValue(
         Date dStart,
         Date dEnd,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/TimeSeriesVectorChart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.chart;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Locale;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.ChartTheme;
+import org.jfree.chart.plot.XYPlot;
+
+import org.jfree.data.time.Minute;
+import org.jfree.data.time.TimeSeries;
+import org.jfree.data.time.TimeSeriesCollection;
+
+
+/**
+ * This class is used to create timeseries charts that contain components of a
+ * vector parameter. The domain axis contains multiple date/time objects.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class TimeSeriesVectorChart extends TimeSeriesChart {
+
+    private static Logger logger =Logger.getLogger(TimeSeriesVectorChart.class);
+
+    public TimeSeriesVectorChart(
+        ChartLabels labels,
+        ChartTheme  theme,
+        Collection  parameters,
+        Collection  measurements,
+        Collection  dates,
+        Collection  result,
+        Collection  timeGaps,
+        Locale      locale,
+        boolean     linesVisible,
+        boolean     shapesVisible
+    ) {
+        super(labels, theme, parameters, measurements, dates, result,
+              timeGaps, locale, linesVisible, shapesVisible);
+    }
+
+
+    @Override
+    protected void initData() {
+        logger.debug("init data for timeseries vector chart");
+
+        Iterator   iter       = resultSet.iterator();
+        Result     row        = null;
+        String     seriesName = null;
+        TimeSeries series     = null;
+
+        int  idx       = 0;
+        int  startPos  = 0;
+        int  endPos    = 0;
+        Date startDate = null;
+        Date endDate   = null;
+
+        ResultDescriptor rd = null;
+        int idxSeries       = -1;
+        int idxX            = -1;
+        int idxY            = -1;
+
+        Result[] results =
+            (Result[]) resultSet.toArray(new Result[resultSet.size()]);
+
+        while (iter.hasNext()) {
+            row = (Result) iter.next();
+
+            if (rd == null) {
+                rd        = row.getResultDescriptor();
+                idxSeries = rd.getColumnIndex("SERIES");
+                idxX      = rd.getColumnIndex("XORDINATE");
+                idxY      = rd.getColumnIndex("YORDINATE");
+            }
+
+            // add current data to plot and prepare for next one
+            if (!row.getString(idxSeries).equals(seriesName)) {
+                logger.debug("prepare data/plot for next dataset");
+
+                if(series != null) {
+                    // add gaps before adding series to chart
+                    startDate = results[startPos].getDate(idxX);
+                    endDate   = results[endPos-1].getDate(idxX);
+                    addGaps(results,series,startDate,endDate,startPos,endPos);
+                    addSeries(series, seriesName, idx);
+
+                    startPos  = endPos + 1;
+                }
+
+                // prepare variables for next plot
+                seriesName = row.getString(idxSeries);
+
+                logger.debug("next dataset is '" + seriesName + "'");
+                series = new TimeSeries(seriesName, Minute.class);
+            }
+
+            addValue(row, series);
+            storeMaxRange(ranges, row.getDouble(idxY), seriesName);
+            endPos++;
+        }
+
+        if (startPos < results.length && endPos-1 < results.length) {
+            // add the last dataset if existing to plot and prepare its axis
+            startDate = results[startPos].getDate(idxX);
+            endDate = results[endPos-1].getDate(idxX);
+            addGaps(results, series, startDate, endDate, startPos, endPos);
+            addSeries(series, seriesName, idx);
+        }
+
+        addDatasets();
+    }
+
+
+    @Override
+    protected void addDatasets() {
+        XYPlot     plot = chart.getXYPlot();
+        int        idx  = 0;
+
+        TimeSeriesCollection tsc  = null;
+        Iterator             iter = datasets.keySet().iterator();
+
+        while (iter.hasNext()) {
+            String key = (String) iter.next();
+            tsc  = (TimeSeriesCollection)datasets.get(key);
+            plot.setDataset(idx, tsc );
+            logger.debug("Added " + key + " parameter to plot.");
+            prepareAxis(key, idx);
+            adjustRenderer(
+                idx++,
+                tsc.getSeriesCount(),
+                linesVisible,
+                shapesVisible
+            );
+        }
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalCrossSectionChart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,367 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.chart;
+
+import de.intevation.gnv.jfreechart.PolygonDataset;
+import de.intevation.gnv.jfreechart.PolygonPlot;
+import de.intevation.gnv.jfreechart.PolygonRenderer;
+import de.intevation.gnv.jfreechart.PolygonSeries;
+
+import de.intevation.gnv.math.AttributedXYColumns;
+
+import de.intevation.gnv.raster.Palette;
+
+import java.awt.Color;
+import java.awt.Paint;
+
+import java.text.NumberFormat;
+
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Map;
+
+import org.jfree.chart.JFreeChart;
+
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.SymbolAxis;
+import org.jfree.chart.axis.ValueAxis;
+
+import org.jfree.chart.plot.PlotOrientation;
+
+import org.jfree.chart.renderer.LookupPaintScale;
+
+import org.jfree.chart.title.PaintScaleLegend;
+import org.jfree.chart.title.TextTitle;
+
+import org.jfree.data.Range;
+
+import org.jfree.ui.RectangleEdge;
+import org.jfree.ui.RectangleInsets;
+
+/**
+ * This class represents a 2D chart containing polygon data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class VerticalCrossSectionChart
+implements   Chart
+{
+    /**
+     *  Lookup class for retrieving a color which corresponds to a specific
+     *  integer value.
+     */
+    public static final class PalettePaintLookup
+    implements PolygonRenderer.PaintLookup
+    {
+        /**
+         * Object storing information about value ranges and its coresponding
+         * colors and descriptions.
+         */
+        private Palette             palette;
+
+        /**
+         * Map containing some special <code>Paint</code> like ground fillcolor.
+         */
+        private Map<Integer, Paint> special;
+
+        /**
+         * Constructor
+         *
+         * @param palette See {@link #palette}
+         */
+        public PalettePaintLookup(Palette palette) {
+            this(palette, null);
+        }
+
+        /**
+         * Constructor
+         *
+         * @param palette See {@link #palette}
+         * @param special See {@link #special}
+         */
+        public PalettePaintLookup(
+            Palette             palette,
+            Map<Integer, Paint> special
+        ) {
+            this.palette = palette;
+            this.special = special;
+        }
+
+        /**
+         * @param index Index of a <code>Paint</code>
+         *
+         * @return <code>Paint</code> object for a given index.
+         */
+        public Paint getPaint(int index) {
+            if (special != null) {
+                Paint paint = special.get(index);
+                if (paint != null) {
+                    return paint;
+                }
+            }
+            return index < 0
+                ? Color.black
+                : palette.getColor(index);
+        }
+    } // class PalettePaintLookup
+
+    /**
+     * This class is used to turn labels which represent a number into a
+     * specific format.
+     */
+    public static class LocalizedLabelGenerator
+    extends             PolygonRenderer.DefaultLabelGenerator
+    {
+        /**
+         * <code>NumberFormat</code> which is used to turn a number into a
+         * specific format.
+         */
+        protected NumberFormat format;
+
+        /**
+         * Constructor
+         */
+        public LocalizedLabelGenerator() {
+        }
+
+        /**
+         * Constructor
+         *
+         * @param format See {@link #format}
+         */
+        public LocalizedLabelGenerator(NumberFormat format) {
+            this.format = format;
+        }
+
+        /**
+         * If label is a <code>Number</code>, it is turned into a format
+         * specified by {@link #format}.
+         *
+         * @param label Label to format.
+         *
+         * @return String representation of label.
+         */
+        @Override
+        protected String toString(Object label) {
+            return label instanceof Number
+                ? format.format(((Number)label).doubleValue())
+                : super.toString(label);
+        }
+    } // class LocalizedLabelGenerator
+
+    public static double MARGIN_TOP    = 0.05d;
+    public static double MARGIN_BOTTOM = 0.00d;
+    public static double MARGIN_LEFT   = 0.00d;
+    public static double MARGIN_RIGHT  = 0.05d;
+
+    /**
+     * JFreeChart object stored at this place after chart creation.
+     */
+    protected JFreeChart chart;
+
+    /**
+     * Stores {@link de.intevation.gnv.jfreechart.PolygonDataset} which is used
+     * to create a vertical cross chart.
+     */
+    protected AttributedXYColumns columns;
+
+    /**
+     * Map which contains colors to fill polygons draw by this chart.
+     */
+    protected Map<Integer, Paint> special;
+
+    /**
+     * Object used to map value intervals to specific colors and descriptions.
+     */
+    protected Palette             palette;
+
+    /**
+     * Locale object used for i18n support.
+     */
+    protected Locale              locale;
+
+    /**
+     * Labels for decorating the chart.
+     */
+    protected ChartLabels         labels;
+
+    /**
+     * Default Constructor
+     */
+    public VerticalCrossSectionChart() {
+    }
+
+    /**
+     * Constructor for VerticalCrossSectionChart creation.
+     *
+     * @param columns See {@link #columns}
+     * @param palette See {@link #palette}
+     * @param locale See {@link #locale}
+     * @param labels See {@link #labels}
+     */
+    public VerticalCrossSectionChart(
+        AttributedXYColumns columns,
+        Palette             palette,
+        Locale              locale,
+        ChartLabels         labels
+    ) {
+        this(columns, palette, null, locale, labels);
+    }
+
+    /**
+     * Constructor for VerticalCrossSectionChart creation.
+     *
+     * @param columns See {@link #columns}
+     * @param palette See {@link #palette}
+     * @param special See {@link #special}
+     * @param locale See {@link #locale}
+     * @param labels See {@link #labels}
+     */
+    public VerticalCrossSectionChart(
+        AttributedXYColumns columns,
+        Palette             palette,
+        Map<Integer, Paint> special,
+        Locale              locale,
+        ChartLabels         labels
+    ) {
+        this.columns = columns;
+        this.palette = palette;
+        this.special = special;
+        this.locale  = locale;
+        this.labels  = labels;
+    }
+
+    /**
+     * This method is used to create a JFreeChart from this object. A 2D plot is
+     * drawn and a legend panel is created containing each value range.
+     *
+     * @return JFreeChart object
+     */
+    protected JFreeChart createChart() {
+
+        boolean legendB  = false;
+        boolean tooltips = false;
+        boolean urls     = false;
+
+        PlotOrientation po  = PlotOrientation.HORIZONTAL;
+        PolygonDataset data = columns.getPolygonDataset();
+
+        HashSet<Integer> usedColors = new HashSet<Integer>();
+
+        for (int i = data.getSeriesCount()-1; i >= 0; --i) {
+            PolygonSeries ps = data.getSeries(i);
+            Integer fill = (Integer)ps.getAttribute("fill");
+            if (fill != null
+            && (special != null && !special.containsKey(fill))) {
+                usedColors.add(fill);
+            }
+        }
+
+        NumberFormat format = NumberFormat.getInstance(locale);
+        format.setMinimumFractionDigits(0);
+        format.setMaximumFractionDigits(2);
+
+        PolygonRenderer renderer = new PolygonRenderer(
+            new PalettePaintLookup(palette, special),
+            new LocalizedLabelGenerator(format));
+
+        ValueAxis domainAxis = new NumberAxis(this.labels.getDomainAxisLabel());
+        ValueAxis rangeAxis  = new NumberAxis(this.labels.getRangeAxisLabel());
+
+        PolygonPlot plot = new PolygonPlot(
+            data,
+            renderer,
+            domainAxis,
+            rangeAxis,
+            null);
+
+        plot.setOutlinePaint(Color.WHITE);
+
+        String [] labels = new String[usedColors.size()];
+
+        int colors = palette.getSize();
+        LookupPaintScale lookupPaint =
+            new LookupPaintScale(-0.5d, labels.length-0.5d, Color.white);
+
+        Color color = null;
+
+        for (int i = 0, j = labels.length-1; i < colors && j >= 0; i++) {
+            if (usedColors.contains(i)) {
+                Palette.Entry entry = palette.getEntryByIndex(i);
+                color     = entry.getColor();
+                labels[j] = entry.getDescription();
+                lookupPaint.add(j-0.5d, color);
+                --j;
+            }
+        }
+
+        JFreeChart chart = new JFreeChart(
+            this.labels.getTitle(),
+            JFreeChart.DEFAULT_TITLE_FONT,
+            plot,
+            legendB);
+
+        chart.removeLegend();
+        chart.addSubtitle(new TextTitle(this.labels.getSubtitle()));
+
+        SymbolAxis scale = new SymbolAxis(this.labels.getParameterName(), labels);
+        scale.setRange(-1.5d, labels.length+0.5d);
+        scale.setGridBandsVisible(false);
+        scale.setPlot(plot);
+
+        PaintScaleLegend legend = new PaintScaleLegend(
+            lookupPaint, scale);
+        legend.setMargin(new RectangleInsets(3d, 10d, 3d, 10d));
+        legend.setPosition(RectangleEdge.LEFT);
+        legend.setAxisOffset(5d);
+
+        chart.addSubtitle(legend);
+
+        // XXX Workaround, because Axes labels are cut at the
+        // left/right/top/bottom edge. The following lines add a white border
+        // between data area and plot border.
+        // see http://www.jfree.org/phpBB2/viewtopic.php?f=3&t=22177&start=0&hilit=axis+labels+cut
+        ValueAxis xAxis = plot.getDomainAxis();
+        Range xRange    = xAxis.getRange();
+        xRange = Range.expand(xRange, MARGIN_LEFT, MARGIN_RIGHT);
+        xAxis.setRange(xRange);
+        plot.setDomainAxis(xAxis);
+
+        ValueAxis yAxis = plot.getRangeAxis();
+        Range yRange    = yAxis.getRange();
+        yRange = Range.expand(yRange, MARGIN_BOTTOM, MARGIN_TOP);
+        yAxis.setRange(yRange);
+        plot.setRangeAxis(yAxis);
+
+        chart.setPadding(new RectangleInsets(10d, 10d, 10d, 10d));
+
+        return chart;
+    }
+
+    /**
+     * @see de.intevation.gnv.chart.Chart#generateChart()
+     */
+    public JFreeChart generateChart() {
+        if (chart == null) {
+            chart = createChart();
+        }
+
+        return chart;
+    }
+
+    /**
+     * Set the background paint of {@link #chart}.
+     * @param paint
+     */
+    public void setBackgroundPaint(Paint paint) {
+        chart.setBackgroundPaint(paint);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileChart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,37 +1,104 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.chart;
 
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Locale;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.ChartTheme;
+
 import org.jfree.chart.axis.Axis;
+import org.jfree.chart.axis.NumberAxis;
+
+import org.jfree.chart.plot.PlotOrientation;
 import org.jfree.chart.plot.XYPlot;
-import org.jfree.chart.plot.PlotOrientation;
+
+import org.jfree.data.Range;
+
+import org.jfree.data.general.Series;
+
 import org.jfree.data.xy.XYSeries;
-import org.jfree.data.general.Series;
 import org.jfree.data.xy.XYSeriesCollection;
 
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.describedata.KeyValueDescibeData;
-
-
 /**
- * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
+ * This class is used to create xy charts of vertical profiles.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class VerticalProfileChart
 extends      AbstractXYLineChart
 {
+    /**
+     * Default axis identifier which is used if @see #getDependendAxisName does
+     * not return a value. The value of this field is {@value}.
+     */
+    public static final String DEFAULT_AXIS = "KPOSITION";
+
+    /**
+     * Logger used for logging with log4j.
+     */
     private static Logger log = Logger.getLogger(VerticalProfileChart.class);
 
-    protected final double PERCENTAGE     = 5.0;
+    /**
+     * Constant used for gap detection. Its value is {@value}.
+     */
+    protected static int PERCENTAGE     = 5;
+
+    /**
+     * Constnat used for gap detection in @see #gridDetection.
+     */
     protected final double GAP_MAX_LEVEL  = Math.sqrt(2.0);
+
+    /**
+     * Constant used for gap detection in @see #addGaps. Its value is {@value}.
+     */
     protected final int    GAP_MAX_VALUES = 60;
 
+    /**
+     * Map to store max ranges of each parameter
+     * (org.jfree.chart.axis.Axis.setAutoRange(true) doesn't seem to work
+     * properly.
+     */
+    protected Map values;
 
+    static {
+        /* The percentage defining the width of a gap should be configured in
+         * conf.xml instead of being configured in a system property */
+        PERCENTAGE = Integer.getInteger("chart.gap.percentage", PERCENTAGE);
+    }
+
+
+    /**
+     * Constructor used to create xy-charts.
+     *
+     * @param labels Labels used to be displayed in title, subtitle and so on.
+     * @param theme ChartTheme used to adjust the rendering of this chart.
+     * @param parameters Collection containing a bunch of parameters.
+     * @param measurements Collection containing a bunch of measurements.
+     * @param dates Collection containing a bunch of date objects.
+     * @param result Collection containing a bunch of <code>Result</code>
+     * objects which contain the actual data items to be displayed.
+     * @param timeGaps Collection with timegap definitions.
+     * @param locale Locale used to specify the format of labels, numbers, ...
+     * @param linesVisible Render lines between data points if true, otherwise
+     * not.
+     * @param shapesVisible Render vertices as points if true, otherwise not.
+     */
     public VerticalProfileChart(
         ChartLabels labels,
         ChartTheme  theme,
@@ -57,12 +124,20 @@
         this.shapesVisible    = shapesVisible;
         this.datasets         = new HashMap();
         this.ranges           = new HashMap();
+        this.values           = new HashMap();
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#initData()
+     */
+    @Override
     protected void initData() {
         log.debug("init data for VerticalProfileChart");
 
+        int items = resultSet.size();
+        log.debug("Found " + items + " items for this chart.");
+
         String  breakPoint1       = null;
         String  breakPoint2       = null;
         String  breakPoint3       = null;
@@ -93,7 +168,9 @@
                 log.debug("prepare data/plot for next dataset");
 
                 if(series != null) {
-                    gapDetection(results, series, startPos, endPos);
+                    if (startPos >= 0 && endPos < items) {
+                        gapDetection(results, series, startPos, endPos);
+                    }
                     addSeries(series, parameter, idx);
 
                     startPos = endPos +1;
@@ -116,20 +193,53 @@
             }
 
             addValue(row, series);
-            storeMaxRange(row.getDouble("YORDINATE"), parameter);
+            Object x = getValue(row);
+            Double y = row.getDouble("YORDINATE");
+            if (x != null && y != null) {
+                storeMaxRange(ranges, y, parameter);
+                storeMaxValue(values, x, parameter);
+            }
             endPos++;
         }
 
-        if (results.length == 0)
+        if (items == 0)
             return;
 
-        gapDetection(results, series, startPos, endPos);
+        if (startPos >= 0 && endPos < items) {
+            gapDetection(results, series, startPos, endPos);
+        }
         addSeries(series, parameter, idx);
 
         addDatasets();
     }
 
 
+    /**
+     * Extract the important value from <code>Result</code> object.
+     *
+     * @param row <code>Result</code> object which contains a required value.
+     *
+     * @return X-ordinate
+     */
+    protected Object getValue(Result row) {
+        return row.getDouble("XORDINATE");
+    }
+
+
+    /**
+     * General method to start a gap detection. The switch between standard gap
+     * detection method <code>addGaps</code> and a specialized method
+     * <code>addGapsOnGrid</code> is done by a parameter <code>DATEID</code>
+     * which is stored a each <code>Result</code> object. Specialized method is
+     * used if <code>DATEID</code> equals 2, otherwise the standard method is
+     * used.
+     *
+     * @param results Array of <code>Result</code> objects storing data of
+     * this chart.
+     * @param series Series used to add gaps.
+     * @param startPos Index of first element of series in results.
+     * @param endPos Index of last element of series in results.
+     */
     protected void gapDetection(
         Result[] results,
         Series   series,
@@ -144,7 +254,71 @@
             addGaps(results, series, startValue, endValue, startPos, endPos);
     }
 
+    @Override
+    protected void prepareAxis(String seriesKey, int idx) {
+        super.prepareAxis(seriesKey, idx);
 
+        XYPlot plot = chart.getXYPlot();
+        NumberAxis domainAxis = (NumberAxis) plot.getRangeAxis(idx);
+
+        Range domainRange = domainAxis.getRange();
+        log.debug("Domain axis range before: " + domainRange.toString());
+
+        domainRange = Range.expand(domainRange, LOWER_MARGIN, UPPER_MARGIN);
+
+        double lower = domainRange.getLowerBound();
+        double upper = domainRange.getUpperBound();
+
+        if (lower == upper) {
+            double lo = lower > 0 ? lower - lower*0.05d : lower + lower*0.05d;
+            double up = upper > 0 ? upper + upper*0.05d : upper - upper*0.05d;
+
+            domainRange = new Range(lo, up);
+        }
+
+        log.debug("Range axis range after: " + domainRange.toString());
+        domainAxis.setRange(domainRange);
+        plot.setRangeAxis(idx, domainAxis);
+    }
+
+
+    /**
+     * Method to expand max range of a range axis.
+     * <code>LOWER_MARGIN</code> and <code>UPPER_MARGIN</code> are used to
+     * expand the range.
+     */
+    protected void prepareRangeAxis(String seriesKey, int idx) {
+        log.debug("Adjust domain range now...");
+        XYPlot plot      = chart.getXYPlot();
+        NumberAxis yAxis = (NumberAxis) plot.getDomainAxis();
+
+        Range yRange = yAxis.getRange();
+        double lo    = yRange.getLowerBound();
+        double hi    = yRange.getUpperBound();
+
+        Iterator iter = values.values().iterator();
+        while (iter.hasNext()) {
+            Range tmp = (Range) iter.next();
+            log.debug("Series range: " + tmp.toString());
+
+            lo = lo < tmp.getLowerBound() ? lo : tmp.getLowerBound();
+            hi = hi > tmp.getUpperBound() ? hi : tmp.getUpperBound();
+        }
+
+        Range merged = Range.expand(
+            new Range(lo, hi),
+            LOWER_MARGIN, UPPER_MARGIN);
+        log.debug("Calculated range for all series = " + merged.toString());
+
+        yAxis.setRange(merged);
+        plot.setDomainAxis(yAxis);
+    }
+
+
+    /**
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#addValue(Result, Series)
+     */
+    @Override
     protected void addValue(Result row, Series series) {
         ((XYSeries) series).add(
             row.getDouble("XORDINATE"),
@@ -153,6 +327,12 @@
     }
 
 
+    /**
+     * @param parameter
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#addSeries(Series, String,
+     * int)
+     */
+    @Override
     protected void addSeries(Series series, String parameter, int idx) {
         log.debug("add series (" + parameter + ")to chart");
 
@@ -173,6 +353,10 @@
     }
 
 
+    /**
+     * Method to add processed datasets to plot. Each dataset is adjusted using
+     * <code>prepareAxis</code> and <code>adjustRenderer</code> methods.
+     */
     protected void addDatasets() {
         Iterator   iter = parameters.iterator();
         XYPlot     plot = chart.getXYPlot();
@@ -198,15 +382,53 @@
                 );
             }
         }
+
+        prepareRangeAxis(null, -1);
     }
 
 
+    /**
+     * Method used to store the max y-range of each parameter in this chart.
+     *
+     * @param values Map to store max values for each parameter.
+     * @param val Value used to be a Double.
+     * @param parameter Title used to identify a range object stored in values.
+     */
+    protected void storeMaxValue(Map values, Object val, String parameter) {
+        double value = ((Double) val).doubleValue();
+        Range  range = null;
+
+        range = values.containsKey(parameter)
+            ? (Range) values.get(parameter)
+            : new Range(value, value);
+
+        double lower = range.getLowerBound();
+        double upper = range.getUpperBound();
+
+        lower = value < lower ? value : lower;
+        upper = value > upper ? value : upper;
+
+        values.put(parameter, new Range(lower, upper));
+    }
+
+
+    /**
+     * @param locale
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#localizeDomainAxis(Axis,
+     * Locale)
+     */
+    @Override
     protected void localizeDomainAxis(Axis axis, Locale locale) {
         // call localizeRangeAxis from superclass which formats NumberAxis
         super.localizeRangeAxis(axis, locale);
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#createSeriesName(String,
+     * String, String)
+     */
+    @Override
     protected String createSeriesName(
         String breakPoint1,
         String breakPoint2,
@@ -220,16 +442,36 @@
     }
 
 
+    /**
+     * Method used to add gaps between data points on grids. The real detection
+     * is done in <code>gridDetection</code>.
+     *
+     * @param results Array of <code>Result</code> objects storing the relevant
+     * values.
+     * @param series Series object where the gaps are added to.
+     * @param startPos Index of first element which should be used in gap
+     * detection. Other series are stored in results as well.
+     * @param endPos Index of last element which should be used in gap
+     * detection.
+     */
     protected void addGapsOnGrid(
         Result[] results,
         Series   series,
         int      startPos,
         int      endPos
     ) {
-        String axis = getDependendAxisName(
-            results[startPos],
-            results[startPos+1]
-        );
+        String axis = null;
+
+        if (results.length > (startPos+1)) {
+            axis = getDependendAxisName(
+                results[startPos],
+                results[startPos+1]
+            );
+        }
+        else {
+            axis = DEFAULT_AXIS;
+        }
+
         double range        = 0;
         int    last         = 0;
         int    current      = 0;
@@ -250,6 +492,24 @@
     }
 
 
+    /**
+     * Standarad method to add gaps. There are two different methods to detect
+     * gaps. <code>simpleDetection</code> is used if the number of data points
+     * in this chart is lower than <code>GAP_MAX_VALUES</code>. Otherwise
+     * <code>specialDetection</code> is used. A data point with
+     * <code>null</code> value is added where a gap should be. This lets
+     * JFreeChart break the current graph.
+     *
+     * @param results Array of <code>Result</code> objects storing the relevant
+     * values.
+     * @param series Series object where the gaps are added to.
+     * @param startValue First data point value in series.
+     * @param endValue Last data point value in series.
+     * @param startPos Index of first data point in results which contains all
+     * data points of all series.
+     * @param endPos Index of last data point in results which contains all data
+     * points of all series.
+     */
     protected void addGaps(
         Result[] results,
         Series   series,
@@ -290,6 +550,21 @@
     }
 
 
+    /**
+     * Simple method to detect gaps. A gap is detected if the delta between two
+     * data points (current, last) is bigger than <code>PERCENTAGE</code> percent
+     * of delta of start and end.
+     * <br>
+     * (smallDelta &gt; delta / 100 * PERCENTAGE)
+     *
+     * @param start First data point value in a series.
+     * @param end Last data point value in a series.
+     * @param last Left value
+     * @param current Right value
+     *
+     * @return true, if a gap is detected between last and current - otherwise
+     * false.
+     */
     protected boolean simpleDetection(
         double start,
         double end,
@@ -303,6 +578,22 @@
     }
 
 
+    /**
+     * Method to detect gaps between two data points. Following formula is used
+     * for detection:<br>
+     * smallDelta &gt; (3.0 / (count - 1) * delta)<br>
+     * smallDelta = current - last<br>
+     * delta      = end - start
+     *
+     * @param start First data point value in a series.
+     * @param end Last data point value in a series.
+     * @param last Left value
+     * @param current Right value
+     *
+     * @param count
+     * @return true, if a gap is detected between last and current - otherwise
+     * false.
+     */
     protected boolean specialDetection(
         double start,
         double end,
@@ -316,12 +607,39 @@
         return (smallDelta > (3.0 / (count - 1) * delta));
     }
 
-    
+
+    /**
+     * Method used to detect gaps between two data points grids. If the delta
+     * between current and last is bigger than <code>GAP_MAX_LEVEL</code>, a gap
+     * is detected.
+     *
+     * @param last Left value
+     * @param current Right value
+     *
+     * @return True, if a gap was detected - otherwise false.
+     */
     protected boolean gridDetection(double last, double current) {
+        if (log.isDebugEnabled()) {
+            log.debug("######################################################");
+            log.debug("Parameters for gap detection");
+            log.debug("Defined gap size for grids: " + GAP_MAX_LEVEL);
+            log.debug("1st value to compare: " + last);
+            log.debug("2nd value to compare: " + current);
+            log.debug("Difference: " + Math.abs(current - last));
+        }
         return (Math.abs(current - last) > GAP_MAX_LEVEL);
     }
 
 
+    /**
+     * This method returns the key which is used to retrieve the y-value served
+     * by a <code>Result</code> object.
+     *
+     * @param first <code>Result</code> object - not used in this class.
+     * @param second <code>Result</code> object - not used in this class.
+     *
+     * @return the string "KPOSITION"
+     */
     protected String getDependendAxisName(Result first, Result second) {
         return "KPOSITION";
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/VerticalProfileVectorChart.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.chart;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.ChartTheme;
+
+import org.jfree.chart.plot.XYPlot;
+
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+
+/**
+ * This class is used to create xy charts of vertical profiles.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class VerticalProfileVectorChart
+extends      VerticalProfileChart
+{
+    private static Logger logger =
+        Logger.getLogger(VerticalProfileVectorChart.class);
+
+    public VerticalProfileVectorChart(
+        ChartLabels labels,
+        ChartTheme  theme,
+        Collection  parameters,
+        Collection  measurements,
+        Collection  dates,
+        Collection  result,
+        Collection  timeGaps,
+        Locale      locale,
+        boolean     linesVisible,
+        boolean     shapesVisible
+    ) {
+        super(labels, theme, parameters, measurements, dates, result,
+              timeGaps, locale, linesVisible, shapesVisible);
+    }
+
+
+    @Override
+    protected void initData() {
+        logger.debug("init data for verticalprofile chart with vector data.");
+
+        int items = resultSet.size();
+        logger.debug("Found " + items + " items for this chart.");
+
+        Iterator iter         = resultSet.iterator();
+        Result     row        = null;
+        String     seriesName = null;
+        XYSeries   series     = null;
+
+        int  idx       = 0;
+        int  startPos  = 0;
+        int  endPos    = 0;
+
+        double startValue = 0;
+        double endValue   = 0;
+
+        ResultDescriptor rd = null;
+        int idxSeries       = -1;
+        int idxX            = -1;
+        int idxY            = -1;
+
+        Result[] results =
+            (Result[]) resultSet.toArray(new Result[resultSet.size()]);
+
+        while (iter.hasNext()) {
+            row = (Result) iter.next();
+
+            if (rd == null) {
+                rd        = row.getResultDescriptor();
+                idxSeries = rd.getColumnIndex("SERIES");
+                idxX      = rd.getColumnIndex("XORDINATE");
+                idxY      = rd.getColumnIndex("YORDINATE");
+            }
+
+            if (!row.getString(idxSeries).equals(seriesName)) {
+                logger.debug("prepare data/plot for next dataset.");
+
+                if (series != null) {
+                    if (startPos >= 0 && endPos < items) {
+                        gapDetection(results, series, startPos, endPos);
+                    }
+
+                    addSeries(series, seriesName, idx);
+
+                    startPos = endPos + 1;
+                }
+
+                seriesName = row.getString(idxSeries);
+
+                logger.debug("next data is '" + seriesName + "'");
+                series = new XYSeries(seriesName);
+            }
+
+            addValue(row, series);
+            Object x = getValue(row);
+            Double y = row.getDouble(idxY);
+            if (x != null && y != null) {
+                storeMaxRange(ranges, y, seriesName);
+                storeMaxValue(values, x, seriesName);
+            }
+
+            endPos++;
+        }
+
+        if (results.length == 0)
+            return;
+
+        if (startPos >= 0 && endPos < items) {
+            gapDetection(results, series, startPos, endPos);
+        }
+        addSeries(series, seriesName, idx);
+
+        addDatasets();
+    }
+
+
+    @Override
+    protected void addDatasets() {
+        XYPlot     plot = chart.getXYPlot();
+        int        idx  = 0;
+
+        XYSeriesCollection sc  = null;
+        Iterator           iter = datasets.keySet().iterator();
+
+        while (iter.hasNext()) {
+            String key = (String) iter.next();
+            sc  = (XYSeriesCollection)datasets.get(key);
+            plot.setDataset(idx, sc );
+            logger.debug("Added " + key + " parameter to plot.");
+            prepareAxis(key, idx);
+            adjustRenderer(
+                idx++,
+                sc.getSeriesCount(),
+                linesVisible,
+                shapesVisible
+            );
+        }
+
+        prepareRangeAxis(null, -1);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/XMLChartTheme.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/XMLChartTheme.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,67 +1,170 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.chart;
 
-import java.awt.Font;
+import de.intevation.artifacts.common.utils.Config;
+
 import java.awt.Color;
+import java.awt.Font;
+import java.awt.Paint;
+
 import java.awt.geom.Ellipse2D;
-import java.lang.NumberFormatException;
 
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.StandardChartTheme;
+
 import org.jfree.chart.plot.XYPlot;
+
+import org.jfree.chart.renderer.xy.AbstractXYItemRenderer;
+import org.jfree.chart.renderer.xy.XYBarRenderer;
 import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
+
 import org.jfree.ui.RectangleInsets;
+
 import org.jfree.util.UnitType;
 
-
 import org.w3c.dom.Document;
 
-import de.intevation.artifactdatabase.Config;
-
 /**
- * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
+ * Implementation of JFreeChart's default implementation
+ * <code>StandardChartTheme</code>. This class takes an xml document with a
+ * bunch of parameters and turns it into a <code>ChartTheme</code> to change
+ * the appearance of charts.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class XMLChartTheme
 extends      StandardChartTheme
 {
+    /**
+     * Default color.
+     */
     private static final Color DEFAULT_COLOR = Color.BLACK;
 
+    /**
+     * Logger used for logging with log4j.
+     */
     private Logger log = Logger.getLogger(XMLChartTheme.class);
 
+    /**
+     * Field storing the visibility of the domain crosshair
+     */
     protected boolean domainCrosshairVisible;
+
+    /**
+     * Field storing the visibility of the range crosshair
+     */
     protected boolean rangeCrosshairVisible;
+
+    /**
+     * Field storing the visiblity of lines.
+     */
     protected boolean renderLines;
+
+    /**
+     * Field storing the visibility of data points
+     */
     protected boolean renderShapes;
 
+    /**
+     * Field storing the width of a data point
+     */
     protected int pointWidth;
+
+    /**
+     * Field storing the height of a data point.
+     */
     protected int pointHeight;
 
+    /**
+     * Field storing the base color of a bin in a histogram chart
+     */
+    protected Paint histogramBasePaint;
 
+
+    /**
+     * Constructor
+     *
+     * @param name Name for this theme.
+     */
     public XMLChartTheme(String name) {
         super(name);
     }
 
 
+    /**
+     * Setter method for the visibility of the domain crosshair.
+     *
+     * @param visible True, if domain crosshair should be visible
+     */
     public void setDomainCrosshairVisible(boolean visible) {
         this.domainCrosshairVisible = visible;
     }
 
 
+    /**
+     * Getter method for retrieving the visibility of the domain crosshair.
+     *
+     * @return Visibility of the domain crosshair.
+     */
     public boolean getDomainCrosshairVisible() {
         return domainCrosshairVisible;
     }
 
 
+    /**
+     * Getter method for retrieving the visibility of the range crosshair.
+     *
+     * @return Visibility of the range crosshair.
+     */
     public boolean getRangeCrosshairVisible() {
         return rangeCrosshairVisible;
     }
 
 
+    /**
+     * Setter method for the visibility of the range crosshair.
+     *
+     * @param visible True, if range crosshair should be visible
+     */
     public void setRangeCrosshairVisible(boolean visible) {
         this.rangeCrosshairVisible = visible;
     }
 
 
+    /**
+     * Method to set the bin color of histograms.
+     *
+     * @param c Bin color
+     */
+    public void setHistogramBasePaint(Color c) {
+        this.histogramBasePaint = c;
+    }
+
+
+    /**
+     * Getter method for retrieving the bin color.
+     *
+     * @return Bin color
+     */
+    public Paint getHistogramBasePaint() {
+        return histogramBasePaint;
+    }
+
+
+    /**
+     * Take a given xml document and read the configuration of a chart
+     * appearance.
+     *
+     * @param document XML document
+     */
     public void applyXMLConfiguration(Document document) {
         log.debug("create XMLChartTheme");
 
@@ -69,6 +172,11 @@
     }
 
 
+    /**
+     * Start parsing the different settings from <code>document</code>.
+     *
+     * @param document XML document
+     */
     private void init(Document document) {
         log.debug("init XMLChartTheme parameters");
 
@@ -79,9 +187,15 @@
         initAxisParameters(document);
         initLegendParameters(document);
         initRenderer(document);
+        initHistogramColor(document);
     }
 
 
+    /**
+     * Read parameters configuring the title of a chart.
+     *
+     * @param document XML document
+     */
     private void initTitleParameters(Document document) {
         log.debug("init title parameters.");
 
@@ -98,6 +212,11 @@
     }
 
 
+    /**
+     * Read parameters configuring the subtitle of a chart.
+     *
+     * @param document XML document
+     */
     private void initSubtitleParameters(Document document) {
         log.debug("init title parameters.");
 
@@ -112,6 +231,11 @@
     }
 
 
+    /**
+     * Read parameters configuring the background color of a chart.
+     *
+     * @param document XML document
+     */
     private void initChartParameters(Document document) {
         log.debug("init chart parameters.");
 
@@ -122,6 +246,11 @@
     }
 
 
+    /**
+     * Read parameters configuring the plot of a chart.
+     *
+     * @param document XML document
+     */
     private void initPlotParameters(Document document) {
         log.debug("init plot parameters.");
 
@@ -165,6 +294,11 @@
     }
 
 
+    /**
+     * Read parameters configuring the axes of a plot.
+     *
+     * @param document XML document
+     */
     private void initAxisParameters(Document document) {
         log.debug("init axis parameters.");
 
@@ -181,6 +315,11 @@
     }
 
 
+    /**
+     * Read parameters configuring the legend of a chart.
+     *
+     * @param document XML document
+     */
     private void initLegendParameters(Document document) {
         log.debug("init legend parameters.");
 
@@ -197,6 +336,11 @@
     }
 
 
+    /**
+     * Read parameters configuring the renderer of a plot.
+     *
+     * @param document XML document
+     */
     private void initRenderer(Document document) {
         log.debug("init renderer parameters.");
 
@@ -213,11 +357,43 @@
     }
 
 
+    /**
+     * Read base color of bins in histogram charts.
+     *
+     * @param document XML document
+     */
+    private void initHistogramColor(Document document) {
+        log.debug("init histogram color");
+        String tmp = getString(document, "theme/histogram/bar/color/@value");
+        Color c = decodeColor(tmp);
+
+        if (c != null)
+            setHistogramBasePaint(c);
+    }
+
+
+    /**
+     * Read a xpath expression and return the matched string.
+     *
+     * @param document Document
+     * @param xpath XPath expression
+     *
+     * @return Matched string
+     */
     private static String getString(Document document, String xpath) {
         return Config.getStringXPath(document, xpath);
     }
 
 
+    /**
+     * Read a xpath and turn it into an integer.
+     *
+     * @param document Document
+     * @param xpath XPath expression
+     *
+     * @return Matched string as integer representation. Return 0 if no integer
+     * have been found at <code>xpath</code>.
+     */
     private static int getInt(Document document, String xpath) {
         String tmp = getString(document, xpath);
 
@@ -228,6 +404,15 @@
     }
 
 
+    /**
+     * Read a xpath and turn it into a boolean.
+     *
+     * @param document Document
+     * @param xpath XPath expression
+     *
+     * @return Matched string as boolean representation. Return false if no
+     * boolean have been found at <code>xpath</code>.
+     */
     private static boolean getBool(Document document, String xpath) {
         String tmp = getString(document, xpath);
 
@@ -238,6 +423,13 @@
     }
 
 
+    /**
+     * Turns a string into a color using {@link java.awt.Color}.
+     *
+     * @param color as string
+     *
+     * @return Color
+     */
     protected Color decodeColor(String color) {
         try {
             if (color == null)
@@ -253,6 +445,15 @@
     }
 
 
+    /**
+     * Create a font with the given parameters.
+     *
+     * @param type Font type
+     * @param size Font size
+     * @param bold Font weight
+     *
+     * @return Font
+     */
     protected Font createFont(String type, int size, boolean bold) {
         Font font = null;
         if (bold)
@@ -264,6 +465,13 @@
     }
 
 
+    /**
+     * Apply settings of this <code>ChartTheme</code> to the given
+     * <code>XYPlot</code>.
+     *
+     * @param plot XYPlot
+     */
+    @Override
     protected void applyToXYPlot(XYPlot plot) {
         log.debug("apply theme parameter to XYPlot");
 
@@ -271,10 +479,23 @@
         plot.setDomainCrosshairVisible(this.domainCrosshairVisible);
         plot.setRangeCrosshairVisible(this.rangeCrosshairVisible);
 
-        applyToXYLineAndShapeRenderer(plot);
+        AbstractXYItemRenderer renderer = (AbstractXYItemRenderer)
+            plot.getRenderer();
+
+        if (renderer instanceof XYLineAndShapeRenderer)
+            applyToXYLineAndShapeRenderer(plot);
+
+        if (renderer instanceof XYBarRenderer)
+            applyToXYBarRenderer(plot);
     }
 
 
+    /**
+     * Apply settings of this <code>ChartTheme</code> to the
+     * <code>XYLineAndShapeRenderer</code> of the given <code>XYPlot</code>.
+     *
+     * @param plot XYPlot
+     */
     protected void applyToXYLineAndShapeRenderer(XYPlot plot) {
         if (plot == null)
             return;
@@ -292,4 +513,21 @@
 
         plot.setRenderer(renderer);
     }
+
+
+    /**
+     * Apply settings of this <code>ChartTheme</code> to the
+     * <code>XYBarRenderer</code> of the given <code>XYPlot</code>.
+     *
+     * @param plot XYPlot
+     */
+    protected void applyToXYBarRenderer(XYPlot plot) {
+        if (plot == null)
+            return;
+
+        XYBarRenderer renderer = (XYBarRenderer) plot.getRenderer();
+
+        renderer.setSeriesPaint(0, histogramBasePaint);
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/exception/TechnicalChartException.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/exception/TechnicalChartException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,16 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.chart.exception;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class TechnicalChartException extends Exception {
 
@@ -22,7 +27,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param message
      */
     public TechnicalChartException(String message) {
@@ -31,7 +36,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param cause
      */
     public TechnicalChartException(Throwable cause) {
@@ -40,7 +45,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param message
      * @param cause
      */
@@ -49,3 +54,4 @@
     }
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/exception/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Exceptions that are used to be thrown if an error occured while chart generation.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Classes and interfaces to support creation of different chart types.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ChartExportHelper.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ChartExportHelper.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,42 +1,87 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.exports;
 
 import com.lowagie.text.Document;
 import com.lowagie.text.DocumentException;
 import com.lowagie.text.PageSize;
 import com.lowagie.text.Rectangle;
+
 import com.lowagie.text.pdf.PdfContentByte;
 import com.lowagie.text.pdf.PdfTemplate;
 import com.lowagie.text.pdf.PdfWriter;
 
-import java.awt.Transparency;
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.artifacts.common.utils.XMLUtils;
+
+import de.intevation.gnv.chart.Chart;
+
 import java.awt.Graphics2D;
+import java.awt.Transparency;
+
+import java.awt.geom.Rectangle2D.Double;
+
 import java.awt.geom.Rectangle2D;
-import java.awt.geom.Rectangle2D.Double;
+
+import java.awt.image.BufferedImage;
+
+import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
-import java.io.IOException;
 import java.io.UnsupportedEncodingException;
+
 import javax.imageio.ImageIO;
 
 import org.apache.batik.svggen.SVGGraphics2D;
 import org.apache.batik.svggen.SVGGraphics2DIOException;
+
 import org.apache.log4j.Logger;
 
 import org.jfree.chart.JFreeChart;
 
-import de.intevation.artifactdatabase.XMLUtils;
-
-
 /**
- * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
+ * This class is a helper class which supports some methods to export charts
+ * into specific formats.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class ChartExportHelper {
 
+    /**
+     * Constant field to define A4 as default page size.
+     */
     private static final String  DEFAULT_PAGE_SIZE = "A4";
+
+    /**
+     * Constant field to define UTF-8 as default encoding.
+     */
     private static final String  DEFAULT_ENCODING  = "UTF-8";
 
+    /**
+     * Logger used for logging with log4j.
+     */
     private static Logger log = Logger.getLogger(ChartExportHelper.class);
 
+
+    /**
+     * A method to export a <code>JFreeChart</code> as image to an
+     * <code>OutputStream</code> with a given format, width and height.
+     *
+     * @param out OutputStream
+     * @param chart JFreeChart object to be exported.
+     * @param format Format (e.g. png, gif, jpg)
+     * @param width Width, the image used to be
+     * @param height Height, the image used to be
+     *
+     * @throws IOException if writing image to OutputStream failed.
+     */
     public static void exportImage(
         OutputStream out,
         JFreeChart chart,
@@ -58,6 +103,98 @@
     }
 
 
+    /**
+     * A method to export a <code>JFreeChart</code> histogram as image to an
+     * <code>OutputStream</code> with a  given format, width and height.
+     *
+     * @param out OutputStream
+     * @param histograms Array of {@link de.intevation.gnv.chart.Chart} objects
+     * @param format A format (e.g. png, gif, jpg)
+     * @param width Width the image used to be
+     * @param height Height the image used to be
+     *
+     * @throws IOException if writing image to OutputStream failed.
+     */
+    public static void exportHistograms(
+        OutputStream out,
+        Chart[]      histograms,
+        String       format,
+        int          width,
+        int          height)
+    throws IOException
+    {
+        log.info("export histograms");
+
+        int size            = histograms.length;
+        BufferedImage image = new BufferedImage(
+            width, height*size, BufferedImage.TYPE_INT_RGB);
+        Graphics2D g        = image.createGraphics();
+
+        for (int i = 0; i < size; i++) {
+            JFreeChart chart = histograms[i].generateChart();
+            chart.draw(g, new Rectangle2D.Double(0.0D, i*height, width, height));
+        }
+        g.finalize();
+
+        ImageIO.write(image, format, out);
+    }
+
+
+    /**
+     * A method to export a <code>JFreeChart</code> histogram as SVG to an
+     * <code>OutputStream</code>.
+     *
+     * @param out OutputStream
+     * @param histograms Array of {@link de.intevation.gnv.chart.Chart}
+     * @param encoding Encoding, defaults to {@link #DEFAULT_ENCODING} if null
+     * @param width Width the svg used to be
+     * @param height Height the svg used to be
+     */
+    public static void exportHistogramsAsSVG(
+        OutputStream out,
+        Chart[]      histograms,
+        String       encoding,
+        int          width,
+        int          height
+    ) {
+        log.info("export histograms as svg");
+
+        if (encoding == null)
+            encoding = DEFAULT_ENCODING;
+
+        org.w3c.dom.Document document = XMLUtils.newDocument();
+        SVGGraphics2D        graphics = new SVGGraphics2D(document);
+
+        int size = histograms.length;
+        for (int i = 0; i < size; i++) {
+            JFreeChart chart = histograms[i].generateChart();
+            chart.draw(graphics, new Rectangle2D.Double(
+                0.0D, i*height,width,height));
+        }
+        graphics.finalize();
+
+        try {
+            graphics.stream(new OutputStreamWriter(out, encoding));
+        }
+        catch (SVGGraphics2DIOException svge) {
+            log.error("Error while writing svg export to output stream.", svge);
+        }
+        catch (UnsupportedEncodingException uee) {
+            log.error("Unsupported encoding: " + encoding, uee);
+        }
+    }
+
+
+    /**
+     * A method to export a <code>JFreeChart</code> as SVG to an
+     * <code>OutputStream</code>.
+     *
+     * @param out OutputStream
+     * @param chart JFreeChart to be exported
+     * @param encoding Encoding, defaults to {@link #DEFAULT_ENCODING} if null
+     * @param width Width the svg used to be
+     * @param height Height the svg used to be
+     */
     public static void exportSVG(
         OutputStream out,
         JFreeChart   chart,
@@ -87,24 +224,75 @@
     }
 
 
+    /**
+     * A method to export a <code>JFreeChart</code> as PDF to an
+     * <code>OutputStream</code>.
+     *
+     * @param out OutputStream
+     * @param chart JFreeChart
+     * @param pageFormat String to specify a page format, {@link
+     * #DEFAULT_PAGE_SIZE} is used if no pageFormat is given
+     * @param landscape If this is true, the pdf is delivered in landscape
+     * format
+     * @param marginLeft Space to left border
+     * @param marginRight Space to right border
+     * @param marginTop Space to upper border
+     * @param marginBottom Space to lower border
+     */
     public static void exportPDF(
         OutputStream out,
         JFreeChart   chart,
         String       pageFormat,
-        boolean      landscape,
         float        marginLeft,
         float        marginRight,
         float        marginTop,
-        float        marginBottom
+        float        marginBottom,
+        CallContext  context
     ) {
         log.info("export chart as pdf.");
 
         if (pageFormat == null)
             pageFormat = DEFAULT_PAGE_SIZE;
 
+        // max size of the chart
         Rectangle page = PageSize.getRectangle(pageFormat);
-        int pageWidth  = (int) (page.getRight(marginRight) - page.getLeft(marginLeft));
-        int pageHeight = (int) (page.getTop(marginTop) - page.getBottom(marginBottom));
+        float pageWidth  = page.getWidth();
+        float pageHeight = page.getHeight();
+
+        // the chart width
+        int chartWidth  = (Integer) context.getContextValue("chart.width");
+        int chartHeight = (Integer) context.getContextValue("chart.height");
+
+        boolean landscape = chartWidth > chartHeight ? true : false;
+
+        float width  = 0;
+        float height = 0;
+        if (landscape) {
+            width  = pageHeight;
+            height = pageWidth;
+        }
+        else {
+            width  = pageWidth;
+            height = pageHeight;
+        }
+
+        float spaceX = width  - marginLeft - marginRight;
+        if (chartWidth > spaceX) {
+            log.warn("Width of the chart is too big for pdf -> resize it now.");
+            double ratio = ((double)spaceX) / chartWidth;
+            chartWidth  *= ratio;
+            chartHeight *= ratio;
+            log.debug("Resized chart to " + chartWidth + "x" + chartHeight);
+        }
+
+        float spaceY = height - marginTop  - marginBottom;
+        if (chartHeight > spaceY) {
+            log.warn("Height of the chart is too big for pdf -> resize it now.");
+            double ratio = ((double)spaceY) / chartHeight;
+            chartWidth  *= ratio;
+            chartHeight *= ratio;
+            log.debug("Resized chart to " + chartWidth + "x" + chartHeight);
+        }
 
         Document document = null;
         if (landscape) {
@@ -123,24 +311,20 @@
 
             PdfContentByte content  = writer.getDirectContent();
 
-            int width  = 0;
-            int height = 0;
-            if (landscape) {
-                width  = pageHeight;
-                height = pageWidth;
-            }
-            else {
-                width  = pageWidth;
-                height = pageHeight;
-            }
-
             PdfTemplate template = content.createTemplate(width, height);
             Graphics2D  graphics = template.createGraphics(width, height);
-            Rectangle2D area = new Rectangle2D.Double(0.0D, 0.0D,width,height);
+
+            double[] origin = getCenteredAnchor(
+                marginLeft, marginRight, marginBottom, marginTop,
+                width, height,
+                chartWidth, chartHeight);
+
+            Rectangle2D area = new Rectangle2D.Double(
+                origin[0], origin[1], chartWidth, chartHeight);
 
             chart.draw(graphics, area);
             graphics.dispose();
-            content.addTemplate(template, marginLeft, marginBottom);
+            content.addTemplate(template, 0f, 0f);
         }
         catch (DocumentException de) {
             log.error("Error while exporting chart to pdf.", de);
@@ -149,5 +333,177 @@
             document.close();
         }
     }
+
+
+    /**
+     * A method to export <code>JFreeChart</code> histograms as PDF to an
+     * <code>OutputStream</code>. Each histogram contained in histograms is
+     * drawn to an own page in the resulting pdf.
+     *
+     * @param out OutputStream
+     * @param histograms JFreeChart histograms
+     * @param pageFormat String to specify a page format, {@link
+     * #DEFAULT_PAGE_SIZE} is used if no pageFormat is given
+     * @param landscape If this is true, the pdf is delivered in landscape
+     * format
+     * @param marginLeft Space to left border
+     * @param marginRight Space to right border
+     * @param marginTop Space to upper border
+     * @param marginBottom Space to lower border
+     */
+    public static void exportHistogramsAsPDF(
+        OutputStream out,
+        Chart[]      histograms,
+        String       pageFormat,
+        float        marginLeft,
+        float        marginRight,
+        float        marginTop,
+        float        marginBottom,
+        CallContext  context
+    ) {
+        log.info("export histogram as pdf.");
+
+        if (pageFormat == null)
+            pageFormat = DEFAULT_PAGE_SIZE;
+
+        Rectangle page = PageSize.getRectangle(pageFormat);
+        float pageWidth  = page.getWidth();
+        float pageHeight = page.getHeight();
+
+        // the chart width
+        int chartWidth  = (Integer) context.getContextValue("chart.width");
+        int chartHeight = (Integer) context.getContextValue("chart.height");
+
+        boolean landscape = chartWidth > chartHeight ? true : false;
+
+        float width  = 0;
+        float height = 0;
+        if (landscape) {
+            width  = pageHeight;
+            height = pageWidth;
+        }
+        else {
+            width  = pageWidth;
+            height = pageHeight;
+        }
+
+        float spaceX = width  - marginLeft - marginRight;
+        if (chartWidth > spaceX) {
+            log.warn("Histogram width is too big for pdf -> resize it now.");
+            double ratio = ((double)spaceX) / chartWidth;
+            chartWidth  *= ratio;
+            chartHeight *= ratio;
+            log.debug("Resized chart to " + chartWidth + "x" + chartHeight);
+        }
+
+        float spaceY = height - marginTop  - marginBottom;
+        if (chartHeight > spaceY) {
+            log.warn("Histogram height is too big for pdf -> resize it now.");
+            double ratio = ((double)spaceY) / chartHeight;
+            chartWidth  *= ratio;
+            chartHeight *= ratio;
+            log.debug("Resized chart to " + chartWidth + "x" + chartHeight);
+        }
+
+        Document document = null;
+        if (landscape) {
+            document = new Document(page.rotate());
+            log.debug("Create landscape pdf.");
+        }
+        else
+            document = new Document(page);
+
+        try {
+            PdfWriter writer = PdfWriter.getInstance(document, out);
+
+            document.addCreationDate();
+            document.open();
+
+            PdfContentByte content  = writer.getDirectContent();
+
+            int size = histograms.length;
+            for (int i = 0; i < size; i++) {
+                if (i > 0) {
+                    document.newPage();
+                }
+
+                JFreeChart chart     = histograms[i].generateChart();
+                PdfTemplate template = content.createTemplate(width, height);
+                Graphics2D  graphics = template.createGraphics(width, height);
+
+                double[] origin = getCenteredAnchor(
+                    marginLeft, marginRight, marginBottom, marginTop,
+                    width, height,
+                    chartWidth, chartHeight);
+
+                Rectangle2D area     = new Rectangle2D.Double(
+                    origin[0], origin[1], chartWidth, chartHeight);
+
+                chart.draw(graphics, area);
+                graphics.dispose();
+                content.addTemplate(template, 0f, 0f);
+            }
+        }
+        catch (DocumentException de) {
+            log.error("Error while exporting histogram to pdf.", de);
+        }
+        finally {
+            document.close();
+        }
+    }
+
+
+    /**
+     * This method returns the anchor of the chart so that the chart is centered
+     * according to the given parameters.
+     *
+     * @param mLeft Left margin
+     * @param mRight Right margin
+     * @param mBottom Bottom margin
+     * @param mTop Top margin
+     * @param width The complete width of the drawing area.
+     * @param height The complete height of the drawing area.
+     * @param chartWidth The width of the chart.
+     * @param chartHeight The height of the chart.
+     *
+     * @return an array that contains the anchor for a chart with the given
+     * parameters. The first value is the x point, the second value is the y
+     * point.
+     */
+    public static double[] getCenteredAnchor(
+        double mLeft,      double mRight,      double mBottom, double mTop,
+        double width,      double height,
+        double chartWidth, double chartHeight
+    ) {
+        if (log.isDebugEnabled()) {
+            log.debug("Calculate centered origin...");
+            log.debug("-> PDF width    : " + width);
+            log.debug("-> PDF height   : " + height);
+            log.debug("-> Chart width  : " + chartWidth);
+            log.debug("-> Chart height : " + chartHeight);
+            log.debug("-> margin left  : " + mLeft);
+            log.debug("-> margin right : " + mRight);
+            log.debug("-> margin bottom: " + mBottom);
+            log.debug("-> margin top   : " + mTop);
+        }
+
+        double[] origin = new double[2];
+
+        double centerX = width  / 2;
+        double centerY = height / 2;
+
+        origin[0] = centerX - chartWidth / 2;
+        origin[1] = centerY - chartHeight / 2;
+
+        origin[0] = origin[0] >= mLeft ? origin[0] : mLeft;
+        origin[1] = origin[1] >= mTop ? origin[1] : mTop;
+
+        if (log.isDebugEnabled()) {
+            log.debug("==> centered left origin: " + origin[0]);
+            log.debug("==> centered top  origin: " + origin[1]);
+        }
+
+        return origin;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultDataCollector.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultDataCollector.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,35 +1,78 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.exports;
 
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import de.intevation.gnv.state.exception.StateException;
+
+import java.util.ArrayList;
 import java.util.List;
-import java.util.ArrayList;
 
 import org.apache.log4j.Logger;
 
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.geobackend.base.ResultDescriptor;
-import de.intevation.gnv.state.exception.StateException;
-
-
 /**
- * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
+ * This is the default implementation of {@link Export.DataCollector}. This
+ * class serves a method to extract required data from <code>Result</code>
+ * objects.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class DefaultDataCollector
 implements Export.DataCollector
 {
+    /**
+     * Logger used to log via log4j.
+     */
     private   Logger log = Logger.getLogger(DefaultDataCollector.class);
 
+    /**
+     * ResultDescriptor used to extract specific attributes from
+     * <code>Result</code> object.
+     */
     protected ResultDescriptor rd;
+
+    /**
+     * Atrribute names in <code>Result</code> object which should be used for
+     * data extraction.
+     */
     protected String []        names;
 
 
+    /**
+     * Constructor
+     *
+     * @param names See {@link #names}
+     */
     public DefaultDataCollector(String[] names) {
         this.names = names;
     }
 
+    /**
+     * This method initializes the <code>ResultDescriptor</code> rd for a faster
+     * data extraction.
+     *
+     * @param res A <code>Result</code> object used to get its description.
+     */
     public void init(Result res) {
         rd = res.getResultDescriptor();
     }
 
+    /**
+     * This method is used to extract the required data specified by {@link
+     * #names}.
+     *
+     * @param result <code>Result</code> object.
+     *
+     * @return Extracted data.
+     */
     public String[] getData(Result result)
     throws StateException {
 
@@ -46,3 +89,4 @@
         return (String[]) entries.toArray((new String[entries.size()]));
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultExport.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultExport.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,38 +1,69 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.exports;
 
-import org.apache.log4j.Logger;
-
 import au.com.bytecode.opencsv.CSVWriter;
 
-import java.util.Iterator;
-import java.util.Collection;
-
-import java.io.UnsupportedEncodingException;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.OutputStream;
-
 import de.intevation.gnv.geobackend.base.Result;
 
 import de.intevation.gnv.state.exception.StateException;
 
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.log4j.Logger;
+
 /**
- * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
- * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
+ * This class is the default implementation of {@link Export}.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class DefaultExport
 implements   Export
 {
+    /**
+     * Logger used for logging via log4j.
+     */
     private static Logger log = Logger.getLogger(DefaultExport.class);
 
-    private Export.DataCollector collector;
+    /**
+     * DataCollector used to extract data from <code>Result</code> objects.
+     */
+    protected Export.DataCollector collector;
 
+    /**
+     * Constructor
+     *
+     * @param collector See {@link #collector}
+     */
     public DefaultExport(Export.DataCollector collector) {
         this.collector = collector;
     }
 
+    /**
+     * This method writes data stored in <code>result</code> into a CSV document
+     * using <code>writer</code>.
+     *
+     * @param profile <code>Profile</code> used to specify the format and columns.
+     * @param result Collection storing the required data.
+     * @param writer CSVWriter to write the csv document.
+     *
+     * @throws StateException
+     */
     protected void writeData(
-        Profile    profile, 
+        Profile    profile,
         Collection result,
         CSVWriter  writer
     )
@@ -51,15 +82,29 @@
         }
     }
 
+    /**
+     * This method takes a data Collection and writes it to
+     * <code>outputStream</code> using the the format specified by
+     * <code>profile</code>.
+     *
+     * @param profile used to specify the format and columns.
+     * @param outputStream OutputStream which is used for writing the export
+     * document to.
+     * @param result Collection storing the data.
+     *
+     * @throws IOException if writing to OutputStream failed.
+     * @throws UnsupportedEncodingException if the encoding was not accepted.
+     * @throws StateException if result is null.
+     */
     public void create(
         Profile      profile,
-        OutputStream outputStream, 
+        OutputStream outputStream,
         Collection   result
     )
     throws
         IOException,
         UnsupportedEncodingException,
-        StateException 
+        StateException
     {
         if (result == null) {
             String msg = "No data given for generation of " +
@@ -71,13 +116,14 @@
         CSVWriter writer = new CSVWriter(
             new OutputStreamWriter(
                 outputStream,
-                profile.getEncoding()), 
+                profile.getEncoding()),
             profile.getSeparator(),
             profile.getQuoteCharacter(),
-            profile.getEscapeCharacter()); 
+            profile.getEscapeCharacter());
 
         writeData(profile, result, writer);
 
         writer.close();
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultProfile.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultProfile.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,25 +1,79 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.exports;
 
-
 /**
- * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
- * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
+ * This class is the default implementation of  {@link Export.Profile} and
+ * serves information about the format used to create an export document.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class DefaultProfile
 implements   Export.Profile
 {
+    /**
+     * Used to collect the required data from <code>Result</code> object.
+     */
     protected Export.DataCollector collector;
+
+    /**
+     * Column headers.
+     */
     protected String []            header;
+
+    /**
+     *
+     */
     protected String []            names;
+
+    /**
+     * Character used to separate columns.
+     */
     protected char                 separator;
+
+    /**
+     * Escape character.
+     */
     protected char                 escapeCharacter;
+
+    /**
+     * Quote character.
+     */
     protected char                 quoteCharacter;
+
+    /**
+     * Format type.
+     */
     protected String               type;
+
+    /**
+     * Encoding used for export.
+     */
     protected String               encoding;
 
-    public DefaultProfile() {
+    /**
+     * Constructor
+     */
+    private DefaultProfile() {
     }
 
+    /**
+     * Constructor
+     *
+     * @param header See {@link #header}
+     * @param separator See {@link #separator}
+     * @param escapeCharacter See {@link #escapeCharacter}
+     * @param quoteCharacter See {@link #quoteCharacter}
+     * @param type See {@link #type}
+     * @param encoding See {@link #encoding}
+     */
     public DefaultProfile(
         String []            header,
         char                 separator,
@@ -36,31 +90,70 @@
         this.encoding        = encoding;
     }
 
+    /**
+     * Returns the given value.
+     *
+     * @param index Index
+     * @param value Value
+     *
+     * @return value
+     */
     public String toString(int index, String value) {
         return value;
     }
 
+    /**
+     * Returns the separator.
+     *
+     * @return Separator
+     */
     public char getSeparator() {
         return separator;
     }
 
+    /**
+     * Returns the escape character.
+     *
+     * @return Escape character
+     */
     public char getEscapeCharacter() {
         return escapeCharacter;
     }
 
+    /**
+     * Returns the quote character.
+     *
+     * @return Quote character.
+     */
     public char getQuoteCharacter() {
         return quoteCharacter;
     }
 
+    /**
+     * Returns the format type.
+     *
+     * @return Type.
+     */
     public String getType() {
         return type;
     }
 
+    /**
+     * Returns the encoding.
+     *
+     * @return Encoding
+     */
     public String getEncoding() {
         return encoding;
     }
 
+    /**
+     * Returns the column headers.
+     *
+     * @return header
+     */
     public String[] getHeader() {
         return header;
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/Export.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/Export.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,40 +1,136 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.exports;
 
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.state.exception.StateException;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+
 import java.util.Collection;
 
-import java.io.OutputStream;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.exception.StateException;
-
 /**
- * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
- * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
+ * This interface should be implemented by a class whose instances are intended
+ * to export a <code>Collection</code> of <code>Result</code>s into a specific
+ * format (e.g. CSV or ODV).
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public interface Export {
 
+    /**
+     * This interface provides some methods which describe the format used by an
+     * <code>Export</code>.
+     */
     public interface Profile {
+        /**
+         *
+         * @param column Column index.
+         * @param value A default value.
+         * @return A specific column as string.
+         */
         String toString(int column, String value);
+
+        /**
+         * This method serves information about the character used to separate
+         * columns.
+         *
+         * @return Character used to separate
+         */
         char      getSeparator();
+
+        /**
+         * This method serves information about the character used as escape
+         * character.
+         *
+         * @return Escape character
+         */
         char      getEscapeCharacter();
+
+        /**
+         * This method serves informatin about the character used as quote
+         * character.
+         *
+         * @return Quote character
+         */
         char      getQuoteCharacter();
+
+        /**
+         * This method serves information about the format.
+         *
+         * @return Format as string.
+         */
         String    getType();
+
+        /**
+         * This method serves information about the encoding to be used.
+         *
+         * @return Encoding
+         */
         String    getEncoding();
+
+        /**
+         * This method returns the header as array.
+         *
+         * @return Header as string array.
+         */
         String [] getHeader();
     }
 
+    /**
+     * This interface should be implemeted to collect the required data from
+     * <code>Result</code> object.
+     */
     public interface DataCollector {
+
+        /**
+         * This method serves the required data stored in a <code>Result</code>
+         * object.
+         *
+         * @param result <code>Result</code> object which contains the required
+         * data.
+         * @return String[] which contains all required data.
+         *
+         * @throws StateException
+         */
         String[] getData(Result result)
         throws StateException;
     }
 
+    /**
+     * This method creates an export document specified by {@link Profile} which
+     * contains the data stored in <code>result</code> and writes it to
+     * <code>outputStream</code>.
+     *
+     * @param profile Profile used to specify the format of the resulting export
+     * document.
+     * @param outputStream Resulting export document is written to this
+     * OutputStream.
+     * @param result Collection which contains the data used to be written into
+     * the export document.
+     *
+     * @throws IOException if an error occured while writing the export document
+     * to OutputStream
+     * @throws UnsupportedEncodingException if the given encoding is not
+     * accepted
+     * @throws StateException if <code>result</code> is null
+     */
     public void create(
         Profile      profile,
-        OutputStream outputStream, 
+        OutputStream outputStream,
         Collection   result
     )
     throws IOException, UnsupportedEncodingException, StateException;
 
 }
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ODVExport.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.exports;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import au.com.bytecode.opencsv.CSVWriter;
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.exception.StateException;
+
+/**
+ * This class is used to create a specific export document which is similar to
+ * an CSV document.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class ODVExport extends DefaultExport {
+
+    /**
+     * Logger used for logging via log4j.
+     */
+    private static Logger log = Logger.getLogger(ODVExport.class);
+
+    /**
+     * Collection of parameters.
+     */
+    private Collection parameters = null;
+
+    /**
+     * The TimeStime which should be integrated in the Export to mark a
+     * TimeSeries.
+     */
+    private String startTime = null;
+
+    /**
+     * Constructor
+     * @param collector DataCollector used to extract the required data.
+     * @param parameters A collection of parameters to be displayed in the
+     * export.
+     * @param startTime The TimeStamp which should ne integrated in the export
+     * to mark a TimeSeries. If it should not be a TimeSeries this Value must
+     * be null.
+     */
+    public ODVExport(DataCollector collector, Collection parameters, String startTime) {
+        super(collector);
+        this.parameters = parameters;
+        this.startTime = startTime;
+    }
+
+
+    @Override
+    protected void writeData(
+        Profile profile, Collection result, CSVWriter writer
+    )throws StateException
+    {
+        Iterator<Result> it = result.iterator();
+        log.debug("Put " + result.size() + " elements into odv export.");
+
+        String[] header = profile.getHeader();
+        ArrayList<String> headerList = new ArrayList<String>();
+        for (int i= 0; i < header.length; i++){
+            headerList.add(header[i]);
+        }
+
+        if (this.startTime != null){
+            headerList.add("time_ISO8601");
+        }
+        ArrayList<String> paramids = new ArrayList<String>();
+
+        Map<StringArrayKey, Map<String,String>> aggregatedRows =
+            new HashMap<StringArrayKey, Map<String,String>>();
+
+        while (it.hasNext()) {
+            Result res = it.next();
+
+            String[] value = collector.getData(res);
+            StringArrayKey key = new StringArrayKey(value);
+            String parameterValue = res.getString("DATAVALUE");
+            String parameterID = res.getString("PARAMETER");
+
+            if (!paramids.contains(parameterID)){
+                paramids.add(parameterID);
+                headerList.add(findParamTitle(parameters, parameterID));
+                headerList.add("QF");
+            }
+
+            Map<String,String> aggregatedRow = aggregatedRows.get(key);
+            if (aggregatedRow!= null){
+                aggregatedRow.put(parameterID, parameterValue);
+            }
+            else{
+                Map<String,String> params = new HashMap<String, String>();
+                params.put(parameterID, parameterValue);
+                aggregatedRows.put(key, params);
+            }
+        }
+
+        if (header != null){
+            writer.writeNext(headerList.toArray(header));
+        }
+
+        Iterator<StringArrayKey> rows = aggregatedRows.keySet().iterator();
+        while (rows.hasNext()){
+            StringArrayKey row = rows.next();
+            Map<String,String> params = aggregatedRows.get(row);
+            ArrayList<String> rowList = new ArrayList<String>();
+            String[] rowArray = row.getValue();
+            for (int i= 0; i < rowArray.length; i++){
+                rowList.add(rowArray[i]);
+            }
+            if (this.startTime != null){
+                String measurementtime = rowList.get(3).replace(' ','T');
+                rowList.set(3, this.startTime.replace('.','-'));
+                rowList.add(measurementtime+":00.0");
+            }
+            for (int i = 0; i < paramids.size();i++){
+                String key = paramids.get(i);
+                String value = params.get(key);
+                if (value == null){
+                    value = "";
+                }
+                rowList.add(value);
+                rowList.add("1");
+            }
+            writer.writeNext(rowList.toArray(rowArray));
+        }
+    }
+
+    /**
+     * This method is used to search specific value coresponding to its key
+     * <code>id</code> and return its description.
+     *
+     * @param values Collection of parameters.
+     * @param id Key used to find the value.
+     *
+     * @return Description of searched value.
+     */
+    protected String findParamTitle(Collection values, String id) {
+        log.debug("find description of dataset");
+
+        if (values != null){
+            Iterator it = values.iterator();
+            while (it.hasNext()) {
+                KeyValueDescibeData data = (KeyValueDescibeData) it.next();
+
+                if (id.equals(data.getKey()))
+                    return data.getValue();
+            }
+        }
+        return "";
+    }
+
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/ShapeDataCollector.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,30 +1,60 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.exports;
 
+import com.vividsolutions.jts.geom.Point;
+
+import com.vividsolutions.jts.io.ParseException;
+import com.vividsolutions.jts.io.WKTReader;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.state.exception.StateException;
+
 import org.apache.log4j.Logger;
 
-import com.vividsolutions.jts.io.WKTReader;
-import com.vividsolutions.jts.io.ParseException;
-import com.vividsolutions.jts.geom.Point;
-
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.exception.StateException;
-
-
 /**
- * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
+ * This class is a specialization of <code>DefaultDataCollector</code>. The
+ * difference between these classes is, that this class extracts points served
+ * by a wkt string.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class ShapeDataCollector
 extends DefaultDataCollector
 {
+    /**
+     * Logger used for logging with log4j.
+     */
     private Logger log = Logger.getLogger(ShapeDataCollector.class);
 
+    /**
+     * WKTReader to parse points from wkt strings.
+     */
     protected WKTReader wktReader = new WKTReader();
 
+    /**
+     * Constructor
+     *
+     * @param names Attributes used to be extracted.
+     */
     public ShapeDataCollector(String[] names) {
         super(names);
     }
 
-    public String[] getData(Result result) 
+    /**
+     * This method takes point from wkt strings as well and split them into x
+     * and y coordinate.
+     *
+     * @see de.intevation.gnv.exports.Export.DataCollector#getData(Result)
+     */
+    public String[] getData(Result result)
     throws StateException {
 
         if (rd == null)
@@ -34,7 +64,7 @@
             String [] entries = new String[names.length+1];
             int j             = 0;
             for (int i = 0; i < names.length; i++) {
-                
+
                 if (names[i].equals("SHAPE")) {
                     Point p  = (Point)wktReader.read(result.getString("SHAPE"));
 
@@ -55,3 +85,4 @@
         }
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/exports/SimpleOdvDataCollector.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/SimpleOdvDataCollector.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,35 +1,77 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.exports;
 
-import java.util.Date;
+import com.vividsolutions.jts.geom.Point;
+
+import com.vividsolutions.jts.io.ParseException;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.state.exception.StateException;
+
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 
+import java.util.Date;
+
 import org.apache.log4j.Logger;
 
-import com.vividsolutions.jts.io.ParseException;
-import com.vividsolutions.jts.geom.Point;
-
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.exception.StateException;
-
 /**
- * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
+ * This class is a specialization of {@link ShapeDataCollector} and turns
+ * furthermore a given datetime string into a specific format.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class SimpleOdvDataCollector
 extends ShapeDataCollector
 {
+    /**
+     * Logger used for logging with log4j.
+     */
     private static Logger log = Logger.getLogger(SimpleOdvDataCollector.class);
 
+    /**
+     * Constant field which defines the source format of a given datetime.
+     */
     public static final String SRC_FORMAT  = "yyyy.MM.dd HH:mm:ss";
+
+    /**
+     * Constant field which defines the target format of a given datetime.
+     */
     public static final String DEST_FORMAT = "yyyy-MM-dd HH:mm";
 
+    /**
+     * Source format.
+     */
     public static DateFormat srcFormat  = new SimpleDateFormat(SRC_FORMAT);
+
+    /**
+     * Target format.
+     */
     public static DateFormat destFormat = new SimpleDateFormat(DEST_FORMAT);
 
+    /**
+     * Constructor
+     *
+     * @param names See {@link #names}
+     */
     public SimpleOdvDataCollector(String[] names) {
         super(names);
     }
 
+    /**
+     * Given datetime values which corresponds to the attribute key 'TIMEVALUE'
+     * are transformed from {@link #SRC_FORMAT} into {@link #DEST_FORMAT}.
+     *
+     * @see de.intevation.gnv.exports.Export.DataCollector#getData(Result)
+     */
     public String[] getData(Result result)
     throws StateException
     {
@@ -40,14 +82,14 @@
             String [] entries = new String[names.length+1];
             int j             = 0;
             for (int i = 0; i < names.length; i++) {
-                
+
                 if (names[i].equals("SHAPE")) {
                     Point p  = (Point)wktReader.read(result.getString("SHAPE"));
 
                     entries[j++] = ""+p.getX();
                     entries[j++] = ""+p.getY();
                 }
-                // Change the datetime format from yyyy.MM.dd HH:mm:ss to 
+                // Change the datetime format from yyyy.MM.dd HH:mm:ss to
                 // yyyy-MM-dd HH:mm
                 else if (names[i].equals("TIMEVALUE")) {
                     Date source  = srcFormat.parse(result.getString(names[i]));
@@ -72,3 +114,4 @@
         }
     }
 }
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/exports/StringArrayKey.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.exports;
+/**
+ * A simple Key Class for generating an syntetic key using the
+ * values of the given Stringarray and not the Hash of the Stringarray
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class StringArrayKey {
+
+    /**
+     * The Stringarray which contains the Values.
+     */
+    private String[] value = null;
+
+    /**
+     * The Key which should be used to compare the Stringarrays.
+     */
+    private String key = null;
+
+    /**
+     * Constructor
+     * @param value the Value which should be used to generate the key
+     */
+    public StringArrayKey(String[] value) {
+        this.value = value;
+        if (value != null){
+            key = "";
+            for (int i = 0; i < value.length; i++){
+                key += value[i];
+            }
+        }
+    }
+
+    /**
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (obj instanceof StringArrayKey){
+            return (((StringArrayKey)obj).key).equals(this.key);
+        }
+        return false;
+    }
+
+    /**
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return this.key.hashCode();
+    }
+
+    /**
+     * Returns the stored origin Values of the Key
+     * @return the stored origin Values of the Key
+     */
+    public String[] getValue() {
+        return value;
+    }
+
+    public String getKey() {
+        return key;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/exports/VerticalCrossODVExport.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.exports;
+
+import com.vividsolutions.jts.geom.Coordinate;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import java.util.Collection;
+import java.util.Date;
+
+import org.apache.log4j.Logger;
+
+import au.com.bytecode.opencsv.CSVWriter;
+import de.intevation.gnv.state.exception.StateException;
+
+
+public class VerticalCrossODVExport implements Export {
+
+    /**
+     * Constant field which defines the source format of a given datetime.
+     */
+    public static final String SRC_FORMAT  = "yyyy.MM.dd HH:mm:ss";
+
+    /**
+     * Constant field which defines the target format of a given datetime.
+     */
+    public static final String DEST_FORMAT = "yyyy-MM-dd HH:mm";
+
+    /**
+     * Source format.
+     */
+    public static DateFormat srcFormat  = new SimpleDateFormat(SRC_FORMAT);
+
+    /**
+     * Target format.
+     */
+    public static DateFormat destFormat = new SimpleDateFormat(DEST_FORMAT);
+
+    /**
+     * Logger used for logging via log4j.
+     */
+    private static Logger logger =
+        Logger.getLogger(VerticalCrossODVExport.class);
+
+    /**
+     * The path in coordinates.
+     */
+    protected Coordinate[] coordinates;
+
+    /**
+     *
+     */
+    protected double       cellHeight;
+
+    /**
+     *
+     */
+    protected double       cellWidth;
+
+    /**
+     * The raster array storing the values for a specific coordinate in a
+     * specific depth.
+     */
+    protected double[]     raster;
+
+    /**
+     * The raster width.
+     */
+    protected int          width;
+
+    /**
+     * The raster height.
+     */
+    protected int          height;
+
+    /**
+     * The date of this export.
+     */
+    protected String       time;
+
+    /**
+     * The constructor used to create a new export helper object.
+     */
+    public VerticalCrossODVExport(
+        Coordinate[] coordinates,
+        double       cellHeight,
+        double       cellWidth,
+        double[]     raster,
+        String       time,
+        int          width,
+        int          height)
+    {
+        this.coordinates = coordinates;
+        this.cellHeight  = cellHeight;
+        this.cellWidth   = cellWidth;
+        this.raster      = raster;
+        this.width       = width;
+        this.height      = height;
+        this.time        = time;
+    }
+
+
+    /**
+     *
+     * @param profile The Profile used to create column headers.
+     * @param outputStream The stream where the odv data are written to.
+     * @param result Not used here, might be null.
+     */
+    public void create(
+        Profile      profile,
+        OutputStream outputStream,
+        Collection   result)
+    throws
+        IOException,
+        UnsupportedEncodingException,
+        StateException
+    {
+        CSVWriter writer = new CSVWriter(
+            new OutputStreamWriter(outputStream, profile.getEncoding()),
+            profile.getSeparator(),
+            profile.getQuoteCharacter(),
+            profile.getEscapeCharacter());
+
+        writer.writeNext(profile.getHeader());
+
+        writeData(writer, time, coordinates, cellHeight, cellWidth, raster);
+
+        writer.close();
+    }
+
+    protected void writeData(
+        CSVWriter    writer,
+        String       time,
+        Coordinate[] coordinates,
+        double       cellHeight,
+        double       cellWidth,
+        double[]     raster)
+    {
+        if (logger.isDebugEnabled()) {
+            logger.debug("+++++++ ODV Export information ++++++++++");
+            logger.debug("+ raster width: " + width);
+            logger.debug("+ raster height: " + height);
+            logger.debug("+ cell height: " + cellHeight);
+            logger.debug("+ cell width: " + cellWidth);
+            logger.debug("+ items in raster: " + raster.length);
+            logger.debug("+ number of coordinates: " + coordinates.length);
+            logger.debug("+++++++++++++++++++++++++++++++++++++++++");
+        }
+
+        String datetime = null;
+        try {
+            Date tmp = srcFormat.parse(time);
+            datetime = destFormat.format(tmp);
+        }
+        catch (ParseException pe) {
+            logger.error(pe, pe);
+        }
+
+        double   maxDepth = 0;
+        String[] row      = new String[10];
+        for (int i = 0; i < width; i++) {
+            row[0] = "GNVExport";
+            row[1] = "Station_" + i;
+            row[2] = "*";
+            row[3] = datetime;
+            row[4] = Double.toString(coordinates[i].x);
+            row[5] = Double.toString(coordinates[i].y);
+            row[6] = "0";
+
+            double depth = cellHeight * 0.5d;
+            for (int j = i; j < raster.length; j += width, depth += cellHeight) {
+                if (j == (i+width)) {
+                    row[0] = "";
+                    row[1] = "";
+                    row[2] = "";
+                    row[3] = "";
+                    row[4] = "";
+                    row[5] = "";
+                    row[6] = "";
+                }
+
+                double value = raster[j];
+
+                row[7] = Double.toString(depth);
+                row[8] = "1";
+                row[9] = Double.toString(value);
+
+                maxDepth = maxDepth >= depth ? maxDepth : depth;
+
+                if (Double.isNaN(value)) {
+                    break;
+                }
+
+                writer.writeNext(row);
+            }
+        }
+
+        logger.info("Detected max depth: " + maxDepth);
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/exports/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Handle different types of data exports (e.g. chart, csv, odv).
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/histogram/HistogramHelper.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,342 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.histogram;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+
+import de.intevation.gnv.chart.ChartLabels;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class supports some helper methods for histogram charts.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class HistogramHelper {
+
+    /**
+     * Logger used for logging with log4j.
+     */
+    private static Logger logger = Logger.getLogger(HistogramHelper.class);
+
+
+    /**
+     * Disabled HistogramHelper constructor. This is a helper class and no
+     * instance should be instantiated from this class.
+     */
+    private HistogramHelper() {
+    }
+
+
+    /**
+     * This function prepare some input data and turns it into an array which is
+     * taken by {@link de.intevation.gnv.chart.DefaultHistogram}.
+     *
+     * @param input A collection with the data used to be displayed in a
+     * histogram
+     * @param parameters A collection with a bunch of parameters
+     * @param measurements A collection with a bunch of measurements
+     * @param dates A collection with a bunch of dates
+     *
+     * @return Object[][] containing raw data which can be used to create
+     * histograms
+     */
+    public static Object[][] prepareHistogramData(
+        Collection input,
+        Collection parameters,
+        Collection measurements,
+        Collection dates
+    ) {
+        List names = new ArrayList<String>();
+        List data  = new ArrayList<Double[]>();
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("############ prepare histogram data ##########");
+            logger.debug("Input data size: " + input.size());
+        }
+
+        if (input == null) {
+            return new Object[0][0];
+        }
+
+        String break1, break2, break3;
+        int b1Idx = -1;
+        int b2Idx = -1;
+        int b3Idx = -1;
+        int yIdx  = -1;
+        try {
+            Iterator iter = input.iterator();
+
+            if (iter.hasNext()) {
+                Result row = (Result) iter.next();
+                Result previousRow = row;
+
+                if (b1Idx == -1) {
+                    ResultDescriptor rd = row.getResultDescriptor();
+                    b1Idx = rd.getColumnIndex("GROUP1");
+                    b2Idx = rd.getColumnIndex("GROUP2");
+                    b3Idx = rd.getColumnIndex("GROUP3");
+                    yIdx  = rd.getColumnIndex("YORDINATE");
+
+                    if (b1Idx == -1 || b2Idx == -1 || b3Idx == -1 || yIdx == -1) {
+                        return new Object[0][0];
+                    }
+                }
+                break1 = row.getString(b1Idx);
+                break2 = row.getString(b2Idx);
+                break3 = row.getString(b3Idx);
+
+                List values = new ArrayList<Double>();
+                while (iter.hasNext()) {
+
+                    // found new series
+                    if (!break1.equals(row.getString(b1Idx))
+                        || !break2.equals(row.getString(b2Idx))
+                        || !break3.equals(row.getString(b3Idx))
+                        ) {
+
+                        // get parameter name
+                        String name = generateName(
+                            break1, break2, break3,
+                            parameters, measurements, dates
+                        );
+
+                        // add values and parameter name
+                        data.add((Double[]) values.toArray(new Double[values.size()]));
+                        names.add(name);
+
+                        if (logger.isDebugEnabled()) {
+                            logger.debug(" --- series name: " + name);
+                            logger.debug(" --- series items: " + values.size());
+                        }
+
+                        values.clear();
+
+                        Double yValue = row.getDouble(yIdx);
+                        if (yValue != null)
+                            values.add(yValue);
+
+                        // set new conditions to find new series
+                        break1 = row.getString(b1Idx);
+                        break2 = row.getString(b2Idx);
+                        break3 = row.getString(b3Idx);
+
+                        previousRow = row;
+                        row         = (Result) iter.next();
+                    } else {
+
+                        Double value = row.getDouble(yIdx);
+                        if (value != null)
+                            values.add(value);
+
+                        row = (Result) iter.next();
+                    }
+                }
+
+                Double yValue = row.getDouble(yIdx);
+                if (yValue != null)
+                    values.add(yValue);
+
+                String name = generateName(
+                    break1, break2, break3, parameters, measurements, dates);
+
+                if (logger.isDebugEnabled()) {
+                    logger.debug(" --- series name: " + name);
+                    logger.debug(" --- series items: " + values.size());
+                }
+
+                data.add((Double[]) values.toArray(new Double[values.size()]));
+                names.add(name);
+            }
+        }
+        catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        int series = data.size();
+        logger.debug(" === Found total: " + series);
+        Object[][] obj = new Object[series][2];
+        for (int i = 0; i < series; i++) {
+            obj[i][0] = names.get(i);
+            obj[i][1] = (Double[]) data.get(i);
+        }
+
+        return obj;
+    }
+
+
+    /**
+     * This method generates a string made up of parameter name and a
+     * measurement.
+     *
+     * @param break1 Id of a parameter.
+     * @param break2 Id of a measurement.
+     * @param break3 Id of a date.
+     * @param parameters A collection with a bunch of parameters.
+     * @param measurements A collection with a bunch of measurements.
+     * @param dates A collection with a bunch of dates.
+     *
+     * @return Concatenated string (${parametername} + ${measurement} + m).
+     */
+    protected static String generateName(
+        String break1, String break2, String break3,
+        Collection parameters, Collection measurements, Collection dates)
+    {
+        return findValueTitle(parameters,break1) + " " +
+               findValueTitle(measurements,break2) + "m";
+    }
+
+
+    /**
+     * Find a value with the given <code>id</code> and return its description.
+     *
+     * @param values A collection which contains the value we are searching for
+     * @param id Id of the value
+     *
+     * @return String representation of the value. An empty string is returned
+     * if no value have been found with the given id.
+     */
+    protected static String findValueTitle(Collection values, String id) {
+        if (values != null) {
+            Iterator it = values.iterator();
+
+            while (it.hasNext()) {
+                KeyValueDescibeData data = (KeyValueDescibeData) it.next();
+
+                if (id.equals(data.getKey())) {
+                    return data.getValue();
+                }
+            }
+        }
+        return "";
+    }
+
+
+    /**
+     * Creates and returns labels to decorate histograms.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @param context The CallContext object.
+     * @param data An array storing strings.
+     * @return A ChartLabels object with the 1st string in <i>data</i> as title.
+     */
+    public static ChartLabels createHistogramLabels(
+        String uuid, CallContext context, Locale locale, Object[] data)
+    {
+        RessourceFactory fac = RessourceFactory.getInstance();
+
+        return new ChartLabels(
+            (String) data[0],
+            "",
+            "",
+            fac.getRessource(locale, "histogram.axis.range.title", ""));
+    }
+
+
+    public static Object[][] prepareVectorialHistogramData(Collection input) {
+        List names = new ArrayList<String>();
+        List data  = new ArrayList<Double[]>();
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("######### prepare vectorial histogram data #######");
+            logger.debug("Input data size: " + input.size());
+        }
+
+        if (input == null) {
+            return new Object[0][0];
+        }
+
+        int sIdx = -1;
+        int yIdx = -1;
+
+        String series = null;
+
+        try {
+            Iterator iter = input.iterator();
+
+            if (iter.hasNext()) {
+                Result row = (Result) iter.next();
+                Result previousRow = row;
+
+                if (sIdx == -1 || yIdx == -1) {
+                    ResultDescriptor rd = row.getResultDescriptor();
+                    sIdx = rd.getColumnIndex("SERIES");
+                    yIdx = rd.getColumnIndex("YORDINATE");
+
+                    if (sIdx == -1 || yIdx == -1) {
+                        return new Object[0][0];
+                    }
+                }
+
+                List values = new ArrayList<Double>();
+                while (iter.hasNext()) {
+                    row = (Result) iter.next();
+
+                    // found new series
+                    if (series != null && !series.equals(row.getString(sIdx))) {
+
+                        // add values and parameter name
+                        data.add((Double[])
+                            values.toArray(new Double[values.size()]));
+                        names.add(series);
+
+                        if (logger.isDebugEnabled()) {
+                            logger.debug(" --- series name: " + series);
+                            logger.debug(" --- series items: " + values.size());
+                        }
+
+                        values.clear();
+                    }
+
+                    Double value = row.getDouble(yIdx);
+                    if (value != null)
+                        values.add(value);
+
+                    series = row.getString(sIdx);
+                }
+
+                if (logger.isDebugEnabled()) {
+                    logger.debug(" --- series name: " + series);
+                    logger.debug(" --- series items: " + values.size());
+                }
+
+                data.add((Double[]) values.toArray(new Double[values.size()]));
+                names.add(series);
+            }
+        }
+        catch (Exception e) {
+            logger.error(e.getMessage(), e);
+        }
+
+        int count = data.size();
+        logger.debug(" === Found total: " + count);
+        Object[][] obj = new Object[count][2];
+        for (int i = 0; i < count; i++) {
+            obj[i][0] = names.get(i);
+            obj[i][1] = (Double[]) data.get(i);
+        }
+
+        return obj;
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/histogram/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Helper classes used while histogram creation.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/CompactXYItems.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.jfreechart;
+
+import java.io.Serializable;
+
+/**
+ * This class is used to represent geometries (e.g. point, line, polygon). Each
+ * geometry is made up of multiple xy points stored in a single array. A line
+ * composed by start- and endpoint is stored in the following order in that
+ * array: [x1, y1, x2, y2].
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha Teichmann</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class CompactXYItems
+implements   Serializable
+{
+    /**
+     * Array storing the xy items.
+     */
+    protected double [] data;
+
+    /**
+     * Constructs a new CompactXYItems object with the given data.
+     *
+     * @param data An array with xy values.
+     */
+    public CompactXYItems(double [] data) {
+        this.data = data;
+    }
+
+    /**
+     * Retrieves the x coordinate of the point with the given index.
+     *
+     * @param index Index
+     * @return X coordinate.
+     */
+    public double getX(int index) {
+        return data[index << 1];
+    }
+
+    /**
+     * Retrieves the y coordinate of the point with the given index.
+     *
+     * @param index Index
+     * @return Y coordinate.
+     */
+    public double getY(int index) {
+        return data[(index << 1)+1];
+    }
+
+    /**
+     * Write the tupel of xy-values at a specific index into the given array.
+     *
+     * @param index Index used to specify the xy-value.
+     * @param xy the xy coordinate is written into this array with the following
+     * order: [x,y]
+     */
+    public void get(int index, double [] xy) {
+        xy[0] = data[index = (index << 1) + 1];
+        xy[1] = data[index + 1];
+    }
+
+    /**
+     *
+     * @return the data array.
+     */
+    public double [] getData() {
+        return data;
+    }
+
+    /**
+     *
+     * @param data
+     */
+    public void setData(double [] data) {
+        this.data = data;
+    }
+
+    /**
+     *
+     * @return the number of data points.
+     */
+    public int size() {
+        return data.length >> 1;
+    }
+
+    /**
+     * Retrieves the bounding box spaned by the coordinates in the data array.
+     *
+     * @param bbox
+     * @return the calculated bounding box.
+     */
+    public double [] calculateBoundingBox(double [] bbox)  {
+        for (int i = 0; i < data.length;) {
+            double x = data[i++];
+            double y = data[i++];
+            if (x < bbox[0]) bbox[0] = x;
+            if (y < bbox[1]) bbox[1] = y;
+            if (x > bbox[2]) bbox[2] = x;
+            if (y > bbox[3]) bbox[3] = y;
+        }
+        return bbox;
+    }
+
+    /**
+     *
+     * @return the coordinates as string.
+     */
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < data.length;) {
+            if (i > 0) sb.append("; ");
+            sb.append('(');
+            sb.append(data[i++]);
+            sb.append(", ");
+            sb.append(data[i++]);
+            sb.append(')');
+        }
+        return sb.toString();
+    }
+
+
+    /**
+     *
+     * @return the lowest x value.
+     */
+    public double getMinX() {
+        double lower = Double.POSITIVE_INFINITY;
+
+        for (int i = 0; i < data.length; i += 2) {
+            double x = data[i];
+
+            if (!Double.isNaN(x)) {
+                lower = Math.min(lower, x);
+            }
+        }
+
+        return lower;
+    }
+
+
+    /**
+     *
+     * @return the highest x value.
+     */
+    public double getMaxX() {
+        double upper = Double.NEGATIVE_INFINITY;
+
+        for (int i = 0; i < data.length; i += 2) {
+            double x = data[i];
+
+            if (!Double.isNaN(x)) {
+                upper = Math.max(upper, x);
+            }
+        }
+
+        return upper;
+    }
+
+
+    /**
+     *
+     * @return the lowest y value.
+     */
+    public double getMinY() {
+        double lower = Double.POSITIVE_INFINITY;
+
+        for (int i = 1; i < data.length; i += 2) {
+            double y = data[i];
+
+            if (!Double.isNaN(y)) {
+                lower = Math.min(lower, y);
+            }
+        }
+
+        return lower;
+    }
+
+
+    /**
+     *
+     * @return the highest y value.
+     */
+    public double getMaxY() {
+        double upper = Double.NEGATIVE_INFINITY;
+
+        for (int i = 1; i < data.length; i += 2) {
+            double y = data[i];
+
+            if (!Double.isNaN(y)) {
+                upper = Math.max(upper, y);
+            }
+        }
+
+        return upper;
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/LevelOrderIndices.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.jfreechart;
+
+import java.util.LinkedList;
+
+/**
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class LevelOrderIndices
+{
+    public interface Visitor {
+
+        Object visit(int index);
+    }
+
+
+    protected int from;
+
+    protected int to;
+
+
+    public LevelOrderIndices() {
+    }
+
+
+    public LevelOrderIndices(int to) {
+        this(0, to);
+    }
+
+
+    public LevelOrderIndices(int from, int to) {
+        this.from = Math.min(from, to);
+        this.to   = Math.max(from, to);
+    }
+
+
+    public Object visit(Visitor visitor) {
+        LinkedList<int[]> queue = new LinkedList<int[]>();
+
+        queue.add(new int [] { from, to });
+
+        while (!queue.isEmpty()) {
+            int [] pair = queue.remove();
+
+            int mid = (pair[0] + pair[1]) >> 1;
+
+            Object result = visitor.visit(mid);
+
+            if (result != null) {
+                return result;
+            }
+
+            if (mid-1 >= pair[0]) {
+                queue.add(new int [] { pair[0], mid-1 });
+            }
+
+            if (mid+1 <= pair[1]) {
+                pair[0] = mid+1;
+                queue.add(pair);
+            }
+        }
+
+        return null;
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonDataset.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.jfreechart;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.jfree.data.Range;
+
+import org.jfree.data.general.AbstractSeriesDataset;
+
+/**
+ * An implementation of {@link org.jfree.data.xy.XYDataset} to create 2D charts.
+ * This dataset contains several <code>PolygonSeries</code> and is used by
+ * <code>PolygonRenderer</code> to draw its items into a 2D chart.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class PolygonDataset
+extends      AbstractSeriesDataset
+{
+    /**
+     * PolygonSeries included in this Dataset
+     */
+    private List data;
+
+
+    /**
+     * Constructor.
+     */
+    public PolygonDataset() {
+        data = new ArrayList();
+    }
+
+    /**
+     * Constructs a new PolygonDataset containing multiple PolygonSeries.
+     *
+     * @param series A collection containing some PolygonSeries.
+     */
+    public PolygonDataset(Collection series) {
+        data = new ArrayList(series);
+    }
+
+    /**
+     * Constructs a PolygonDataset with a single PolygonSeries.
+     *
+     * @param series A PolygonSeries.
+     */
+    public PolygonDataset(PolygonSeries series) {
+        this();
+
+        if (series != null) {
+            data.add(series);
+        }
+    }
+
+
+    /**
+     *
+     * @param series
+     */
+    public void addSeries(PolygonSeries series) {
+        if (series == null)
+            throw new IllegalArgumentException("Null 'series' argument.");
+
+        data.add(series);
+    }
+
+    /**
+     *
+     * @param series
+     */
+    public void addAllSeries(Collection<PolygonSeries> series) {
+        data.addAll(series);
+    }
+
+    /**
+     * Retrieves the x-axis range of all PolygonSeries in this dataset.
+     *
+     * @return range of the x-axis.
+     */
+    public Range getDomainBounds() {
+        double lower       = Double.POSITIVE_INFINITY;
+        double upper       = Double.NEGATIVE_INFINITY;
+        int    seriesCount = getSeriesCount();
+
+        for (int s = 0; s < seriesCount; s++) {
+            PolygonSeries series = getSeries(s);
+
+            Range domainRange = series.getDomainBounds();
+            double minX = domainRange.getLowerBound();
+            if (!Double.isNaN(minX)) {
+                lower = Math.min(lower, minX);
+            }
+
+            double maxX = domainRange.getUpperBound();
+            if (!Double.isNaN(maxX)) {
+                upper = Math.max(upper, maxX);
+            }
+        }
+
+        return new Range(lower, upper);
+    }
+
+
+    /**
+     * Retrieves the y-axis range of all PolygonSeries in this dataset.
+     *
+     * @return the y-axis range.
+     */
+    public Range getRangeBounds() {
+        double lower       = Double.POSITIVE_INFINITY;
+        double upper       = Double.NEGATIVE_INFINITY;
+        int    seriesCount = getSeriesCount();
+
+        for (int i = 0; i < seriesCount; i++) {
+            PolygonSeries series = getSeries(i);
+
+            Range range = series.getRangeBounds();
+            double minX = range.getLowerBound();
+            if (!Double.isNaN(minX)) {
+                lower = Math.min(lower, minX);
+            }
+
+            double maxX = range.getUpperBound();
+            if (!Double.isNaN(maxX)) {
+                upper = Math.max(upper, maxX);
+            }
+        }
+
+        return new Range(lower, upper);
+    }
+
+
+    /**
+     * Returns the number of series in this dataset.
+     *
+     * @return the number of series in this dataset.
+     */
+    public int getSeriesCount() {
+        return data.size();
+    }
+
+
+    /**
+     * Returns the key for a series.
+     *
+     * @param index Index of a specific series.
+     * @return the series key of the series with the given index.
+     */
+    public Comparable getSeriesKey(int index) {
+        return ((PolygonSeries)data.get(index)).getKey();
+    }
+
+
+    /**
+     *
+     * @param idx Index.
+     * @return the series with the given index.
+     */
+    public PolygonSeries getSeries(int idx) {
+        return (PolygonSeries)data.get(idx);
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonPlot.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,513 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.jfreechart;
+
+import java.awt.AlphaComposite;
+import java.awt.Composite;
+import java.awt.Graphics2D;
+import java.awt.Shape;
+
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.jfree.chart.axis.Axis;
+import org.jfree.chart.axis.AxisCollection;
+import org.jfree.chart.axis.AxisLocation;
+import org.jfree.chart.axis.AxisSpace;
+import org.jfree.chart.axis.AxisState;
+import org.jfree.chart.axis.ValueAxis;
+
+import org.jfree.chart.plot.Plot;
+import org.jfree.chart.plot.PlotOrientation;
+import org.jfree.chart.plot.PlotRenderingInfo;
+import org.jfree.chart.plot.PlotState;
+
+import org.jfree.data.Range;
+
+import org.jfree.ui.RectangleEdge;
+import org.jfree.ui.RectangleInsets;
+
+import org.jfree.util.ObjectList;
+
+/**
+ * A class for plotting polygons into a 2D chart. This plot makes use of <code>
+ * PolygonRenderer</code>.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+// TODO implement cloneable
+public class PolygonPlot
+extends      Plot
+{
+    public static final String PLOT_TYPE = "PolygonPlot";
+
+    public static final PlotOrientation DEFAULT_PLOT_ORIENTATION =
+        PlotOrientation.VERTICAL;
+
+    private PolygonDataset  dataset;
+    private transient PolygonRenderer renderer;
+
+    private PlotOrientation orientation;
+
+    private RectangleInsets axisOffset;
+
+    private ObjectList      domainAxisLocation;
+    private ObjectList      rangeAxisLocation;
+    private ObjectList      domainAxes;
+    private ObjectList      rangeAxes;
+
+
+    /**
+     * Constructs a new PolygonPlot with a dataset and a renderer.
+     *
+     * @param dataset Dataset containing polygons.
+     * @param renderer The renderer used to draw polygons.
+     */
+    public PolygonPlot(PolygonDataset dataset, PolygonRenderer renderer) {
+        this(dataset, renderer, null, null, PlotOrientation.HORIZONTAL);
+    }
+
+
+    /**
+     * @param dataset Dataset containing polygons.
+     * @param renderer The renderer used to draw polygons.
+     * @param orientation The orientation used for this plot.
+     */
+    public PolygonPlot(
+        PolygonDataset  dataset,
+        PolygonRenderer renderer,
+        PlotOrientation orientation
+    ) {
+        this(dataset, renderer, null, null, orientation);
+    }
+
+
+    /**
+     * @param dataset Dataset containing polygons.
+     * @param renderer The renderer used to draw polygons.
+     * @param domainAxis The x axis.
+     * @param rangeAxis The y axis.
+     * @param orientation The orientation used for this plot.
+     */
+    public PolygonPlot(
+        PolygonDataset  dataset,
+        PolygonRenderer renderer,
+        ValueAxis       domainAxis,
+        ValueAxis       rangeAxis,
+        PlotOrientation orientation
+    ) {
+        super();
+
+        this.dataset            = dataset;
+        this.renderer           = renderer;
+        this.domainAxes         = new ObjectList();
+        this.rangeAxes          = new ObjectList();
+        this.domainAxisLocation = new ObjectList();
+        this.rangeAxisLocation  = new ObjectList();
+        this.axisOffset         = RectangleInsets.ZERO_INSETS;
+
+        if (orientation != null)
+            this.orientation = orientation;
+        else
+            this.orientation = DEFAULT_PLOT_ORIENTATION;
+
+        if (domainAxis != null) {
+            this.domainAxes.set(0, domainAxis);
+            domainAxis.setPlot(this);
+        }
+        domainAxisLocation.set(0, AxisLocation.BOTTOM_OR_LEFT);
+
+        if (rangeAxis != null) {
+            this.rangeAxes.set(0, rangeAxis);
+            rangeAxis.setPlot(this);
+        }
+        rangeAxisLocation.set(0, AxisLocation.BOTTOM_OR_LEFT);
+
+        configureDomainAxis();
+        configureRangeAxis();
+    }
+
+
+    public void configureDomainAxis() {
+        // we just have 1 dataset
+        Range domainAxisRange = getDataset().getDomainBounds();
+
+        for (int i = 0; i < domainAxes.size(); i++) {
+            ValueAxis axis = (ValueAxis) domainAxes.get(i);
+
+            if (axis != null) {
+                axis.configure();
+                axis.setRange(domainAxisRange);
+            }
+        }
+    }
+
+    public ValueAxis getDomainAxis() {
+        return getDomainAxis(0);
+    }
+
+    public void setDomainAxis(ValueAxis axis) {
+        domainAxes.set(0, axis);
+    }
+
+    public ValueAxis getDomainAxis(int index) {
+        return index < domainAxes.size()
+            ? (ValueAxis)domainAxes.get(index)
+            : null;
+    }
+
+    public ValueAxis getRangeAxis() {
+        return getRangeAxis(0);
+    }
+
+    public void setRangeAxis(ValueAxis axis) {
+        rangeAxes.set(0, axis);
+    }
+
+    public ValueAxis getRangeAxis(int index) {
+        return index < rangeAxes.size()
+            ? (ValueAxis)rangeAxes.get(index)
+            : null;
+    }
+
+    public  void configureRangeAxis() {
+        // we just have 1 dataset
+        Range rangeAxisRange = getDataset().getRangeBounds();
+
+        for (int i = 0; i < rangeAxes.size(); i++) {
+            ValueAxis axis = (ValueAxis) rangeAxes.get(i);
+
+            if (axis != null) {
+                axis.configure();
+                axis.setRange(rangeAxisRange);
+            }
+        }
+    }
+
+    public PolygonDataset getDataset(){
+        return this.dataset;
+    }
+
+    public String getPlotType() {
+        return PLOT_TYPE;
+    }
+
+    public  void setDataset(PolygonDataset dataset) {
+        this.dataset = dataset;
+    }
+
+
+    /**
+     * This is the major method to draw the into a given Graphic2D object.
+     *
+     * @param g2 Graphics object where the plot is drawn into.
+     * @param area The bounds for drawing this plot.
+     * @param anchor An anchor point.
+     * @param parentState The plot state.
+     * @param info
+     */
+    public void draw(
+        Graphics2D        g2,
+        Rectangle2D       area,
+        Point2D           anchor,
+        PlotState         parentState,
+        PlotRenderingInfo info
+    ) {
+        Graphics2D  savedG2       = g2;
+        Rectangle2D savedDataArea = area;
+
+        if (info != null) {
+            info.setPlotArea(area);
+            info.setDataArea(area);
+        }
+
+        AxisSpace space      = calculateAxisSpace(g2, area);
+        Rectangle2D dataArea = space.shrink(area, null);
+
+        // draw background and outline
+        drawBackground(g2, area);
+        drawOutline(g2, area);
+
+        Shape savedClip = g2.getClip();
+        g2.clip(area);
+
+        Composite originalComposite = g2.getComposite();
+        g2.setComposite(AlphaComposite.getInstance(
+            AlphaComposite.SRC_OVER,
+            getForegroundAlpha()
+        ));
+
+        // draw axis
+        drawAxes(g2, area, dataArea, info);
+
+        if (!isEmptyOrNull(dataset)) {
+            // draw data
+            drawPolygons(savedG2, dataArea, info);
+            drawLabels(savedG2, dataArea, info);
+        }
+
+        g2.setClip(savedClip);
+        g2.setComposite(originalComposite);
+    }
+
+
+    /**
+     * Method to draw the axis for this plot.
+     *
+     * @param g2
+     * @param plotArea
+     * @param dataArea
+     * @param plotState
+     */
+    private void drawAxes(
+        Graphics2D        g2,
+        Rectangle2D       plotArea,
+        Rectangle2D       dataArea,
+        PlotRenderingInfo plotState
+    ) {
+        AxisCollection axisCollection = new AxisCollection();
+
+        for (int i = 0; i < domainAxes.size(); i++) {
+            ValueAxis axis = (ValueAxis) domainAxes.get(i);
+            if (axis != null)
+                axisCollection.add(axis, getDomainAxisEdge(i));
+        }
+
+        for (int i = 0; i < rangeAxes.size(); i++) {
+            ValueAxis axis = (ValueAxis) rangeAxes.get(i);
+            if (axis != null)
+                axisCollection.add(axis, getRangeAxisEdge(i));
+        }
+
+        Map axisStateMap = new HashMap();
+
+        // draw the top axes
+        double cursor = dataArea.getMinY() - this.axisOffset.calculateTopOutset(
+                dataArea.getHeight());
+        Iterator iterator = axisCollection.getAxesAtTop().iterator();
+        while (iterator.hasNext()) {
+            ValueAxis axis = (ValueAxis) iterator.next();
+            AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
+                    RectangleEdge.TOP, plotState);
+            cursor = info.getCursor();
+            axisStateMap.put(axis, info);
+        }
+
+        // draw the bottom axes
+        cursor = dataArea.getMaxY()
+                 + this.axisOffset.calculateBottomOutset(dataArea.getHeight());
+        iterator = axisCollection.getAxesAtBottom().iterator();
+        while (iterator.hasNext()) {
+            ValueAxis axis = (ValueAxis) iterator.next();
+            AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
+                    RectangleEdge.BOTTOM, plotState);
+            cursor = info.getCursor();
+            axisStateMap.put(axis, info);
+        }
+
+        // draw the left axes
+        cursor = dataArea.getMinX()
+                 - this.axisOffset.calculateLeftOutset(dataArea.getWidth());
+        iterator = axisCollection.getAxesAtLeft().iterator();
+        while (iterator.hasNext()) {
+            ValueAxis axis = (ValueAxis) iterator.next();
+            AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
+                    RectangleEdge.LEFT, plotState);
+            cursor = info.getCursor();
+            axisStateMap.put(axis, info);
+        }
+
+        // draw the right axes
+        cursor = dataArea.getMaxX()
+                 + this.axisOffset.calculateRightOutset(dataArea.getWidth());
+        iterator = axisCollection.getAxesAtRight().iterator();
+        while (iterator.hasNext()) {
+            ValueAxis axis = (ValueAxis) iterator.next();
+            AxisState info = axis.draw(g2, cursor, plotArea, dataArea,
+                    RectangleEdge.RIGHT, plotState);
+            cursor = info.getCursor();
+            axisStateMap.put(axis, info);
+        }
+    }
+
+
+    /**
+     * Put some labels at data items into the plot. Uses PolygonRenderer to do
+     * this job.
+     *
+     * @param g2
+     * @param area
+     * @param info
+     */
+    private void drawLabels(
+        Graphics2D        g2,
+        Rectangle2D       area,
+        PlotRenderingInfo info
+    ) {
+        renderer.drawLabels(g2, this, area, dataset);
+    }
+
+
+    /**
+     * Plot the polygons. Uses PolygonRenderer to do this job.
+     *
+     * @param g2
+     * @param area
+     * @param info
+     */
+    private void drawPolygons(
+        Graphics2D        g2,
+        Rectangle2D       area,
+        PlotRenderingInfo info
+    ) {
+        renderer.drawPolygons(g2, this, area, dataset);
+    }
+
+
+    private AxisSpace calculateAxisSpace(Graphics2D  g2, Rectangle2D plotArea) {
+        AxisSpace space         = new AxisSpace();
+        space                   = calculateRangeAxisSpace(g2, plotArea, space);
+        Rectangle2D tmpPlotArea = space.shrink(plotArea, null);
+        space                   = calculateDomainAxisSpace(g2, plotArea, space);
+
+        return space;
+    }
+
+
+    private AxisSpace calculateDomainAxisSpace(
+        Graphics2D  g2,
+        Rectangle2D plotArea,
+        AxisSpace   space
+    ) {
+        if (space == null)
+            space = new AxisSpace();
+
+        for (int i = 0; i < domainAxes.size(); i++) {
+            Axis axis = (Axis) domainAxes.get(i);
+
+            if (axis != null) {
+                RectangleEdge edge = getDomainAxisEdge(i);
+                space = axis.reserveSpace(g2, this, plotArea, edge, space);
+            }
+        }
+
+        return space;
+    }
+
+
+    private AxisSpace calculateRangeAxisSpace(
+        Graphics2D  g2,
+        Rectangle2D plotArea,
+        AxisSpace   space
+    ) {
+        if (space == null)
+            space = new AxisSpace();
+
+        for (int i = 0; i < rangeAxes.size(); i++) {
+            Axis axis = (Axis) rangeAxes.get(i);
+
+            if (axis != null) {
+                RectangleEdge edge = getRangeAxisEdge(i);
+                space = axis.reserveSpace(g2, this, plotArea, edge, space);
+            }
+        }
+
+        return space;
+    }
+
+
+    public RectangleEdge getDomainAxisEdge() {
+        return Plot.resolveDomainAxisLocation(
+            getDomainAxisLocation(), orientation
+        );
+    }
+
+
+    public RectangleEdge getDomainAxisEdge(int idx) {
+        AxisLocation  location = getDomainAxisLocation(idx);
+        RectangleEdge result   = Plot.resolveDomainAxisLocation(
+            location, orientation
+        );
+
+        if (result == null)
+            result = RectangleEdge.opposite(getDomainAxisEdge());
+
+        return result;
+    }
+
+
+    public RectangleEdge getRangeAxisEdge() {
+        return Plot.resolveRangeAxisLocation(
+            getRangeAxisLocation(), orientation
+        );
+    }
+
+
+    public RectangleEdge getRangeAxisEdge(int idx) {
+        AxisLocation  location = getRangeAxisLocation(idx);
+        RectangleEdge result   = Plot.resolveRangeAxisLocation(
+            location,
+            orientation
+        );
+
+        if (result == null)
+            result = RectangleEdge.opposite(getRangeAxisEdge());
+
+        return result;
+    }
+
+
+    public AxisLocation getDomainAxisLocation() {
+        return (AxisLocation) domainAxisLocation.get(0);
+    }
+
+
+    public AxisLocation getDomainAxisLocation(int idx) {
+        if (idx < domainAxisLocation.size())
+            return (AxisLocation) domainAxisLocation.get(idx);
+
+        return null;
+    }
+
+
+    public AxisLocation getRangeAxisLocation() {
+        return (AxisLocation) rangeAxisLocation.get(0);
+    }
+
+
+    public AxisLocation getRangeAxisLocation(int idx) {
+        if (idx < rangeAxisLocation.size())
+            return (AxisLocation) rangeAxisLocation.get(idx);
+
+        return null;
+    }
+
+
+    /**
+     * @return true, if dataset is null or if it does not contain any
+     * PolygonSeries, otherwise false.
+     */
+    private boolean isEmptyOrNull(PolygonDataset dataset) {
+        if (dataset != null) {
+            int seriesCount = dataset.getSeriesCount();
+            for (int s = 0; s < seriesCount; s++) {
+                PolygonSeries series = dataset.getSeries(s);
+                if (series.getItemCount() > 0) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonRenderer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,312 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.jfreechart;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics2D;
+import java.awt.Paint;
+import java.awt.Shape;
+
+import java.awt.geom.GeneralPath;
+
+import java.awt.geom.Rectangle2D.Double;
+
+import java.awt.geom.Rectangle2D;
+
+import java.util.ArrayList;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.axis.ValueAxis;
+
+import org.jfree.data.Range;
+
+import org.jfree.text.TextUtilities;
+
+import org.jfree.ui.RectangleEdge;
+
+/**
+ * This renderer is used to draw polygons into a Graphics object.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class PolygonRenderer
+{
+	private static Logger log = Logger.getLogger(
+		PolygonRenderer.class);
+
+        /**
+         * This interfaces describes a single method to retrieve a Paint object
+         * for a given index.
+         */
+        public interface PaintLookup {
+
+            /**
+             *
+             * @param index Index.
+             * @return Paint
+             */
+            Paint getPaint(int index);
+
+    } // interface PaintLookup
+
+        /**
+         * This class is used to generate labels for a given series.
+         */
+        public static class DefaultLabelGenerator
+    implements          PolygonSeriesLabelGenerator
+    {
+            /**
+             * Construts an empty DefaultLabelGenerator.
+             */
+            public DefaultLabelGenerator() {
+        }
+
+            /**
+             *
+             * @param series A PolygonSeries.
+             * @return The label of series.
+             */
+            public String generateLabel(PolygonSeries series) {
+            Object label = series.getAttribute("label");
+            return label != null
+                ? toString(label)
+                : null;
+        }
+
+            /**
+             *
+             * @param label Object
+             * @return String representaton of label.
+             */
+            protected String toString(Object label) {
+            return label.toString();
+        }
+    } // class DefaultLabelGenerator
+
+        /**
+         * Constructor.
+         */
+        public static final PolygonSeriesLabelGenerator
+        DEFAULT_LABEL_GENERATOR_INSTANCE = new DefaultLabelGenerator();
+
+        protected PaintLookup                 lookup;
+
+    protected PolygonSeriesLabelGenerator labelGenerator;
+
+
+    public PolygonRenderer(PaintLookup lookup) {
+        this(lookup, null);
+    }
+
+
+    public PolygonRenderer(
+        PaintLookup                 lookup,
+        PolygonSeriesLabelGenerator labelGenerator
+    ) {
+        this.lookup         = lookup;
+        this.labelGenerator = labelGenerator;
+    }
+
+    /**
+     * This method draws polygons of each series in <code>dataset</code> into
+     * the given graphics object. If a polygon has no attribute 'fill', we
+     * expect that it is a line, otherwise the polygon is filled.
+     *
+     */
+    public void drawPolygons(
+        Graphics2D     graphics,
+        PolygonPlot    plot,
+        Rectangle2D    area,
+        PolygonDataset dataset
+    ) {
+        int seriesCount = dataset.getSeriesCount();
+        for (int i = 0; i < seriesCount; i++) {
+            PolygonSeries series   = dataset.getSeries(i);
+            Integer       colorIdx = (Integer)series.getAttribute("fill");
+
+            if (colorIdx != null) {
+                Paint paint = lookup.getPaint(colorIdx.intValue());
+                graphics.setPaint(paint != null ? paint : Color.black);
+                graphics.fill(constructShape(plot, area, series, true));
+            }
+            else {
+                Number lineWidth = (Number)series.getAttribute("line.width");
+                BasicStroke stroke = new BasicStroke(
+                    lineWidth != null ? lineWidth.floatValue() : 1f);
+                graphics.setStroke(stroke);
+                graphics.setPaint(Color.black);
+                graphics.draw(constructShape(plot, area, series, false));
+            }
+        }
+    }
+
+    /**
+     * Draw labels at each item of a series in the given dataset. If the series
+     * has no label attritue, no label is drawn.
+     *
+     */
+    public void drawLabels(
+        final Graphics2D  graphics,
+        final PolygonPlot plot,
+        final Rectangle2D area,
+        PolygonDataset    dataset
+    ) {
+        if (labelGenerator == null) {
+            return;
+        }
+
+        final ArrayList<Rectangle2D> bboxes = new ArrayList<Rectangle2D>();
+
+        Font font = graphics.getFont();
+        font = font.deriveFont(Font.PLAIN, Math.max(8, font.getSize()-3));
+        graphics.setFont(font);
+        FontMetrics metrics = graphics.getFontMetrics(font);
+
+        for (int i = dataset.getSeriesCount()-1; i >= 0; --i) {
+            PolygonSeries series = dataset.getSeries(i);
+
+            String label = labelGenerator.generateLabel(series);
+            if (label == null) {
+                continue;
+            }
+
+            final Rectangle2D box = TextUtilities.getTextBounds(
+                label, graphics, metrics);
+
+            for (int j = series.getItemCount()-1; j >= 0; --j) {
+                final CompactXYItems ring = series.getItem(j);
+                LevelOrderIndices loi = new LevelOrderIndices(ring.size()-1);
+                Rectangle2D r = (Rectangle2D)loi.visit(
+                    new LevelOrderIndices.Visitor()
+                {
+                    ValueAxis          da = plot.getDomainAxis();
+                    ValueAxis          ra = plot.getRangeAxis();
+                    RectangleEdge      de = plot.getDomainAxisEdge();
+                    RectangleEdge      re = plot.getRangeAxisEdge();
+                    Rectangle2D.Double r  = new Rectangle2D.Double(
+                        0d, 0d, box.getWidth(), box.getHeight());
+
+                    public Object visit(int index) {
+                        r.x = da.valueToJava2D(ring.getX(index), area, de)
+                            - 0.5*box.getWidth();
+                        r.y = ra.valueToJava2D(ring.getY(index), area, re)
+                            + 0.5*box.getHeight();
+
+                        for (Rectangle2D b: bboxes) {
+                            if (b.intersects(r)) {
+                                return null;
+                            }
+                        }
+                        return r;
+                    }
+                });
+
+                if (r != null) {
+                    bboxes.add(r);
+                    graphics.drawString(
+                        label, (float)r.getX(), (float)r.getY());
+                }
+            } // for all items in series
+        } // for all series
+    }
+
+    /**
+     * Creates a shape made up of the CompactXYItems object stored in the given
+     * series.
+     *
+     * @param plot The plot.
+     * @param area The boundary.
+     * @param series The series storing the items.
+     * @param close Specifies if the polygon should be closed or not.
+     * @return the constructed shape.
+     */
+    protected Shape constructShape(
+        PolygonPlot   plot,
+        Rectangle2D   area,
+        PolygonSeries series,
+        boolean       close
+    ) {
+        ValueAxis     da = plot.getDomainAxis();
+        ValueAxis     ra = plot.getRangeAxis();
+        RectangleEdge de = plot.getDomainAxisEdge();
+        RectangleEdge re = plot.getRangeAxisEdge();
+
+        CompactXYItems [] rings = series.getRings();
+        GeneralPath       path  = new GeneralPath();
+
+        for (int i = 0; i < rings.length; ++i) {
+
+            CompactXYItems ring = rings[i];
+
+            double [] data = ring.getData();
+
+            if (data.length >= 2) {
+                path.moveTo(
+                    (float)da.valueToJava2D(data[0], area, de),
+                    (float)ra.valueToJava2D(data[1], area, re));
+            }
+            for (int j = 2; j < data.length;) {
+                path.lineTo(
+                    (float)da.valueToJava2D(data[j++], area, de),
+                    (float)ra.valueToJava2D(data[j++], area, re));
+            }
+            if (close) {
+                path.closePath();
+            }
+        }
+        return path;
+    }
+
+    /**
+     * Retrieves the bounding box of a dataset.
+     */
+    public Rectangle2D getBoundingBox(PolygonDataset dataset) {
+        Rectangle2D bbox = null;
+
+        for (int i = 0, N = dataset.getSeriesCount(); i < N; i++) {
+            Range domain = dataset.getSeries(i).getDomainBounds();
+            Range range  = dataset.getSeries(i).getRangeBounds();
+
+            double x = domain.getLowerBound();
+            double y = range.getLowerBound();
+            double w = Math.abs(domain.getUpperBound() - x);
+            double h = Math.abs(range.getUpperBound() - y);
+
+            if (bbox == null) {
+                bbox = new Rectangle2D.Double(x, y, w, h);
+            }
+            else {
+                bbox.add(new Rectangle2D.Double(x, y, w, h));
+            }
+        }
+
+        return bbox;
+    }
+
+    /**
+     *
+     * @return the bounds of a series.
+     */
+    public Rectangle2D getBounds(PolygonSeries series) {
+
+        Range domain = series.getDomainBounds();
+        Range range  = series.getRangeBounds();
+
+        return new Rectangle2D.Double(
+            domain.getLowerBound(), range.getLowerBound(),
+            domain.getUpperBound(), range.getUpperBound()
+        );
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonSeries.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.jfreechart;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jfree.data.Range;
+
+import org.jfree.data.general.Series;
+
+/**
+ * This class represents a series of polygon items.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha Teichmann</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class PolygonSeries
+extends      Series
+{
+    /**
+     * Polygons.
+     */
+    protected CompactXYItems []  rings;
+
+    /**
+     * A map containing attribues.
+     */
+    protected Map                attributes;
+
+    /**
+     * The unique key of this series.
+     */
+    private static long uniqueKey;
+
+    /**
+     *
+     * @return a unique key.
+     */
+    protected synchronized static Long createUniqueKey() {
+        return new Long(uniqueKey++);
+    }
+
+    /**
+     * Constructor to create an empty PolygonSeries with a unique key.
+     */
+    public PolygonSeries() {
+        this(createUniqueKey(), null);
+    }
+
+    /**
+     *
+     * @param key The key used for  this series.
+     * @param rings Polygons.
+     */
+    public PolygonSeries(Comparable key, CompactXYItems [] rings) {
+        this(key, null, rings, new HashMap());
+    }
+
+    /**
+     *
+     * @param key The key used for this series.
+     * @param description A description of this series.
+     * @param rings Polygons.
+     */
+    public PolygonSeries(
+        Comparable       key,
+        String           description,
+        CompactXYItems[] rings
+    ) {
+        this(key, description, rings, new HashMap());
+    }
+
+    /**
+     *
+     * @param key The key used for this series.
+     * @param description A description of this series.
+     * @param rings Polygons.
+     * @param attributes Some attribues.
+     */
+    public PolygonSeries(
+        Comparable        key,
+        String            description,
+        CompactXYItems [] rings,
+        Map               attributes
+    ) {
+        super(key, description);
+        this.rings      = rings;
+        this.attributes = attributes;
+    }
+
+
+    public void setRings(CompactXYItems [] rings) {
+        this.rings = rings;
+    }
+
+
+    public CompactXYItems [] getRings() {
+        return rings;
+    }
+
+
+    public void addRing(CompactXYItems newRing) {
+        if (rings == null) {
+            rings = new CompactXYItems [] { newRing };
+        }
+        else {
+            CompactXYItems [] nRings = new CompactXYItems[rings.length + 1];
+            System.arraycopy(rings, 0, nRings, 0, rings.length);
+            nRings[rings.length] = newRing;
+            rings = nRings;
+        }
+    }
+
+
+    public void addRings(CompactXYItems [] newRings) {
+        if (newRings == null || newRings.length == 0) {
+            return;
+        }
+        if (rings == null || rings.length == 0) {
+            rings = newRings;
+        }
+        else {
+            CompactXYItems [] both =
+                new CompactXYItems[rings.length + newRings.length];
+            System.arraycopy(rings, 0, both, 0, rings.length);
+            System.arraycopy(newRings, 0, both, rings.length, newRings.length);
+            rings = both;
+        }
+    }
+
+
+    public Object getAttribute(Object key) {
+        return attributes.get(key);
+    }
+
+
+    public Object setAttribute(Object key, Object value) {
+        return attributes.put(key, value);
+    }
+
+
+    public int getItemCount() {
+        return rings != null ? rings.length : 0;
+    }
+
+
+    public CompactXYItems getItem(int idx) {
+        return rings[idx];
+    }
+
+
+    public Object removeAttribute(Object key) {
+        return attributes.remove(key);
+    }
+
+
+    public boolean hasAttribute(Object key) {
+        return attributes.containsKey(key);
+    }
+
+
+    /**
+     *
+     * @return the range of the x axis.
+     */
+    public Range getDomainBounds() {
+        double upper = Double.NEGATIVE_INFINITY;
+        double lower = Double.POSITIVE_INFINITY;
+        int    count = getItemCount();
+
+        for (int i = 0; i < count; i++) {
+            CompactXYItems  items = getItem(i);
+            double          minX  = items.getMinX();
+            double          maxX  = items.getMaxX();
+
+            if (!Double.isNaN(minX)) {
+                lower = Math.min(lower, minX);
+            }
+
+            if (!Double.isNaN(maxX)) {
+                upper = Math.max(upper, maxX);
+            }
+        }
+
+        if (lower > upper) {
+            return null;
+        }
+
+        return new Range(lower, upper);
+    }
+
+
+    /**
+     *
+     * @return the range of the y axis.
+     */
+    public Range getRangeBounds() {
+        double upper = Double.NEGATIVE_INFINITY;
+        double lower = Double.POSITIVE_INFINITY;
+        int    count = getItemCount();
+
+        for (int i = 0; i < count; i++) {
+            CompactXYItems  items = getItem(i);
+            double          minY  = items.getMinY();
+            double          maxY  = items.getMaxY();
+
+            if (!Double.isNaN(minY)) {
+                lower = Math.min(lower, minY);
+            }
+
+            if (!Double.isNaN(maxY)) {
+                upper = Math.max(upper, maxY);
+            }
+        }
+
+        if (lower > upper) {
+            return null;
+        }
+
+        return new Range(lower, upper);
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/PolygonSeriesLabelGenerator.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.jfreechart;
+
+/**
+ * This interface describes a single method generating labels by given Series.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public interface PolygonSeriesLabelGenerator
+{
+    /**
+     *
+     * @param series The given series.
+     * @return A label for this series.
+     */
+    String generateLabel(PolygonSeries series);
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/jfreechart/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains classes and interfaces used to create 2D charts.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/layer/LayerArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.layer;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.gnv.artifacts.GNVArtifactBase;
+
+/**
+ * Artifact used for Product Layer.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class LayerArtifact extends GNVArtifactBase{
+
+    /**
+     * the logger, used to log exceptions and additionally information
+     */
+    private static Logger log = Logger.getLogger(LayerArtifact.class);
+
+    /**
+     * The UID of this Class
+     */
+    private static final long serialVersionUID = 409054207294748753L;
+
+    /**
+     * Constructor
+     */
+    public LayerArtifact() {
+        super();
+        log.debug("LayerArtifact.Constructor");
+        this.name = "layer";
+    }
+
+    @Override
+    public void setup(
+        String          identifier,
+        ArtifactFactory factory,
+        Object          context,
+        CallMeta        meta,
+        Document        data
+    ) {
+        log.debug("LayerArtifact.setup");
+        super.setup(identifier, factory, context, meta, data);
+    }
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/layer/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains classes providing specific artifacts representing
+Layer.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/AreaInterpolation.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+
+import com.vividsolutions.jts.index.strtree.STRtree;
+
+import java.awt.Dimension;
+
+import java.io.Serializable;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Does an area interpolation for "Horizontalschnitte".
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class AreaInterpolation
+implements   Serializable
+{
+    private static Logger log = Logger.getLogger(AreaInterpolation.class);
+
+    /**
+     * The generated raster.
+     */
+    protected double [] raster;
+
+    /**
+     * The width of the raster.
+     */
+    protected int width;
+    /**
+     * The height of the raster.
+     */
+    protected int height;
+
+    /**
+     * Default constructor.
+     */
+    public AreaInterpolation() {
+    }
+
+    /**
+     * Returns the width of the generated raster.
+     * @return the width of the raster.
+     */
+    public int getWidth() {
+        return width;
+    }
+
+    /**
+     * Returns the height of the raster.
+     * @return The height of the raster.
+     */
+    public int getHeight() {
+        return height;
+    }
+
+    /**
+     * The generated raster.
+     * @return the raster.
+     */
+    public double [] getRaster() {
+        return raster;
+    }
+
+    /**
+     * Epsilon for numerical stability.
+     */
+    public static final double EPS = 1e-6d;
+
+
+    /**
+     * Fills a raster by interpolating the input values.
+     * @param points The attributed input values.
+     * @param boundingBox The world area where to interpolate.
+     * @param samples The width and height of the raster.
+     * @param depth The callback to query the depth at a given point.
+     * @param extrapolationRounds Number of extrapolation point layers
+     * to generate before doing the interpolation.
+     * @return true if the interpolation succeeds else false.
+     */
+    public boolean interpolate(
+        List<? extends Point2d> points,
+        Envelope                boundingBox,
+        Dimension               samples,
+        XYDepth                 depth,
+        int                     extrapolationRounds
+    ) {
+        boolean debug = log.isDebugEnabled();
+
+        if (points == null || points.isEmpty()) {
+            log.warn("no points to interpolate");
+            return false;
+        }
+
+        List<GridCell> cells = GridCell.pointsToGridCells(
+            points,
+            Interpolation2D.relevantArea(
+                boundingBox,
+                points),
+            extrapolationRounds);
+
+        if (cells.isEmpty()) {
+            log.warn("no cells to interpolate");
+            return false;
+        }
+
+        int W = samples.width;
+        int H = samples.height;
+
+        double cellWidth  = boundingBox.getWidth()  / W;
+        double cellHeight = boundingBox.getHeight() / H;
+
+        STRtree spatialIndex = new STRtree();
+
+        for (GridCell cell: cells) {
+            spatialIndex.insert(cell.getEnvelope(), cell);
+        }
+
+        if (debug) {
+            log.debug("width:  "        + boundingBox.getWidth());
+            log.debug("height:  "       + boundingBox.getHeight());
+            log.debug("sample width:  " + W);
+            log.debug("sample height: " + H);
+            log.debug("cell width:  "   + cellWidth);
+            log.debug("cell height: "   + cellHeight);
+        }
+
+        Envelope   queryBuffer     = new Envelope();
+        Coordinate center          = new Coordinate();
+        GridCell.CellFinder finder = new GridCell.CellFinder();
+
+        double [] raster = new double[W*H];
+        Arrays.fill(raster, Double.NaN);
+
+        double minX = boundingBox.getMinX();
+        double minY = boundingBox.getMinY();
+
+        long startTime = System.currentTimeMillis();
+
+        int pos = 0;
+        for (int j = 0; j < H; ++j) {
+
+            double y = j*cellHeight + 0.5d*cellHeight + minY;
+            double x = 0.5d*cellWidth + minX;
+
+            for (int end = pos + W; pos < end; ++pos, x += cellWidth) {
+
+                queryBuffer.init(x - EPS, x + EPS, y - EPS, y + EPS);
+                center.x = x; center.y = y;
+                finder.prepare(center);
+                spatialIndex.query(queryBuffer, finder);
+
+                GridCell found = finder.found;
+
+                if (found == null || depth.depth(center) > 0d) {
+                    continue;
+                }
+
+                double z1 = Interpolation2D.interpolate(
+                    found.p1.x, found.p1.z,
+                    found.p2.x, found.p2.z,
+                    center.x);
+                double z2 = Interpolation2D.interpolate(
+                    found.p3.x, found.p3.z,
+                    found.p4.x, found.p4.z,
+                    center.x);
+                double y1 = Interpolation2D.interpolate(
+                    found.p1.x, found.p1.y,
+                    found.p2.x, found.p2.y,
+                    center.x);
+                double y2 = Interpolation2D.interpolate(
+                    found.p3.x, found.p3.y,
+                    found.p4.x, found.p4.y,
+                    center.x);
+                raster[pos] = Interpolation2D.interpolate(
+                    y1, z1,
+                    y2, z2,
+                    center.y);
+            }
+        }
+
+        long stopTime = System.currentTimeMillis();
+
+        if (debug) {
+            log.debug("interpolation took: " +
+                (stopTime - startTime)/1000f + " secs");
+        }
+
+        this.raster = raster;
+        this.width  = W;
+        this.height = H;
+
+        return true;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedPoint2ds.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import com.vividsolutions.jts.geom.MultiLineString;
+import com.vividsolutions.jts.geom.MultiPolygon;
+
+import de.intevation.gnv.utils.Pair;
+
+import java.io.Serializable;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Stores the results of an area interpolation.
+ * Used to generate the final products.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class AttributedPoint2ds
+implements   Serializable
+{
+    /**
+     * The list of input points.
+     */
+    protected List<? extends Point2d>             points;
+
+    /**
+     * The map of input attributes that are need to generate
+     * the products.
+     */
+    protected Map                                 attributes;
+
+    /**
+     * The interpolation result.
+     */
+    protected AreaInterpolation                   interpolation;
+
+    /**
+     * The JTS multi line strings to be written by GeoTools later.
+     */
+    protected List<Pair<Object, MultiLineString>> lineStrings;
+
+    /**
+     * The JTS multi polygons to be written by GeoTools later.
+     */
+    protected Map<Integer, MultiPolygon>          polygons;
+
+    /**
+     * Default constructor.
+     */
+    public AttributedPoint2ds() {
+    }
+
+    /**
+     * Constructor to create a AttributedPoint2ds with a list
+     * of input points.
+     *
+     * @param points The input points.
+     */
+    public AttributedPoint2ds(List<? extends Point2d> points) {
+        this.points = points;
+    }
+
+    /**
+     * Returns an attribute from the map of external attributes.
+     * @param key The key of the attribute.
+     * @return The attribute or null if the attribute was not found.
+     */
+    public Object getAttribute(Object key) {
+        return attributes != null
+            ? attributes.get(key)
+            : null;
+    }
+
+    /**
+     * Stores an attribute under a given key in
+     * the map of external attributes.
+     * @param key The key of the attribute.
+     * @param value The attribute value.
+     */
+    public void setAttribute(Object key, Object value) {
+        if (attributes == null) {
+            attributes = new HashMap();
+        }
+        attributes.put(key, value);
+    }
+
+    /**
+     * Returns the input points.
+     * @return The input points.
+     */
+    public List<? extends Point2d> getPoints() {
+        return points;
+    }
+
+    /**
+     * Sets the input points.
+     * @param points The input points.
+     */
+    public void setPoints(List<? extends Point2d> points) {
+        this.points = points;
+    }
+
+    /**
+     * Sets the area interpolation result.
+     * @param interpolation The new interpolation result.
+     */
+    public void setInterpolation(AreaInterpolation interpolation) {
+        this.interpolation = interpolation;
+    }
+
+    /**
+     * Returns the area interpolation result.
+     * @return The interpolation result.
+     */
+    public AreaInterpolation getInterpolation() {
+        return interpolation;
+    }
+
+    /**
+     * Sets the produced JTS multi polygons.
+     * @param polygons The multi polygons.
+     */
+    public void setPolygons(Map<Integer, MultiPolygon> polygons) {
+        this.polygons = polygons;
+    }
+
+    /**
+     * Returns the JTS multi polygons.
+     * @return The polygons.
+     */
+    public Map<Integer, MultiPolygon> getPolygons() {
+        return polygons;
+    }
+
+    /**
+     * Set the produced JTS multi line strings.
+     * @param lineStrings The line strings.
+     */
+    public void setLineStrings(
+        List<Pair<Object, MultiLineString>> lineStrings
+    ) {
+        this.lineStrings = lineStrings;
+    }
+
+    /**
+     * Returns the produced JTS multi line strings.
+     * @return The line strings.
+     */
+    public List<Pair<Object, MultiLineString>> getLineStrings() {
+        return lineStrings;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/AttributedXYColumns.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import de.intevation.gnv.jfreechart.PolygonDataset;
+
+import java.io.Serializable;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Stores the results of a 3D interpolation. Used to generate the final
+ * products.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class AttributedXYColumns
+implements   Serializable
+{
+    /**
+     * The list of height value column.
+     */
+    protected List<? extends XYColumn> columns;
+
+    /**
+     * The extra input attributes which are not relevant
+     * for the interpolation but for generating the results.
+     */
+    protected Map                      attributes;
+
+    /**
+     * The interpolation result.
+     */
+    protected Interpolation3D          interpolation;
+
+    /**
+     * Dataset to be used in a {@link de.intevation.gnv.jfreechart.PolygonPlot}.
+     */
+    protected PolygonDataset           dataset;
+
+    /**
+     * Default constructor.
+     */
+    public AttributedXYColumns() {
+    }
+
+    /**
+     * Constructor to create a AttributedXYColumns instance only
+     * with the height value columns.
+     * @param columns The height value columns.
+     */
+    public AttributedXYColumns(List<? extends XYColumn> columns) {
+        this(columns, null);
+    }
+
+    /**
+     * Constructor to create a AttributedXYColumns with
+     * height value columns and the attributes to be used to
+     * generate the results.
+     * @param columns The height value columns.
+     * @param attributes The external attributes.
+     */
+    public AttributedXYColumns(
+        List<? extends XYColumn> columns,
+        Map attributes
+    ) {
+        this.columns    = columns;
+        this.attributes = attributes;
+    }
+
+    /**
+     * Gets an attribute.
+     * @param key The key of the attribute.
+     * @return The attribute or null if no such attribue is found.
+     */
+    public Object getAttribute(Object key) {
+        return attributes != null
+            ? attributes.get(key)
+            : null;
+    }
+
+    /**
+     * Puts an attribute to the map of external attributes.
+     * @param key The key of the attribute.
+     * @param value The value of the attribute.
+     */
+    public void setAttribute(Object key, Object value) {
+        if (attributes == null) {
+            attributes = new HashMap();
+        }
+        attributes.put(key, value);
+    }
+
+    /**
+     * Returns the list of height value columns.
+     * @return The list of height value columns.
+     */
+    public List<? extends XYColumn> getXYColumns() {
+        return columns;
+    }
+
+    /**
+     * Sets the list of height value columns.
+     * @param columns The new list of height value columns.
+     */
+    public void setXYColumns(List<? extends XYColumn> columns) {
+        this.columns = columns;
+    }
+
+    /**
+     * Sets the interpolation result.
+     * @param interpolation The new interpolation result.
+     */
+    public void setInterpolation(Interpolation3D interpolation) {
+        this.interpolation = interpolation;
+    }
+
+    /**
+     * Gets the interpolation results.
+     * @return The interpolation results.
+     */
+    public Interpolation3D getInterpolation() {
+        return interpolation;
+    }
+
+    /**
+     * Sets the generated polygon data set to be used in a
+     * {@link de.intevation.gnv.jfreechart.PolygonPlot}.
+     * @param dataset The polygon data set.
+     */
+    public void setPolygonDataset(PolygonDataset dataset) {
+        this.dataset = dataset;
+    }
+
+    /**
+     * Returns the polygon data set.
+     * @return The polygon data set.
+     */
+    public PolygonDataset getPolygonDataset() {
+        return dataset;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/ConstantFunction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import org.apache.commons.math.analysis.UnivariateRealFunction;
+
+/**
+ * Models a constant function to be used in function evaluation.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class ConstantFunction
+implements   UnivariateRealFunction
+{
+    /**
+     * The constant value.
+     */
+    protected double value;
+
+    /**
+     * Defaut constructor.
+     */
+    public ConstantFunction() {
+    }
+
+    /**
+     * Constructor to create a ConstantFunction with
+     * a given constant value.
+     * @param value The constant value.
+     */
+    public ConstantFunction(double value) {
+        this.value = value;
+    }
+
+    public double value(double x) {
+        return value;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/ConstantXYDepth.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import com.vividsolutions.jts.geom.Coordinate;
+
+/**
+ * Instances of the implementation return a constant value.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class ConstantXYDepth
+implements   XYDepth
+{
+    /**
+     * The constant depth.
+     */
+    protected double depth;
+
+    /**
+     * Default constructor. The constant depth = 0.
+     */
+    public ConstantXYDepth() {
+    }
+
+    /**
+     * Construtor to create a ConstantXYDepth with a given depth.
+     * @param depth The constant depth.
+     */
+    public ConstantXYDepth(double depth) {
+        this.depth = depth;
+    }
+
+    public double depth(Coordinate coordinate) {
+        return depth;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/GridCell.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,416 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import com.vividsolutions.jts.algorithm.CGAlgorithms;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.LinearRing;
+import com.vividsolutions.jts.geom.Point;
+import com.vividsolutions.jts.geom.Polygon;
+
+import com.vividsolutions.jts.index.ItemVisitor;
+
+import java.io.Serializable;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Spans a rectangle of points to be used in spatial indexing.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class GridCell
+implements   Serializable
+{
+    private static Logger log = Logger.getLogger(GridCell.class);
+
+    /**
+     * Callback for {@link com.vividsolutions.jts.index.SpatialIndex}
+     * to find a GridCell which contains a given point.
+     */
+    public static final class CellFinder
+    implements                ItemVisitor
+    {
+        /**
+         * Stores the found GridCell.
+         */
+        public    GridCell found;
+
+        /**
+         * The query point.
+         */
+        protected Point    point;
+
+        /**
+         * Default constructor.
+         */
+        public CellFinder() {
+        }
+
+        /**
+         * Prepares a spatial index lookup.
+         * @param center The query point.
+         */
+        public void prepare(Coordinate center) {
+            found = null;
+            point = GEOMETRY_FACTORY.createPoint(center);
+        }
+
+        /**
+         * Called by the spatial index as a 2nd order filter.
+         * @param item The GridCell to test.
+         */
+        public void visitItem(Object item) {
+            if (found == null) {
+                GridCell cell = (GridCell)item;
+                if (cell.contains(point)) {
+                    found = cell;
+                }
+            }
+        }
+    } // class CellFinder
+
+    /**
+     * The first point.
+     */
+    public Point2d p1;
+    /**
+     * The second point.
+     */
+    public Point2d p2;
+    /**
+     * The third point.
+     */
+    public Point2d p3;
+    /**
+     * The fourth point.
+     */
+    public Point2d p4;
+
+    /**
+     * Polygon created from the four points.
+     */
+    protected Polygon polygon;
+
+    /**
+     * Geometry factory to create the query points and the polygons.
+     */
+    public static final GeometryFactory GEOMETRY_FACTORY
+        = new GeometryFactory();
+
+    /**
+     * Default constructor.
+     */
+    public GridCell() {
+    }
+
+    /**
+     * Constructor to create a GridCell out of four given points..
+     * @param p1 The first point.
+     * @param p2 The second point.
+     * @param p3 The thrid point.
+     * @param p4 The fourth point.
+     */
+    public GridCell(Point2d p1, Point2d p2, Point2d p3, Point2d p4) {
+        this.p1 = p1;
+        this.p2 = p2;
+        this.p3 = p3;
+        this.p4 = p4;
+        createPolygon();
+    }
+
+    /**
+     * Creates the polygon from the four points.
+     */
+    protected void createPolygon() {
+        Coordinate [] coords = new Coordinate [] { p1, p2, p3, p4, p1 };
+        if (!CGAlgorithms.isCCW(coords)) {
+            for (int i = 0, j = coords.length-1; i < j; ++i, --j) {
+                Coordinate c = coords[i];
+                coords[i] = coords[j];
+                coords[j] = c;
+            }
+        }
+        LinearRing shell = GEOMETRY_FACTORY
+            .createLinearRing(coords);
+
+        if (!shell.isValid()) {
+            log.warn("linear ring is not valid");
+        }
+
+        polygon = GEOMETRY_FACTORY.createPolygon(shell, null);
+    }
+
+    /**
+     * Returns the envelope of the four point polygon.
+     * @return the envelope.
+     */
+    public Envelope getEnvelope() {
+        return polygon.getEnvelopeInternal();
+    }
+
+    /**
+     * Test if a given point is inside this grid cell.
+     * @param coord
+     * @return true, if this grid cell contains the given point - otherwise
+     * false.
+     */
+    public boolean contains(Geometry coord) {
+        return polygon.contains(coord);
+    }
+
+    /**
+     * Converts a list of points to a list of grid cells.
+     * @param points This list of points.
+     * @return This list of grid cells.
+     */
+    public static List<GridCell> pointsToGridCells(
+        List<? extends Point2d> points
+    ) {
+        return pointsToGridCells(points, null);
+    }
+
+    /**
+     * Converts a list of points to a list of grid cells.
+     * Points that are not in a relevant area are ignored.
+     * @param points The list of points.
+     * @param relevantArea The relevant area.
+     * @return The list of grid cells.
+     */
+    public static List<GridCell> pointsToGridCells(
+        List<? extends Point2d> points,
+        Envelope                relevantArea
+    ) {
+        return pointsToGridCells(points, relevantArea, 0);
+    }
+
+    private static final int NEIGHBORS [][] = {
+        { -1, -1 }, // 0
+        { -1,  0 }, // 1
+        { -1, +1 }, // 2
+        {  0, +1 }, // 3
+        { +1, +1 }, // 4
+        { +1,  0 }, // 5
+        { +1, -1 }, // 6
+        {  0, -1 }  // 7
+    };
+
+    /**
+     * Generate points by extrapolating border points.
+     * @param rows (i, j) indexed map of points.
+     * @param minI min known i.
+     * @param maxI max known i.
+     * @param minJ min known j.
+     * @param maxJ max known j.
+     * @param rounds Deternine how many extra rings should be generated.
+     * @param relevantArea The relevant area.
+     * @return number of newly generated points.
+     */
+    public static int extrapolate(
+        HashMap<Integer, HashMap<Integer, Point2d>> rows,
+        int minI, int maxI,
+        int minJ, int maxJ,
+        int rounds,
+        Envelope relevantArea
+    ) {
+        Point2d [] neighbors = new Point2d[NEIGHBORS.length];
+        Point2d [] positions = new Point2d[NEIGHBORS.length];
+
+        int total = 0;
+
+        ArrayList<ArrayList<IJKey>> prio =
+            new ArrayList<ArrayList<IJKey>>(NEIGHBORS.length);
+
+        for (int i = 0; i < NEIGHBORS.length; ++i) {
+            prio.add(new ArrayList<IJKey>());
+        }
+
+        while (rounds-- > 0) {
+            for (int i = minI; i <= maxI; ++i) {
+                for (int j = minJ; j <= maxJ; ++j) {
+                    Point2d p = get(rows, i, j);
+                    if (p != null) {
+                        continue;
+                    }
+
+                    int count = 0;
+
+                    for (int k = 0; k < neighbors.length; ++k) {
+                        neighbors[k] = positions[k] = null;
+                        int dij [] = NEIGHBORS[k];
+                        Point2d n1 = get(rows, i+  dij[0], j+  dij[1]);
+                        Point2d n2 = get(rows, i+2*dij[0], j+2*dij[1]);
+                        if (n1 != null && n2 != null) {
+                            ++count;
+                        }
+                    }
+
+                    if (count > 0) {
+                        prio.get(count-1).add(new IJKey(i, j));
+                    }
+                } // for all columns
+            } // for all rows
+
+            int N = 0;
+
+            for (int l = NEIGHBORS.length-1; l >= 0; --l) {
+                ArrayList<IJKey> list = prio.get(l);
+                for (IJKey ij: list) {
+                    int i = ij.i;
+                    int j = ij.j;
+                    for (int k = 0; k < neighbors.length; ++k) {
+                        neighbors[k] = positions[k] = null;
+                        int dij [] = NEIGHBORS[k];
+                        Point2d n1 = get(rows, i+  dij[0], j+  dij[1]);
+                        Point2d n2 = get(rows, i+2*dij[0], j+2*dij[1]);
+                        if (n1 != null && n2 != null) {
+                            neighbors[k] = n1;
+                            positions[k] = n1.extrapolate(-1d, n2);
+                        }
+                    }
+
+                    Point2d avg = Point2d.average(positions);
+
+                    if (avg != null && avg.near(positions)
+                    && (relevantArea == null
+                        || relevantArea.contains(avg.x, avg.y))) {
+                        avg.i = i;
+                        avg.j = j;
+                        avg.inverseDistanceWeighting(neighbors);
+                        put(rows, avg, i, j);
+                    }
+                }
+                N += list.size();
+                list.clear();
+            }
+
+            if (N == 0) {
+                break;
+            }
+            total += N;
+        } // for all rounds
+
+        return total;
+    }
+
+    /**
+     * Converts a list of points to a list of grid cells.
+     * @param points The list of points.
+     * @param relevantArea The relevant area. If a point is
+     * not inside this area it is ignored during the build process.
+     * @param extrapolationRounds Number of extra point rings.
+     * 0 = no extrpolation.
+     * @return The list of grid cells.
+     */
+    public static List<GridCell> pointsToGridCells(
+        List<? extends Point2d> points,
+        Envelope                relevantArea,
+        int                     extrapolationRounds
+    ) {
+        int minI = Integer.MAX_VALUE;
+        int maxI = Integer.MIN_VALUE;
+        int minJ = Integer.MAX_VALUE;
+        int maxJ = Integer.MIN_VALUE;
+
+        HashMap<Integer, HashMap<Integer, Point2d>> rows =
+            new HashMap<Integer, HashMap<Integer, Point2d>>();
+
+        int culled = 0;
+
+        for (Point2d p: points) {
+
+            if (relevantArea != null && !relevantArea.contains(p.x, p.y)) {
+                ++culled;
+                continue;
+            }
+
+            if (p.i < minI) minI = p.i;
+            if (p.i > maxI) maxI = p.i;
+            if (p.j < minJ) minJ = p.j;
+            if (p.j > maxJ) maxJ = p.j;
+
+            HashMap<Integer, Point2d> row = rows.get(p.i);
+
+            if (row == null) {
+                rows.put(p.i, row = new HashMap<Integer, Point2d>());
+            }
+
+            row.put(p.j, p);
+        }
+
+        ArrayList<GridCell> cells = new ArrayList<GridCell>(points.size());
+
+        int extrapolated = extrapolate(
+            rows,
+            minI, maxI,
+            minJ, maxJ,
+            extrapolationRounds,
+            relevantArea);
+
+        for (int i = minI + 1; i <= maxI; ++i) {
+            HashMap<Integer, Point2d> row1 = rows.get(i-1);
+            HashMap<Integer, Point2d> row2 = rows.get(i);
+
+            if (row1 == null || row2 == null) {
+                continue;
+            }
+
+            for (int j = minJ + 1; j < maxJ; ++j) {
+                Point2d p1 = row1.get(j-1);
+                Point2d p2 = row1.get(j);
+                Point2d p3 = row2.get(j);
+                Point2d p4 = row2.get(j-1);
+
+                if (p1 != null && p2 != null && p3 != null && p4 != null) {
+                    cells.add(new GridCell(p1, p2, p3, p4));
+                }
+            }
+        } // for all rows
+
+        if (log.isDebugEnabled()) {
+            log.debug("culled points: " + culled);
+            log.debug("extrapolated points: " + extrapolated);
+            log.debug("min/max i: " + minI + " / " + maxI);
+            log.debug("min/max j: " + minJ + " / " + maxJ);
+            log.debug("cells found: " + cells.size());
+        }
+
+        return cells;
+    }
+
+    private static Point2d get(
+        HashMap<Integer, HashMap<Integer, Point2d>> rows,
+        int i, int j
+    ) {
+        HashMap<Integer, Point2d> row = rows.get(i);
+        return row != null ? row.get(j) : null;
+    }
+
+    private static void put(
+        HashMap<Integer, HashMap<Integer, Point2d>> rows,
+        Point2d point,
+        int i, int j
+    ) {
+        Integer I = Integer.valueOf(i);
+        HashMap<Integer, Point2d> row = rows.get(I);
+        if (row == null) {
+            rows.put(I, row = new HashMap<Integer, Point2d>());
+        }
+        row.put(j, point);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/HeightValue.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import java.io.Serializable;
+
+import java.util.Comparator;
+
+/**
+ * An attributed height value. It holds a z value, a parameter value
+ * and a layer index.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class HeightValue
+implements   Serializable
+{
+    /**
+     * Comparator to sort <code>HeightValue</code>s by their z value
+     * in reversed order.
+     */
+    public static final Comparator INV_Z_COMPARATOR = new Comparator() {
+        public int compare(Object a, Object b) {
+            HeightValue ha = (HeightValue)a;
+            HeightValue hb = (HeightValue)b;
+            if (ha.z > hb.z) return -1;
+            if (ha.z < hb.z) return +1;
+            return 0;
+        }
+    };
+
+    /**
+     * The height value.
+     */
+    public double z;
+
+    /**
+     * The parameter value.
+     */
+    public double v;
+
+    /**
+     * The layer index;
+     */
+    public int    k;
+
+    /**
+     * Constructor to create a HeightValue with a given height,
+     * parameter value and layer index.
+     * @param z The height.
+     * @param v The parameter value.
+     * @param k The layer index.
+     */
+    public HeightValue(double z, double v, int k) {
+        this.z = z;
+        this.v = v;
+        this.k = k;
+    }
+
+    /**
+     * Return the height of this HeightValue.
+     * @return the height.
+     */
+    public double getZ() {
+        return z;
+    }
+
+    /**
+     * Return the parameter value of this HeightValue.
+     * @return The parameter value.
+     */
+    public double getV() {
+        return v;
+    }
+
+    /**
+     * Returns the layer index of this HeightValue.
+     * @return The layer index.
+     */
+    public double getK() {
+        return k;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/IJKey.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import java.io.Serializable;
+
+/**
+ * Tuple (i, j) to model a pair of integers. Useful to store index pairs
+ * in maps.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class IJKey
+implements   Serializable
+{
+    /**
+     * i component of the tuple.
+     */
+    public int i;
+    /**
+     * j component of the tuple.
+     */
+    public int j;
+
+    /**
+     * Default constructor.
+     */
+    public IJKey() {
+    }
+
+    /**
+     * Constructor to set i and j.
+     * @param i The i component.
+     * @param j The j component.
+     */
+    public IJKey(int i, int j) {
+        this.i = i;
+        this.j = j;
+    }
+
+    /**
+     * Orders i and j by their values.
+     */
+    public void sort() {
+        if (i > j) {
+            int t = i;
+            i = j;
+            j = t;
+        }
+    }
+
+    /**
+     * Hashes i and j into a common value.
+     * @return the hash code.
+     */
+    @Override
+    public int hashCode() {
+        return (i << 16) | j;
+    }
+
+    /**
+     * IJKeys are considered equal if the i and j components
+     * are equal.
+     * @param obj The other IJKey
+     * @return true if the IJKeys are equal else false.
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof IJKey)) {
+            return false;
+        }
+        IJKey other = (IJKey)obj;
+        return i == other.i && j == other.j;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation2D.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation2D.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,31 +1,220 @@
-package de.intevation.gnv.math;
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.HashMap;
-import java.util.Collections;
+package de.intevation.gnv.math;
 
 import com.vividsolutions.jts.geom.Coordinate;
 import com.vividsolutions.jts.geom.Envelope;
 
-import com.vividsolutions.jts.index.quadtree.Quadtree;
+import com.vividsolutions.jts.index.strtree.STRtree;
+
+import java.util.List;
 
 import org.apache.log4j.Logger;
 
 /**
- *  @author Sascha L. Teichmann
+ * Interpolates along a given line string. This used to generate
+ * "horizontale Schnittprofile".
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public final class Interpolation2D
 {
     private static Logger log = Logger.getLogger(Interpolation2D.class);
 
+    /**
+     * If the number of input points are over this threshold
+     * some culling strategies are applied to reduce the amount of points.
+     */
+    public static final int CULL_POINT_THRESHOLD = Integer.getInteger(
+        "gnv.interpolation2d.cull.point.threshold", 1000);
+
+    /**
+     * Numerical stability epsilon.
+     */
+    public static final double EPS = 1e-6d;
+
+    /**
+     * Callback to send the interpolated values back to the
+     * caller without building large temporary strcutures.
+     */
     public interface Consumer {
-        void interpolated(Coordinate point);
+        /**
+         * Sends an interpolated point back to the called.
+         * The interpolated parameter is stored in the z component.
+         * @param point The interpolated point.
+         * @param success true if interpolation at the point
+         * succeed, else false.
+         */
+        void interpolated(Coordinate point, boolean success);
     } // interface Consumer
 
     private Interpolation2D() {
     }
 
+    /**
+     * Calculates the relevant area for a given line string.
+     * @param path The line string.
+     * @param points The sample points.
+     * @return The relevant area.
+     */
+    public static final Envelope relevantArea(
+        List<? extends Coordinate> path,
+        List<? extends Coordinate> points
+    ) {
+        return relevantArea(path, points, CULL_POINT_THRESHOLD);
+    }
+
+    /**
+     * Calculates the relevant area for a given bounding box.
+     * @param pathBBox The bounding box.
+     * @param points The sample points.
+     * @return The relevant area.
+     */
+    public static final Envelope relevantArea(
+        Envelope                   pathBBox,
+        List<? extends Coordinate> points
+    ) {
+        return relevantArea(pathBBox, points, CULL_POINT_THRESHOLD);
+    }
+
+    /**
+     * Calculates the relevant area for a given bounding box.
+     * @param pathBBox The bounding box.
+     * @param points The sample points.
+     * @param threshold If the number of sample points
+     * are below this threshold no relevant area is calculated.
+     * @return The relevant area.
+     */
+    public static final Envelope relevantArea(
+        Envelope                   pathBBox,
+        List<? extends Coordinate> points,
+        int                        threshold
+    ) {
+        return points.size() < threshold
+            ? null
+            : relevantArea(
+                pathBBox,
+                pointsBoundingBox(points));
+    }
+
+    /**
+     * Calculates the relevant area for a given line string.
+     * @param path The line string.
+     * @param points The sample points.
+     * @param threshold If the number of sample points
+     * are below this threshold no relevant area is calculated.
+     * @return The relevant area.
+     */
+    public static final Envelope relevantArea(
+        List<? extends Coordinate> path,
+        List<? extends Coordinate> points,
+        int                        threshold
+    ) {
+        return points.size() < threshold || path.isEmpty()
+            ? null
+            : relevantArea(
+                pointsBoundingBox(path),
+                pointsBoundingBox(points));
+    }
+
+    /**
+     * Heuristic function to define a 'relevant area'.
+     * @param pathBBox The bounding box of the line line string.
+     * @param pointsBBox The bounding box of the sample points.
+     * @return The relevant area.
+     */
+    public static final Envelope relevantArea(
+        Envelope pathBBox,
+        Envelope pointsBBox
+    ) {
+        double pathArea   = pathBBox.getWidth()*pathBBox.getHeight();
+        double pointsArea = pointsBBox.getWidth()*pointsBBox.getHeight();
+
+        if (pathArea > 0.8d*pointsArea) { return null; }
+
+        double nArea = 1.44d * pathArea;
+        if (nArea < 0.1d*pointsArea) nArea = 0.1d*pointsArea;
+        double w = pathBBox.getWidth();
+        double h = pathBBox.getHeight();
+        double [] d = solveQuadratic(1d, w+h, pathArea - nArea);
+
+        if (d == null) { return null; }
+
+        double extra = pos(d);
+
+        pathBBox.expandBy(extra);
+
+        return pathBBox;
+    }
+
+    /**
+     * Solves quadratic equation a*x*x + b*x + c = 0.
+     * @param a a-coefficent.
+     * @param b b-coefficent
+     * @param c c-coefficent.
+     * @return the solution of the equation, or null if not solvable.
+     */
+    public static final double [] solveQuadratic(
+        double a, double b, double c
+    ) {
+        double d = b*b - 4d*a*c;
+        if (d < 0d) { return null; }
+
+        d = Math.sqrt(d);
+        a = 1d/(2d*a);
+        b = -b;
+
+        return new double [] { a*(b + d), a*(b - d) };
+    }
+
+    /**
+     * Return the element of a two element array which
+     * is greater or equal zero.
+     * @param x The two values.
+     * @return The value which is greater or equal zero.
+     */
+    public static final double pos(double [] x) {
+        return x[0] >= 0 ? x[0] : x[1];
+    }
+
+
+    /**
+     * Calculates the bounding box of a given line string.
+     * @param path The line string.
+     * @return The bounding box.
+     */
+    public static Envelope pointsBoundingBox(
+        List<? extends Coordinate> path
+    ) {
+        int N = path.size();
+        Envelope area = new Envelope(path.get(N-1));
+
+        for (int i = N-2; i >= 0; --i) {
+            area.expandToInclude(path.get(i));
+        }
+
+        return area;
+    }
+
+    /**
+     * Interpolates linearly a number of coordinates and parameter values along
+     * a given line string path. The results are issued to a consumer.
+     * @param path The line string path.
+     * @param points The sample points.
+     * @param from Start point as a scalar value linear
+     * referenced on the line string.
+     * @param to End point of  as a scalar value linear
+     * referenced on the line string.
+     * @param steps Number of points to be interpolated.
+     * @param metrics The used metric.
+     * @param consumer The callback to retrieve the result points.
+     */
     public static void interpolate(
         List<? extends Coordinate> path,
         List<? extends Point2d>    points,
@@ -35,80 +224,33 @@
         Metrics                    metrics,
         Consumer                   consumer
     ) {
+        boolean debug = log.isDebugEnabled();
+
         int N = path.size();
         int M = points.size();
 
-        log.debug("Size of path: " + N);
-        log.debug("Size of points: " + M);
+        if (debug) {
+            log.debug("Size of path: " + N);
+            log.debug("Size of points: " + M);
+        }
 
         if (M < 1 || N < 2) { // nothing to do
             return;
         }
 
-        HashMap<Integer, ArrayList<Point2d>> map = new HashMap<Integer, ArrayList<Point2d>>();
-
-        for (int k = M-1; k >= 0; --k) {
-            Point2d p = points.get(k);
-
-            ArrayList<Point2d> list = map.get(p.j);
+        List<GridCell> cells = GridCell.pointsToGridCells(
+            points, relevantArea(path, points));
 
-            if (list == null) {
-                map.put(p.j, list = new ArrayList<Point2d>());
-            }
-            list.add(p);
-        }
-
-        double dxMax = -Double.MAX_VALUE;
-
-        for (ArrayList<Point2d> v: map.values()) {
-            Collections.sort(v, Point2d.X_COMPARATOR);
-            for (int i = 1, L = v.size(); i < L; ++i) {
-                double dx = Math.abs(v.get(i).x - v.get(i-1).x);
-                if (dx > dxMax) {
-                    dxMax = dx;
-                }
-            }
+        if (cells.isEmpty()) {
+            log.warn("no cells found");
+            return;
         }
 
-        dxMax = dxMax + 1e-5d;
-
-        map.clear();
-
-        for (int k = M-1; k >= 0; --k) {
-            Point2d p = points.get(k);
-
-            ArrayList<Point2d> list = map.get(p.i);
-
-            if (list == null) {
-                map.put(p.i, list = new ArrayList<Point2d>());
-            }
-            list.add(p);
-        }
-
-        double dyMax = -Double.MAX_VALUE;
+        // put into spatial index to speed up finding neighbors.
+        STRtree spatialIndex = new STRtree();
 
-        for (ArrayList<Point2d> v: map.values()) {
-            Collections.sort(v, Point2d.Y_COMPARATOR);
-            for (int i = 1, L = v.size(); i < L; ++i) {
-                double dy = Math.abs(v.get(i).y - v.get(i-1).y);
-                if (dy > dyMax) {
-                    dyMax = dy;
-                }
-            }
-        }
-
-        dyMax = dyMax + 1e-5d;
-
-        map = null;
-
-        log.debug("buffer size: " + dxMax + " / " + dyMax);
-
-        // put into spatial index to speed up finding neighbors.
-        Quadtree spatialIndex = new Quadtree();
-
-        for (int i = 0; i < M; ++i) {
-            Point2d p = points.get(i);
-            spatialIndex.insert(p.envelope(), p);
+        for (GridCell cell: cells) {
+            spatialIndex.insert(cell.getEnvelope(), cell);
         }
 
         LinearToMap linearToMap = new LinearToMap(
@@ -116,88 +258,77 @@
 
         double dP = (to - from)/steps;
 
-        Coordinate center = new Coordinate();
-
-        Envelope queryBuffer = new Envelope();
-
-        Point2d [] neighbors = new Point2d[4];
+        Coordinate          center      = new Coordinate();
+        Envelope            queryBuffer = new Envelope();
+        GridCell.CellFinder finder      = new GridCell.CellFinder();
 
         int missedInterpolations = 0;
-        int interpolations = 0;
+        int interpolations       = 0;
 
         for (double p = from; p <= to; p += dP) {
             if (!linearToMap.locate(p, center)) {
                 continue;
             }
             queryBuffer.init(
-                center.x - dxMax, center.x + dxMax, 
-                center.y - dyMax, center.y + dyMax);
-
-            List potential = spatialIndex.query(queryBuffer);
-
-            L1Comparator invL1 = new L1Comparator(center);
-            Collections.sort(potential, invL1);
-
-            neighbors[0] = neighbors[1] = 
-            neighbors[2] = neighbors[3] = null;
+                center.x - EPS, center.x + EPS,
+                center.y - EPS, center.y + EPS);
 
-            /* bit code of neighbors
-               0---1
-               | x |
-               2---3
-            */
+            finder.prepare(center);
+            spatialIndex.query(queryBuffer, finder);
 
-            int mask = 0;
-            // reversed order is essential here!
-            for (int i = potential.size()-1; i >= 0; --i) {
-                Point2d n = (Point2d)potential.get(i);
-                int code = n.x > center.x ? 1 : 0;
-                if (n.y > center.y) code |= 2;
-                neighbors[code] = n;
-                mask |= 1 << code;
+            GridCell found = finder.found;
+
+            if (found == null) {
+                consumer.interpolated(center, false);
+                ++missedInterpolations;
+                continue;
             }
 
-            int numNeighbors = Integer.bitCount(mask);
+            Point2d n0 = found.p1;
+            Point2d n1 = found.p2;
+            Point2d n2 = found.p3;
+            Point2d n3 = found.p4;
 
-            // only interpolate if we have all four neighbors
-            // and we do not have any gaps.
-            if (numNeighbors == 4
-            && !neighbors[0].hasIGap(neighbors[1])
-            && !neighbors[1].hasJGap(neighbors[3])
-            && !neighbors[3].hasIGap(neighbors[2])
-            && !neighbors[2].hasJGap(neighbors[0])
-            ) {
-                double z1 = interpolate(
-                    neighbors[0].x, neighbors[0].z,
-                    neighbors[1].x, neighbors[1].z,
-                    center.x);
-                double z2 = interpolate(
-                    neighbors[2].x, neighbors[2].z,
-                    neighbors[3].x, neighbors[3].z,
-                    center.x);
-                double y1 = interpolate(
-                    neighbors[0].x, neighbors[0].y,
-                    neighbors[1].x, neighbors[1].y,
-                    center.x);
-                double y2 = interpolate(
-                    neighbors[2].x, neighbors[2].y,
-                    neighbors[3].x, neighbors[3].y,
-                    center.x);
-                center.z = interpolate(
-                    y1, z1,
-                    y2, z2,
-                    center.y);
-                consumer.interpolated(center);
-                ++interpolations;
-            }
-            else {
-                ++missedInterpolations;
-            }
+            double z1 = interpolate(
+                n0.x, n0.z,
+                n1.x, n1.z,
+                center.x);
+            double z2 = interpolate(
+                n2.x, n2.z,
+                n3.x, n3.z,
+                center.x);
+            double y1 = interpolate(
+                n0.x, n0.y,
+                n1.x, n1.y,
+                center.x);
+            double y2 = interpolate(
+                n2.x, n2.y,
+                n3.x, n3.y,
+                center.x);
+            center.z = interpolate(
+                y1, z1,
+                y2, z2,
+                center.y);
+            consumer.interpolated(center, true);
+            ++interpolations;
         }
 
-        log.debug("interpolations: " + interpolations + " / " + missedInterpolations);
+        if (debug) {
+            log.debug("interpolations: " +
+                interpolations + " / " + missedInterpolations);
+        }
     }
 
+    /**
+     * Linear interpolate a value between (x1, y1) and (x2, y2) at
+     * a given x-value.
+     * @param x1 x component of first point.
+     * @param y1 y component of first point.
+     * @param x2 x component of second point.
+     * @param y2 y component of second point.
+     * @param x The x value.
+     * @return The intepolated result.
+     */
     public static final double interpolate(
         double x1, double y1,
         double x2, double y2,
@@ -211,4 +342,4 @@
         return m*x + b;
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolation3D.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,351 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+
+import com.vividsolutions.jts.index.strtree.STRtree;
+
+import java.awt.Dimension;
+
+import java.io.Serializable;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Interpolates parameter values along a given line string from surface
+ * to the sea ground to generate "Profilschnitte".
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class Interpolation3D
+implements   Serializable
+{
+    private static Logger log = Logger.getLogger(Interpolation3D.class);
+
+    /**
+     * The default width of the interpolation: {@value}
+     */
+    public static final int DEFAULT_WIDTH  = 1024;
+
+    /**
+     * The default height of the interpolation: {@value}
+     */
+    public static final int DEFAULT_HEIGHT =  768;
+
+    /**
+     * Epsilon for numerical stability.
+     */
+    public static final double EPS = 1e-6d;
+
+    /**
+     * The width of the interpolation.
+     */
+    protected int width;
+
+    /**
+     * The height of the interpolation.
+     */
+    protected int height;
+
+    /**
+     * The cell width of the interpolation in world units.
+     */
+    protected double cellWidth;
+
+    /**
+     * The cell height of the interpolation in world units.
+     */
+    protected double cellHeight;
+
+    /**
+     * The coordinates of the interpolation.
+     */
+    protected Coordinate[] coordinates;
+
+    /**
+     * The generated raster.
+     */
+    protected double [] raster;
+
+    /**
+     * The sea ground depth along the line string.
+     */
+    protected double [] depths;
+
+    /**
+     * Default constructor.
+     */
+    public Interpolation3D() {
+        this(DEFAULT_WIDTH, DEFAULT_HEIGHT);
+    }
+
+    /**
+     * Constructor to create a Interpolation3D with a given size.
+     * @param size The size of the interpolation.
+     */
+    public Interpolation3D(Dimension size) {
+        this(size.width, size.height);
+    }
+
+    /**
+     * Constructor to create a Interpolation3D with a given size.
+     * @param width The width of the interpolation.
+     * @param height the height of the interpolation.
+     */
+    public Interpolation3D(int width, int height) {
+        this.width  = width;
+        this.height = height;
+    }
+
+    /**
+     * Returns the raster height of the interpolation.
+     * @return The raster height of the interpolation.
+     */
+    public int getHeight() {
+        return height;
+    }
+
+    /**
+     * Returns the raster width of the interpolation.
+     * @return The raster width of the interpolation.
+     */
+    public int getWidth() {
+        return width;
+    }
+
+    /**
+     * Returns the cell width of the interpolation in world units.
+     * @return The cell width of the interpolation in world units.
+     */
+    public double getCellWidth() {
+        return cellWidth;
+    }
+
+    /**
+     * Returns the cell height of the interpolation in world units.
+     * @return The cell height of the interpolation in world units.
+     */
+    public double getCellHeight() {
+        return cellHeight;
+    }
+
+    /**
+     * Returns the coordinates used for the interpolation.
+     * @return the coordinates used for the interpolation.
+     */
+    public Coordinate[] getCoordinates() {
+        return coordinates;
+    }
+
+    /**
+     * Returns the generated raster.
+     * @return The generated raster.
+     */
+    public double [] getRaster() {
+        return raster;
+    }
+
+    /**
+     * Returns the depths along the line string path.
+     * @return The depth along the line string path.
+     */
+    public double [] getDepths() {
+        return depths;
+    }
+
+    /**
+     * Returns the deepest depth along the line string path.
+     * @return The deepest depth along the line string path.
+     */
+    public double getMaxDepth() {
+        double maxDepth = Double.MAX_VALUE;
+        for (int i = depths!=null?depths.length-1:0; i >= 0; --i) {
+            double d = depths[i];
+            if (!Double.isNaN(d) && d < maxDepth) {
+                maxDepth = d;
+            }
+        }
+        return maxDepth;
+    }
+
+    /**
+     * Interpolates parameters along a given line string path from the surface
+     * to the sea ground.
+     * @param path The line string path.
+     * @param points The sample points.
+     * @param from Start point in scalar terms of the line string.
+     * @param to End point in scalar terms of the line string.
+     * @param metrics The used metric.
+     * @param xyDepth The callback to query the depth at a given point.
+     * @return true if the interpolation succeeds, else false.
+     */
+    public boolean interpolate(
+        List<? extends Coordinate> path,
+        List<? extends XYColumn>   points,
+        double                     from,
+        double                     to,
+        Metrics                    metrics,
+        XYDepth                    xyDepth
+    ) {
+        boolean debug = log.isDebugEnabled();
+
+        int N = path.size();
+        int M = points.size();
+
+        if (debug) {
+            log.debug("Size of path: " + N);
+            log.debug("Size of points: " + M);
+        }
+
+        if (M < 1 || N < 2) { // nothing to do
+            return false;
+        }
+
+        List<GridCell> cells = GridCell.pointsToGridCells(
+            points, Interpolation2D.relevantArea(path, points));
+
+        if (cells.isEmpty()) {
+            log.warn("no cells found");
+            return false;
+        }
+
+        // put into spatial index to speed up finding neighbors.
+        STRtree spatialIndex = new STRtree();
+
+        for (GridCell cell: cells) {
+            spatialIndex.insert(cell.getEnvelope(), cell);
+        }
+
+        LinearToMap linearToMap = new LinearToMap(
+            path, from, to, metrics);
+
+        double [] depths = new double[width];
+        Arrays.fill(depths, Double.NaN);
+
+        Coordinate[] coordinates = new Coordinate[width];
+
+        double cellWidth = (to - from)/width;
+
+        double maxDepth = Double.MAX_VALUE;
+
+        int i = 0;
+        Coordinate center = new Coordinate();
+        for (double p = cellWidth*0.5; i < depths.length; ++i, p += cellWidth) {
+            if (linearToMap.locate(p, center)) {
+                coordinates[i] = (Coordinate) center.clone();
+                double depth = xyDepth.depth(center);
+                depths[i] = depth;
+                if (depth < maxDepth) {
+                    maxDepth = depth;
+                }
+            }
+        }
+
+        if (maxDepth == Double.MAX_VALUE) {
+            log.warn("no depth found -> no interpolation");
+            return false;
+        }
+
+        double cellHeight = Math.abs(maxDepth)/height;
+
+        if (debug) {
+            log.debug("max depth found: " + maxDepth);
+            log.debug("cell size: " + cellWidth + " x " + cellHeight);
+        }
+
+        double [] raster = new double[width*height];
+        Arrays.fill(raster, Double.NaN);
+
+        Envelope            queryBuffer  = new Envelope();
+        GridCell.CellFinder finder       = new GridCell.CellFinder();
+
+        i = 0;
+        for (double p = cellWidth*0.5; i < depths.length; ++i, p += cellWidth) {
+            double depth = depths[i];
+            if (Double.isNaN(depth) || depth >= 0d) {
+                continue;
+            }
+            linearToMap.locate(p, center);
+
+            queryBuffer.init(
+                center.x - EPS, center.x + EPS,
+                center.y - EPS, center.y + EPS);
+
+            finder.prepare(center);
+            spatialIndex.query(queryBuffer, finder);
+
+            GridCell found = finder.found;
+
+            if (found == null) {
+                continue;
+            }
+
+            XYColumn n0 = (XYColumn)found.p1;
+            XYColumn n1 = (XYColumn)found.p2;
+            XYColumn n2 = (XYColumn)found.p3;
+            XYColumn n3 = (XYColumn)found.p4;
+
+            if (n0.prepare(xyDepth)
+            &&  n1.prepare(xyDepth)
+            &&  n2.prepare(xyDepth)
+            &&  n3.prepare(xyDepth)
+            ) {
+                double y1 = Interpolation2D.interpolate(
+                    n0.x, n0.y,
+                    n1.x, n1.y,
+                    center.x);
+                double y2 = Interpolation2D.interpolate(
+                    n2.x, n2.y,
+                    n3.x, n3.y,
+                    center.x);
+                double z = -cellHeight*0.5;
+                for (int j = i;
+                    j < raster.length && z >= depth;
+                    z -= cellHeight, j += width) {
+
+                    double v0 = n0.value(z);
+                    double v1 = n1.value(z);
+                    double v2 = n2.value(z);
+                    double v3 = n3.value(z);
+
+                    double z1 = Interpolation2D.interpolate(
+                        n0.x, v0,
+                        n1.x, v1,
+                        center.x);
+                    double z2 = Interpolation2D.interpolate(
+                        n2.x, v2,
+                        n3.x, v3,
+                        center.x);
+                    double value = Interpolation2D.interpolate(
+                        y1, z1,
+                        y2, z2,
+                        center.y);
+                    raster[j] = value;
+                }
+                // XXX: Adjusted depth to create no gap
+                // between last value and ground.
+                depths[i] = z+0.5d*cellHeight;
+            } // down the x/y column
+        } // all along the track
+
+        this.coordinates = coordinates;
+        this.depths      = depths;
+        this.raster      = raster;
+        this.cellWidth   = cellWidth;
+        this.cellHeight  = cellHeight;
+
+        return true;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolator.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Interpolator.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,12 +1,29 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.math;
 
 import com.vividsolutions.jts.geom.Coordinate;
 
 /**
- *  @author Sascha L. Teichmann
+ * Implementations of this interface interpolate coordinates
+ * a line at a given point determined by a factor t (0 &lt;= t &lt;= 1).<br>
+ * If t = 0 the start point of the line is used.<br>
+ * If t = 1 the start point of the line is used.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public interface Interpolator
 {
+    /**
+     * Interpolates a point along a line with a given factor between 0 and 1.
+     * @param t The factor.
+     * @param v The result of the interpolation is stored in this coordinate.
+     */
     void interpolate(double t, Coordinate v);
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/L1Comparator.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/L1Comparator.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,30 +1,78 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.math;
 
+import com.vividsolutions.jts.geom.Coordinate;
+
 import java.util.Comparator;
 
-import com.vividsolutions.jts.geom.Coordinate;
-
 /**
- *  @author Sascha L. Teichmann
+ * Compares two coordinates a and b by their L1(Manhattan) distance
+ * relative to a reference point r.
+ * da = L1(a, r)<br>
+ * db = L1(b, r)<br>
+ * -1 if da &lt; db, +1 if da &gt; db, 0 else.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public  class L1Comparator
 implements    Comparator
 {
     private Coordinate ref;
 
+    /**
+     * Default constructor.
+     */
+    public L1Comparator() {
+    }
+
+    /**
+     * Constructor to create a L1Comparator with a given reference point.
+     * @param ref The reference point.
+     */
     public L1Comparator(Coordinate ref) {
         this.ref = ref;
     }
 
+    /**
+     * Explicitly sets the reference point.
+     * @param ref The reference point.
+     */
+    public void setReference(Coordinate ref) {
+        this.ref = ref;
+    }
+
+    /**
+     * Compares to coordinate by their L1 distance to the reference point.
+     * @param a The first coordinate.
+     * @param b The second coordinate.
+     * @return -1 if L1(a, ref) &lt; L1(b, ref),
+     * +1 if L1(a, ref) &gt; L1(b, ref), 0 else.
+     */
     public int compare(Object a, Object b) {
         Coordinate pa = (Coordinate)a;
         Coordinate pb = (Coordinate)b;
-        double da = Point2d.L1(ref, pa);
-        double db = Point2d.L1(ref, pb);
+        double da = L1(ref, pa);
+        double db = L1(ref, pb);
         if (da < db) return -1;
         if (da > db) return +1;
         return 0;
     }
+
+    /**
+     * Computes the L1 distance between two points a and b:<br>
+     * L1(a, b) = abs(a.x - b.x) + abs(a.y - b.y)
+     * @param a The first point.
+     * @param b The second point.
+     * @return The L1 distance.
+     */
+    public static double L1(Coordinate a, Coordinate b) {
+        return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
+    }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
-
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearFunction.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearFunction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,30 +1,95 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.math;
 
+import org.apache.commons.math.FunctionEvaluationException;
+
+import org.apache.commons.math.analysis.UnivariateRealFunction;
+
 import org.apache.commons.math.optimization.fitting.ParametricRealFunction;
 
-import org.apache.commons.math.FunctionEvaluationException;
-
 /**
- *  @author Sascha L. Teichmann
+ * Models a linear function to be usable in the fitting framework of
+ * the Apache Commons Mathematics Library.
+ *
+ *  @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class LinearFunction
 implements   ParametricRealFunction
 {
+    /**
+     * Instance to prevent needless creations of instances.
+     */
     public static final LinearFunction INSTANCE = new LinearFunction();
 
+    /**
+     * Specialized class to be useful in function evaluating
+     * in the Apache Commons Mathematics Library.
+     */
+    public static class Univariate
+    implements          UnivariateRealFunction
+    {
+        /**
+         * The linear scaling factor.
+         */
+        protected double m;
+        /**
+         * The linear offset.
+         */
+        protected double b;
+
+        /**
+         * Default constructor.
+         */
+        public Univariate() {
+        }
+
+        /**
+         * Constructor to create a Univariate with the linear parameters
+         * of the line between (x1, y1) and (x2, y2).
+         * @param x1 The x coordinate of the first point.
+         * @param y1 The y coordinate of the first point.
+         * @param x2 The x coordinate of the second point.
+         * @param y2 The y coordinate of the second point.
+         */
+        public Univariate(double x1, double y1, double x2, double y2) {
+            if (y1 == y2) {
+                m = 0d;
+                b = (x1 + x2)*0.5d;
+            }
+            else {
+                m = (x1 - x2)/(y1 - y2);
+                b = y1 - m*x1;
+            }
+        }
+
+        public double value(double x) {
+            return m*x + b;
+        }
+    } // class Univariate
+
+    /**
+     * Default constructor.
+     */
     public LinearFunction() {
     }
 
     public double value(double x, double [] parameters)
-    throws FunctionEvaluationException 
+    throws FunctionEvaluationException
     {
         return x*parameters[0] + parameters[1];
     }
 
-    public double [] gradient(double x, double [] parameters) 
-    throws FunctionEvaluationException 
+    public double [] gradient(double x, double [] parameters)
+    throws FunctionEvaluationException
     {
         return new double [] { x, 1f };
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearMetrics.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearMetrics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,16 +1,32 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.math;
 
 import com.vividsolutions.jts.geom.Coordinate;
 
 /**
- *  @author Sascha L. Teichmann
+ * Implements {@link de.intevation.gnv.math.Metrics}
+ * for linear interpolations and distance measurements.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public final class LinearMetrics
 implements         Metrics
 {
+    /**
+     * Instance to prevent needless creations of instances.
+     */
     public static final Metrics INSTANCE =
         new LinearMetrics();
 
+    /**
+     * Implements the corresponding linear interpolator.
+     */
     public static final class LinearInterpolator
     implements                Interpolator
     {
@@ -19,6 +35,12 @@
         private double my;
         private double by;
 
+        /**
+         * Constructor to create a linear interpolator between two
+         * given points.
+         * @param p1 The first point.
+         * @param p2 The second point.
+         */
         public LinearInterpolator(Coordinate p1, Coordinate p2) {
 
             /*
@@ -56,4 +78,4 @@
         return new LinearInterpolator(p1, p2);
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearToMap.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/LinearToMap.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,16 +1,32 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.math;
 
 import com.vividsolutions.jts.geom.Coordinate;
 
+import java.util.Iterator;
 import java.util.List;
-import java.util.Iterator;
 import java.util.NoSuchElementException;
 
 /**
- *  @author Sascha L. Teichmann
+ * Given a list of line segments instances of this class are able
+ * to span a metric system between a start and an end point
+ * represented as scalar values to 2D coordinate on the
+ * course of the segments.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class LinearToMap
 {
+    /**
+     * Represents a segment of the line string.
+     */
     public static final class Range {
         private Range next;
 
@@ -23,11 +39,25 @@
 
         private Interpolator interpolator;
 
+        /**
+         * Default constructor.
+         */
         public Range() {
         }
 
+        /**
+         * Constructor to create a segment that maps
+         * a coordinate pair to two scalar values.
+         * Interpolations inside this segment are done with
+         * a given interpolator.
+         * @param from Start point of the segment.
+         * @param to End point of the segment.
+         * @param interpolator The interpolator.
+         * @param p1 The scalar value mapped to the start point.
+         * @param p2 The scalar value mappend to the end point.
+         */
         public Range(
-            double       from, 
+            double       from,
             double       to,
             Interpolator interpolator,
             Coordinate   p1,
@@ -44,32 +74,73 @@
                 : 1.0d/(to - from);
         }
 
+        /**
+         * Interpolated a coordinate on the segment given a scalar value
+         * between the start and end point of the range.
+         * @param x The scalar value.
+         * @param v The interpolated value is stored here.
+         */
         public void eval(double x, Coordinate v) {
             interpolator.interpolate((x - from)*b, v);
         }
 
+        /**
+         * Checks if a given value is inside this segment.
+         * @param x The value to test
+         * @return true if inside, else false.
+         */
         public boolean inside(double x) {
             return x >= from && x <= to;
         }
 
+        /**
+         * Returns the start point of this segment.
+         * @return The start point.
+         */
         public Coordinate startPoint() {
             return p1;
         }
 
+        /**
+         * Return the end point of this segment.
+         * @return The end point.
+         */
         public Coordinate endPoint() {
             return p2;
         }
     } // class Range
 
+    /**
+     * The head of the internal range list.
+     */
     protected Range head;
+
+    /**
+     * The last accessed segment. Used to accelerate
+     * the access of the right segment.
+     */
     protected Range last;
 
+    /**
+     * Default constructor.
+     */
     public LinearToMap() {
     }
 
+    /**
+     * Constructor to create a LinearToMap that maps
+     * given scalar values to coordinates of a given
+     * list of line segments.
+     * @param path The list of line segments.
+     * @param from The start value mapped to the start point
+     * of the first line segment.
+     * @param to The end value mapped to the end point of
+     * the last line segment.
+     * @param metrics The metric used to span the 2D space.
+     */
     public LinearToMap(
-        List<? extends Coordinate> path, 
-        double                     from, 
+        List<? extends Coordinate> path,
+        double                     from,
         double                     to,
         Metrics                    metrics
     ) {
@@ -108,6 +179,11 @@
         }
     }
 
+    /**
+     * Returns a segment on which a given value is found.
+     * @param diagramX The value.
+     * @return The segment or null if no matching segment was found.
+     */
     protected Range locateRange(double diagramX) {
 
         if (last != null && last.inside(diagramX)) {
@@ -125,6 +201,13 @@
         return null;
     }
 
+    /**
+     * Interpolates a coordinate at a given scalar position.
+     * @param diagramX The scalar position.
+     * @param v The interpolated coordinate is stored here.
+     * @return true if the scalar position is inside the
+     * spanned range of the line string, else false.
+     */
     public boolean locate(double diagramX, Coordinate v) {
         Range range = locateRange(diagramX);
         if (range == null) {
@@ -134,8 +217,15 @@
         return true;
     }
 
+    /**
+     * Returns the length of a given line string using
+     * a given metric.
+     * @param path The line string.
+     * @param metrics The used metric.
+     * @return The length of the line string.
+     */
     public static double length(
-        List<? extends Coordinate> path, 
+        List<? extends Coordinate> path,
         Metrics                    metrics
     ) {
         double sum = 0d;
@@ -147,6 +237,10 @@
         return sum;
     }
 
+    /**
+     * Return the number of segments in this map.
+     * @return the number of segments.
+     */
     public int numRanges() {
         int count = 0;
         Range current = head;
@@ -157,6 +251,10 @@
         return count;
     }
 
+    /**
+     * Returns an iterator over all segments of this map.
+     * @return The iterator.
+     */
     public Iterator ranges() {
         return new Iterator() {
 
@@ -181,4 +279,4 @@
         };
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Metrics.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Metrics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,14 +1,38 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.math;
 
 import com.vividsolutions.jts.geom.Coordinate;
 
 /**
- *  @author Sascha L. Teichmann
+ * Implementations provides the ability to calculate the distance between
+ * two points ans support for interpolating points between two points.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public interface Metrics
 {
+    /**
+     * Calculates the distance between two given points.
+     * @param p1 The first point.
+     * @param p2 The second point.
+     * @return The distance.
+     */
     double distance(Coordinate p1, Coordinate p2);
 
+    /**
+     * Return an interpolator which allows interpolations between
+     * two given points.
+     * @param p1 The first point.
+     * @param p2 The second point.
+     * @return The interpolator.
+     */
     Interpolator getInterpolator(Coordinate p1, Coordinate p2);
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/math/Point2d.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/Point2d.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,38 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.math;
 
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+
 import java.util.Comparator;
 
-import com.vividsolutions.jts.geom.Envelope;
-import com.vividsolutions.jts.geom.Coordinate;
+import org.apache.log4j.Logger;
 
 /**
- *  @author Sascha L. Teichmann
+ * Point which besides the x, y, z coodinates has an index i, j pair
+ * to model neighborhood.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class Point2d
 extends      Coordinate
 {
+    private static Logger log = Logger.getLogger(Point2d.class);
+
+    /**
+     * Numerical tolerance epsilon: {@value}
+     */
     public static final double EPSILON = 1e-3d;
 
+    /**
+     * Compares two Point2ds by their x coordinates
+     */
     public static final Comparator X_COMPARATOR = new Comparator() {
         public int compare(Object a, Object b) {
             double xa = ((Coordinate)a).x;
@@ -23,6 +43,9 @@
         }
     };
 
+    /**
+     * Compares two Point2ds by their y coordinates.
+     */
     public static final Comparator Y_COMPARATOR = new Comparator() {
         public int compare(Object a, Object b) {
             double ya = ((Coordinate)a).y;
@@ -33,63 +56,239 @@
         }
     };
 
-    public static class InverseL1Comparator
-    implements          Comparator
-    {
-        private Point2d ref;
-
-        public InverseL1Comparator(Point2d ref) {
-            this.ref = ref;
-        }
-
-        public int compare(Object a, Object b) {
-            Point2d pa = (Point2d)a;
-            Point2d pb = (Point2d)b;
-            double da = ref.L1(pa);
-            double db = ref.L1(pb);
-            if (da < db) return -1;
-            if (da > db) return +1;
-            return 0;
-        }
-    } // class InverseL1Comparator
-
+    /**
+     * The i index of this Point2d.
+     */
     public int i;
+    /**
+     * The j index of this Point2d.
+     */
     public int j;
 
+    /**
+     * Default constructor.
+     */
     public Point2d() {
     }
 
+    /**
+     * Constructor setting x and y coordinate.
+     * @param x The x coordinate.
+     * @param y The y coordinate.
+     */
+    public Point2d(double x, double y) {
+        super(x, y);
+    }
+
+    /**
+     * Constructor setting x, y and i, j.
+     * @param x The x coordinate.
+     * @param y The y coordinate.
+     * @param i The i index.
+     * @param j The j index.
+     */
+    public Point2d(double x, double y, int i, int j) {
+        super(x, y);
+        this.i = i;
+        this.j = j;
+    }
+
+    /**
+     * Constructor setting x, y, z and i, j.
+     * @param x The x coordinate.
+     * @param y The y coordinate.
+     * @param z The z coordinate.
+     * @param i The i index.
+     * @param j The j index.
+     */
     public Point2d(double x, double y, double z, int i, int j) {
         super(x, y, z);
         this.i = i;
         this.j = j;
     }
 
-
+    /**
+     * Calculates the L1 distance to another Point2d.
+     * @param other The other Point2d.
+     * @return The L1 distance.
+     */
     public double L1(Point2d other) {
-        return L1(this, other);
+        return L1Comparator.L1(this, other);
     }
 
-    public static double L1(Coordinate a, Coordinate b) {
-        return Math.abs(a.x - b.x) + Math.abs(a.y - b.y);
-    }
-
+    /**
+     * Creates an envelope around this Point2d with
+     * the numerical tolerance of {@link #EPSILON}.
+     * @return The envelope.
+     */
     public Envelope envelope() {
         return envelope(EPSILON);
     }
 
+    /**
+     *Creates an envelope around this Point2d with
+     * a given tolerance.
+     * @param epsilon The tolerance in all directions.
+     * @return The envelope.
+     */
     public Envelope envelope(double epsilon) {
         return new Envelope(
             x-epsilon, x+epsilon,
             y-epsilon, y+epsilon);
     }
 
+    /**
+     * Given this and another Point2d it looks if there is
+     * a gap between the in points in i index direction.
+     * @param other The other Point2d.
+     * @return true if there is is a gap, else false.
+     */
     public boolean hasIGap(Point2d other) {
         return Math.abs(i - other.i) > 1;
     }
 
+    /**
+     * Given this and another Point2d it looks if there is
+     * a gap between the in points in j index direction.
+     * @param other The other Point2d.
+     * @return true if there is is a gap, else false.
+     */
     public boolean hasJGap(Point2d other) {
         return Math.abs(j - other.j) > 1;
     }
+
+    /**
+     * Given this and another Point2d a new Point2d is
+     * created via {@link #newPoint() }. The x, y coordinate
+     * of the new point is on the line of this and the other
+     * given point at a given scaling point.
+     * @param t The scaling factor.
+     * @param other The other point.
+     * @return The new Point2d.
+     */
+    public Point2d extrapolate(double t, Point2d other) {
+        if (other == null) {
+            return null;
+        }
+        Point2d p = newPoint();
+        p.x = t*(other.x - x) + x;
+        p.y = t*(other.y - y) + y;
+        return p;
+    }
+
+    /**
+     * Creates a new Point2d or an instance of a subclass.
+     * Override this in subclasses.
+     * @return The new Point2d.
+     */
+    public Point2d newPoint() {
+        return new Point2d(0d, 0d);
+    }
+
+    /**
+     * Creates a new Point2d or an instance of a subclass
+     * at a given coordinate.
+     * Override this in subclasses.
+     * @param x The x coordinate.
+     * @param y The y coordinate.
+     * @return The new point.
+     */
+    public Point2d newPoint(double x, double y) {
+        return new Point2d(x, y);
+    }
+
+    /**
+     * Sets the z value to the inverse distance weighting (IDW) value
+     * of the z values of a set of given points.
+     * @param ps The points from wich the z values are taken
+     * to calculate the IDW.
+     */
+    public void inverseDistanceWeighting(Point2d [] ps) {
+
+        double sum = 0d;
+
+        double [] d = new double[ps.length];
+
+        for (int i = 0; i < ps.length; ++i) {
+            Point2d p = ps[i];
+            if (p != null) {
+                double di = distance(p);
+                if (di < 1e-5d) { z = p.z; return; }
+                di = 1d/di;
+                d[i] = di;
+                sum += di;
+            }
+        }
+
+        if (sum == 0d) {
+            return;
+        }
+
+        double v = 0d;
+
+        for (int i = 0; i < ps.length; ++i) {
+            Point2d p = ps[i];
+            if (p != null) {
+                v += p.z*d[i];
+            }
+        }
+        z = v/sum;
+    }
+
+    /**
+     * Creates a new point via {@link #newPoint() } with the
+     * x,y coordinates of the center of a given set of
+     * coordinates.
+     * @param ps The points from which the x,y coordinates are
+     * taken to calculate the center.
+     * @return The new center point.
+     */
+    public static Point2d average(Point2d [] ps) {
+
+        Point2d p = null;
+        int count = 0;
+
+        for (int i = 0; i < ps.length; ++i) {
+            Point2d t = ps[i];
+            if (t != null) {
+                ++count;
+                if (p == null) {
+                    p = t.newPoint(t.x, t.y);
+                }
+                else {
+                    p.x += t.x;
+                    p.y += t.y;
+                }
+            }
+        }
+
+        if (p != null) {
+            double s = 1d/count;
+            p.x *= s;
+            p.y *= s;
+        }
+
+        return p;
+    }
+
+    /**
+     * Checks if this Point2d is near to at least one point
+     * out of a given set of points. Near is defined by an
+     * euclidian distance small than {@link #EPSILON}.
+     * @param ps The set of points to be tested.
+     * @return true if this Point2d is near to one of the given
+     * points, else false.
+     */
+    public boolean near(Point2d [] ps) {
+
+        for (int i = 0; i < ps.length; ++i) {
+            Point2d p = ps[i];
+            if (p != null && distance(p) > EPSILON) {
+                return false;
+            }
+        }
+
+        return true;
+    }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/QueriedXYDepth.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import com.vividsolutions.jts.geom.Coordinate;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.geobackend.base.query.QueryExecutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
+
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+
+import de.intevation.gnv.geobackend.sde.datasources.RasterObject;
+
+import de.intevation.gnv.utils.WKTUtils;
+
+import java.lang.ref.SoftReference;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This implementation uses the geo backend to query a depth via
+ * a raster layer stored in the database.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class QueriedXYDepth
+implements   XYDepth
+{
+    private static Logger log = Logger.getLogger(QueriedXYDepth.class);
+
+    private static final String queryID = "rasterQuery";
+
+    private QueryExecutor queryExecutor;
+
+    private ArrayList<SoftReference<RasterObject>> rasterData;
+
+    private RasterObject last;
+
+    private int interpolation;
+
+    /**
+     * Default construtor. Interpolation method is bilinear.
+     */
+    public QueriedXYDepth() {
+        this(RasterObject.BILINEAR);
+    }
+
+    /**
+     * Constructor to create a QueriedXYDepth with a given interpolation
+     * method.
+     * @param interpolation The interpolation method.
+     */
+    public QueriedXYDepth(int interpolation) {
+        this.interpolation = interpolation;
+        rasterData    = new ArrayList<SoftReference<RasterObject>>();
+        queryExecutor = QueryExecutorFactory.getInstance().getQueryExecutor();
+    }
+
+    public double depth(Coordinate coordinate) {
+        double resultValue = Double.NaN;
+
+        RasterObject ro = getRasterObject(coordinate);
+
+        if (ro == null) {
+            try {
+                String[] filterValues =
+                    new String[] { WKTUtils.toWKT(coordinate) };
+                Collection<Result> result = queryExecutor.executeQuery(
+                    queryID, filterValues);
+                for (Result row: result) {
+                    if ((ro = (RasterObject)row.getObject(0)) != null) {
+                        rasterData.add(
+                            new SoftReference<RasterObject>(last = ro));
+                    }
+                    break;
+                }
+            } catch (QueryException e) {
+                log.error(e, e);
+            }
+        }
+        return ro != null
+            ? ro.getValue(coordinate, interpolation)
+            : Double.NaN;
+    }
+
+    private RasterObject getRasterObject(Coordinate coordinate) {
+        if (last != null && last.contains(coordinate)) {
+            return last;
+        }
+        for (int i = rasterData.size()-1; i >= 0; --i) {
+            SoftReference<RasterObject> ref = rasterData.get(i);
+            RasterObject ro = ref.get();
+            if (ro != null && ro.contains(coordinate)) {
+                return last = ro;
+            }
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/XYColumn.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.MathException;
+
+import org.apache.commons.math.analysis.UnivariateRealFunction;
+
+import org.apache.commons.math.analysis.interpolation.SplineInterpolator;
+import org.apache.commons.math.analysis.interpolation.UnivariateRealInterpolator;
+
+import org.apache.log4j.Logger;
+
+/**
+ * A column of discrete attributed height values located at a point.
+ * Values between the discrete height values are interpolated.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class XYColumn
+extends      Point2d
+implements   UnivariateRealFunction
+{
+    private static Logger log = Logger.getLogger(XYColumn.class);
+
+    /**
+     * The list of discrete height values.
+     */
+    protected List<HeightValue> values;
+
+    /**
+     * The curve used to interpolate the points between the
+     * discrete height values.
+     */
+    protected transient UnivariateRealFunction curve;
+
+    /**
+     * Default constructor.
+     */
+    public XYColumn() {
+        values = new ArrayList<HeightValue>();
+    }
+
+    /**
+     * Constructor to create an XYColumn with a given (x, y) coordinate
+     * and an (i, j) index tuple.
+     * @param x The x coordinate.
+     * @param y The y coordinate.
+     * @param i The i component.
+     * @param j The j component.
+     */
+    public XYColumn(double x, double y, int i, int j) {
+        super(x, y, i, j);
+        values = new ArrayList<HeightValue>();
+    }
+
+    /**
+     * Adds a given height value to the list of height values.
+     * @param value The height value.
+     */
+    public void add(HeightValue value) {
+        values.add(value);
+    }
+
+    /**
+     * Returns the list of height values.
+     * @return The list of height values.
+     */
+    public List<HeightValue> getValues() {
+        return values;
+    }
+
+    public double value(double depth) {
+        try {
+            if (curve != null) {
+                HeightValue h = values.get(0);
+                // extrapolate beyond boundaries by repeating
+                if (depth > h.z) return h.v;
+                h = values.get(values.size()-1);
+                if (depth < h.z) return h.v;
+                return curve.value(depth);
+            }
+        }
+        catch (FunctionEvaluationException fee) {
+            log.error("evaluation failed", fee);
+        }
+
+        return Double.NaN;
+    }
+
+    /**
+     * Prepares this XYColumn to be queried. A given XYDepth
+     * object is used to fill the values to a certain depth.
+     * @param xyDepth To figure out the depth a the cordinate.
+     * @return true if preparation succeeds else false.
+     */
+    public boolean prepare(XYDepth xyDepth) {
+        if (curve == null) {
+            int N = values.size();
+            if (N == 0) {
+                log.error("no points for interpolation");
+                return false;
+            }
+
+            if (N == 1) {
+                // only one value -> constant function
+                curve = new ConstantFunction(values.get(0).v);
+            }
+            else { // more than on value
+                double depth = xyDepth.depth(this);
+                Collections.sort(values, HeightValue.INV_Z_COMPARATOR);
+
+                // if there is no value at 0 repeat first value
+                HeightValue first = values.get(0);
+                if (first.z < 0d) {
+                    values.add(0, new HeightValue(0d, first.v, first.k-1));
+                    ++N;
+                }
+
+                // if there is no value at depth repeat last value
+                HeightValue last = values.get(N-1);
+                if (last.z > depth) {
+                    values.add(new HeightValue(depth, last.v, last.k+1));
+                    ++N;
+                }
+                if (N < 3) { // interpolate linear
+                    first = values.get(0);
+                    last  = values.get(N-1);
+                    curve = new LinearFunction.Univariate(
+                        first.z, first.v,
+                        last.z,  last.v);
+                }
+                else { // higher degree interpolation
+                    double [] z = new double[N];
+                    double [] v = new double[N];
+                    for (int i = 0; i < N; ++i) {
+                        HeightValue h = values.get(N-1-i);
+                        z[i] = h.z;
+                        v[i] = h.v;
+                    }
+                    try {
+                        curve = getInterpolator().interpolate(z, v);
+                    }
+                    catch (MathException me) {
+                        log.error("interpolation failed", me);
+                        return false;
+                    }
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Returns the interpolator used to interpolate the values between
+     * the discrete height values. This class returns an instance of
+     * {@link org.apache.commons.math.analysis.interpolation.SplineInterpolator}.
+     * Override this if you want to use another kind of interpolation.
+     * @return The interpolator to be used.
+     */
+    protected UnivariateRealInterpolator getInterpolator() {
+        return new SplineInterpolator();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/XYDepth.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.math;
+
+import com.vividsolutions.jts.geom.Coordinate;
+
+/**
+ * Interface to encapsulate the query of the depth at a given point.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public interface XYDepth
+{
+    /**
+     * Returns the depth at a given coordinate. Negative
+     * values are below the water surface.
+     * @param coordinate The coordinate where to take the depth.
+     * @return The depth at the queried coordinate. NaN is no
+     * depth is available at the given point.
+     */
+    double depth(Coordinate coordinate);
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/math/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Classes and interface to do the different kinds of cross sections.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,25 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.profile.horizontal;
 
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.gnv.artifacts.GNVArtifactBase;
+
 import org.apache.log4j.Logger;
+
 import org.w3c.dom.Document;
 
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.artifacts.CallContext;
-import de.intevation.gnv.artifacts.GNVArtifactBase;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class HorizontalProfileArtifact extends GNVArtifactBase {
 
@@ -35,24 +42,21 @@
         this.name = "horizontalProfile";
     }
 
-    /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)
-     */
-    @Override
-    public Document describe(Document data, CallContext context) {
-        log.debug("HorizontalProfileArtifact.describe");
-        return super.createDescibeOutput(context.getMeta(), 
-                                         super.identifier,
-                                         this.getIncludeUIFromDocument(data));
-    }
 
     /**
      * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String,
-     *      de.intevation.artifacts.ArtifactFactory, java.lang.Object)
+     * de.intevation.artifacts.ArtifactFactory, java.lang.Object,
+     * org.w3c.dom.Document)
      */
     @Override
-    public void setup(String identifier, ArtifactFactory factory, Object context) {
+    public void setup(
+        String identifier,
+        ArtifactFactory factory,
+        Object context,
+        CallMeta meta,
+        Document data
+    ) {
         log.debug("HorizontalProfileArtifact.setup");
-        super.setup(identifier, factory, context);
+        super.setup(identifier, factory, context, meta, data);
     }
 }
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileInstantaneousPointArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileInstantaneousPointArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,13 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.profile.horizontal;
 
 import org.apache.log4j.Logger;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class HorizontalProfileInstantaneousPointArtifact extends
                                                         HorizontalProfileArtifact {
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,13 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.profile.horizontal;
 
 import org.apache.log4j.Logger;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class HorizontalProfileMeshArtifact extends HorizontalProfileArtifact {
     /**
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshCrossArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/HorizontalProfileMeshCrossArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,12 +1,17 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.profile.horizontal;
 
 import org.apache.log4j.Logger;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class HorizontalProfileMeshCrossArtifact extends
@@ -21,7 +26,7 @@
      */
     private static Logger log = Logger
             .getLogger(HorizontalProfileMeshCrossArtifact.class);
-    
+
     /**
      * Constructor
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontal/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains classes providing specific artifacts representing
+'Horizontalprofile'.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontalcrosssection/HorizontalCrossSectionMeshArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,25 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.profile.horizontalcrosssection;
 
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.gnv.artifacts.GNVArtifactBase;
+
 import org.apache.log4j.Logger;
+
 import org.w3c.dom.Document;
 
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.artifacts.CallContext;
-import de.intevation.gnv.artifacts.GNVArtifactBase;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class HorizontalCrossSectionMeshArtifact extends GNVArtifactBase {
     /**
@@ -34,25 +41,38 @@
         log.debug("HorizontalCrossSectionMeshArtifact.Constructor");
         this.name = "horizontalCrossSectionMesh";
     }
-    
+
+
+   /**
+    * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String,
+    * de.intevation.artifacts.ArtifactFactory, java.lang.Object,
+    * org.w3c.dom.Document)
+    */
+    @Override
+    public void setup(
+        String          identifier,
+        ArtifactFactory factory,
+        Object          context,
+        CallMeta        meta,
+        Document        data
+    ) {
+        log.debug("HorizontalCrossSectionMeshArtifact.setup");
+        super.setup(identifier, factory, context, meta, data);
+    }
+
+
     /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)
+     * This method is called just before an artifact is exported. It removes all
+     * data which should not serialized into an export.
+     *
+     * @param context CallContext object.
      */
     @Override
-    public Document describe(Document data, CallContext context) {
-        log.debug("HorizontalCrossSectionMeshArtifact.describe");
-        return super.createDescibeOutput(context.getMeta(), 
-                super.identifier,
-                this.getIncludeUIFromDocument(data));
-    }
+    public void cleanup(Object context) {
+        if (current != null)
+            current.cleanup(context);
 
-    /**
-     * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String,
-     *      de.intevation.artifacts.ArtifactFactory, java.lang.Object)
-     */
-    @Override
-    public void setup(String identifier, ArtifactFactory factory, Object context) {
-        log.debug("HorizontalCrossSectionMeshArtifact.setup");
-        super.setup(identifier, factory, context);
+        super.cleanup(context);
     }
 }
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/profile/horizontalcrosssection/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains classes providing specific artifacts representing
+'Horizontalschnitte'.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+DOCUMENT ME!
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,25 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.profile.vertical;
 
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.gnv.artifacts.GNVArtifactBase;
+
 import org.apache.log4j.Logger;
+
 import org.w3c.dom.Document;
 
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.artifacts.CallContext;
-import de.intevation.gnv.artifacts.GNVArtifactBase;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class VerticalProfileArtifact extends GNVArtifactBase {
     /**
@@ -34,24 +41,22 @@
         this.name = "verticalProfile";
     }
 
-    /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)
-     */
-    @Override
-    public Document describe(Document data, CallContext context) {
-        log.debug("VerticalProfileArtifact.describe");
-        return super.createDescibeOutput(context.getMeta(), 
-                super.identifier,
-                this.getIncludeUIFromDocument(data));
-    }
 
     /**
      * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String,
-     *      de.intevation.artifacts.ArtifactFactory, java.lang.Object)
+     *      de.intevation.artifacts.ArtifactFactory, java.lang.Object,
+     *      org.w3c.dom.Document)
      */
     @Override
-    public void setup(String identifier, ArtifactFactory factory, Object context) {
+    public void setup(
+        String identifier,
+        ArtifactFactory factory,
+        Object context,
+        CallMeta meta,
+        Document data
+    ) {
         log.debug("VerticalProfileArtifact.setup");
-        super.setup(identifier, factory, context);
+        super.setup(identifier, factory, context, meta, data);
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileInstantaneousPointArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileInstantaneousPointArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,13 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.profile.vertical;
 
 import org.apache.log4j.Logger;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class VerticalProfileInstantaneousPointArtifact extends
                                                       VerticalProfileArtifact {
@@ -31,3 +36,4 @@
         super.name = super.name + "InstantaneousPoint";
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileMeshArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/VerticalProfileMeshArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,13 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.profile.vertical;
 
 import org.apache.log4j.Logger;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class VerticalProfileMeshArtifact extends VerticalProfileArtifact {
     /**
@@ -30,3 +35,4 @@
         super.name = super.name + "Mesh";
     }
 }
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/profile/vertical/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains classes that provide specific artifacts representing
+'Vertikalprofile'.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,25 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.profile.verticalcrosssection;
 
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.gnv.artifacts.GNVArtifactBase;
+
 import org.apache.log4j.Logger;
+
 import org.w3c.dom.Document;
 
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.artifacts.CallContext;
-import de.intevation.gnv.artifacts.GNVArtifactBase;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class VerticalCrossSectionMeshArtifact extends GNVArtifactBase {
     /**
@@ -34,25 +41,23 @@
         log.debug("VerticalCrossSectionMeshArtifact.Constructor");
         this.name = "verticalCrossSectionMesh";
     }
-    
-    /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)
-     */
-    @Override
-    public Document describe(Document data, CallContext context) {
-        log.debug("VerticalCrossSectionMeshArtifact.describe");
-        return super.createDescibeOutput(context.getMeta(), 
-                super.identifier,
-                this.getIncludeUIFromDocument(data));
-    }
+
 
     /**
      * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String,
-     *      de.intevation.artifacts.ArtifactFactory, java.lang.Object)
+     *      de.intevation.artifacts.ArtifactFactory, java.lang.Object,
+     *      org.w3c.dom.Document)
      */
     @Override
-    public void setup(String identifier, ArtifactFactory factory, Object context) {
+    public void setup(
+        String          identifier,
+        ArtifactFactory factory,
+        Object          context,
+        CallMeta        meta,
+        Document        data
+    ) {
         log.debug("VerticalCrossSectionMeshArtifact.setup");
-        super.setup(identifier, factory, context);
+        super.setup(identifier, factory, context, meta, data);
     }
 }
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/profile/verticalcrosssection/VerticalCrossSectionMeshParallelArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.profile.verticalcrosssection;
+
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.gnv.artifacts.GNVArtifactBase;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ *
+ */
+public class VerticalCrossSectionMeshParallelArtifact extends GNVArtifactBase {
+
+    private static Logger logger =
+        Logger.getLogger(VerticalCrossSectionMeshParallelArtifact.class);
+
+
+    public VerticalCrossSectionMeshParallelArtifact() {
+        super();
+        this.name = "verticalCrossSectionMeshParallel";
+    }
+
+
+    @Override
+    public void setup(
+        String          identifier,
+        ArtifactFactory factory,
+        Object          context,
+        CallMeta        meta,
+        Document        data
+    ){
+        super.setup(identifier, factory, context, meta, data);
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/profile/verticalcrosssection/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains classes that provide specific artifacts representing
+'Profilschnitte'.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/AbstractProducer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import de.intevation.gnv.raster.Vectorizer.RingsHandler;
+
+/**
+ * Abstract base class for producing multi polygons and
+ * multi line strings. This base class stores a bounding box
+ * of world coordinates which helps to transform the index
+ * spaced egde data into real world coordinates.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public abstract class AbstractProducer
+implements            RingsHandler
+{
+    /**
+     * min x coord of the world.
+     */
+    protected double minX;
+
+    /**
+     * min y coord of the world.
+     */
+    protected double minY;
+
+    /**
+     * max x coord of the world.
+     */
+    protected double maxX;
+
+    /**
+     * max y coord of the world.
+     */
+    protected double maxY;
+
+    /**
+     * Default constructor.
+     */
+    public AbstractProducer() {
+    }
+
+    /**
+     * Constructor to create an Abstract producer with a
+     * given world bounding box.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
+    public AbstractProducer(
+        double minX, double minY,
+        double maxX, double maxY
+    ) {
+        this.minX = minX;
+        this.minY = minY;
+        this.maxX = maxX;
+        this.maxY = maxY;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/DemuxRingsHandler.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import de.intevation.gnv.raster.Vectorizer.Edge;
+import de.intevation.gnv.raster.Vectorizer.RingsHandler;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Ring Handler that demultiplexes to a list of other ring handlers.
+ * Handy if you want to pipe the polygons and line strings produced
+ * by the Vectorize to more than one handler at once.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class DemuxRingsHandler
+implements   RingsHandler
+{
+    /**
+     * The list of internal ring handlers.
+     */
+    protected ArrayList<RingsHandler> handlers;
+
+    /**
+     * Default constructor.
+     */
+    public DemuxRingsHandler() {
+        handlers = new ArrayList<RingsHandler>();
+    }
+
+    /**
+     * Add a ring handler to the list of handlers.
+     * @param handler The handler to add to the internal list.
+     */
+    public void addHandler(RingsHandler handler) {
+        handlers.add(handler);
+    }
+
+    public void handleRings(
+        List<Edge> rings,
+        int        value,
+        int        width,
+        int        height
+    ) {
+        for (RingsHandler handler: handlers) {
+            handler.handleRings(rings, value, width, height);
+        }
+    }
+
+    /**
+     * Empties the internal list of ring handlers.
+     */
+    public void clear() {
+        handlers.clear();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/ExternalIndexConverter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Converts the interal color index of a polygon to the external index
+ * defined by the corresponding palette entry.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class ExternalIndexConverter
+implements   JTSMultiPolygonProducer.ValueConverter
+{
+    private static Logger log = Logger.getLogger(
+        ExternalIndexConverter.class);
+
+    /**
+     * The palette where to find the color indices.
+     */
+    protected Palette palette;
+
+    /**
+     * Default constructor.
+     */
+    public ExternalIndexConverter() {
+    }
+
+    /**
+     * Constrcutor to create an ExternalIndexConverter with
+     * a given palette.
+     * @param palette The palette where to find the color indices.
+     */
+    public ExternalIndexConverter(Palette palette) {
+        this.palette = palette;
+    }
+
+    /**
+     * Maps the color index of a polygon to the external index
+     * defined by the corresponing palette entry.
+     * @param value The value to convert
+     * @return The mapped value or the original value if
+     * no corresponing palette entry was found.
+     */
+    public Integer convert(Integer value) {
+        if (value == null) {
+            return value;
+        }
+
+        int v = value.intValue();
+
+        if (v == -1) {
+            return value;
+        }
+
+        Palette.Entry entry = palette.getEntryByIndex(v);
+
+        if (entry == null) {
+            log.warn("cannot find palette entry for index: " + v);
+            return value;
+        }
+
+        return Integer.valueOf(entry.getExternalIndex());
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Filter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import org.w3c.dom.Element;
+
+/**
+ * Interface to model transformations of rasters.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public interface Filter
+{
+    /**
+     *  Allows the creation of filters parameterized from XML elements.
+     */
+    public interface Factory {
+
+        /**
+         * Setup the factory with a given XML element.
+         * @param element
+         */
+        void init(Element element);
+
+        /**
+         * Created a new Filter with this factory.
+         * @return The new created Filter.
+         */
+        Filter create();
+
+    } // interface Factory
+
+    /**
+     * Apply this filter to a given raster. The original raster is
+     * unmodified and a new raster is created.
+     * @param raster The original raster.
+     * @return The new raster.
+     */
+    Raster filter(Raster raster);
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoAttributeGenerator.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+/**
+ * Generates label attributes for iso lines. It takes the
+ * neighboring palette ranges and calculates the mid point
+ * between these two ranges.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class IsoAttributeGenerator
+implements   IsoProducer.AttributeGenerator
+{
+    /**
+     * The palette where to look for the ranges.
+     */
+    protected Palette palette;
+
+    /**
+     * Default constructor.
+     */
+    public IsoAttributeGenerator() {
+    }
+
+    /**
+     * Constructor to create an IsoAttributeGenerator with
+     * a given lookup palette.
+     * @param palette The palette.
+     */
+    public IsoAttributeGenerator(Palette palette) {
+        this.palette = palette;
+    }
+
+    public Object generateAttribute(int neighbor1, int neighbor2) {
+        Palette.Entry e1 = palette.getEntryByIndex(neighbor1);
+        Palette.Entry e2 = palette.getEntryByIndex(neighbor2);
+
+        if (e1 == null || e2 == null) {
+            return null;
+        }
+
+        double e1t = e1.getFrom();
+        double e2f = e2.getTo();
+
+        return Double.valueOf(e2f >= e1t
+            ? 0.5d*(e1t+e2f)
+            : 0.5d*(e2.getTo()+e1.getFrom()));
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoPolygonSeriesProducer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import de.intevation.gnv.jfreechart.CompactXYItems;
+import de.intevation.gnv.jfreechart.PolygonSeries;
+
+import de.intevation.gnv.math.IJKey;
+
+import de.intevation.gnv.raster.Vectorizer.Edge;
+
+import gnu.trove.TDoubleArrayList;
+import gnu.trove.TIntObjectHashMap;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Vectorizer backend to generate iso lines which are able to be visualized
+ * via {@link de.intevation.gnv.jfreechart.PolygonPlot} as line strings
+ * and custom labels on the chart.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class IsoPolygonSeriesProducer
+extends      IsoProducer
+{
+    private static Logger log = Logger.getLogger(
+        IsoPolygonSeriesProducer.class);
+
+    /**
+     * The line width of the line string used in the chart.
+     */
+    public static final Float LINE_WIDTH = Float.valueOf(0.1f);
+
+    /**
+     * Constructor to create an IsoPolygonSeriesProducer with a
+     * given world bounding box.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
+    public IsoPolygonSeriesProducer(
+        double minX, double minY,
+        double maxX, double maxY
+    ) {
+        super(minX, minY, maxX, maxY);
+    }
+
+    /**
+     * Returns a collection of series with line strings
+     * with no AttributeGenerator.
+     * @return The collection with line strings.
+     */
+    public Collection<PolygonSeries> getSeries() {
+        return getSeries(null);
+    }
+
+    /**
+     * Returns a collection of series with line strings.
+     * The label attributes are generated with a given generator.
+     * @param attributeGenerator The attribute generator. Maybe null
+     * if no attributes should be generated.
+     * @return The collection with the line strings.
+     */
+    public Collection<PolygonSeries> getSeries(
+        AttributeGenerator attributeGenerator
+    ) {
+        ArrayList<PolygonSeries> series = new ArrayList<PolygonSeries>();
+
+        double b1 = minX;
+        double m1 = width != 1
+            ? (maxX - minX)/(width-1)
+            : 0d;
+
+         double b2 = minY;
+         double m2 = height != 1
+            ? (maxY - minY)/(height-1)
+            : 0d;
+
+        TDoubleArrayList vertices = new TDoubleArrayList();
+
+        for (IJKey key: joinPairs()) {
+            PolygonSeries ps = new PolygonSeries();
+
+            // process complete
+            ArrayList<Edge> completeList = complete.get(key);
+            if (completeList != null) {
+                for (Edge head: completeList) {
+                    Edge current = head;
+                    do {
+                        vertices.add(m1*(current.a % width) + b1);
+                        vertices.add(m2*(current.a / width) + b2);
+                    }
+                    while ((current = current.next) != head);
+                    // add head again to close shape
+                    vertices.add(m1*(head.a % width) + b1);
+                    vertices.add(m2*(head.a / width) + b2);
+                    ps.addRing(new CompactXYItems(vertices.toNativeArray()));
+                    vertices.reset();
+                }
+            }
+
+            // process open
+            TIntObjectHashMap map = commonOpen.get(key);
+
+            if (map != null) {
+                for (Edge head: headList(map)) {
+
+                    head = Vectorizer.simplify(head, width);
+                    Edge current = head, last = head;
+                    do {
+                        vertices.add(m1*(current.a % width) + b1);
+                        vertices.add(m2*(current.a / width) + b2);
+                        last = current;
+                    }
+                    while ((current = current.next) != null);
+                    // add b from tail
+                    vertices.add(m1*(last.b % width) + b1);
+                    vertices.add(m2*(last.b / width) + b2);
+                    ps.addRing(new CompactXYItems(vertices.toNativeArray()));
+                    vertices.reset();
+                } // for all in common open
+            } // if map defined for key
+
+            if (ps.getItemCount() > 0) {
+                series.add(ps);
+                if (attributeGenerator != null) {
+                    Object attribute = attributeGenerator
+                        .generateAttribute(key.i, key.j);
+
+                    if (attribute != null) {
+                        ps.setAttribute("label", attribute);
+                    }
+                }
+                ps.setAttribute("line.width", LINE_WIDTH);
+            }
+        } // for all pairs
+
+        return series;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/IsoProducer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import de.intevation.gnv.math.IJKey;
+
+import de.intevation.gnv.raster.Vectorizer.Edge;
+
+import gnu.trove.TIntHashSet;
+import gnu.trove.TIntObjectHashMap;
+import gnu.trove.TObjectProcedure;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ * Vectorizer backend to generate iso lines as line strings
+ * and custom labels on the chart.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class IsoProducer
+extends      AbstractProducer
+{
+    /**
+     * Iso lines separate two neighbors. This interface decouples
+     * the generation of a suitable label for these to neighbors.
+     */
+    public interface AttributeGenerator {
+
+        /**
+         * Generate attribute show as label for two given neighbors.
+         * @param neighbor1 The first neighbor.
+         * @param neighbor2 The second neighbor.
+         * @return The label attribute.
+         */
+        Object generateAttribute(int neighbor1, int neighbor2);
+
+    } // interface AttributeGenerator
+
+    /**
+     * Internal map of open edge to neighbor attributes.
+     */
+    protected HashMap<Edge, Integer>            open;
+    /**
+     * Internal map to associate neighbors with open edges.
+     */
+    protected HashMap<IJKey, TIntObjectHashMap> commonOpen;
+    /**
+     * Internal map to associate neighbors with complete rings.
+     */
+    protected HashMap<IJKey, ArrayList<Edge>>   complete;
+
+    /**
+     * Width of the index space.
+     */
+    protected int    width;
+    /**
+     * Height of the index space.
+     */
+    protected int    height;
+
+    /**
+     * Constructor with a given world bounding box.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
+    public IsoProducer(
+        double minX, double minY,
+        double maxX, double maxY
+    ) {
+        super(minX, minY, maxX, maxY);
+
+        open       = new HashMap<Edge, Integer>();
+        commonOpen = new HashMap<IJKey, TIntObjectHashMap>();
+        complete   = new HashMap<IJKey, ArrayList<Edge>>();
+    }
+
+    public void handleRings(
+        List<Edge> rings,
+        int        value,
+        int        width,
+        int        height
+    ) {
+        if (value == -1) {
+            return;
+        }
+        this.width  = width;
+        this.height = height;
+
+        Integer v = Integer.valueOf(value);
+
+        for (Edge head: rings) {
+            Edge current = head;
+            do {
+                Integer neighbor = open.remove(current);
+
+                if (neighbor != null) {
+                    IJKey pair = new IJKey(value, neighbor.intValue());
+                    pair.sort();
+
+                    TIntObjectHashMap co = commonOpen.get(pair);
+
+                    if (co == null) {
+                        commonOpen.put(pair, co = new TIntObjectHashMap());
+                    }
+
+                    Edge edge = new Edge(current);
+
+                    Edge otherA = (Edge)co.remove(edge.a);
+                    if (otherA != null) {
+                        otherA.chain(edge, edge.a);
+                    }
+
+                    Edge otherB = (Edge)co.remove(edge.b);
+                    if (otherB != null) {
+                        otherB.chain(edge, edge.b);
+                    }
+
+                    if (edge.isComplete()) {
+                        ArrayList list = complete.get(pair);
+                        if (list == null) {
+                            complete.put(pair, list = new ArrayList());
+                        }
+                        list.add(Vectorizer.simplify(edge, width));
+                    }
+                    else {
+                        if (otherA == null) {
+                            co.put(edge.a, edge);
+                        }
+                        if (otherB == null) {
+                            co.put(edge.b, edge);
+                        }
+                    }
+                }
+                else {
+                    Edge edge = new Edge(current.b, current.a);
+                    open.put(edge, v);
+                }
+
+                current = current.next;
+            }
+            while (current != head);
+        } // for all rings
+
+    } // handleRings
+
+    /**
+     * Join the pairs of neighbors i,j to have a distinct set.
+     * @return The distinct pairs of neighbors.
+     */
+    protected HashSet<IJKey> joinPairs() {
+        HashSet<IJKey> pairs = new HashSet<IJKey>();
+        pairs.addAll(complete  .keySet());
+        pairs.addAll(commonOpen.keySet());
+        return pairs;
+    }
+
+    /**
+     * Filter out the head list from the open edge lists.
+     * @param map Map of end and head lists.
+     * @return list of only head lists.
+     */
+    protected static ArrayList<Edge> headList(TIntObjectHashMap map) {
+        final ArrayList<Edge> headList = new ArrayList<Edge>();
+        map.forEachValue(new TObjectProcedure() {
+            TIntHashSet headSet = new TIntHashSet();
+            public boolean execute(Object value) {
+                Edge head = ((Edge)value).head();
+                if (headSet.add(head.a)) {
+                    headList.add(head);
+                }
+                return true;
+            }
+        });
+        return headList;
+    }
+
+    /**
+     * Reset internal data structures to save some memory.
+     */
+    public void clear() {
+        open.clear();
+        complete.clear();
+        commonOpen.clear();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiLineStringProducer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.MultiLineString;
+import com.vividsolutions.jts.geom.Polygon;
+import com.vividsolutions.jts.geom.TopologyException;
+
+import de.intevation.gnv.math.IJKey;
+
+import de.intevation.gnv.raster.Vectorizer.Edge;
+
+import de.intevation.gnv.utils.Pair;
+
+import gnu.trove.TIntObjectHashMap;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Vectorizer backend to generated iso lines in form of
+ * JTS multi linestrings.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class JTSMultiLineStringProducer
+extends      IsoProducer
+{
+    private static Logger log = Logger.getLogger(
+        JTSMultiLineStringProducer.class);
+
+    /**
+     * The JTS geometry factory of this producer.
+     */
+    protected GeometryFactory geometryFactory;
+
+    /**
+     * The polygon used to clip the produced multe line strings.
+     */
+    protected Polygon clip;
+
+    /**
+     * Constructor to create a JTSMultiLineStringProducer with
+     * a given clipping polygon and a world bounding box.
+     * @param clip The clipping polygon.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
+    public JTSMultiLineStringProducer(
+        Polygon clip,
+        double minX, double minY,
+        double maxX, double maxY
+    ) {
+        this(
+            clip,
+            // XXX: Geotools crashes if only using a 2d packed data format!
+            JTSMultiPolygonProducer.createDefaultGeometryFactory(3),
+            minX, minY,
+            maxX, maxY);
+    }
+
+    /**
+     * Constructor to create a JTSMultiLineStringProducer with
+     * a given clipping polygon, a geometry factory
+     * and a world bounding box.
+     * @param clip The clipping polygon.
+     * @param geometryFactory The geometry factory.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
+    public JTSMultiLineStringProducer(
+        Polygon clip,
+        GeometryFactory geometryFactory,
+        double minX, double minY,
+        double maxX, double maxY
+    ) {
+        super(minX, minY, maxX, maxY);
+        this.clip = clip;
+        this.geometryFactory = geometryFactory;
+    }
+
+    /**
+     * Clips a given line string against the clippin polygon. The
+     * result is stored in the given list of line strings.
+     * @param lineString The line string to be clipped.
+     * @param lineStrings The result line string list.
+     */
+    protected void clipLineString(
+        LineString            lineString,
+        ArrayList<LineString> lineStrings
+    ) {
+        if (clip == null) {
+            lineStrings.add(lineString);
+            return;
+        }
+
+        if (!lineString.intersects(clip)) {
+            return;
+        }
+
+        try {
+            Geometry result = lineString.intersection(clip);
+
+            if (result instanceof LineString) {
+                lineStrings.add((LineString)result);
+            }
+            else if (result instanceof MultiLineString) {
+                MultiLineString mls = (MultiLineString)result;
+                for (int i = 0, N = mls.getNumGeometries(); i < N; ++i) {
+                    Geometry g = mls.getGeometryN(i);
+                    if (g instanceof LineString) {
+                        lineStrings.add((LineString)g);
+                    }
+                    else {
+                        log.warn("cannot handle geometry " + g.getClass());
+                    }
+                }
+            }
+            else {
+                log.warn("cannot handle " + result.getClass());
+            }
+        }
+        catch (TopologyException te) {
+            log.error(te.getLocalizedMessage(), te);
+            lineStrings.add(lineString);
+        }
+    }
+
+    /**
+     * Returns a list of pairs attribute -&gt; multi line string.
+     * All line strings produced are grouped by there attribute
+     * which is generated with the given attribute generator.
+     * @param attributeGenerator The attribute generator.
+     * @return The list of attribute/multi line strings.
+     */
+    public List<Pair<Object, MultiLineString>> getMultiLineStrings(
+        AttributeGenerator attributeGenerator
+    ) {
+        ArrayList<Pair<Object, MultiLineString>> multiLineStrings =
+            new ArrayList<Pair<Object, MultiLineString>>();
+
+        double b1 = minX;
+        double m1 = width != 1
+            ? (maxX - minX)/(width-1)
+            : 0d;
+
+         double b2 = minY;
+         double m2 = height != 1
+            ? (maxY - minY)/(height-1)
+            : 0d;
+
+        ArrayList<Coordinate> coordinates = new ArrayList<Coordinate>();
+
+        for (IJKey key: joinPairs()) {
+            ArrayList<LineString> lineStrings = new ArrayList<LineString>();
+
+            // process complete
+            ArrayList<Edge> completeList = complete.get(key);
+            if (completeList != null) {
+                for (Edge head: completeList) {
+                    Edge current = head;
+                    do {
+                        coordinates.add(new Coordinate(
+                            m1*(current.a % width) + b1,
+                            m2*(current.a / width) + b2));
+                    }
+                    while ((current = current.next) != head);
+                    // add head again to close shape
+                    coordinates.add(new Coordinate(
+                        m1*(head.a % width) + b1,
+                        m2*(head.a / width) + b2));
+
+                    clipLineString(
+                        geometryFactory.createLineString(
+                            coordinates.toArray(
+                                new Coordinate[coordinates.size()])),
+                        lineStrings);
+
+                    coordinates.clear();
+                }
+            }
+
+            // process open
+            TIntObjectHashMap map = commonOpen.get(key);
+
+            if (map != null) {
+                for (Edge head: headList(map)) {
+
+                    head = Vectorizer.simplify(head, width);
+                    Edge current = head, last = head;
+                    do {
+                        coordinates.add(new Coordinate(
+                            m1*(current.a % width) + b1,
+                            m2*(current.a / width) + b2));
+                        last = current;
+                    }
+                    while ((current = current.next) != null);
+                    // add b from tail
+                    coordinates.add(new Coordinate(
+                        m1*(last.b % width) + b1,
+                        m2*(last.b / width) + b2));
+
+                    clipLineString(
+                        geometryFactory.createLineString(
+                            coordinates.toArray(
+                                new Coordinate[coordinates.size()])),
+                        lineStrings);
+
+                    coordinates.clear();
+                } // for all in common open
+            } // if map defined for key
+
+			if (!lineStrings.isEmpty()) {
+                MultiLineString multiLineString =
+                    geometryFactory.createMultiLineString(
+                        lineStrings.toArray(
+                            new LineString[lineStrings.size()]));
+                lineStrings.clear();
+                Object attribute = attributeGenerator != null
+                    ? attributeGenerator.generateAttribute(key.i, key.j)
+                    : key;
+                multiLineStrings.add(new Pair<Object, MultiLineString>(
+                    attribute,
+                    multiLineString));
+			}
+        } // for all pairs
+
+        return multiLineStrings;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/JTSMultiPolygonProducer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,311 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import com.vividsolutions.jts.algorithm.CGAlgorithms;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.LinearRing;
+import com.vividsolutions.jts.geom.MultiPolygon;
+import com.vividsolutions.jts.geom.Polygon;
+import com.vividsolutions.jts.geom.PrecisionModel;
+import com.vividsolutions.jts.geom.TopologyException;
+
+import com.vividsolutions.jts.geom.impl.PackedCoordinateSequenceFactory;
+
+import de.intevation.gnv.raster.Vectorizer.Edge;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Vectorizer backend to generated polygons in form of
+ * JTS multi multi polygons.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class JTSMultiPolygonProducer
+extends      AbstractProducer
+{
+    private static Logger log = Logger.getLogger(
+        JTSMultiPolygonProducer.class);
+
+    /**
+     * The reference system of used coordinates: {@value}
+     */
+    public static final int SRID_WGS84 = 4326;
+
+    /**
+     * Interface to decouple the conversion of the internal
+     * index scheme of the polygons to an external one.
+     */
+    public interface ValueConverter {
+
+        /**
+         * Maps integer index schemes.
+         * @param value The input value.
+         * @return The resulting index.
+         */
+        Integer convert(Integer value);
+
+    } // interface ValueConverter
+
+    /**
+     * The JTS geometry factory.
+     */
+    protected GeometryFactory geometryFactory;
+
+    /**
+     * The clipping polygon.
+     */
+    protected Polygon clip;
+
+    /**
+     * Internal map to map the internal polygons indices to a
+     * list of generated polygons.
+     */
+    protected HashMap<Integer, ArrayList<Polygon>> valueToPolygons;
+
+    /**
+     * Default constructor.
+     */
+    public JTSMultiPolygonProducer() {
+    }
+
+    /**
+     * Constructor to create a JTSMultiPolygonProducer with a
+     * given clipping polygon and a world bounding box.
+     * @param clip The clipping polygon.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
+    public JTSMultiPolygonProducer(
+        Polygon clip,
+        double minX, double minY,
+        double maxX, double maxY
+    ) {
+        this(
+            clip,
+            createDefaultGeometryFactory(),
+            minX, minY,
+            maxX, maxY);
+    }
+
+    /**
+     *  Constructor to create a JTSMultiPolygonProducer with a
+     * given clipping polygon, a geometry factory and a world bounding box.
+     * @param clip The clipping polygon.
+     * @param geometryFactory The geometry factory.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
+    public JTSMultiPolygonProducer(
+        Polygon clip,
+        GeometryFactory geometryFactory,
+        double minX, double minY,
+        double maxX, double maxY
+    ) {
+        super(minX, minY, maxX, maxY);
+        this.clip = clip;
+        this.geometryFactory = geometryFactory;
+        valueToPolygons = new HashMap<Integer, ArrayList<Polygon>>();
+    }
+
+    /**
+     * Creates a 3D geometry factory via
+     * {@link #createDefaultGeometryFactory(int)}.
+     * @return The new geometry factory.
+     */
+    public static GeometryFactory createDefaultGeometryFactory() {
+        return createDefaultGeometryFactory(3);
+    }
+
+    /**
+     * Creates a geometry factory with a given dimension.
+     * @param dim The dimension.
+     * @return The new geometry factory.
+     */
+    public static GeometryFactory createDefaultGeometryFactory(int dim) {
+        return new GeometryFactory(
+            new PrecisionModel(
+                PrecisionModel.FLOATING),
+            SRID_WGS84,
+            new PackedCoordinateSequenceFactory(
+                PackedCoordinateSequenceFactory.DOUBLE,
+                dim));
+    }
+
+    public void handleRings(
+        List<Edge> rings,
+        int        value,
+        int        width,
+        int        height
+    ) {
+        if (value == -1) {
+            return;
+        }
+
+        double b1 = minX;
+        double m1 = width != 1
+           ? (maxX - minX)/(width-1)
+           : 0d;
+
+        double b2 = minY;
+        double m2 = height != 1
+           ? (maxY - minY)/(height-1)
+           : 0d;
+
+        ArrayList<Coordinate> vertices = new ArrayList<Coordinate>();
+
+        LinearRing shell = null;
+        ArrayList<LinearRing> holes = new ArrayList<LinearRing>();
+
+        for (Edge head: rings) {
+            Edge current = head;
+            do {
+                vertices.add(new Coordinate(
+                    m1*(current.a % width) + b1,
+                    m2*(current.a / width) + b2));
+            }
+            while ((current = current.prev) != head);
+            vertices.add(new Coordinate(
+                m1*(head.a % width) + b1,
+                m2*(head.a / width) + b2));
+
+            Coordinate [] coordinates =
+                vertices.toArray(new Coordinate[vertices.size()]);
+
+            vertices.clear();
+
+            LinearRing ring = geometryFactory.createLinearRing(
+                coordinates);
+
+            if (CGAlgorithms.isCCW(coordinates)) {
+                shell = ring;
+            }
+            else {
+                holes.add(ring);
+            }
+        }
+
+        if (shell == null) {
+            log.error("polygon has no shell");
+            return;
+        }
+
+        Polygon polygon = geometryFactory.createPolygon(
+            shell,
+            holes.toArray(new LinearRing[holes.size()]));
+
+        if (clip == null || clip.intersects(polygon)) {
+            Integer v = Integer.valueOf(value);
+
+            ArrayList<Polygon> polygons = valueToPolygons.get(v);
+
+            if (polygons == null) {
+                valueToPolygons.put(v, polygons = new ArrayList<Polygon>());
+            }
+
+            polygons.add(polygon);
+        }
+    }
+
+    /**
+     * Returns a index -&gt; multi polyon map. The internal index scheme
+     * is retained.
+     * {@link #getMultiPolygons(de.intevation.gnv.raster.JTSMultiPolygonProducer.ValueConverter)}
+     * @return The new map.
+     */
+    public Map<Integer, MultiPolygon> getMultiPolygons() {
+        return getMultiPolygons(null);
+    }
+
+    /**
+     * Flattend a JTS geometry to a multi polygon if possible
+     * @param result The geometry to be flattend
+     * @return The resulting multi polygon.
+     */
+    protected MultiPolygon flattenCollection(Geometry result) {
+
+        if (result instanceof MultiPolygon) {
+            return (MultiPolygon)result;
+        }
+
+        if (result instanceof Polygon) {
+            return geometryFactory.createMultiPolygon(
+                new Polygon[] { (Polygon)result });
+        }
+
+        log.warn("cannot handle " + result.getClass());
+
+        return null;
+    }
+
+    /**
+     * Returns a index -&gt; multi polyon map. The internal index scheme
+     * is remapped with the given value converter.
+     * @param valueConverter Converter to remap the index scheme. Maybe null
+     * if no remapping is required.
+     * @return The new map.
+     */
+    public Map<Integer, MultiPolygon> getMultiPolygons(
+        ValueConverter valueConverter
+    ) {
+        TreeMap<Integer, MultiPolygon> multiPolygons =
+            new TreeMap<Integer, MultiPolygon>();
+
+        for (Map.Entry<Integer, ArrayList<Polygon>> entry:
+            valueToPolygons.entrySet()
+        ) {
+            ArrayList<Polygon> polygons = entry.getValue();
+
+            Integer value = valueConverter != null
+                ? valueConverter.convert(entry.getKey())
+                : entry.getKey();
+
+            MultiPolygon mp = geometryFactory.createMultiPolygon(
+                polygons.toArray(new Polygon[polygons.size()]));
+
+            if (clip != null) {
+                try {
+                    Geometry result = mp.intersection(clip);
+
+                    MultiPolygon mp2 = flattenCollection(result);
+
+                    if (mp2 != null) { mp = mp2; }
+                }
+                catch (TopologyException te) {
+                    log.error(te.getLocalizedMessage(), te);
+                }
+            }
+            multiPolygons.put(value, mp);
+        }
+
+        return multiPolygons;
+    }
+
+    /**
+     * Empties internal temporary data structures to save some memory.
+     */
+    public void clear() {
+        valueToPolygons.clear();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/KernelFilter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Element;
+
+/**
+ * An implemenation of raster filters based on given kernels.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class KernelFilter
+implements   Filter
+{
+    private static Logger log = Logger.getLogger(KernelFilter.class);
+
+    /**
+     *  Implemens a factory which produces KernelFilters with Gauss kernels.
+     */
+    public static class GaussFactory
+    implements          Filter.Factory
+    {
+        /**
+         * Default sigma of Gauss kernel: {@value}
+         */
+        public static final double DEFAULT_SIGMA  = 1.0d;
+        /**
+         * Default radius of Gauss kernel: {@value}
+         */
+        public static final int    DEFAULT_RADIUS = 5;
+
+        /**
+         * Configured sigma.
+         */
+        protected double sigma;
+        /**
+         * Configured radius.
+         */
+        protected int    radius;
+
+        /**
+         * Default constructor.
+         */
+        public GaussFactory() {
+            sigma  = DEFAULT_SIGMA;
+            radius = DEFAULT_RADIUS;
+        }
+
+        public void init(Element element) {
+            String s = element.getAttribute("sigma");
+            String r = element.getAttribute("radius");
+
+            if ((s = s.trim()).length() > 0) {
+                try {
+                    sigma = Math.abs(Double.parseDouble(s));
+                }
+                catch (NumberFormatException nfe) {
+                    log.warn("gauss sigma '" + s + "' not a valid float value.");
+                }
+            }
+
+            if ((r = r.trim()).length() > 0) {
+                try {
+                    radius = Math.min(3, Math.abs(Integer.parseInt(r)));
+                }
+                catch (NumberFormatException nfe) {
+                    log.warn("gauss radius '" + r + "' not a valid integer value.");
+                }
+            }
+        }
+
+        public Filter create() {
+            return new KernelFilter(Raster.Kernel.createGauss(sigma, radius));
+        }
+    } // class GaussFactory
+
+    /**
+     * The kernel used by this filter.
+     */
+    protected Raster.Kernel kernel;
+
+    /**
+     * Default constructor.
+     */
+    public KernelFilter() {
+    }
+
+    /**
+     * Constructor to create a filter with a given kernel.
+     * @param kernel The kernel to be used.
+     */
+    public KernelFilter(Raster.Kernel kernel) {
+        this.kernel = kernel;
+    }
+
+    public Raster filter(Raster raster) {
+        return raster.create(kernel);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Palette.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,436 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import de.intevation.gnv.raster.Raster.ValueToIndex;
+
+import java.awt.Color;
+
+import java.util.Arrays;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/**
+ * Lookup mechanism to map double values from a list of
+ * ranges onto a set of colors and vice versa.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class Palette
+implements   ValueToIndex
+{
+    private static Logger log = Logger.getLogger(Palette.class);
+
+    /**
+     * An entry in the lookup table.
+     */
+    public static final class Entry
+    implements                Comparable
+    {
+        private Entry  left;
+        private Entry  right;
+
+        private int    index;
+
+        private int    externalIndex;
+
+        private double from;
+        private double to;
+
+        private String description;
+
+        private Color  color;
+
+        /**
+         * Default constructor
+         */
+        public Entry() {
+        }
+
+        /**
+         * Copy constructor
+         * @param other The entry to copy.
+         */
+        public Entry(Entry other) {
+            index         = other.index;
+            externalIndex = other.externalIndex;
+            from          = other.from;
+            to            = other.to;
+            description   = other.description;
+            color         = other.color;
+        }
+
+        /**
+         * Constructor to set the palette index, the exteral index,
+         * the value range, the color and the description.
+         * @param index The pallette index
+         * @param externalIndex The external index
+         * @param from Start of the interval
+         * @param to End of the interval
+         * @param color The color belonging to this interval.
+         * @param description The description of this range.
+         */
+        public Entry(
+            int    index,
+            int    externalIndex,
+            double from,
+            double to,
+            Color  color,
+            String description
+        ) {
+            this.index         = index;
+            this.externalIndex = externalIndex;
+            this.from          = from;
+            this.to            = to;
+            this.color         = color;
+            this.description   = description;
+        }
+
+        /**
+         * Compares two entries by the start point of the interval.
+         * @param other
+         * @return -1 if this start point is before other. +1 if this
+         * start point is after, else 0.
+         */
+        public int compareTo(Object other) {
+            Entry e = (Entry)other;
+            if (from < e.from) return -1;
+            if (from > e.from) return +1;
+            return 0;
+        }
+
+        /**
+         * The starting point of the interval.
+         * @return The starting point.
+         */
+        public double getFrom() {
+            return from;
+        }
+
+        /**
+         * The end point of the interval.
+         * @return The end point.
+         */
+        public double getTo() {
+            return to;
+        }
+
+        /**
+         * The color of the entry.
+         * @return The color.
+         */
+        public Color getColor() {
+            return color;
+        }
+
+        /**
+         * The external index of this entry. Useful to model
+         * external joins.
+         * @return The external index.
+         */
+        public int getExternalIndex() {
+            return externalIndex;
+        }
+
+        /**
+         * Searches for an entry which has a range that contains
+         * the given value.
+         * @param value The value to be searched.
+         * @return The entry containing the value or null if no such
+         * entry exists.
+         */
+        public Entry locateEntry(double value) {
+            Entry current = this;
+            while (current != null) {
+                boolean b = value >= current.from;
+                if (b && value <= current.to) {
+                    return current;
+                }
+                current = b
+                    ? current.right
+                    : current.left;
+            }
+            return null;
+        }
+
+        /**
+         * Returns the palette index for a given value.
+         * @param value The value to search.
+         * @return The index of the palette entry or -1 if
+         * no such entry exists.
+         */
+        public int locate(double value) {
+            Entry entry = locateEntry(value);
+            return entry != null
+                ? entry.index
+                : -1;
+        }
+
+        /**
+         * Searches for an interval with a given index.
+         * @param index The index to be searched.
+         * @return The entry with the given index or null if no
+         * such entry exists.
+         */
+        public Entry findByIndex(int index) {
+            Entry current = this;
+            while (current != null) {
+                if (current.index == index) {
+                    break;
+                }
+                current = index < current.index
+                    ? current.left
+                    : current.right;
+            }
+            return current;
+        }
+
+        /**
+         * The description of this entry.
+         * @return The description.
+         */
+        public String getDescription() {
+            return description;
+        }
+
+        /**
+         * Determines if the range of this entry has
+         * infinitive length.
+         * @return true if the range of this entry has infinitive
+         * length else false.
+         */
+        public boolean isInfinity() {
+            return from == -Double.MAX_VALUE
+              ||   to   ==  Double.MAX_VALUE;
+        }
+    } // class Entry
+
+    /**
+     * Internal table of the entrys.
+     */
+    protected Entry [] entries;
+
+    /**
+     * Root of the entry tree used to map values to entries.
+     */
+    protected Entry    lookup;
+
+    /**
+     * The list of colors used by this palette.
+     */
+    protected Color [] rgbs;
+
+    private Entry buildLookup(Entry [] entries, int lo, int hi) {
+        if (lo > hi) {
+            return null;
+        }
+        int mid = (lo + hi)/2;
+        Entry entry = entries[mid];
+        entry.left  = buildLookup(entries, lo, mid-1);
+        entry.right = buildLookup(entries, mid+1, hi);
+        return entry;
+    }
+
+    /**
+     * Default constructor.
+     */
+    public Palette() {
+    }
+
+    /**
+     * Constructor to create the palette from an XML document.
+     * @param document The document with palette information.
+     */
+    public Palette(Document document) {
+
+        NodeList rangeNodes = document.getElementsByTagName("range");
+
+        entries = new Entry[rangeNodes.getLength()];
+        rgbs    = new Color[entries.length];
+
+        for (int i = 0; i < entries.length; ++i) {
+            Element rangeElement = (Element)rangeNodes.item(i);
+            double from     = doubleValue(rangeElement.getAttribute("from"));
+            double to       = doubleValue(rangeElement.getAttribute("to"));
+            int    extIndex = intValue(rangeElement.getAttribute("index"), i);
+            Color  color    = color(rangeElement.getAttribute("rgb"));
+            String desc     = rangeElement.getAttribute("description");
+            if (from > to) { double t = from; from = to; to = t; }
+            entries[i] = new Entry(i, extIndex, from, to, color, desc);
+            rgbs[i] = color;
+        }
+
+        buildLookup();
+    }
+
+    /**
+     * Constructor to split a given palette into a given number of
+     * equal sized sub entries. Ranges of infinitive length are not
+     * splitted.
+     * @param original The source palette.
+     * @param N The number of chunks to split single ranges into.
+     */
+    public Palette(Palette original, int N) {
+        if (N < 2)  {
+            throw new IllegalArgumentException("N < 2");
+        }
+
+        Entry [] origEntries = original.entries;
+
+        int newSize = 0;
+        for (int i = 0; i < origEntries.length; ++i) {
+            // cannot split infinity intervals
+            newSize += origEntries[i].isInfinity() ? 1 : N;
+        }
+
+        entries = new Entry[newSize];
+        rgbs    = new Color[newSize];
+
+        for (int i = 0, j = 0; i < origEntries.length; ++i) {
+            Entry origEntry = origEntries[i];
+            if (origEntry.isInfinity()) {
+                // infinity intervals are just copied
+                Entry nEntry = new Entry(origEntry);
+                entries[j] = nEntry;
+                rgbs[j]    = nEntry.color;
+                nEntry.index = j++;
+            }
+            else {
+                // split interval into N parts
+                double from  = origEntry.from;
+                double to    = origEntry.to;
+                double delta = (to - from)/N;
+				for (int k = 0; k < N; ++k) {
+                    Entry nEntry = new Entry(origEntry);
+                    nEntry.from = from;
+                    nEntry.to   = from + delta;
+                    from += delta;
+                    entries[j] = nEntry;
+                    rgbs[j]    = nEntry.color;
+                    nEntry.index = j++;
+                }
+            } // limited interval
+        } // for all original entries
+
+        buildLookup();
+    }
+
+    private static final int intValue(String s, int def) {
+        if (s == null || (s = s.trim()).length() == 0) {
+            return def;
+        }
+        try {
+            return Integer.parseInt(s);
+        }
+        catch (NumberFormatException nfe) {
+            log.error(nfe.getLocalizedMessage(), nfe);
+        }
+        return def;
+    }
+
+    private static final double doubleValue(String s) {
+        if (s == null || (s = s.trim()).length() == 0) {
+            return 0d;
+        }
+        if ((s = s.toLowerCase()).startsWith("-inf")) {
+            return -Double.MAX_VALUE; // XXX: Not using Double.NEGATIVE_INFINITY!
+        }
+
+        if (s.startsWith("inf")) {
+            return Double.MAX_VALUE; // XXX: Not using Double.NEGATIVE_INFINITY!
+        }
+
+        return Double.parseDouble(s);
+    }
+
+    private static final Color color(String s) {
+        if (s == null || (s = s.trim()).length() == 0) {
+            return null;
+        }
+        return Color.decode(s);
+    }
+
+
+    /**
+     * Internal method to build the lookup tree.
+     */
+    protected void buildLookup() {
+        Arrays.sort(entries);
+        lookup = buildLookup(entries, 0, entries.length-1);
+    }
+
+    /**
+     * Creates a new palette which has ranges that are subdivided
+     * into a given number of sub ranges each.
+     * @param N The number od sub divisions of each range.
+     * @return The new created palette.
+     */
+    public Palette subdivide(int N) {
+        return new Palette(this, N);
+    }
+
+    /**
+     * Return the number of entries in this palette.
+     * @return The number of entries.
+     */
+    public int getSize() {
+        return rgbs.length;
+    }
+
+    /**
+     * Return the color of an entry for a given index.
+     * @param index The index.
+     * @return The color.
+     */
+    public Color getColor(int index) {
+        return rgbs[index];
+    }
+
+    /**
+     * Return the RGB value
+     * @param index of an entry for a given index.
+     * @return rgb value
+     */
+    public int indexToRGB(int index) {
+        return rgbs[index].getRGB();
+    }
+
+    /**
+     * Searches for the index of an entry which contains the
+     * given value.
+     * @param value The value to be searched.
+     * @return The index of the entry or -1 if no entry is found.
+     */
+    public int toIndex(double value) {
+        return lookup.locate(value);
+    }
+
+    /**
+     * Searches for the an entry which contains the given value.
+     * @param value The value to be searched.
+     * @return The entry which contains the value or null if
+     * no such entry is found.
+     */
+    public Entry getEntry(double value) {
+        return lookup.locateEntry(value);
+    }
+
+    /**
+     * Searches the entry for a given index.
+     * @param index The index of the entry.
+     * @return The entry or null if no such entry is found.
+     */
+    public Entry getEntryByIndex(int index) {
+        return lookup.findByIndex(index);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/PaletteManager.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import java.lang.ref.SoftReference;
+
+import java.util.HashMap;
+
+/**
+ * Manages palettes by their name. Provides different levels of
+ * subdivisions.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class PaletteManager
+{
+    /**
+     * The base palette.
+     */
+    protected Palette base;
+
+    /**
+     * The description of the palette.
+     */
+    protected String  description;
+
+    /**
+     * The name of the palette.
+     */
+    protected String  name;
+
+    /**
+     * Already created subdivisions of the palette.
+     */
+    protected HashMap<Integer, SoftReference<Palette>> levels;
+
+    /**
+     * Default constructor.
+     */
+    public PaletteManager() {
+    }
+
+    /**
+     * Constructor to create a palette manager with a given name,
+     * description and base palette.
+     * @param name The name.
+     * @param description The description.
+     * @param base The base palette.
+     */
+    public PaletteManager(
+        String  name,
+        String  description,
+        Palette base
+    ) {
+        this.name        = name;
+        this.description = description;
+        this.base        = base;
+        levels = new HashMap<Integer, SoftReference<Palette>>();
+    }
+
+    /**
+     * Returns the description of the palette.
+     * @return The description.
+     */
+    public String getDescription() {
+        return description;
+    }
+
+    /**
+     * The name of the palette.
+     * @return The name.
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Returns the base palette.
+     * @return The base palette.
+     */
+    public Palette getBase() {
+        return base;
+    }
+
+    /**
+     * Returns the subdivided palette of a given level.
+     * @param n The level of subdivision.
+     * @return The subdivided palette.
+     */
+    public Palette getLevel(int n) {
+        if (n < 2) {
+            return base;
+        }
+
+        Integer N = Integer.valueOf(n);
+
+        Palette palette;
+
+        synchronized (levels) {
+            SoftReference<Palette> ref = levels.get(N);
+
+            if (ref != null && (palette = ref.get()) != null) {
+                return palette;
+            }
+
+            palette = base.subdivide(n);
+
+            ref = new SoftReference(palette);
+
+            levels.put(N, ref);
+        }
+
+        return palette;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/PolygonDatasetProducer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import de.intevation.gnv.jfreechart.CompactXYItems;
+import de.intevation.gnv.jfreechart.PolygonDataset;
+import de.intevation.gnv.jfreechart.PolygonSeries;
+
+import de.intevation.gnv.raster.Vectorizer.Edge;
+
+import gnu.trove.TDoubleArrayList;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * Vectorizer backend to produce polygon datasets suitable to being
+ * displayed with {@link de.intevation.gnv.jfreechart.PolygonPlot}.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class PolygonDatasetProducer
+extends      AbstractProducer
+{
+    /**
+     * Maps value integers to series of polygons to group
+     * them by value.
+     */
+    protected HashMap<Integer, PolygonSeries> polygonSeries;
+
+    /**
+     * Default constructor.
+     */
+    protected PolygonDatasetProducer() {
+    }
+
+    /**
+     * Constructor to create a PolygonDatasetProducer with
+     * a given world bound box.
+     * @param minX Min x coord of the world.
+     * @param minY Min y coord of the world.
+     * @param maxX Max x coord of the world.
+     * @param maxY Max y coord of the world.
+     */
+    public PolygonDatasetProducer(
+        double minX, double minY,
+        double maxX, double maxY
+
+    ) {
+        super(minX, minY, maxX, maxY);
+        polygonSeries = new HashMap<Integer, PolygonSeries>();
+    }
+
+    public void handleRings(
+        List<Edge> rings,
+        int        value,
+        int        width,
+        int        height
+    ) {
+        if (value == -1) {
+            return;
+        }
+
+        Integer v = Integer.valueOf(value);
+
+        PolygonSeries ps = polygonSeries.get(v);
+
+        if (ps == null) {
+            polygonSeries.put(v, ps = new PolygonSeries());
+            ps.setAttribute("fill", v);
+        }
+
+        TDoubleArrayList vertices = new TDoubleArrayList();
+
+        /* minX = 0*m1 + b1 <=> b1 = minX
+         * maxX = (width-1)*m1 + b1
+         * m1 = (maxX - minX)/(width-1)
+         */
+
+        double b1 = minX;
+        double m1 = width != 1
+           ? (maxX - minX)/(width-1)
+           : 0d;
+
+        double b2 = minY;
+        double m2 = height != 1
+           ? (maxY - minY)/(height-1)
+           : 0d;
+
+        for (Edge head: rings) {
+            Edge current = head;
+            do {
+                vertices.add(m1*(current.a % width) + b1);
+                vertices.add(m2*(current.a / width) + b2);
+            }
+            while ((current = current.next) != head);
+            ps.addRing(new CompactXYItems(vertices.toNativeArray()));
+            vertices.reset();
+        }
+    }
+
+    /**
+     * Creates a new PolygonDataset from the polygons build by this
+     * backend.
+     * @return the new PolygonDataset
+     */
+    public PolygonDataset getPolygonDataset() {
+        return new PolygonDataset(polygonSeries.values());
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Raster.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,415 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+/**
+ * A 2D double  valued representation of a raster array.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class Raster
+{
+    /**
+     * A kernel can be applied to a raster to fold its values.
+     */
+    public static class Kernel {
+
+        /**
+         * The coefficients of the folding matrix.
+         */
+        public static final class Coeff {
+            /**
+             * i delta index of this coefficient.
+             */
+            public int    di;
+            /**
+             * i delta index of this coefficient.
+             */
+            public int    dj;
+            /**
+             * The weight of this coefficient.
+             */
+            public double c;
+
+            /**
+             * Default constructor
+             */
+            public Coeff() {
+            }
+
+            /**
+             * Constructor to set the delta position and the weight of
+             * the coefficient.
+             * @param di The i delta index.
+             * @param dj The j delta index.
+             * @param c The weight of the index.
+             */
+            public Coeff(int di, int dj, double c) {
+                this.di = di;
+                this.dj = dj;
+                this.c  = c;
+            }
+
+            /**
+             * Returns a string representation of this coefficient.
+             * @return The string representation.
+             */
+            @Override
+            public String toString() {
+                return String.valueOf(c);
+            }
+
+        } // class Coeff
+
+        /**
+         * The coefficients of the folding matrix.
+         */
+        protected Coeff [] coeffs;
+        /**
+         * The width of the kernel.
+         */
+        protected int      width;
+
+        /**
+         * Default constrcutor.
+         */
+        public Kernel() {
+        }
+
+        /**
+         * Constructor for a kernel with a given coefficient matrix
+         * with a given width.
+         * @param coeffs The coefficients.
+         * @param width The width of the kernel.
+         */
+        public Kernel(Coeff [] coeffs, int width) {
+            this.coeffs = coeffs;
+            this.width  = width;
+        }
+
+        /**
+         * Evaluates the 2D Gauss normal distribution a given x, y
+         * and a given sigma.
+         * @param x The x location.
+         * @param y The y location.
+         * @param sigma The sigma of the distribution.
+         * @return The value at point x, y.
+         */
+        public static double gauss(double x, double y, double sigma) {
+            double s2 = sigma*sigma;
+            return 1.0d/(2.0d*Math.PI*s2)*Math.exp(-(x*x + y*y)/(2.0d*s2));
+        }
+
+        /**
+         * Creates a Gauss kernel with sigma = 1 and width 5.
+         * @return The new kernel.
+         */
+        public static Kernel createGauss() {
+            return createGauss(1.0d, 5);
+        }
+
+        /**
+         * Creates a Gauss kernel with a given sigma and width.
+         * @param sigma The sigma value
+         * @param width  The width of the kernel.
+         * @return The new kernel.
+         */
+        public static Kernel createGauss(double sigma, int width) {
+            Coeff [] coeffs = new Coeff[width*width];
+            double sum = 0d;
+            for (int j = 0; j < width; ++j) {
+                int y = -width/2 + j;
+                for (int i = 0; i < width; ++i) {
+                    int x = -width/2 + i;
+                    double c = gauss(x, y, sigma);
+                    coeffs[j*width + i] = new Coeff(x, y, c);
+                    sum += c;
+                }
+            }
+            sum = 1.0/sum;
+            for (int i = 0; i < coeffs.length; ++i) {
+                coeffs[i].c *= sum;
+            }
+            return new Kernel(coeffs, width);
+        }
+
+        /**
+         * Evaluates this Kernel at the raster at raster index i, j.
+         * @param access The accessor to the raster.
+         * @param i The i raster index.
+         * @param j The j raster index.
+         * @return The folded value at index i, j.
+         */
+        public double fold(Access access, int i, int j) {
+
+            double s = 0.0d;
+
+            double unused = 0d;
+
+            for (int k = 0; k < coeffs.length; ++k) {
+                Coeff coeff = coeffs[k];
+                double v = access.get(i + coeff.di, j + coeff.dj);
+                if (Double.isNaN(v)) {
+                    unused += coeff.c;
+                }
+                else {
+                    s += v * coeff.c;
+                }
+            }
+
+            return s*(1.0d - unused);
+        }
+
+        /**
+         * Returns a string representation of this kernel.
+         * @return The string representation.
+         */
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder();
+
+            int height = coeffs.length/width;
+
+            for (int j = 0; j < height; ++j) {
+                if (j > 0) {
+                    sb.append(System.getProperty("line.separator"));
+                }
+                for (int i = 0; i < width; ++i) {
+                    if (i > 0) {
+                        sb.append("\t");
+                    }
+                    sb.append(coeffs[j*width + i]);
+                }
+            }
+
+            return sb.toString();
+        }
+    } // class Kernel
+
+    /**
+     * Interface of allow special access patterns to the raster,
+     * especially at the border.
+     */
+    public interface Access {
+
+        /**
+         * Returns the raster value at a given index point.
+         * @param i The i index
+         * @param j The j index
+         * @return The value of the raster.
+         */
+        double get(int i, int j);
+
+    } // interface Access
+
+    /**
+     * Interface to decouple the lookup which is needed
+     * to map double values to integers.
+     */
+    public interface ValueToIndex {
+
+        /**
+         * Returns the corresponding integer to a given value.
+         * @param value The value to be queried.
+         * @return The integer value or -1 if no such value was found.
+         */
+        int toIndex(double value);
+
+    } // interface ValueToIndex;
+
+    /**
+     * Brings raster to an integer representation with equal sized bins
+     * of integer vaules.
+     */
+    public static class IsoClasses
+    implements          ValueToIndex
+    {
+        /**
+         * Linear scaling factor.
+         */
+        protected double m;
+        /**
+         * Linear offset.
+         */
+        protected double b;
+        /**
+         * Number of classes.
+         */
+        protected int    numClasses;
+
+        /**
+         * Constructor to build a lookup to transform
+         * an raster into an equals sized bin integer array.
+         * @param raster The original raster
+         * @param numClasses The number of classes.
+         */
+        public IsoClasses(Raster raster, int numClasses) {
+
+            this.numClasses = numClasses;
+
+            double min =  Double.MAX_VALUE;
+            double max = -Double.MAX_VALUE;
+
+            double [] src = raster.raster;
+
+            for (int i = 0; i < src.length; ++i) {
+                double x = src[i];
+                if (!Double.isNaN(x)) {
+                    if (x < min) min = x;
+                    if (x > max) max = x;
+                }
+            }
+
+            /* f(min) = 0, f(max) = numClasses - 1
+
+               I:  0              = m*min + b
+               II: numClasses - 1 = m*max + b
+
+               II - I:
+               numClasses - 1 = m*(max - min)
+
+               m = (numClasses - 1)/(max - min)
+               b = m*min
+            */
+
+            if (max == min) {
+                m = 0;
+                b = 0;
+            }
+            else {
+                m = (numClasses - 1)/(max - min);
+                b = m*min;
+            }
+        }
+
+        /**
+         * Implements the double to integer lookup.
+         * @param value The value to map.
+         * @return The mapped value.
+         */
+        public int toIndex(double value) {
+            return Double.isNaN(value)
+                ? -1
+                : Math.min(Math.max(0, (int)Math.round(m*value + b)), numClasses-1);
+        }
+    } // class IsoClasses
+
+    /**
+     * Internal representation of the raster.
+     */
+    protected double [] raster;
+    /**
+     * The width of the raster.
+     */
+    protected int       width;
+
+    /**
+     * Default constructor. Creates an 0x0 raster.
+     */
+    public Raster() {
+        this(new double[0], 0);
+    }
+
+    /**
+     * Creates a raster with given values and width.
+     * @param raster
+     * @param width
+     */
+    public Raster(double [] raster, int width) {
+        this.raster = raster;
+        this.width  = width;
+    }
+
+    /**
+     * The width of the raster.
+     * @return The width.
+     */
+    public int getWidth() {
+        return width;
+    }
+
+    /**
+     * The height of the raster.
+     * @return The height.
+     */
+    public int getHeight() {
+        return raster.length / width;
+    }
+
+    /**
+     * The values of the raster.
+     * @return The values.
+     */
+    public double [] getValues() {
+        return raster;
+    }
+
+    /**
+     * Creates an integer representation of this raster using a
+     * given value to index transformer.
+     * @param valueToIndex The transformer to map double to integer values.
+     * @return The new created integer representation.
+     */
+    public int [] toIndexed(ValueToIndex valueToIndex) {
+        int [] dst = new int[raster.length];
+        for (int i = 0; i < raster.length; ++i) {
+            dst[i] = valueToIndex.toIndex(raster[i]);
+        }
+        return dst;
+    }
+
+    /**
+     * Creates a new raster by applying a kernel to this raster.
+     * Access to the raster is continuous at the border.
+     * The original raster is not modified.
+     * @param kernel The kernel to be applied.
+     * @return The new raster.
+     */
+    public Raster create(Kernel kernel) {
+        double [] dst = new double[raster.length];
+        Raster r = new Raster(dst, width);
+        r.apply(kernel, continueBorder());
+        return r;
+    }
+
+    /**
+     * Creates a new raster by applying a kernel to this raster.
+     * Access to the raster is given.
+     * @param kernel The kernel to be applied.
+     * @param access The access method to the raster.
+     */
+    public void apply(Kernel kernel, Access access) {
+        int height = getHeight();
+        for (int j = 0; j < height; ++j) {
+            int row = j*width;
+            for (int i = 0; i < width; ++i) {
+                raster[row + i] = kernel.fold(access, i, j);
+            }
+        }
+    }
+
+    /**
+     * Returns a continuous access to the raster. Values
+     * at the border are repeated til infinity if indices
+     * are accessed outside the defined area.
+     * @return The accessor.
+     */
+    public Access continueBorder() {
+        return new Access() {
+            int height = getHeight()-1;
+            public double get(int i, int j) {
+                     if (i < 0)      i = 0;
+                else if (i >= width) i = width-1;
+                     if (j < 0)      j = 0;
+                else if (j > height) j = height;
+                return raster[j*width + 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/gnv-artifacts/src/main/java/de/intevation/gnv/raster/RasterToPPM.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import java.awt.Color;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * Little helper class to write a Raster into an output stream
+ * as a Netpbm PPM file.
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class RasterToPPM
+{
+    private RasterToPPM() {
+    }
+
+    /**
+     * Writes a Raster to a given stream as PPM.
+     * @param raster The raster to be written.
+     * @param palette The palette used to figure out the rgb values.
+     * @param out  The stream to write into.
+     * @throws IOException Thrown if some error occurred during writing
+     * data to the output stream.
+     */
+    public static void writeToPPM(
+        Raster       raster,
+        Palette      palette,
+        OutputStream out
+    )
+    throws IOException
+    {
+        int W = raster.getWidth();
+        int H = raster.getHeight();
+        out.write(("P6\n" + W + " " + H + "\n255\n").getBytes("US-ASCII"));
+        double [] values = raster.getValues();
+        int pos = 0;
+        byte [] data = new byte[W*3];
+        int black = Color.BLACK.getRGB();
+        for (int i = 0; i < H; ++i) {
+            for (int j = 0; j < data.length; ++pos) {
+                Palette.Entry entry = palette.getEntry(values[pos]);
+                int rgb = entry == null
+                    ? black
+                    : entry.getColor().getRGB();
+                data[j++] = (byte)((rgb >> 16) & 0xff);
+                data[j++] = (byte)((rgb >>  8) & 0xff);
+                data[j++] = (byte)( rgb        & 0xff);
+            }
+            out.write(data);
+        }
+        out.flush();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/Vectorizer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,516 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.raster;
+
+import gnu.trove.TIntObjectHashMap;
+import gnu.trove.TIntStack;
+
+import java.util.ArrayList;
+import java.util.BitSet;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Instances of this class are able to vectorize 2D integer arrays
+ * with a kind of flood filling regions detection mechanism to
+ * a set of line strings and polygons.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class Vectorizer
+{
+    private static Logger log = Logger.getLogger(Vectorizer.class);
+
+    /**
+     * Callback to process the found line strings and polygons.
+     */
+    public interface RingsHandler {
+
+        /**
+         * Called from {@link #process(de.intevation.gnv.raster.Vectorizer.RingsHandler) }
+         * to give the found features to the postprocessing backend.
+         * @param rings The found line strings and polygons.
+         * @param value The integer value of the raster surrounded by
+         * the features.
+         * @param width The width of the index space of the vectorized data.
+         * @param height The height of the index space of the vectorized data.
+         */
+        void handleRings(
+            List<Edge> rings,
+            int        value,
+            int        width,
+            int        height);
+
+    } // interface RingsHandler
+
+    /**
+     * Doubly link list representing a line string or a polygon.
+     */
+    public static final class Edge {
+
+        /**
+         * The predecessor.
+         */
+        public Edge prev;
+        /**
+         * The successor.
+         */
+        public Edge next;
+
+        /**
+         * Index of first vertex. To separate x and y values
+         * you have to divide the value by the width of the
+         * index space.
+         */
+        public int a;
+        /**
+         * Index of second vertex. To separate x and y values
+         * you have to divide the value by the width of the
+         * index space.
+         */
+        public int b;
+
+        /**
+         * Default constructor.
+         */
+        public Edge() {
+        }
+
+        /**
+         * Constructor to create Edge with two vertices.
+         * @param a The first vertex.
+         * @param b The second vertex.
+         */
+        public Edge(int a, int b) {
+            this.a = a;
+            this.b = b;
+        }
+
+        /**
+         * Copy constructor
+         * @param other The edge to clone.
+         */
+        public Edge(Edge other) {
+            a = other.a;
+            b = other.b;
+        }
+
+        /**
+         * Chain a given edge segment to this segment. The
+         * side of the chaining is determined by a given
+         * parameter.
+         * @param other The segment to chain.
+         * @param found The side to chain.
+         */
+        public void chain(Edge other, int found) {
+
+            if (found == a) {
+                other.next = this;
+                prev = other;
+                return;
+            }
+
+            if (found == b) {
+                next = other;
+                other.prev = this;
+                return;
+            }
+
+            throw new IllegalStateException("cannot chain");
+        }
+
+        /**
+         * Tells if the list is complete which means that this
+         * edge list is a closed polygon.
+         * @return true if edge list is closed else false.
+         */
+        public boolean isComplete() {
+            Edge current = this;
+            do {
+                if (current.prev == null || current.next == null) {
+                    return false;
+                }
+                current = current.next;
+            }
+            while (current != this);
+            return true;
+        }
+
+        /**
+         * Returns the length of this edge list in next direction.
+         * Segments in prev direction are ignored.
+         * @return The length of this edge list.
+         */
+        public int length() {
+            int length = 0;
+            Edge current = this;
+            do { ++length; }
+            while ((current = current.next) != null && current != this);
+            return length;
+        }
+
+        /**
+         * Returns the head node of this edge list.
+         * @return The head node.
+         */
+        public Edge head() {
+            Edge current = this;
+            while (current.prev != null) {
+                current = current.prev;
+            }
+            return current;
+        }
+
+        /**
+         * Hashes the two vertex indices to a common value.
+         * @return The hash value.
+         */
+        @Override
+        public int hashCode() {
+            return (a << 16) | b;
+        }
+
+        /**
+         * Two edges are considered equal if they have the same
+         * a and b vertices.
+         * @param other The other edge.
+         * @return true if the edges are equal else false.
+         */
+        @Override
+        public boolean equals(Object other) {
+            Edge e = (Edge)other;
+            return a == e.a && b == e.b;
+        }
+    } // class Edge
+
+    /**
+     * Simplifies a given edge list by removing collinear vertices.
+     * Attention: The original list is modified.
+     * @param edge The edge list to simplify.
+     * @param width The width of the vertex index space.
+     * @return The simplified list.
+     */
+    protected static Edge simplify(Edge edge, int width) {
+
+        Edge e1 = edge, start = edge;
+
+        int length = edge.length();
+
+        if (length < 2) {
+            return e1;
+        }
+
+        Edge e2 = edge.next;
+
+        int count = 0;
+
+        do {
+            int e1x = e1.a % width;
+            int e1y = e1.a / width;
+            int e2x = e1.b % width;
+            int e2y = e1.b / width;
+            int e3x = e2.b % width;
+            int e3y = e2.b / width;
+
+            if ((e1x == e2x && e2x == e3x && e1x == e3x)
+                    ||  (e1y == e2y && e2y == e3y && e1y == e3y)) {
+                e1.b = e2.b;
+                Edge removed = e1.next;
+                e1.next = e2.next;
+                if (e1.next != null) {
+                    e1.next.prev = e1;
+                }
+                e2 = e1.next;
+                count = 0;
+                --length;
+                if (removed == start) {
+                    start = e1;
+                }
+            }
+            else {
+                e1 = e1.next;
+                e2 = e2.next;
+                ++count;
+            }
+        }
+        while (length > 1 && e2 != null && count < length + 2);
+
+        return start;
+    }
+
+    /**
+     * The raster to be traced.
+     */
+    protected int []            raster;
+    /**
+     * The width of the raster.
+     */
+    protected int               width;
+    /**
+     * Map of the currently open edges.
+     */
+    protected TIntObjectHashMap openEdges;
+    /**
+     * List of rings already found.
+     */
+    protected List<Edge>        rings;
+    /**
+     * Flag to signal if a simplification should be performed
+     * after a ring is completed.
+     */
+    protected boolean           simplify;
+
+    /**
+     * Default constructor. Simplification is turned on.
+     */
+    public Vectorizer() {
+        this(true);
+    }
+
+    /**
+     * Constructor to create a vectorized with an explicit
+     * simplification policy.
+     * @param simplify Indicates if simplification should be
+     * used on ring completion.
+     */
+    public Vectorizer(boolean simplify) {
+        openEdges     = new TIntObjectHashMap();
+        rings         = new ArrayList<Edge>();
+        this.simplify = simplify;
+    }
+
+    /**
+     * Constructor to create a vectorizer with a given raster and width.
+     * Simplification is turn on.
+     * @param raster The raster to be vectorized.
+     * @param width The width of the raster.
+     */
+    public Vectorizer(int [] raster, int width) {
+        this(true, raster, width);
+    }
+
+    /**
+     * Constructor to create a vectorizer with a given raster, width
+     * and an explicit simplification policy.
+     * @param simplify Indicates if simplification should be
+     * used on ring completion.
+     * @param raster The raster to be vectorized.
+     * @param width The width of the raster.
+     */
+    public Vectorizer(boolean simplify, int [] raster, int width) {
+        this(simplify);
+        this.raster = raster;
+        this.width  = width;
+    }
+
+    /**
+     * Returns (x, y+1) for given vertex in index space.
+     * @param i vertex in index space.
+     * @param w width of raster.
+     * @return (x, y+1) in index space.
+     */
+    public static final int tl(int i, int w) {
+        int x = i % w;
+        int y = i / w;
+        return x + (w + 1)*y;
+    }
+
+    /**
+     * Returns tl(i, w) + 1.
+     * @param i vertex in index space.
+     * @param w width of raster.
+     * @return tl(i, w) + 1.
+     */
+    public static final int tr(int i, int w) {
+        return tl(i, w) + 1;
+    }
+
+    /**
+     * Returns tl(i, w) + w + 1.
+     * @param i vertex in index space.
+     * @param w width of raster.
+     * @return tl(i, w) + w + 1.
+     */
+    public static final int bl(int i, int w) {
+        return tl(i, w) + w + 1;
+    }
+
+    /**
+     * Returns bl(i, w) + 1.
+     * @param i vertex in index space.
+     * @param w width of raster.
+     * @return bl(i, w) + 1.
+     */
+    public static final int br(int i, int w) {
+        return bl(i, w) + 1;
+    }
+
+    /**
+     * Resets open resources after a set of features were found.
+     */
+    protected void resetRegion() {
+        openEdges.clear();
+        rings.clear();
+    }
+
+    /**
+     * Adds an edge to the map of open edges, joins it
+     * with its direct neighbors of if complete add the
+     * list to the complete features.
+     * @param edge
+     */
+    protected void emit(Edge edge) {
+
+        Edge otherA = (Edge)openEdges.remove(edge.a);
+        if (otherA != null) {
+            otherA.chain(edge, edge.a);
+        }
+
+        Edge otherB = (Edge)openEdges.remove(edge.b);
+        if (otherB != null) {
+            otherB.chain(edge, edge.b);
+        }
+
+        if (edge.isComplete()) {
+            rings.add(simplify ? simplify(edge, width + 1) : edge);
+        }
+        else {
+            if (otherA == null) {
+                openEdges.put(edge.a, edge);
+            }
+            if (otherB == null) {
+                openEdges.put(edge.b, edge);
+            }
+        }
+    }
+
+    /**
+     * Vectorize the raster. The found features are fed into
+     * the given ring handler.
+     * @param handler The RingHandler to postprocess the found features.
+     * @return The number of regions found.
+     */
+    public int process(RingsHandler handler) {
+
+        BitSet visited = new BitSet(raster.length);
+
+        TIntStack stack = new TIntStack();
+
+        int regions = 0;
+
+        int height = raster.length / width;
+
+        for (int i = 0; i < raster.length; ++i) {
+            if (visited.get(i)) {
+                continue;
+            }
+
+            ++regions;
+
+            int currentValue = raster[i];
+            visited.set(i);
+
+            int current = i;
+            visited.set(current);
+
+            for (;;) {
+                int tl = tl(current, width);
+                int tr = tr(current, width);
+                int bl = bl(current, width);
+                int br = br(current, width);
+
+                int t = current - width;
+
+                if (t < 0) {
+                    emit(new Edge(tr, tl));
+                }
+                else {
+                    if (raster[t] != currentValue) {
+                        emit(new Edge(tr, tl));
+                    }
+                    else {
+                        if (!visited.get(t)) {
+                            visited.set(t);
+                            stack.push(t);
+                        }
+                    }
+                }
+
+                int b = current + width;
+
+                if (b >= raster.length) {
+                    emit(new Edge(bl, br));
+                }
+                else {
+                    if (raster[b] != currentValue) {
+                        emit(new Edge(bl, br));
+                    }
+                    else {
+                        if (!visited.get(b)) {
+                            visited.set(b);
+                            stack.push(b);
+                        }
+                    }
+                }
+
+                int x = current % width;
+
+                if (x == 0) {
+                    emit(new Edge(tl, bl));
+                }
+                else {
+                    int l = current - 1;
+                    if (raster[l] != currentValue) {
+                        emit(new Edge(tl, bl));
+                    }
+                    else {
+                        if (!visited.get(l)) {
+                            visited.set(l);
+                            stack.push(l);
+                        }
+                    }
+                }
+
+                if (x == width - 1) {
+                    emit(new Edge(br, tr));
+                }
+                else {
+                    int r = current + 1;
+                    if (raster[r] != currentValue) {
+                        emit(new Edge(br, tr));
+                    }
+                    else {
+                        if (!visited.get(r)) {
+                            visited.set(r);
+                            stack.push(r);
+                        }
+                    }
+                }
+
+                if (stack.size() == 0) {
+                    break;
+                }
+
+                current = stack.pop();
+            }
+
+            handler.handleRings(
+                rings,
+                currentValue,
+                width + 1,
+                height + 1);
+
+            resetRegion();
+        }
+
+        return regions;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/raster/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Classes and interfaces to handle 2D double valued
+raster arrays. Additional palette support and vectorization these rasters into
+simple feature vector representations are supplied.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/AutoResumeState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state;
+
+/**
+ *
+ * Markerinterface for states which should be used for
+ * automatically resume and jump to the next <code>State</code> using
+ * the conditions of the transitions which are linked to it.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public interface AutoResumeState extends State{
+
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/CoordinateSelectionState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,28 +1,42 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 
 import org.apache.log4j.Logger;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
 
 import com.vividsolutions.jts.geom.Point;
-import com.vividsolutions.jts.io.ParseException;
-import com.vividsolutions.jts.io.WKTReader;
 
+import de.intevation.artifacts.common.utils.Config;
 import de.intevation.gnv.geobackend.base.Result;
 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
 import de.intevation.gnv.state.describedata.NamedArrayList;
 import de.intevation.gnv.state.describedata.NamedCollection;
+import de.intevation.gnv.utils.ArtifactXMLUtilities;
 import de.intevation.gnv.utils.InputValidator;
+import de.intevation.gnv.utils.WKTUtils;
 import de.intevation.gnv.utils.exception.ValidationException;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * This state handles coordinate input by the user. It searches database results
+ * for coordinates and turns them into a human readable form.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class CoordinateSelectionState extends StateBase {
@@ -31,13 +45,28 @@
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(CoordinateSelectionState.class);
-    
+
     /**
      * The UID of this Class
      */
     private static final long serialVersionUID = 6318923553625195063L;
 
     /**
+     * XPATH Expressions for the setup.
+     */
+
+    private final static String MESH_WIDTH_XPATH = "mesh-width";
+    private final static String XLINK_XPATH = "xlink:href";
+    private final static String MESH_LIST_XPATH = "/mesh-widths/mesh";
+    private final static String ID_XPATH = "id";
+    private final static String WIDTH_VALUE_XPATH = "width";
+
+    /**
+     * Holds all given Widths between two MeshPoints for different Meshes.
+     */
+    private HashMap<String, Double> meshWidths = null;
+
+    /**
      * Constructor
      */
     public CoordinateSelectionState() {
@@ -45,36 +74,37 @@
     }
 
     @Override
-    protected void purifyResult(Collection<Result> result, String uuid) {
+    protected List<Object> purifyResult(Collection<Result> result, String uuid) {
         log.debug("CoordinateSelectionState.purifyResult");
-        Collection<Object> describeData = this.getDescibeData(uuid);
-        if (describeData == null) {
-            describeData = new ArrayList<Object>();
-        }
-        NamedCollection<KeyValueDescibeData> keyValueDescibeData = this
-                .extractKVP(result, "FEATUREID", "SHAPE");
+        List<Object> describeData = new ArrayList<Object>();
+
+        NamedCollection<KeyValueDescibeData> keyValueDescibeData =
+            extractKVP(result, "FEATUREID", "SHAPE");
+
         describeData.add(keyValueDescibeData);
-        this.setDescibeData(uuid, describeData);
+        return describeData;
     }
-    
+
+
     @Override
     protected String prepareInputData4RegionDBQuery(String value) {
         log.debug("CoordinateSelectionState.prepareInputData4RegionDBQuery");
         double distance=0.;
         String returnValue = null;
         try {
-            Point center = new InputValidator().getPointValue(value);
-            String meshIDValue = super.inputData.get("meshid").getValue();
+            Point center = InputValidator.getPointValue(value);
+            String meshId = super.inputData.get("meshid").getValue();
             int segments = 97;
-            int meshid = new Integer(meshIDValue);
-            if (meshid == 3 || meshid == 5){ // TODO nicht hier festbrennen.
-                distance = 0.15; //nord-ostsee 6nm // 97 Stützpunkte
-            }else if (meshid == 1 || meshid == 4){
-                distance = 0.03; //Kuestenmodell 1 nm
-            }else if (meshid == 2 || meshid == 321){
-                distance = 0.3; //SST Karten ca 20km
-            }else if (meshid == 641){
-                distance = 0.3; //Eisdaten Klima
+            if (meshWidths != null){
+                Double distanceValue = this.meshWidths.get(meshId);
+                if (distanceValue != null){
+                    log.debug("User "+distanceValue+" as Buffer around given Point");
+                    distance = distanceValue.doubleValue();
+                }else{
+                    log.warn("No distance is configured for Mesh with id"+ meshId);
+                }
+            }else{
+                log.warn("No MeshWidth configured. Check if this is correct.");
             }
             returnValue = center.buffer(distance,segments).toText();
         } catch (NumberFormatException e) {
@@ -83,12 +113,10 @@
             log.error(e,e);
         }
         return returnValue;
-        
+
     }
-    
-    /**
-     * @see de.intevation.gnv.state.StateBase#extractKVP(java.util.Collection, java.lang.String, java.lang.String)
-     */
+
+
     @Override
     protected NamedCollection<KeyValueDescibeData> extractKVP(
             Collection<Result> result,
@@ -102,37 +130,54 @@
         while (rit.hasNext()) {
             Result resultValue = rit.next();
             String key = resultValue.getString(keyid);
-            if(prevKey == null || !prevKey.equals(key)){ // müssen wir so machen, da die sde kein select distinct auf layern zulässt.
-                String geomString = this.convert2DisplayCoordinate(resultValue.getString(valueid));
+            if(prevKey == null || !prevKey.equals(key)){ // TODO: FIXME: We have to do that because the arcsde does not support a distinct Query on Layers
+                String geomString = CoordinateSelectionState.convert2DisplayCoordinate(resultValue.getString(valueid));
                 String value = geomString;
                 if (resultValue.getResultDescriptor().getColumnIndex("VALUE") > 0){
                     value = resultValue.getString("VALUE") + " - "+value;
                 }
-                
-                
+
+
                 keyValueDescibeData.add(new DefaultKeyValueDescribeData(key,value ));
             }
             prevKey = key;
         }
         return keyValueDescibeData;
     }
-    
-    protected String convert2DisplayCoordinate(String wkt){
-        String formattedCoordinate = null;
-        try {
-            Point p = (Point)new WKTReader().read(wkt);
-            double lat = p.getY();
-            double lon =p.getX();
-            String nord="N";
-            String ost="E";
-            if (lat <0 ){nord="S"; lat=-lat;}
-            if (lon <0 ){ost="W"; lon=-lon;}
-            formattedCoordinate =  String.format("%1$02d°%2$1S %3$05.2f' %4$03d°%5$1S %6$05.2f'",
-                                  (int)lat, nord,60.*(lat-((int)lat)),(int)lon,ost,60.*(lon-((int)lon)));
-        } catch (ParseException e) {
-            log.error(e,e);
+
+    /**
+     * Turn coordinate into a human readable format.
+     *
+     * @param wkt Coordinate as wkt string.
+     * @return formatted coordinate.
+     */
+    protected static String convert2DisplayCoordinate(String wkt){
+        return WKTUtils.toText(wkt);
+    }
+
+
+    @Override
+    public void setup(Node configuration) {
+        super.setup(configuration);
+        Element widthElement = (Element)Config.getNodeXPath(configuration, MESH_WIDTH_XPATH);
+
+        if (widthElement != null){
+            String fileName = widthElement.getAttribute(XLINK_XPATH);
+            fileName = Config.replaceConfigDir(fileName);
+            Node configurationNode = new ArtifactXMLUtilities().readConfiguration(fileName);
+            NodeList meshNodes = Config.getNodeSetXPath(configurationNode,MESH_LIST_XPATH );
+            if (meshNodes != null){
+                meshWidths = new HashMap<String, Double>(meshNodes.getLength());
+                for (int i = 0; i < meshNodes.getLength(); i++){
+                    Element meshNode = (Element)meshNodes.item(i);
+                    String id = meshNode.getAttribute(ID_XPATH);
+                    Double value = Double.parseDouble(meshNode.getAttribute(WIDTH_VALUE_XPATH));
+                    meshWidths.put(id, value);
+                }
+            }
+        }else{
+            log.warn("No Mesh Width defined.");
         }
-        
-        return formattedCoordinate;
     }
 }
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultAutoResumeState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+
+/**
+ * Default implementation of <code>AutoResumeState</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class DefaultAutoResumeState extends StateBase implements AutoResumeState
+{
+    /**
+     * The UID of this Class.
+     */
+    private static final long serialVersionUID = -4470531390092041577L;
+
+    /**
+     * Constructor
+     */
+    public DefaultAutoResumeState() {
+        super();
+    }
+
+
+    @Override
+    protected List<Object> purifyResult(Collection<Result> result, String uuid) {
+        return new ArrayList<Object>(0);
+    }
+
+
+    @Override
+    protected String[] getDescriptionForInputData(
+        InputData data, CallContext context, String uuid) {
+        return new String[0];
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultExportMode.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state;
+
+/**
+ * This is the default implementation of <code>ExportMode</code>.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class DefaultExportMode
+implements   ExportMode
+{
+    /**
+     * The name of the export (e.g. pdf, svg, image).
+     */
+    protected String name;
+
+    /**
+     * A description for this export.
+     */
+    protected String description;
+
+    /**
+     * The mimetype used to do execute this export.
+     */
+    protected String mimeType;
+
+    /**
+     * Constructor.
+     *
+     */
+    public DefaultExportMode(String name, String description, String mimeType){
+        this.name        = name;
+        this.description = description;
+        this.mimeType    = mimeType;
+    }
+
+
+    public String getName() {
+        return name;
+    }
+
+
+    public String getDescription() {
+        return description;
+    }
+
+
+    public String getMimeType() {
+        return mimeType;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputData.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,24 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The default implementation of <code>InputData</code>. This object stores
+ * multiple values separated by {@link #VALUE_SEPARATOR} for a specific key.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class DefaultInputData implements InputData {
 
@@ -13,8 +26,35 @@
      *
      */
     private static final long serialVersionUID = 4308041648698108066L;
-    private String name = null;
-    private String value = null;
+
+    private static final Logger logger = Logger.getLogger(DefaultInputData.class);
+
+    /**
+     * The character used to separate the different values.
+     */
+    public final static String VALUE_SEPARATOR = " , ";
+
+    /**
+     * The key/name of this object.
+     */
+    protected String name;
+
+    /**
+     * Values separated by {@link #VALUE_SEPARATOR}.
+     */
+    protected String value;
+
+    /**
+     * Descriptions for values used for user interface creation. Each value
+     * should have an own description in this map.
+     */
+    protected Map    description;
+
+    /**
+     * An extra object. Might be everything.
+     */
+    protected Object object;
+
 
     /**
      * Constructor
@@ -24,33 +64,158 @@
         this.value = value;
     }
 
-    /**
-     * @see de.intevation.gnv.state.InputData#getName()
-     */
+
+    public DefaultInputData(String name, Object object) {
+        this.name   = name;
+        this.object = object;
+    }
+
+
+    public DefaultInputData(
+        String name,
+        String value,
+        Object object)
+    {
+        this.name        = name;
+        this.object      = object;
+        this.value       = value;
+    }
+
+
     public String getName() {
         return this.name;
     }
 
-    /**
-     * @see de.intevation.gnv.state.InputData#getValue()
-     */
+
     public String getValue() {
         return this.value;
     }
 
+
+    public void setObject(Object object) {
+        this.object = object;
+    }
+
+
+    public Object getObject() {
+        return object;
+    }
+
     /**
-     * @see java.lang.Object#toString()
+     *
+     * @param key Key needs to be a single value of {@link #value}.
+     * @return the description.
      */
+    public String getDescription(String key) {
+        if (description == null)
+            return null;
+
+        return (String) description.get(key);
+    }
+
+    /**
+     * Return all descriptions as array.
+     *
+     * @return descriptions as array.
+     */
+    public String[] getDescription() {
+        String[] values      = splitValue();
+        int length           = values.length;
+
+        String[] description = new String[length];
+        for (int i = 0; i < length; i++) {
+            description[i] = (String) this.description.get(values[i]);
+        }
+
+        return description;
+    }
+
+
+    public void setDescription(String[] description) {
+        if (this.description == null)
+            this.description = new HashMap();
+
+        String[] values = splitValue();
+
+        int length     = values.length;
+        int descLength = description.length;
+
+        for (int i = 0; i < length; i++) {
+            if (i < descLength) {
+                this.description.put(values[i], description[i]);
+            }
+            else {
+                break;
+            }
+        }
+    }
+
+
     @Override
     public String toString() {
         return this.name + "==> " + this.value;
     }
 
-    /**
-     * @see de.intevation.gnv.state.InputData#concartValue(java.lang.String)
-     */
+
     public void concartValue(String value) {
-        this.value = this.value + " , " + value;
+        this.value = this.value + VALUE_SEPARATOR + value;
     }
 
+
+    public String[] splitValue() {
+        if (this.value != null){
+            return this.value.split(VALUE_SEPARATOR);
+        }
+        return null;
+    }
+
+    @Override
+    public int hashCode() {
+        logger.debug("*************************************");
+        logger.debug("HashCode name: " + name);
+
+        int hash = 0;
+
+        hash ^= name.hashCode();
+
+        if (value != null) {
+            hash ^= value.hashCode() << 2;
+        }
+
+        if (object != null) {
+            hash ^= object.hashCode() << 4;
+        }
+
+        logger.debug("HashCode value: " + hash);
+        logger.debug("*************************************");
+
+        return hash;
+    }
+
+
+    @Override
+    public boolean equals(Object o) {
+        if (!(o instanceof DefaultInputData))
+            return false;
+
+        DefaultInputData other = (DefaultInputData) o;
+
+        if (!name.equals(other.name))
+            return false;
+
+        if ((value == null) && (other.value == null))
+            return false;
+
+        if (!value.equals(other.value))
+            return false;
+
+        if (!(object == null) && (other.object == null))
+            return false;
+
+        if (!(object == other.object))
+            return false;
+
+        return true;
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputValue.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultInputValue.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The default implementation of <code>InputValue</code>. InputValue objects are
+ * used to store meta information about <code>InputData</code> objects.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class DefaultInputValue implements InputValue {
 
@@ -19,6 +26,7 @@
     private int usedInQueries = 1;
     private String defaultValue = "N/N";
 
+
     public DefaultInputValue(String name, String type, String defaultValue,
                              boolean multiselect) {
         this(name, type, multiselect, 1);
@@ -26,9 +34,7 @@
 
     }
 
-    /**
-     * Constructor
-     */
+
     public DefaultInputValue(String name, String type, boolean multiselect,
                              int usedInQueries) {
         this.name = name;
@@ -37,22 +43,20 @@
         this.usedInQueries = usedInQueries;
     }
 
-    /**
-     * @see de.intevation.gnv.state.InputValue#getName()
-     */
+
     public String getName() {
         return this.name;
     }
 
-    /**
-     * @see de.intevation.gnv.state.InputValue#getType()
-     */
+
     public String getType() {
         return this.type;
     }
 
     /**
-     * @see java.lang.Object#toString()
+     * Returns the information as string.
+     *
+     * @return information as string.
      */
     @Override
     public String toString() {
@@ -60,19 +64,20 @@
                + "==> multiselect: " + this.multiselect;
     }
 
-    /**
-     * @see de.intevation.gnv.state.InputValue#isMultiselect()
-     */
+
     public boolean isMultiselect() {
         return this.multiselect;
     }
 
+
     public int usedInQueries() {
         return this.usedInQueries;
     }
 
+
     public String getDefaultValue() {
         return this.defaultValue;
     }
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultOutputMode.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultOutputMode.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,13 +1,21 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
 import java.util.Collection;
+import java.util.List;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The default implementation of <code>OutputMode</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class DefaultOutputMode implements OutputMode {
 
@@ -19,46 +27,55 @@
     private String description = null;
     private String mimeType = null;
     private Collection<InputValue> inputParameters = null;
+    private List<ExportMode> exportModes;
 
     /**
      * Constructor
-     * 
-     * @param name
-     * @param description
-     * @param mimeType
+     *
+     * @param name The name of the output mode.
+     * @param description The description of this output mode.
+     * @param mimeType The mime type used by this output mode.
+     * @param inputParameters The input parameters required by this output mode.
+     * @param exportModes The export modes for this output mode.
      */
-    public DefaultOutputMode(String name, String description, String mimeType,
-                             Collection<InputValue> inputParameters) {
+    public DefaultOutputMode(
+        String name,
+        String description,
+        String mimeType,
+        Collection<InputValue> inputParameters,
+        List<ExportMode> exportModes)
+    {
         super();
-        this.name = name;
-        this.description = description;
-        this.mimeType = mimeType;
+        this.name            = name;
+        this.description     = description;
+        this.mimeType        = mimeType;
         this.inputParameters = inputParameters;
+        this.exportModes     = exportModes;
     }
 
     /**
-     * @see de.intevation.gnv.state.OutputMode#getDescription()
+     * @return the description.
      */
     public String getDescription() {
         return this.description;
     }
 
     /**
-     * @see de.intevation.gnv.state.OutputMode#getMimeType()
+     * @return the mime type.
      */
     public String getMimeType() {
         return this.mimeType;
     }
 
     /**
-     * @see de.intevation.gnv.state.OutputMode#getName()
+     * @return the name.
      */
     public String getName() {
         return this.name;
     }
 
     /**
-     * @see java.lang.Object#toString()
+     * @return this output mode as string.
      */
     @Override
     public String toString() {
@@ -67,10 +84,19 @@
     }
 
     /**
-     * @see de.intevation.gnv.state.OutputMode#getInputParameters()
+     * @return the input parameters.
      */
     public Collection<InputValue> getInputParameters() {
         return this.inputParameters;
     }
 
+    /**
+     *
+     * @return the export modes.
+     */
+    public List<ExportMode> getExportModes() {
+        return exportModes;
+    }
+
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/DefaultState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the default implementation of <code>StateBase</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class DefaultState extends StateBase {
 
@@ -21,3 +28,4 @@
     }
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/ExportMode.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state;
+
+import java.io.Serializable;
+
+/**
+ * This interface defines basic methods which are necessary for exports.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public interface ExportMode
+extends          Serializable
+{
+    /**
+     * Return the export name (e.g. pdf, svg, image).
+     *
+     * @return the export name.
+     */
+    public String getName();
+
+    /**
+     * Return the description for this export.
+     *
+     * @return the export description.
+     */
+    public String getDescription();
+
+    /**
+     * Returns the mime type used by this export.
+     *
+     * @return export's mimetype.
+     */
+    public String getMimeType();
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/ExtendedInputData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state;
+
+/**
+ * This class is used to save the relation between two attributes. Mainly used
+ * to save the relation between a measurement and the parameter it belongs to.
+ *
+ * @see MeasurementState
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ExtendedInputData extends DefaultInputData {
+
+    /**
+     * The separater used to separate measurement ids and parameter ids.
+     */
+    public static final String SEPARATOR = ";";
+
+    /**
+     * The parameter this object belongs to.
+     */
+    protected String parameterid;
+
+    /**
+     * Constructcor.
+     *
+     * @param name
+     * @param value
+     * @param object
+     * @param parameterid
+     */
+    public ExtendedInputData(
+        String name,
+        String value,
+        Object object,
+        String parameterid)
+    {
+        super(name, value, object);
+        this.parameterid = parameterid;
+    }
+
+    /**
+     * Return the parameter ids this object belongs to.
+     *
+     * @return the parameter id.
+     */
+    public String getParameterID() {
+        return parameterid;
+    }
+
+    /**
+     * Set the parameter ids.
+     *
+     * @param parameterid Parameter ids.
+     */
+    public void setParameter(String parameterid) {
+        this.parameterid = parameterid;
+    }
+
+    /**
+     * Return all parameter ids as array.
+     *
+     * @return Array of parameter ids.
+     */
+    public String[] splitParameter() {
+        if (parameterid != null)
+            return parameterid.split(SEPARATOR);
+
+        return null;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/InputData.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/InputData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,19 +1,88 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
 import java.io.Serializable;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This interface defines the basic methods used to store multiple values with
+ * a specific key and name.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public interface InputData extends Serializable {
 
+    /**
+     * Method to Retrieve the name of this input data item.
+     *
+     * @return the name
+     */
     public String getName();
 
+    /**
+     * Method to retrieve the value of this input data item. A value might be a
+     * list of values separated by a specific character.
+     *
+     * @return the value
+     */
     public String getValue();
 
+    /**
+     * Method to store a further object at this input data item.
+     *
+     * @param o A further object.
+     */
+    public void setObject(Object o);
+
+    /**
+     * Method to retrieve the extra object.
+     *
+     * @return the extra object.
+     */
+    public Object getObject();
+
+    /**
+     * Method to store descriptions for this input data item.
+     *
+     * @param description Array of descriptions.
+     */
+    public void setDescription(String[] description);
+
+    /**
+     * Method to retrieve a description specified by a given key.
+     *
+     * @param key Key.
+     * @return the description for this key.
+     */
+    public String getDescription(String key);
+
+    /**
+     * Method to retrieve all descriptions of this input data item.
+     *
+     * @return descriptions.
+     */
+    public String[] getDescription();
+
+    /**
+     * Append a further string value to the value field devided by a separater
+     * character.
+     *
+     * @param value Value to append.
+     */
     public void concartValue(String value);
+
+    /**
+     * Method to retrieve the character separated values split into an array.
+     *
+     * @return values as array.
+     */
+    String[] splitValue();
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/InputValue.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/InputValue.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,24 +1,58 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
 import java.io.Serializable;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This interface defines some basic methods to retrieve information about the
+ * type of an user input.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public interface InputValue extends Serializable {
 
+    /**
+     * Retrieve the name of the inserted data.
+     *
+     * @return the input data name.
+     */
     public String getName();
 
+    /**
+     * Retrieve the type of the input.
+     *
+     * @return the input data type.
+     */
     public String getType();
 
+    /**
+     * Retrieve the default value used when no input is done.
+     *
+     * @return the input data default value.
+     */
     public String getDefaultValue();
 
+    /**
+     * Retrieve information about mutliselect fields.
+     *
+     * @return true, if the input data is a multiselect, otherwise false.
+     */
     public boolean isMultiselect();
 
+    /**
+     * Retrieve information about the occurance of this input in an sql
+     * statement.
+     *
+     * @return the number of times, this data is used in a sql query.
+     */
     public int usedInQueries();
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/MeasurementState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,457 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state;
+
+import de.intevation.artifacts.common.utils.XMLUtils;
+
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import de.intevation.gnv.state.describedata.ExtendedKeyValueData;
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.describedata.NamedArrayList;
+import de.intevation.gnv.state.describedata.NamedCollection;
+
+import de.intevation.gnv.state.exception.StateException;
+
+import de.intevation.gnv.utils.InputValidator;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.TreeMap;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * This state handles input of measurements relating to a parameter. The user
+ * interface description created by this class represents a matrix - each
+ * parameter in a single row, each measurement in a column. An invalid
+ * measurement column for a specific parameter is marked as disabled and should
+ * not be selected.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class MeasurementState
+extends      DefaultState
+{
+    private static Logger logger = Logger.getLogger(MeasurementState.class);
+
+    public static final String SQL_KEY_PARAMETERID = "PARAMETERID";
+
+    public static final String SEPARATOR = ";";
+
+
+    /**
+     * This class is used to generate the Matrix in <code>MinMaxDateState</code>.
+     * Parameter and Measurements are stored in separate lists and can be
+     * requested via different methods.
+     *
+     * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+     */
+    private class ParameterMatrix {
+        private final Logger logger =
+            Logger.getLogger(ParameterMatrix.class);
+
+        private List measurements;
+        private List mDescriptions;
+        private List parameters;
+        private boolean[][] values;
+
+        /**
+         * Constructs a new matrix.
+         *
+         * @param data A collection containing the measurements.
+         * @param parameter An array of parameters.
+         */
+        public ParameterMatrix(Collection data, String[] parameter) {
+            measurements  = new ArrayList(data.size());
+            mDescriptions = new ArrayList(data.size());
+            parameters    = new ArrayList(parameter.length);
+
+            values = new boolean[data.size()][parameter.length];
+            for (int i = 0; i < data.size(); i++) {
+                Arrays.fill(values[i], false);
+            }
+
+            initParameters(parameter);
+            initMeasurements(data);
+        }
+
+        /**
+         * Initialize the measurements used in this matrix.
+         *
+         * @param data The measurements.
+         */
+        private void initMeasurements(Collection data) {
+            Iterator iter = data.iterator();
+            while (iter.hasNext()) {
+                ExtendedKeyValueData value = (ExtendedKeyValueData) iter.next();
+                String key                = value.getKey();
+                String val                = value.getValue();
+                String parameter          = value.getParameter();
+
+                int i                     = measurements.indexOf(key);
+                int j                     = parameters.indexOf(parameter);
+                int tmp                   = mDescriptions.indexOf(val);
+
+                if (i < 0) {
+                    measurements.add(key);
+                    i = measurements.indexOf(key);
+
+                    mDescriptions.add(val);
+                    tmp = mDescriptions.indexOf(val);
+                }
+
+                if (j < 0) {
+                    logger.warn("Not a valid parameter: " + parameter);
+                }
+
+                if (i >= 0 && i < measurements.size() && j >= 0
+                &&  j < parameters.size())
+                {
+                    values[i][j] = true;
+                }
+            }
+        }
+
+        /**
+         * Initialize the parameters used in this matrix.
+         *
+         * @param parameter Parameters.
+         */
+        private void initParameters(String[] parameter) {
+            for (String param: parameter) {
+                parameters.add(param);
+            }
+        }
+
+        /**
+         * Returns the number of measurements.
+         *
+         * @return the number of measurements.
+         */
+        public int measurementSize() {
+            if (measurements != null)
+                return measurements.size();
+
+            return 0;
+        }
+
+        /**
+         * Returns the number of parameters.
+         *
+         * @return number of parameters.
+         */
+        public int parameterSize() {
+            if (parameters != null)
+                return parameters.size();
+
+            return 0;
+        }
+
+        /**
+         * Returns the measurement at idx.
+         *
+         * @param idx Index.
+         * @return the measurement.
+         */
+        public String getMeasurement(int idx) {
+            if (idx >= 0 && idx < measurements.size())
+                return (String) measurements.get(idx);
+
+            logger.warn("Index is out of bounds: " + idx);
+            return "";
+        }
+
+        /**
+         * Returns the parameter at idx.
+         *
+         * @param idx Index
+         * @return the parameter.
+         */
+        public String getParameter(int idx) {
+            if (idx >= 0 && idx < parameters.size()) {
+                return (String) parameters.get(idx);
+            }
+
+            logger.warn("Index is out of bounds: " + idx);
+            return "";
+        }
+
+        /**
+         * Returns a description text for a specific measurement.
+         *
+         * @param idx Index of a measurement.
+         * @return measurement's description.
+         */
+        public String getMDescription(int idx) {
+            if (mDescriptions != null) {
+                return (String) mDescriptions.get(idx);
+            }
+
+            return null;
+        }
+
+        /**
+         * This method returns true, if a measurement is valid for a specific
+         * parameter - otherwise false.
+         *
+         * @param i Index of a measurement column.
+         * @param j Index of a parameter row.
+         * @return true, if valid, else false.
+         */
+        public boolean isValid(int i, int j) {
+            if (i < 0 || i > measurements.size()
+            ||  j < 0 || j > parameters.size())
+            {
+                logger.warn("Index out of bounds: " + i + "|" + j);
+                return false;
+            }
+
+            return values[i][j];
+        }
+    } // End of ParameterMatrix
+
+
+    public MeasurementState() {
+        super();
+    }
+
+    @Override
+    protected NamedCollection<KeyValueDescibeData> extractKVP(
+        Collection<Result> result,
+        String             keyid,
+        String             valueid
+    ) {
+        NamedCollection<KeyValueDescibeData> kvdd =
+            new NamedArrayList<KeyValueDescibeData>(dataName, result.size());
+
+        kvdd.setMultiSelect(true);
+
+        int keyPos = -1;
+        int valPos = -1;
+        int parPos = -1;
+
+        for (Result res: result) {
+            if (keyPos < 0 || valPos < 0 || parPos < 0) {
+                ResultDescriptor rd = res.getResultDescriptor();
+
+                keyPos = rd.getColumnIndex(keyid);
+                valPos = rd.getColumnIndex(valueid);
+                parPos = rd.getColumnIndex(SQL_KEY_PARAMETERID);
+            }
+
+            kvdd.add(new ExtendedKeyValueData(
+                res.getString(keyPos),
+                res.getString(valPos),
+                getID(),
+                res.getString(parPos)));
+        }
+
+        return kvdd;
+    }
+
+
+    /**
+     * This method create the user interface description for measurement and
+     * parameters as matrix. A row for each parameter, a column for each
+     * measurement.
+     */
+    @Override
+    protected void appendToDynamicNode(
+        XMLUtils.ElementCreator artCreator,
+        XMLUtils.ElementCreator creator,
+        Document                document,
+        Node                    dynamicNode,
+        CallMeta                callMeta,
+        Object                  o
+    ) {
+        NamedArrayList all       = (NamedArrayList) o;
+        String name              = all.getName();
+        RessourceFactory factory = RessourceFactory.getInstance();
+
+        Element matrixNode = creator.create("group");
+        Element matrixLabel = creator.create("label");
+        matrixLabel.setTextContent(factory.getRessource(
+            callMeta.getLanguages(), all.getName(), all.getName()));
+        creator.addAttr(matrixNode, "mode", "matrix");
+        matrixNode.appendChild(matrixLabel);
+
+        InputData inputParam = inputData.get("parameterid");
+        ParameterMatrix matrix = new ParameterMatrix(all, inputParam.splitValue());
+
+        int measurements = matrix.measurementSize();
+        int parameters   = matrix.parameterSize();
+
+        for (int i = 0; i < parameters; i++) {
+            Element select = creator.create("select");
+            String param   = matrix.getParameter(i);
+            creator.addAttr(select, "label", inputParam.getDescription(param));
+            creator.addAttr(select, "ref", name);
+
+            for (int j = 0; j < measurements; j++) {
+                Element item  = creator.create("item");
+                Element label = creator.create("label");
+                Element value = creator.create("value");
+
+                creator.addAttr(item, "ref", name);
+                creator.addAttr(
+                    item,
+                    "parameter",
+                    matrix.getMDescription(j));
+
+                if (!matrix.isValid(j, i)) {
+                    creator.addAttr(item, "disabled", "true");
+                }
+                else {
+                    creator.addAttr(item, "disabled", "false");
+                }
+
+                String tmpValue = matrix.getMeasurement(j) + ";" + param;
+                label.setTextContent(matrix.getMDescription(j));
+                value.setTextContent(tmpValue);
+
+                item.appendChild(label);
+                item.appendChild(value);
+                select.appendChild(item);
+            }
+
+            matrixNode.appendChild(select);
+        }
+
+        dynamicNode.appendChild(matrixNode);
+    }
+
+
+    /**
+     * This feed takes some input data storing measurement ids and parameter ids
+     * and put them into ExtendedInputData objects to save the relation between
+     * a measurement and the parameter it belongs to.
+     */
+    @Override
+    public Document feed(
+        CallContext           context,
+        Collection<InputData> input,
+        String                uuid)
+    throws StateException
+    {
+        RessourceFactory resFactory = RessourceFactory.getInstance();
+        Locale[] serverLocales      = resFactory.getLocales();
+        Locale locale               = context.getMeta().getPreferredLocale(
+            serverLocales);
+
+        if (input == null) {
+            String msg = resFactory.getRessource(
+                locale,
+                EXCEPTION_NO_INPUT,
+                EXCEPTION_NO_INPUT);
+            logger.warn(msg);
+            return feedFailure(msg);
+        }
+
+        for(InputData item: input) {
+            String   name         = item.getName();
+            InputValue inputValue = inputValues.get(name);
+
+            String[] tupel = extractValuesAndParams(item.getValue());
+            String   type  = inputValue.getType();
+
+            if (inputValue == null) {
+                String msg = resFactory.getRessource(
+                    locale,
+                    EXCEPTION_INVALID_INPUT,
+                    EXCEPTION_INVALID_INPUT);
+                logger.warn(msg);
+                return feedFailure(msg);
+            }
+
+            if (!InputValidator.isInputValid(tupel[0], type)) {
+                String msg = resFactory.getRessource(
+                    locale,
+                    EXCEPTION_INVALID_INPUT,
+                    EXCEPTION_INVALID_INPUT);
+                logger.warn(msg);
+                return feedFailure(msg);
+            }
+
+            if (inputData == null) {
+                inputData = new TreeMap<String, InputData>();
+            }
+
+            ExtendedInputData extended = new ExtendedInputData(
+                name,
+                tupel[0],
+                item.getObject(),
+                tupel[1]);
+
+            if (name.equals(dataName)) {
+                String[] desc = getDescriptionForInputData(
+                    extended, context, uuid);
+                extended.setDescription(desc);
+            }
+
+            inputData.put(name, extended);
+        }
+
+        return feedSuccess();
+    }
+
+
+    /**
+     * Extract parameter ids and measurement ids from DefaultInputData objects
+     * and return an array. In the first position of this array, the measurement
+     * ids are placed, in the second position the parameter ids - all separated
+     * by a character.
+     *
+     * @param tmp String containing measurement ids and parameter ids.
+     * @return An array with separated measurements and parameters.
+     */
+    protected String[] extractValuesAndParams(String tmp) {
+        String[] array = tmp.split(DefaultInputData.VALUE_SEPARATOR);
+
+        String[] extracted = new String[2];
+        for (String item: array) {
+            String[] tupel = item.split(ExtendedInputData.SEPARATOR);
+
+            if (extracted[0] == null) {
+                extracted[0] = tupel[0];
+            }
+            else {
+                extracted[0] +=
+                    DefaultInputData.VALUE_SEPARATOR + tupel[0];
+            }
+
+            if (extracted[1] == null) {
+                extracted[1] = tupel[1];
+            }
+            else {
+                extracted[1] += DefaultInputData.VALUE_SEPARATOR + tupel[1];
+            }
+        }
+
+        logger.debug("VALUES RESULT: " + extracted[0]);
+        logger.debug("PARAMS RESULT: " + extracted[1]);
+
+        return extracted;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/MinMaxDateState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state;
+
+import java.util.Collection;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.Locale;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+
+import de.intevation.artifacts.CallContext;
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+import de.intevation.gnv.geobackend.util.DateUtils;
+import de.intevation.gnv.state.describedata.DefaultMinMaxDescribeData;
+import de.intevation.gnv.state.describedata.DescribeData;
+import de.intevation.gnv.state.describedata.MinMaxDescribeData;
+import de.intevation.gnv.state.exception.StateException;
+import de.intevation.gnv.utils.InputValidator;
+
+/**
+ * This state handles date input. The resulting describe document of this state
+ * contains two fields in the user interface description to define a time range.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class MinMaxDateState extends MinMaxState {
+
+
+    /**
+     *
+     */
+    public static final String EXCEPTION_DATE_REQUIRED =
+        "input.is.not.valid.date.required";
+
+    /**
+     *
+     */
+    public static final String EXCEPTION_START_AFTER_END =
+        "start.date.after.end.date";
+
+    /**
+     *
+     */
+    public static final String EXCEPTION_DATE_OUT_OF_RANGE =
+        "date.out.of.range";
+
+    /**
+     *
+     */
+    public static final String EXCEPTION_MISSING_DATE =
+        "missing.data.field";
+
+    private static Logger logger = Logger.getLogger(MinMaxDateState.class);
+
+
+    /**
+     *
+     */
+    public MinMaxDateState() {
+        super();
+    }
+
+
+    /**
+     * This feed method needs a collection of two InputData objects. These
+     * objects' values need to be a datetime string which is turned into a Date
+     * object. Afterwards, the given dates are validated. Min and max date need
+     * to be in range of the min and max date retrieved by
+     * {@link #getDescibeData(java.lang.String)}.
+     */
+    @Override
+    public Document feed(
+        CallContext           context,
+        Collection<InputData> inputData,
+        String                uuid)
+    throws StateException {
+        RessourceFactory resFactory = RessourceFactory.getInstance();
+        Locale[] serverLocales      = resFactory.getLocales();
+        Locale locale               = context.getMeta().getPreferredLocale(
+            serverLocales);
+
+        if (inputData == null) {
+            String msg = "No input data given.";
+            logger.warn(msg);
+            return feedFailure(msg);
+        }
+
+        Iterator iter     = inputData.iterator();
+
+        MinMaxDescribeData data =
+            (MinMaxDescribeData) getDescibeData(uuid).get(0);
+        Object min = data.getMinValue();
+        Object max = data.getMaxValue();
+
+        Object tmpMin = null;
+        Object tmpMax = null;
+
+        while (iter.hasNext()) {
+            InputData  tmp   = (InputData) iter.next();
+            InputValue meta  = inputValues.get(tmp.getName());
+            String     type  = meta.getType();
+            String     value = tmp.getValue();
+            String     name  = tmp.getName();
+
+            if (meta == null) {
+                String msg = "Input data not expected here. Data will be ignored.";
+                logger.warn(msg);
+                return feedFailure(msg);
+            }
+
+            if (!InputValidator.isInputValid(value, type)) {
+                String msg = resFactory.getRessource(
+                    locale, EXCEPTION_DATE_REQUIRED, EXCEPTION_DATE_REQUIRED);
+                logger.error(msg);
+                return feedFailure(msg);
+            }
+
+            Date lower = null;
+            if (min instanceof GregorianCalendar) {
+                lower = ((GregorianCalendar)min).getTime();
+            }
+
+            Date upper = null;
+            if (max instanceof GregorianCalendar) {
+                upper = ((GregorianCalendar)max).getTime();
+            }
+
+            Date d = null;
+            try {
+                d = DateUtils.getDateFromString(value,DateUtils.DATE_PATTERN);
+            }
+            catch (Exception e) {
+                logger.warn(e, e);
+            }
+
+            if (d == null || lower == null || upper == null) {
+                String msg = resFactory.getRessource(
+                    locale,
+                    EXCEPTION_MISSING_DATE,
+                    EXCEPTION_MISSING_DATE);
+                logger.warn(msg);
+            }
+            else {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("Date to validate: " + d.toString());
+                    logger.debug("Lower date bound: " + lower.toString());
+                    logger.debug("Upper date bound: " + upper.toString());
+                }
+
+                if (!InputValidator.isDateValid(d, lower, upper)) {
+                    String msg = resFactory.getRessource(
+                        locale,
+                        EXCEPTION_DATE_OUT_OF_RANGE,
+                        EXCEPTION_DATE_OUT_OF_RANGE);
+                    logger.error(msg);
+                    return feedFailure(msg);
+                }
+            }
+
+            if (name.equals(MINVALUEFIELDNAME)) {
+                tmpMin = value;
+            }
+
+            if (name.equals(MAXVALUEFIELDNAME)) {
+                tmpMax = value;
+            }
+
+            if (tmpMin != null && tmpMax != null) {
+                if (!InputValidator.isInputValid((String) tmpMin, (String) tmpMax, type)) {
+                    String msg = resFactory.getRessource(
+                        locale,
+                        EXCEPTION_START_AFTER_END,
+                        EXCEPTION_START_AFTER_END);
+                    logger.error(msg);
+                    return feedFailure(msg);
+                }
+            }
+        }
+
+        DescribeData values = new DefaultMinMaxDescribeData(
+            dataName, tmpMin, tmpMax, getID());
+
+        this.inputData.put(dataName, new DefaultInputData(dataName, values));
+
+        return feedSuccess();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/MinMaxState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/MinMaxState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,33 +1,60 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
 
 import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
 import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.util.DateUtils;
 import de.intevation.gnv.state.describedata.DefaultMinMaxDescribeData;
 import de.intevation.gnv.state.describedata.DescribeData;
+import de.intevation.gnv.state.describedata.MinMaxDescribeData;
+import de.intevation.gnv.state.exception.StateException;
+import de.intevation.gnv.utils.InputValidator;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This state handles input of a min and max value and validates the user input.
+ * The min value needs to be equal or smaller than the max value, otherwise the
+ * input results in an error.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class MinMaxState extends StateBase {
 
     /**
-     * The UID of this Class
-     */
-    private static final long serialVersionUID = -3525903792105187408L;
-    /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(MinMaxState.class);
 
-    /**
+   /**
+    * Key to lookup the localized exceptionmessage in the ResourceFiles.
+    */
+   public static final String EXCEPTION_INVALID_MIN_MAX_INPUT =
+                                           "input.is.not.valid.minmax";
+
+   /**
      * Constructor
      */
     public MinMaxState() {
@@ -35,28 +62,179 @@
     }
 
     /**
-     * @see de.intevation.gnv.state.StateBase#purifyResult(java.util.Collection,
-     *      java.lang.String)
+     * The objects returned by the database are searched for two fields with
+     * 'MIN' and 'MAX' as names. These objects are stored and used to be
+     * displayed in the gui to give the user an orientation of the range he is
+     * able to insert.
      */
     @Override
-    protected void purifyResult(Collection<Result> result, String uuid) {
-        log.debug("MinMaxState.purifyResult");
-        Collection<Object> describeData = this.getDescibeData(uuid);
-        if (describeData == null) {
-            describeData = new ArrayList<Object>();
-        }
+    protected List<Object> purifyResult(
+        Collection<Result> result, String uuid)
+    {
+        List<Object> describeData = new ArrayList<Object>();
+
         if (result != null && result.size() == 1) {
-            
             Result value = result.iterator().next();
-            DescribeData values = new DefaultMinMaxDescribeData(this.dataName, 
-                                                               value.getObject("MIN"), 
-                                                               value.getObject("MAX"));
-            log.debug(values.toString());
+            DescribeData values = new DefaultMinMaxDescribeData(
+                dataName,
+                value.getObject("MIN"),
+                value.getObject("MAX"),
+                getID());
             describeData.add(values);
         } else {
             log.warn("Result cannot be handled as MinMax Resultset");
         }
-        this.setDescibeData(uuid, describeData);
+
+        return describeData;
     }
 
+
+    @Override
+    public Document feed(
+        CallContext           context,
+        Collection<InputData> inputData,
+        String                uuid)
+    throws StateException {
+        RessourceFactory resFactory = RessourceFactory.getInstance();
+
+        if (inputData == null) {
+            String msg = "No input data given.";
+            log.warn(msg);
+            return feedFailure(msg);
+        }
+
+        InputValidator iv = new InputValidator();
+        Iterator iter     = inputData.iterator();
+
+        Object min = null;
+        Object max = null;
+
+        while (iter.hasNext()) {
+            InputData  tmp   = (InputData) iter.next();
+            InputValue meta  = inputValues.get(tmp.getName());
+            String     type  = meta.getType();
+            String     value = tmp.getValue();
+            String     name  = tmp.getName();
+
+            if (meta == null) {
+                String msg = "Input data not expected here. Data will be ignored.";
+                log.warn(msg);
+                return feedFailure(msg);
+            }
+
+            boolean valid = InputValidator.isInputValid(value, type);
+            if (!valid) {
+                String msg = "Input is not valid for this state.";
+                log.error(msg);
+                return feedFailure(msg);
+            }
+
+            if (name.equals(MINVALUEFIELDNAME)) {
+                min = value;
+            }
+
+            if (name.equals(MAXVALUEFIELDNAME)) {
+                max = value;
+            }
+
+            if (min != null && max != null) {
+                if (!InputValidator.isInputValid((String) min, 
+                                                 (String) max, 
+                                                 type)) {
+                    Locale[] serverLocales      = resFactory.getLocales();
+                    Locale locale               = context.getMeta()
+                                                         .getPreferredLocale(
+                                                                serverLocales);
+                    String msg = resFactory.getRessource(locale, 
+                                                EXCEPTION_INVALID_MIN_MAX_INPUT, 
+                                                EXCEPTION_INVALID_MIN_MAX_INPUT);
+                    log.error(msg);
+                    return feedFailure(msg);
+                }
+            }
+        }
+
+
+
+        DescribeData values = new DefaultMinMaxDescribeData(
+            dataName, min, max, getID());
+
+        this.inputData.put(dataName, new DefaultInputData(dataName, values));
+
+        return feedSuccess();
+    }
+
+
+    @Override
+    protected void appendToStaticNode(
+        XMLUtils.ElementCreator artCreator,
+        XMLUtils.ElementCreator creator,
+        Document                document,
+        Node                    staticNode,
+        CallMeta                callMeta
+    ) {
+        InputData  data = inputData.get(dataName);
+
+        if (data == null) {
+            return;
+        }
+
+        MinMaxDescribeData minMax = (MinMaxDescribeData) data.getObject();
+
+        Object min = minMax.getMinValue();
+        Object max = minMax.getMaxValue();
+        if (min instanceof GregorianCalendar) {
+            Date d = ((GregorianCalendar) min).getTime();
+            min = DateUtils.getPatternedDateAmer(d);
+        }
+
+        if (max instanceof GregorianCalendar) {
+            Date d = ((GregorianCalendar) max).getTime();
+            max = DateUtils.getPatternedDateAmer(d);
+        }
+
+        Element groupNode = creator.create("group");
+        artCreator.addAttr(groupNode, "state", minMax.getState(), true);
+
+        creator.addAttr(groupNode, "ref", minMax.getName());
+        Element groupNodeLableNode = creator.create("label");
+        groupNodeLableNode.setTextContent(RessourceFactory
+                .getInstance().getRessource(
+                        callMeta.getLanguages(),
+                        minMax.getName(),
+                        minMax.getName()));
+        groupNode.appendChild(groupNodeLableNode);
+
+        Element inputMinNode = creator.create("input");
+        creator.addAttr(inputMinNode, "ref", MINVALUEFIELDNAME);
+        Element inputMinLableNode = creator.create("label");
+        inputMinLableNode.setTextContent(RessourceFactory
+                .getInstance().getRessource(
+                        callMeta.getLanguages(), MINVALUEFIELDNAME,
+                        MINVALUEFIELDNAME));
+        inputMinNode.appendChild(inputMinLableNode);
+
+        Element inputMinValueNode = creator.create("value");
+        inputMinValueNode.setTextContent(min.toString());
+        inputMinNode.appendChild(inputMinValueNode);
+
+        Element inputMaxNode = creator.create("input");
+        creator.addAttr(inputMaxNode, "ref", MAXVALUEFIELDNAME);
+        Element inputMaxLableNode = creator.create("label");
+        inputMaxLableNode.setTextContent(RessourceFactory
+                .getInstance().getRessource(
+                        callMeta.getLanguages(), MAXVALUEFIELDNAME,
+                        MAXVALUEFIELDNAME));
+        inputMaxNode.appendChild(inputMaxLableNode);
+
+        Element inputMaxValueNode = creator.create("value");
+        inputMaxValueNode.setTextContent(max.toString());
+        inputMaxNode.appendChild(inputMaxValueNode);
+
+        groupNode.appendChild(inputMinNode);
+        groupNode.appendChild(inputMaxNode);
+
+        staticNode.appendChild(groupNode);
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputMode.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputMode.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,22 +1,62 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
 import java.io.Serializable;
+
 import java.util.Collection;
+import java.util.List;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the interface description of an <code>OutputMode</code>. The
+ * methods defined here retrieve some basic information for an output. An output
+ * can be chart, histogram, statistic, csv, odv and so on.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public interface OutputMode extends Serializable {
 
+    /**
+     * Retrieve the name of this output mode.
+     *
+     * @return the name of this output mode.
+     */
     public String getName();
 
+    /**
+     * Retrieve the description of an output.
+     *
+     * @return the description.
+     */
     public String getDescription();
 
+    /**
+     * Retrieve the mimetype used for the output.
+     *
+     * @return the mimetype.
+     */
     public String getMimeType();
 
+    /**
+     * Retrieve a list of optional InputValue objects the user is able to
+     * adjust.
+     *
+     * @return optional input parameters.
+     */
     public Collection<InputValue> getInputParameters();
+
+    /**
+     * Retrieve a list of export modes this output can be exported to.
+     *
+     * @return some export modes.
+     */
+    public List<ExportMode> getExportModes();
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,42 +1,60 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.state.exception.StateException;
+
 import java.io.OutputStream;
+
 import java.util.Collection;
 
 import org.w3c.dom.Document;
 
-import de.intevation.artifacts.CallContext;
-import de.intevation.gnv.state.exception.StateException;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the interface description of an output state. Currently, there are
+ * two methods defined:<br>
+ * <ol>
+ *  <li>out(): To start an output of the current state.</li>
+ *  <li>getOutputModes(): To retrieve a list of possible output modes.</li>
+ * </ol>
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
-public interface OutputState extends State {
+public interface OutputState
+extends          State
+{
 
     /**
      * Returns the Rendered Result of an State.
-     * 
-     * @param outputMode
-     *            The Mode that should be produces (Chart, Map, ...)
-     * @return The Bytecode of the Result
+     *
+     * @param format
+     * @param inputData
+     * @param outputStream
+     * @param uuid
+     * @param callContext
      * @throws StateException
      */
     public void out(
-        Document format,
+        Document              format,
         Collection<InputData> inputData,
-        OutputStream outputStream,
-        String uuid,
-        CallContext callContext
+        OutputStream          outputStream,
+        String                uuid,
+        CallContext           callContext
     ) throws StateException;
 
     /**
      * Delivers the provided OutputModes of an State
-     * 
+     *
      * @return the provided OutputModes of an State
      */
     public Collection<OutputMode> getOutputModes();
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputStateBase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/OutputStateBase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,13 +1,24 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Locale;
 
+import javax.xml.xpath.XPathConstants;
+
+import net.sf.ehcache.Cache;
 
 import org.apache.log4j.Logger;
 import org.w3c.dom.Document;
@@ -15,7 +26,9 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import de.intevation.artifactdatabase.Config;
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
 import de.intevation.gnv.artifacts.cache.CacheFactory;
 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
@@ -23,14 +36,34 @@
 import de.intevation.gnv.geobackend.base.query.QueryExecutor;
 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
 import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+import de.intevation.gnv.state.describedata.MinMaxDescribeData;
 import de.intevation.gnv.state.exception.StateException;
+import de.intevation.gnv.utils.InputValidator;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the default implementation of <code>OutputState</code>. Artifacts
+ * having reached this state or a subclass of this state are able to produce
+ * some output (e.g. chart, histograms, statistic, etc).
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ *
  */
-public abstract class OutputStateBase extends StateBase implements
-                                                                 OutputState {
+public abstract class OutputStateBase
+extends               StateBase
+implements            OutputState
+{
+    public static final String XPATH_OUTPUT_MODE =
+        "/art:action/art:out/@name";
+
+    public static final String XPATH_EXPORT_MODE =
+        "/art:action/art:out/art:export/@name";
+
+    public static final String XPATH_MIME_TYPE   =
+        "/art:action/art:out/art:mime-type/@value";
+
+    public static final String XPATH_EXPORTS =
+        "exportModes/export";
 
     /**
      * The UID of this Class
@@ -46,7 +79,7 @@
      * The different Outputmodes which are provided by an OutputState
      */
     protected Collection<OutputMode> outputModes = null;
-    
+
     protected String queryODVID = null;
 
     /**
@@ -56,24 +89,19 @@
         super();
     }
 
-    /**
-     * @see de.intevation.gnv.state.OutputState#getOutputModes()
-     */
     public Collection<OutputMode> getOutputModes() {
         log.debug("OutputStateBase.getOutputModes");
         return this.outputModes;
     }
 
-    /**
-     * @see de.intevation.gnv.state.StateBase#setup(org.w3c.dom.Node)
-     */
+
     @Override
     public void setup(Node configuration) {
         log.debug("OutputStateBase.setup");
         super.setup(configuration);
-        
+
         this.queryODVID = Config.getStringXPath(configuration,"queryID-odv");
-        
+
         NodeList outputModeList = Config.getNodeSetXPath(configuration,
                 "outputsModes/outputsMode");
         if (outputModeList != null) {
@@ -104,8 +132,28 @@
                     }
                 }
 
+                // parse export modes
+                List<ExportMode> exportList = null;
+                NodeList exports = (NodeList) XMLUtils.xpath(
+                    currentNode, XPATH_EXPORTS, XPathConstants.NODESET);
+
+                if (exports != null) {
+                    int exportSize   = exports.getLength();
+
+                    exportList = new ArrayList<ExportMode>(exportSize);
+                    for (int k = 0; k < exportSize; k++) {
+                        Element exp    = (Element) exports.item(k);
+                        String expName = exp.getAttribute("name");
+                        String expDesc = exp.getAttribute("description");
+                        String expMime = exp.getAttribute("mime-type");
+
+                        exportList.add(
+                            new DefaultExportMode(expName, expDesc, expMime));
+                    }
+                }
+
                 OutputMode outputMode = new DefaultOutputMode(name,
-                        description, mimeType, inputParameters);
+                        description, mimeType, inputParameters, exportList);
                 log.debug(outputMode.toString());
                 this.outputModes.add(outputMode);
 
@@ -113,60 +161,96 @@
         }
     }
 
-    /**
-     * @see de.intevation.gnv.state.StateBase#advance()
-     */
+
     @Override
-    public void advance(String uuid, CallMeta callMeta)
-                                                       throws StateException {
+    public void advance(String uuid, CallContext context)
+    throws StateException
+    {
     }
 
+
     @Override
-    public void initialize(String uuid, CallMeta callMeta)
-                                                          throws StateException {
-    }
-
-    public void out(Document format, Collection<InputData> inputData,
-                    OutputStream outputStream, String uuid, CallMeta callMeta)
-                                                                              throws StateException {
+    public void initialize(String uuid, CallContext context)
+    throws StateException
+    {
     }
 
     /**
-     * @see de.intevation.gnv.state.OutputState#out(java.lang.String,
-     *      java.util.Collection, java.io.OutputStream)
+     * This method needs to be defined by concrete subclasses. Nothing is done
+     * here.
+     */
+    public void out(
+        Document              format,
+        Collection<InputData> inputData,
+        OutputStream          outputStream,
+        String                uuid,
+        CallMeta              callMeta
+    )
+    throws StateException
+    {
+    }
+
+    /**
+     * This method needs to be defined by concrete subclasses. Nothing is done
+     * here.
      */
     public void out(String outputMode, Collection<InputData> inputData,
                     OutputStream outputStream) throws StateException {
     }
 
     /**
-     * @return
+     * Returns the data used to create charts. If a cache is configured, try to
+     * fetch the data from cache. The database is queried if the data is not in
+     * cache yet, or if no cache is configured. If the cache is configured, but
+     * the data is not in cache yet, put it into cache for a faster access
+     * in a later time.
+     *
+     * @param uuid The uuid of an artifact.
+     * @param callContext The CallContext.
+     * @return the chart data.
      */
-    protected Collection<Result> getChartResult(String uuid) {
+    protected Object getChartResult(String uuid, CallContext callContext) {
         log.debug("OutputStateBase.getChartResult");
-        Collection<Result> result = null;
-        if (CacheFactory.getInstance().isInitialized()) {
-            String key = uuid + super.getID();
-            log.debug("Hash for Queryelements: " + key);
-            net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key);
+        CacheFactory factory = CacheFactory.getInstance();
+
+        if (factory.isInitialized()) {
+            // we use a cache
+            log.info("Using cache.");
+            Cache cache = factory.getCache();
+            String key  = "chart_" + getHash();
+
+            net.sf.ehcache.Element value = cache.get(key);
             if (value != null) {
-                result = (Collection<Result>) (value.getObjectValue());
-            }else{
-                result = this.getData(this.queryID);
-                if (CacheFactory.getInstance().isInitialized()) {
-                    CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, result));
-                }
-                
+                log.debug("Found element in cache.");
+                return value.getObjectValue();
+            }
+            else {
+                log.debug("Element not in cache, we need to ask the database");
+                Object result = getData(queryID);
+                cache.put(new net.sf.ehcache.Element(key, result));
+
+                return result;
             }
         }
-        return result;
+        else {
+            // we don't use a cache, so we have to query the database every
+            // single time
+            log.info("Not using a cache.");
+            return getData(queryID);
+        }
     }
 
-    protected Object getChartFromCache(String uuid) {
+    /**
+     * This method should no longer be used, because it is not good to put a
+     * chart into cache. Parameter changes done by the user wouldn't be detected
+     * proper.
+     * @deprecated
+     */
+    protected Object getChartFromCache(String uuid, CallContext callContext) {
         log.debug("Fetch chart [" + uuid + "] from cache");
         CacheFactory cacheFactory = CacheFactory.getInstance();
         if (cacheFactory.isInitialized()) {
-            String key = "chart_" + uuid + super.getID();
+            String key = "chart_" + getHash();
             net.sf.ehcache.Element object = cacheFactory.getCache().get(key);
 
             if (object != null) {
@@ -175,7 +259,13 @@
         }
         return null;
     }
-    
+
+    /**
+     * Retrieves the data used to create an ODV export.
+     *
+     * @param uuid
+     * @return odv data.
+     */
     protected Collection<Result> getODVResult(String uuid) {
         log.debug("OutputStateBase.getODVResult");
         // TODO add Caching? I think it's not nessessary
@@ -189,10 +279,12 @@
     }
 
     /**
-     * @param returnValue
-     * @return
+     * Retrieve data from database with help of queryID.
+     *
+     * @param queryID A query id defined in sql statements properties file.
+     * @return some data.
      */
-    private Collection<Result> getData(String queryID) {
+    protected Collection<Result> getData(String queryID) {
         log.debug("OutputStateBase.getData");
         Collection<Result> returnValue = null;
         try {
@@ -210,11 +302,15 @@
         }
         return returnValue;
     }
-    
+
+    /**
+     * This method removes the data used for creating charts from cache.
+     *
+     */
     protected void removeChartResult(String uuid) {
         log.debug("OutputStateBase.getChartResult");
         if (CacheFactory.getInstance().isInitialized()) {
-            String key = uuid + super.getID();
+            String key = "chart_" + getHash();
             log.debug("Hash for Queryelements: " + key);
             net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key);
             if (value != null) {
@@ -223,46 +319,173 @@
         }
     }
 
+    /**
+     * This method should no longer be used. It removes a chart from cache.
+     *
+     * @deprecated
+     */
     protected void removeChart(String uuid) {
         log.debug("OutputStateBase.removeChart from cache");
 
         CacheFactory cacheFactory = CacheFactory.getInstance();
         if (cacheFactory.isInitialized()) {
-            String key = "chart_" + uuid + super.getID();
+            String key = "chart_" + getHash();
             net.sf.ehcache.Element object = cacheFactory.getCache().get(key);
             if (object != null)
                 cacheFactory.getCache().remove(key);
         }
     }
 
+    /**
+     * This is an internal method used while database query.
+     */
     protected void purifyChart(Object chart, String uuid) {
         log.debug("Prufify chart [" + uuid + "]");
         CacheFactory cacheFactory = CacheFactory.getInstance();
         if (cacheFactory.isInitialized()) {
-            String key = "chart_" + uuid + getID();
+            String key = "chart_" + getHash();
             cacheFactory.getCache().put(new net.sf.ehcache.Element(key, chart));
         }
     }
 
+
     /**
-     * @see de.intevation.gnv.state.StateBase#putInputData(java.util.Collection, java.lang.String)
+     * Use this method to feed a state with new data.
      */
     @Override
-    public void putInputData(Collection<InputData> inputData, 
+    public Document feed(
+        CallContext           context,
+        Collection<InputData> inputData,
+        String                uuid)
+    throws StateException
+    {
+        putInputData(inputData, uuid);
+
+        return feedSuccess();
+    }
+
+    /**
+     * This method is used to put new data into a next state. The difference
+     * between this method and feed is, that this method should be used to
+     * transfer some old input data required by this state. New data need to be
+     * inserted via feed!
+     */
+    @Override
+    public void putInputData(Collection<InputData> inputData,
                              String uuid)
                                          throws StateException {
         log.debug("OutputStateBase.putInputData");
         this.removeChartResult(uuid);
         this.removeChart(uuid);
-        super.putInputData(inputData, uuid);
-    }
 
-    public void out(String outputMode, Collection<InputData> inputData,
-                    OutputStream outputStream, String uuid, CallMeta callMeta)
-                                                                              throws StateException {
+        if (inputData != null) {
+            Iterator<InputData> it = inputData.iterator();
+            InputValidator iv = new InputValidator();
+            while (it.hasNext()) {
+                InputData tmpItem     = it.next();
+                Object    tmpObj      = tmpItem.getObject();
+                InputValue inputValue = this.inputValues.get(tmpItem.getName());
+                if (inputValue != null) {
+                    if (this.inputData == null) {
+                        this.inputData = new HashMap<String, InputData>(
+                                inputData.size());
+                    }
+
+                    boolean valid = InputValidator.isInputValid(tmpItem.getValue(),
+                            inputValue.getType());
+                    if (valid) {
+                        if (tmpItem.getName().equals(MINVALUEFIELDNAME)){
+                            String minValue = tmpItem.getValue();
+                            String maxValue = getInputValue4ID(inputData, MAXVALUEFIELDNAME);
+                            valid = InputValidator.isInputValid(maxValue,inputValue.getType());
+                            if (!valid){
+                                String errMsg = "Wrong input for " + tmpItem.getValue()
+                                                + " is not an " + inputValue.getType()
+                                                + " Value.";
+                                log.warn(errMsg);
+                                throw new StateException(errMsg);
+                            }
+
+                            valid = InputValidator.isInputValid(minValue,
+                                    maxValue,
+                                    inputValue.getType());
+                            if (!valid){
+                                String errMsg = "MaxValue-Input is less than MinValue-Input ";
+                                log.warn(errMsg);
+                                throw new StateException(errMsg);
+                            }
+                        }else if (tmpItem.getName().equals(MAXVALUEFIELDNAME)){
+                            String minValue = getInputValue4ID(inputData, MINVALUEFIELDNAME);
+                            String maxValue = tmpItem.getValue();
+                            valid = InputValidator.isInputValid(minValue,inputValue.getType());
+                            if (!valid){
+                                String errMsg = "Wrong input for " + tmpItem.getValue()
+                                                + " is not an " + inputValue.getType()
+                                                + " Value.";
+                                log.warn(errMsg);
+                                throw new StateException(errMsg);
+                            }
+
+                            valid = InputValidator.isInputValid(minValue,
+                                                    maxValue,
+                                                    inputValue.getType());
+                            if (!valid){
+                                String errMsg = "MaxValue-Input is less than MinValue-Input ";
+                                log.warn(errMsg);
+                                throw new StateException(errMsg);
+                            }
+                        }
+                        this.inputData.put(tmpItem.getName(), tmpItem);
+                    } else {
+                        String errMsg = "Wrong input for " + tmpItem.getValue()
+                                        + " is not an " + inputValue.getType()
+                                        + " Value.";
+                        log.warn(errMsg);
+                        throw new StateException(errMsg);
+                    }
+
+                }
+                else if (tmpObj != null && tmpObj instanceof MinMaxDescribeData) {
+                    MinMaxDescribeData data = (MinMaxDescribeData) tmpObj;
+                    if (this.inputData == null) {
+                        this.inputData = new HashMap<String, InputData>(inputData.size());
+                    }
+                    this.inputData.put(tmpItem.getName(), tmpItem);
+                    this.inputData.put("minvalue", new DefaultInputData("minvalue", (String) data.getMinValue()));
+                    this.inputData.put("maxvalue", new DefaultInputData("maxvalue", (String) data.getMaxValue()));
+                }
+                else {
+
+                    String errMsg = "No Inputvalue given for Inputdata "
+                                    + tmpItem.getName();
+                    log.warn(errMsg + "Value will be ignored");
+
+                }
+            }
+        } else {
+            log.warn("No Inputdata given");
+        }
+        setHash(uuid);
     }
 
 
+    public void out(
+        String                outputMode,
+        Collection<InputData> inputData,
+        OutputStream          outputStream,
+        String                uuid,
+        CallMeta              callMeta)
+    throws StateException { }
+
+
+    /**
+     * Retrieves a message from resource bundle specified by locale.
+     *
+     * @param locale Locale to use.
+     * @param key The key of the message.
+     * @param value The default value.
+     * @return The value.
+     */
     protected String getMessage(Locale locale, String key, String value) {
         return RessourceFactory.getInstance().getRessource(
             locale,
@@ -271,3 +494,4 @@
         );
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferCoordinateSelectionState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state;
+
+import de.intevation.artifacts.common.utils.Config;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.state.exception.StateException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * This method looks for former inserted coordinates before initialization.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class PreSettingsTransferCoordinateSelectionState extends CoordinateSelectionState {
+
+
+    /**
+     * The UID of this Class.
+     */
+    private static final long serialVersionUID = -3972304838976884048L;
+
+    private String transferPreSettingsName = null;
+
+    private String transferInputDataname = null;
+    /**
+     * Constructor
+     */
+    public PreSettingsTransferCoordinateSelectionState() {
+        super();
+    }
+
+
+    /**
+     * Lookup mechanism for former inserted data before intialization begins.
+     *
+     * @param uuid
+     * @param context
+     * @throws StateException
+     */
+    @Override
+    public void initialize(String uuid, CallContext context)
+                                                            throws StateException {
+        Map<String, InputData> preSettings = this.getPreSettings();
+        if (preSettings != null){
+            InputData ip = preSettings.get(transferPreSettingsName);
+            if (ip != null){
+                Collection<InputData> localInputdata = new ArrayList<InputData>(1);
+                localInputdata.add(new DefaultInputData(transferInputDataname,
+                                                        ip.getValue()));
+                this.putInputData(localInputdata, uuid);
+            }
+        }
+
+        super.initialize(uuid, context);
+    }
+
+
+    /**
+     *
+     * @param configuration
+     */
+    @Override
+    public void setup(Node configuration) {
+
+        Element preSettingsNode = (Element)Config.getNodeXPath(configuration,
+                                                         "presettings-transfer");
+        if (preSettingsNode != null){
+            this.transferPreSettingsName = preSettingsNode.getAttribute("presetting");
+            this.transferInputDataname   = preSettingsNode.getAttribute("inputvalue");
+        }
+        super.setup(configuration);
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/state/PreSettingsTransferState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state;
+
+import de.intevation.artifacts.common.utils.Config;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.state.exception.StateException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Map;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * This special state does a lookup for already inserted data while
+ * initializing. If there are some data for this state, take them for further
+ * work.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class PreSettingsTransferState extends DefaultState {
+
+    /**
+     * The UID of this Class
+     */
+    private static final long serialVersionUID = 573381812690806922L;
+
+    private String transferPreSettingsName = null;
+
+    private String transferInputDataname = null;
+    /**
+     * Constructor
+     */
+    public PreSettingsTransferState() {
+        super();
+    }
+
+
+    /**
+     * This method does a lookup for already inserted data before initializing
+     * it.
+     *
+     * @param uuid
+     * @param context
+     * @throws StateException
+     */
+    @Override
+    public void initialize(String uuid, CallContext context)
+                                                            throws StateException {
+        Map<String, InputData> preSettings = this.getPreSettings();
+        if (preSettings != null){
+            InputData ip = preSettings.get(transferPreSettingsName);
+            if (ip != null){
+                Collection<InputData> localInputdata = new ArrayList<InputData>(1);
+                localInputdata.add(new DefaultInputData(transferInputDataname,
+                                                        ip.getValue()));
+                this.putInputData(localInputdata, uuid);
+            }
+        }
+
+        super.initialize(uuid, context);
+    }
+
+
+    /**
+     *
+     * @param configuration
+     */
+    @Override
+    public void setup(Node configuration) {
+
+        Element preSettingsNode = (Element)Config.getNodeXPath(configuration,
+                                                         "presettings-transfer");
+        if (preSettingsNode != null){
+            this.transferPreSettingsName = preSettingsNode.getAttribute("presetting");
+            this.transferInputDataname   = preSettingsNode.getAttribute("inputvalue");
+        }
+        super.setup(configuration);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/SingleInputState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/SingleInputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,19 +1,37 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.state.describedata.DefaultSingleValueDescribeData;
+import de.intevation.gnv.state.exception.StateException;
+import de.intevation.gnv.utils.InputValidator;
+
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
 
 import org.apache.log4j.Logger;
 
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.describedata.DefaultSingleValueDescribeData;
+import org.w3c.dom.Document;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This state handles single user input. The user is allowed to select just one
+ * value.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class SingleInputState extends StateBase {
 
@@ -22,9 +40,6 @@
      */
     private static Logger log = Logger.getLogger(SingleInputState.class);
 
-    /**
-     *
-     */
     private static final long serialVersionUID = -6169497306324917318L;
 
     /**
@@ -33,17 +48,12 @@
     public SingleInputState() {
     }
 
-    /**
-     * @see de.intevation.gnv.state.StateBase#purifyResult(java.util.Collection,
-     *      java.lang.String)
-     */
+
     @Override
-    protected void purifyResult(Collection<Result> result, String uuid) {
+    protected List<Object> purifyResult(Collection<Result> result, String uuid) {
         log.debug("SingleInputState.purifyResult");
-        Collection<Object> describeData = this.getDescibeData(uuid);
-        if (describeData == null) {
-            describeData = new ArrayList<Object>();
-        }
+        List<Object> describeData = new ArrayList<Object>();
+
         String value = null;
         if (result != null && result.size() == 1) {
             Result tmpItem = result.iterator().next();
@@ -52,8 +62,68 @@
             value = "";
         }
 
-        describeData.add(new DefaultSingleValueDescribeData(this.dataName,value));
-        this.setDescibeData(uuid, describeData);
+        describeData.add(new DefaultSingleValueDescribeData(
+            this.dataName, value, getID()));
+
+        return describeData;
     }
 
+    /**
+     * This feed method needs a collection of two InputData objects. These
+     * objects' values need to be a datetime string which is turned into a Date
+     * object. Afterwards, the given dates are validated. Min and max date need
+     * to be in range of the min and max date retrieved by
+     * {@link #getDescibeData(java.lang.String)}.
+     */
+    @Override
+    public Document feed(
+        CallContext           context,
+        Collection<InputData> inputData,
+        String                uuid)
+    throws StateException {
+        RessourceFactory resFactory = RessourceFactory.getInstance();
+        Locale[] serverLocales      = resFactory.getLocales();
+        Locale locale               = context.getMeta().getPreferredLocale(
+            serverLocales);
+
+        if (inputData == null) {
+            String msg = "No input data given.";
+            log.warn(msg);
+            return feedFailure(msg);
+        }
+
+        Iterator<InputData> it = inputData.iterator();
+        InputData tmpItem      = it.next();
+        InputValue inputValue  = inputValues.get(tmpItem.getName());
+
+        if (inputValue == null) {
+            String msg = resFactory.getRessource(
+                locale,
+                EXCEPTION_INVALID_INPUT,
+                EXCEPTION_INVALID_INPUT);
+            log.warn(msg);
+            return feedFailure(msg);
+        }
+
+        boolean valid = InputValidator.isInputValid(
+            tmpItem.getValue(), inputValue.getType());
+
+        if (valid) {
+            String[] desc = getDescriptionForInputData(tmpItem, context, uuid);
+            tmpItem.setDescription(desc);
+
+            this.inputData.put(tmpItem.getName(), tmpItem);
+            return feedSuccess();
+        }
+
+        else {
+            String msg = resFactory.getRessource(
+                locale,
+                EXCEPTION_INVALID_INPUT,
+                EXCEPTION_INVALID_INPUT);
+            log.warn(msg);
+            return feedFailure(msg);
+        }
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/State.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/State.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,47 +1,190 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.state.exception.StateException;
+
 import java.io.Serializable;
+
 import java.util.Collection;
+import java.util.Map;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
-import de.intevation.artifacts.CallMeta;
-import de.intevation.gnv.state.exception.StateException;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This interface describes the basic method a concrete state class needs to
+ * implement.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public interface State extends Serializable {
 
+    /**
+     * Setup the state.
+     *
+     * @param configuration State configuration.
+     */
     public void setup(Node configuration);
 
+    /**
+     * Return the id of the state.
+     *
+     * @return the id.
+     */
     public String getID();
 
+    /**
+     * Return the description of the state.
+     *
+     * @return the description of the state.
+     */
     public String getDescription();
 
-    public void describe(Document document, Node rootNode, 
-                         CallMeta callMeta, String uuid);
+    /**
+     * This method is called when an artifacts retrieves a describe request. It
+     * creates the user interface description of the current state.
+     *
+     * @param document Describe doucment.
+     * @param rootNode Parent node for all new xml elements.
+     * @param context The CallContext.
+     * @param uuid The uuid of an artifact.
+     */
+    public void describe(
+        Document    document,
+        Node        rootNode,
+        CallContext context,
+        String      uuid
+    );
 
+    /**
+     * This method is used to insert new data into this state. Concrete
+     * subclasses should valide the input before saving it.
+     *
+     * @param context The CallContext.
+     * @param inputData New InputData items.
+     * @param uuid The uuid of an artifact.
+     * @return a document with an error or sucess message.
+     * @throws StateException
+     */
+    public Document feed(
+        CallContext context, Collection<InputData> inputData, String uuid)
+    throws StateException;
+
+    /**
+     * Set the previous state.
+     *
+     * @param state The previous state.
+     */
     public void setParent(State state);
 
+    /**
+     * Returns the previous state.
+     *
+     * @return the previous state.
+     */
     public State getParent();
 
+    /**
+     * Retrieve a collection of required input values.
+     *
+     * @return required input values.
+     */
     public Collection<InputValue> getRequiredInputValues();
 
-    public void putInputData(Collection<InputData> inputData, 
-                             String uuid)throws StateException;
+    /**
+     * Retrieves a map with InputData items.
+     *
+     * @return a map with InputData items.
+     */
+    public Map<String, InputData> inputData();
 
+    /**
+     * Use this method to feed a state with some data.
+     *
+     * @param inputData InputData collection.
+     * @param uuid UUID of an artifact.
+     * @throws StateException
+     */
+    public void putInputData(Collection<InputData> inputData, String uuid)
+    throws StateException;
+
+    /**
+     * Retrieves a collection with the InputData stored in this state.
+     *
+     * @return An InputData collection.
+     * @throws StateException
+     */
     public Collection<InputData> getInputData() throws StateException;
 
-    public void advance(String uuid, CallMeta callMeta)
-                                                    throws StateException;
-    public void initialize(String uuid, CallMeta callMeta)
-                                                    throws StateException;
-    
+    /**
+     * This method is called to advance to a next or previous state.
+     *
+     * @param uuid The uuid of an artifact.
+     * @param context The CallContext object.
+     * @throws StateException
+     */
+    public void advance(String uuid, CallContext context)
+    throws StateException;
 
+    /**
+     * This method is called when the state is created.
+     *
+     * @param uuid The uuid of an artifact.
+     * @param context The CallContext object.
+     * @throws StateException
+     */
+    public void initialize(String uuid, CallContext context)
+    throws StateException;
+
+    /**
+     * This method can be used to reset the state.
+     *
+     * @param uuid The uuid of an artifact.
+     */
+    public void reset(String uuid);
+
+    /**
+     * This method is called when the lifetime of an artifact ends or if the
+     * user decides to step back to a previous state.
+     *
+     * @param globalContext The CallContext.
+     */
+    public void endOfLife(Object globalContext);
+
+    /**
+     * This method is used to put some InputData objects into an artifact before
+     * the parameterization begins.
+     *
+     * @param preSettings
+     */
+    public void setPreSettings(Map<String,InputData> preSettings);
+
+    /**
+     * This method retrieves a map with InputData objects which have been
+     * inserted into this state before the parameterization has started. The key
+     * used to store the objects is the name of the state.
+     *
+     * @return map with InputData objects.
+     */
+    public Map<String,InputData> getPreSettings();
+
+    /**
+     * Method to remove the data stored at a state which should not be
+     * serialized while an artifact is exported.
+     *
+     * @param context The CallContext
+     */
+    public void cleanup(Object context);
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateBase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,32 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state;
 
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 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;
@@ -20,9 +34,11 @@
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import de.intevation.artifactdatabase.Config;
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
-import de.intevation.gnv.artifacts.GNVArtifactBase;
 import de.intevation.gnv.artifacts.cache.CacheFactory;
 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
 import de.intevation.gnv.geobackend.base.Result;
@@ -41,8 +57,12 @@
 import de.intevation.gnv.utils.InputValidator;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the major implementation of <code>State</code>. Nearly every other
+ * state is derived by this class.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public abstract class StateBase implements State {
 
@@ -54,35 +74,73 @@
     /**
      * the logger, used to log exceptions and additonaly information
      */
-    private static Logger log = Logger.getLogger(GNVArtifactBase.class);
-    
-    private final static String MINVALUEFIELDNAME = "minvalue";
-    private final static String MAXVALUEFIELDNAME = "maxvalue";
-    
+    private static Logger log = Logger.getLogger(StateBase.class);
+
+    protected final static String MINVALUEFIELDNAME = "minvalue";
+
+    protected final static String MAXVALUEFIELDNAME = "maxvalue";
+
     private final static String NODATASELECTIONKEY = "n/n";
-    
-    private final static String DESCRIBEDATAKEY = "_DESCRIBEDATA";
+
+    public final static String DESCRIBEDATAKEY = "_DESCRIBEDATA";
+
+    public final static String XPATH_STATIC_UI  = "art:static";
+
+    public final static String XPATH_DYNAMIC_UI = "art:dynamic";
+
+    public static final String EXCEPTION_NO_INPUT      = "no.input.data";
+
+    public static final String EXCEPTION_INVALID_INPUT =
+        "input.is.not.valid";
+
+    public final static String HASH_ID_SEPARATOR = "#";
+
+    /** input value names which should not be rendered from State itself */
+    public final static String[] BLACKLIST = {"sourceid", "fisname"};
 
     private String id = null;
 
+    protected String hash;
+
     private String description = null;
 
     protected String dataName = null;
 
+    protected String preSettingsName = null;
+
     protected boolean dataMultiSelect = false;
-    
+
     protected boolean dataNoSelect = false;
 
     protected String queryID = null;
 
     protected Collection<String> inputValueNames = null;
 
-    private Map<String, InputValue> inputValues = null;
+    protected Map<String, InputValue> inputValues = null;
 
-    private State parent = null;
+    protected State parent = null;
 
     protected Map<String, InputData> inputData = null;
-    
+
+    protected Map<String, InputData> preSettings = null;
+
+
+    /**
+     * The source date format as string.
+     */
+    public static String srcDateFormat = "yyyy.MM.dd hh:mm:ss";
+
+
+    /**
+     * The source date format used to read string represented strings.
+     */
+    public static DateFormat srcFormat;
+
+
+    static {
+        srcFormat = new SimpleDateFormat(srcDateFormat);
+    }
+
 
     /**
      * Constructor
@@ -91,39 +149,33 @@
         super();
     }
 
-    /**
-     * @see de.intevation.gnv.state.State#getID()
-     */
+
     public String getID() {
         return this.id;
     }
 
-    /**
-     * @see de.intevation.gnv.state.State#getDescription()
-     */
+
     public String getDescription() {
         return this.description;
     }
 
 
-
-    /**
-     * @see de.intevation.gnv.state.State#getRequiredInputValues()
-     */
     public Collection<InputValue> getRequiredInputValues() {
         return this.inputValues.values();
     }
 
-    /**
-     * @see de.intevation.gnv.state.State#setup(org.w3c.dom.Node)
-     */
+
+    public void reset(String uuid) {
+        inputData.remove(dataName);
+    }
+
+
     public void setup(Node configuration) {
-        log.debug("StateBase.setup");
         this.id = ((Element)configuration).getAttribute("id");
         this.description = ((Element)configuration).getAttribute("description");
 
         log.info("State-ID = " + this.id);
-        
+
         NodeList inputValuesNodes = Config.getNodeSetXPath(configuration,
                 "inputvalues/inputvalue");
         this.inputValues = new HashMap<String, InputValue>(inputValuesNodes
@@ -142,11 +194,10 @@
                             .warn("Used in Query Value cannot be transformed into a Number");
                 }
             }
-            InputValue inputValue = new DefaultInputValue(inputValueNode.getAttribute("name"), 
-                                                          inputValueNode.getAttribute("type"), 
+            InputValue inputValue = new DefaultInputValue(inputValueNode.getAttribute("name"),
+                                                          inputValueNode.getAttribute("type"),
                                                           Boolean.parseBoolean(inputValueNode.
                                                           getAttribute("multiselect")), usedinQuery);
-            log.debug(inputValue.toString());
             this.inputValues.put(inputValue.getName(), inputValue);
             this.inputValueNames.add(inputValue.getName());
         }
@@ -161,35 +212,39 @@
         if (dataMultiSelectValue != null) {
             this.dataMultiSelect = Boolean.parseBoolean(dataMultiSelectValue);
         }
-        
+
         String dataNoSelectValue =Config.getStringXPath(configuration,
                                                         "data-noselect");
         if (dataNoSelectValue != null) {
             this. dataNoSelect = Boolean.parseBoolean(dataNoSelectValue);
         }
-        
+
+        this.preSettingsName = Config.getStringXPath(configuration, "presettings-name");
+
     }
 
-    /**
-     * @see de.intevation.gnv.state.State#getParent()
-     */
+
     public State getParent() {
         return this.parent;
     }
 
-    /**
-     * @see de.intevation.gnv.state.State#setParent(de.intevation.gnv.state.State)
-     */
+
     public void setParent(State state) {
         this.parent = state;
     }
 
-    /**
-     * @see de.intevation.gnv.state.State#putInputData(java.util.Collection)
-     */
-    public void putInputData(Collection<InputData> inputData, String uuid)
-                                                                          throws StateException {
-        log.debug("StateBase.putInputData");
+
+    public Document feed(
+        CallContext           context,
+        Collection<InputData> inputData,
+        String                uuid)
+    throws StateException
+    {
+        RessourceFactory resFactory = RessourceFactory.getInstance();
+        Locale[] serverLocales      = resFactory.getLocales();
+        Locale locale               = context.getMeta().getPreferredLocale(
+            serverLocales);
+
         if (inputData != null) {
             Iterator<InputData> it = inputData.iterator();
             InputValidator iv = new InputValidator();
@@ -198,17 +253,123 @@
                 InputValue inputValue = this.inputValues.get(tmpItem.getName());
                 if (inputValue != null) {
                     if (this.inputData == null) {
-                        this.inputData = new HashMap<String, InputData>(
-                                inputData.size());
+                        this.inputData = new TreeMap<String, InputData>();
                     }
-                    
-                    boolean valid = iv.isInputValid(tmpItem.getValue(),
+
+                    boolean valid = InputValidator.isInputValid(tmpItem.getValue(),
+                            inputValue.getType());
+                    if (valid) {
+
+                        if (tmpItem.getName().equals(this.dataName)){
+                            String[] desc = getDescriptionForInputData(
+                                tmpItem, context, uuid);
+                            tmpItem.setDescription(desc);
+                        }
+                        this.inputData.put(tmpItem.getName(), tmpItem);
+                    } else {
+                        String msg = resFactory.getRessource(
+                            locale,
+                            EXCEPTION_INVALID_INPUT,
+                            EXCEPTION_INVALID_INPUT);
+                        log.warn(msg);
+                        return feedFailure(msg);
+                    }
+
+                } else {
+                    String msg = resFactory.getRessource(
+                        locale,
+                        EXCEPTION_INVALID_INPUT,
+                        EXCEPTION_INVALID_INPUT);
+                    log.warn(msg);
+                    return feedFailure(msg);
+
+                }
+            }
+
+            return feedSuccess();
+        } else {
+            String msg = resFactory.getRessource(
+                locale,
+                EXCEPTION_NO_INPUT,
+                EXCEPTION_NO_INPUT);
+            log.warn(msg);
+            return feedFailure(msg);
+        }
+    }
+
+
+    protected Document feedSuccess() {
+        return ArtifactXMLUtilities.createSuccessReport(
+            "Initialize success", XMLUtils.newDocument());
+    }
+
+
+    protected Document feedFailure(String msg) {
+        return ArtifactXMLUtilities.createInputExceptionReport(
+            msg, XMLUtils.newDocument());
+    }
+
+
+    protected String[] getDescriptionForInputData(
+        InputData data, CallContext context, String uuid)
+    {
+        // there is only one element in the list, so take the first
+        Object obj = getDescibeData(uuid).get(0);
+        List descs = new ArrayList();
+
+        if (obj instanceof NamedArrayList) {
+            NamedArrayList list = (NamedArrayList) obj;
+            List       selected = Arrays.asList(data.splitValue());
+            int            size = list.size();
+
+            for (int i = 0; i < size; i++) {
+                KeyValueDescibeData kv = (KeyValueDescibeData) list.get(i);
+
+                // values are concatinated in InputData, so one InputData object can
+                // contain many input
+                String key = kv.getKey();
+                int idx = selected.indexOf(key);
+                if (idx >= 0) {
+                    descs.add(kv.getValue());
+
+                    // XXX Workarround: I just wanted to remove the element at
+                    // 'idx' from selected, but for any reason this is not
+                    // possible (throws an exception) (iw)
+                    List tmp = new ArrayList();
+                    for (int j = 0; j < selected.size(); j++) {
+                        if (j != idx)
+                            tmp.add(selected.get(j));
+                    }
+
+                    selected = tmp;
+                }
+            }
+        }
+
+        return (String[]) descs.toArray(new String[descs.size()]);
+    }
+
+
+    public void putInputData(Collection<InputData> inputData, String uuid)
+    throws StateException {
+        if (inputData != null) {
+            Iterator<InputData> it = inputData.iterator();
+            InputValidator iv = new InputValidator();
+            while (it.hasNext()) {
+                InputData tmpItem = it.next();
+                InputValue inputValue = this.inputValues.get(tmpItem.getName());
+                if (inputValue != null) {
+                    if (this.inputData == null) {
+                        this.inputData = new TreeMap<String, InputData>();
+                    }
+
+                    boolean valid = InputValidator.isInputValid(tmpItem.getValue(),
                             inputValue.getType());
                     if (valid) {
                         if (tmpItem.getName().equals(MINVALUEFIELDNAME)){
                             String minValue = tmpItem.getValue();
                             String maxValue = this.getInputValue4ID(inputData, MAXVALUEFIELDNAME);
-                            valid = iv.isInputValid(maxValue,inputValue.getType());
+                            valid = InputValidator.isInputValid(maxValue,inputValue.getType());
                             if (!valid){
                                 String errMsg = "Wrong input for " + tmpItem.getValue()
                                                 + " is not an " + inputValue.getType()
@@ -216,8 +377,8 @@
                                 log.warn(errMsg);
                                 throw new StateException(errMsg);
                             }
-                            
-                            valid = iv.isInputValid(minValue, 
+
+                            valid = InputValidator.isInputValid(minValue,
                                     maxValue,
                                     inputValue.getType());
                             if (!valid){
@@ -228,7 +389,7 @@
                         }else if (tmpItem.getName().equals(MAXVALUEFIELDNAME)){
                             String minValue = this.getInputValue4ID(inputData, MINVALUEFIELDNAME);
                             String maxValue = tmpItem.getValue();
-                            valid = iv.isInputValid(minValue,inputValue.getType());
+                            valid = InputValidator.isInputValid(minValue,inputValue.getType());
                             if (!valid){
                                 String errMsg = "Wrong input for " + tmpItem.getValue()
                                                 + " is not an " + inputValue.getType()
@@ -236,8 +397,8 @@
                                 log.warn(errMsg);
                                 throw new StateException(errMsg);
                             }
-                            
-                            valid = iv.isInputValid(minValue, 
+
+                            valid = InputValidator.isInputValid(minValue,
                                                     maxValue,
                                                     inputValue.getType());
                             if (!valid){
@@ -246,7 +407,6 @@
                                 throw new StateException(errMsg);
                             }
                         }
-                        this.setSelection(tmpItem, uuid);
                         this.inputData.put(tmpItem.getName(), tmpItem);
                     } else {
                         String errMsg = "Wrong input for " + tmpItem.getValue()
@@ -266,9 +426,22 @@
         } else {
             log.warn("No Inputdata given");
         }
+
+        setHash(uuid);
     }
-    
-    private String getInputValue4ID(Collection<InputData> inputData, String inputName){
+
+
+    public void setPreSettings(Map<String, InputData> preSettings) {
+        this.preSettings = preSettings;
+    }
+
+
+    public Map<String, InputData> getPreSettings() {
+        return this.preSettings;
+    }
+
+
+    protected String getInputValue4ID(Collection<InputData> inputData, String inputName){
         Iterator<InputData> it = inputData.iterator();
         while (it.hasNext()) {
             InputData tmpItem = it.next();
@@ -279,107 +452,19 @@
         return null;
     }
 
-    private void setSelection(InputData inputData, String uuid) {
-        log.debug("StateBase.setSelection");
-
-        Object o = this.getDescribeData(inputData.getName(),uuid);
-        if (o != null) {
-            if (o instanceof Collection<?>) {
-                Collection<KeyValueDescibeData> values = (Collection<KeyValueDescibeData>) o;
 
-                String value = inputData.getValue();
-                String[] selectedValues = value.split(",");
-                Set<String> selectedItems = new HashSet<String>(
-                        selectedValues.length);
-                for (int i = 0; i < selectedValues.length; i++) {
-                    selectedItems.add(selectedValues[i].trim());
-                }
-                // Selektion umsetzen
-                Iterator<KeyValueDescibeData> it = values.iterator();
-                while (it.hasNext()) {
-                    KeyValueDescibeData data = it.next();
-                    String key = "" + data.getKey();
-                    boolean selected = selectedItems.contains(key);
-                    data.setSelected(selected);
-                }
-            } else if (o instanceof MinMaxDescribeData) {
-                MinMaxDescribeData data = (MinMaxDescribeData) o;
-                if (inputData.getName().equals(MINVALUEFIELDNAME)) {
-                    data.setMinValue(inputData.getValue());
-                }
-                if (inputData.getName().equals(MAXVALUEFIELDNAME)) {
-                    data.setMaxValue(inputData.getValue());
-                }
-            } else if (o instanceof SingleValueDescribeData) {
-                ((SingleValueDescribeData)o).setValue(inputData.getValue());
-            }
-        }
+    public void advance(String uuid, CallContext context)
+    throws StateException
+    {
     }
 
-    private Object getDescribeData(String name, String uuid) {
-        log.debug("StateBase.getDescribeData");
-        Collection<Object> descibeData = this.getDescibeData(uuid);
-        if (descibeData != null) {
-            Iterator<Object> it = descibeData.iterator();
-            while (it.hasNext()) {
-                Object o = it.next();
-                if (o instanceof NamedCollection<?>) {
-                    if (name.equals(((NamedCollection<?>) o).getName())) {
-                        return o;
-                    }
-                } else if (o instanceof MinMaxDescribeData) {
-                    if (name.equals(((MinMaxDescribeData) o).getMinName())) {
-                        return o;
-                    }
-                    if (name.equals(((MinMaxDescribeData) o).getMaxName())) {
-                        return o;
-                    }
-                }else if (o instanceof SingleValueDescribeData) {
-                    if (name.equals(((SingleValueDescribeData)o).getName())){
-                        return o;
-                    }
-                }
-            }
-        }
-        return null;
 
+    public void initialize(String uuid, CallContext context)
+    throws StateException
+    {
     }
 
-    /**
-     * @see de.intevation.gnv.state.State#advance(java.lang.String,
-     *      de.intevation.artifacts.CallMeta)
-     */
-    public void advance(String uuid, CallMeta callMeta)
-                                                   throws StateException {
-    }
-    
-    public void initialize(String uuid, CallMeta callMeta)
-                                                   throws StateException {
-        log.debug("StateBase.initialize");
-        try {
-            String[] filterValues = this
-                    .generateFilterValuesFromInputData();
-            Collection<Result> result = null;
-            try {
-                if (this.queryID != null) {
-                    QueryExecutor queryExecutor = QueryExecutorFactory
-                            .getInstance().getQueryExecutor();
-                    result = queryExecutor.executeQuery(this.queryID,
-                            filterValues);
-                }
-                this.purifyResult(result, uuid);
-            } catch (RuntimeException e) {
-                log.error(e, e);
-            }
-        } catch (QueryException e) {
-            log.error(e, e);
-            throw new StateException(e);
-        }
-    }
 
-    /**
-     * @return
-     */
     protected String[] generateFilterValuesFromInputData() {
         List<String> list = new ArrayList<String>();
         Iterator<String> it = this.inputValueNames.iterator();
@@ -388,6 +473,7 @@
             InputData data = this.inputData.get(value);
             if (data != null
                 && this.inputValues.containsKey(data.getName())) {
+
                 int size = this.inputValues.get(data.getName())
                         .usedInQueries();
                 String type = this.inputValues.get(data.getName())
@@ -399,7 +485,7 @@
                 } else if (type.equalsIgnoreCase("date")) {
                     requestValue = this
                             .prepareInputData4DateDBQuery(requestValue);
-                } else if (type.equalsIgnoreCase("coordinate")){
+                } else if (type.equalsIgnoreCase("coordinate") || (type.equalsIgnoreCase("geometry") && requestValue.toLowerCase().startsWith("point"))){
                     requestValue = this
                     .prepareInputData4RegionDBQuery(requestValue);
                 }
@@ -408,16 +494,16 @@
                 }
             }
         }
-        String[] filterValues = list.toArray(new String[0]);
+        String[] filterValues = list.toArray(new String[list.size()]);
         return filterValues;
     }
-    
+
+
     protected String prepareInputData4RegionDBQuery(String value){
         return value;
     }
 
     private String prepareInputData4DateDBQuery(String value) {
-        log.debug("StateBase.prepareInputData4DateDBQuery");
         if (value != null) {
             String[] values = value.split(",");
             String newValue = "";
@@ -436,7 +522,6 @@
     }
 
     private String prepareInputData4DBQuery(String value) {
-        log.debug("StateBase.prepareInputData4DBQuery");
         if (value != null) {
             String[] values = value.split(",");
             String newValue = "";
@@ -453,42 +538,51 @@
 
     }
 
-    /**
-     * @param result
-     */
-    protected void purifyResult(Collection<Result> result, String uuid) {
-        log.debug("StateBase.purifyResult");
-        Collection<Object> describeData = this.getDescibeData(uuid);
-        if (describeData == null) {
-            describeData = new ArrayList<Object>();
-        }
-        NamedCollection<KeyValueDescibeData> keyValueDescibeData = extractKVP(result, "KEY", "VALUE");
-        describeData.add(keyValueDescibeData); 
-        this.setDescibeData(uuid, describeData);
+
+    protected List<Object> purifyResult(Collection<Result> result, String uuid) {
+        List<Object> describeData = new ArrayList<Object>();
+
+        NamedCollection<KeyValueDescibeData> keyValueDescibeData =
+            extractKVP(result, "KEY", "VALUE");
+
+        describeData.add(keyValueDescibeData);
+
+        return describeData;
     }
 
-    /**
-     * @param result
-     * @return
-     */
+
     protected NamedCollection<KeyValueDescibeData> extractKVP(Collection<Result> result,
                                                               String keyid,
                                                               String valueid) {
         Iterator<Result> rit = result.iterator();
         int dataSize = (this.dataNoSelect ? result.size()+1 : result.size());
-        
+
         NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(
                 this.dataName, dataSize);
         keyValueDescibeData.setMultiSelect(this.dataMultiSelect);
-        
+
         if (this.dataNoSelect){
-            keyValueDescibeData.add(new DefaultKeyValueDescribeData(NODATASELECTIONKEY, 
-                                                                    "No Selection"));
+            keyValueDescibeData.add(new DefaultKeyValueDescribeData(
+                NODATASELECTIONKEY,
+                "No Selection",
+                getID()
+            ));
         }
+
         boolean initialized = false;
-        int keyPos= 0;
-        int valuePos = 1;
-        String previousKey = null;
+        int     keyPos      = 0;
+        int     valuePos    = 1;
+        String  previousKey = null;
+        InputData preSettingsData =
+            (this.preSettings != null && this.preSettingsName != null)
+                ? this.preSettings.get(this.preSettingsName)
+                : null;
+        boolean filterWithPresettings = preSettingsData != null;
+
+        List<String> preSettingValues = null;
+        if(filterWithPresettings){
+            preSettingValues = Arrays.asList(preSettingsData.splitValue());
+        }
         while (rit.hasNext()) {
             Result resultValue = rit.next();
             if (!initialized){
@@ -500,228 +594,494 @@
                 initialized = true;
             }
             String tmpKey = resultValue.getString(keyPos);
-            // TODO: HACK da die ARCSDE kein DISTINCT auf räumlichen Anfragen unterstützt.
+
+            // TODO: FIXME: We have to do that because the arcsde does not
+            //       support a distinct Query on Layers.
             if (previousKey == null || !tmpKey.equals(previousKey)){
                 previousKey = tmpKey;
-                keyValueDescibeData.add(new DefaultKeyValueDescribeData(tmpKey, resultValue.getString(valuePos)));
+                if (!filterWithPresettings || preSettingValues.contains(tmpKey)){
+                    keyValueDescibeData.add(
+                            new DefaultKeyValueDescribeData(
+                                                tmpKey,
+                                                resultValue.getString(valuePos),
+                                                getID())
+                                );
+                }
             }
         }
         return keyValueDescibeData;
     }
 
-    /**
-     * @see de.intevation.gnv.state.State#describe(org.w3c.dom.Document,
-     *      org.w3c.dom.Node, de.intevation.artifacts.CallMeta,
-     *      java.lang.String)
-     */
-    public void describe(Document document, Node rootNode, CallMeta callMeta,String uuid) {
-        log.debug("StateBase.describe");
-        Collection<Object> descibeData = this.getDescibeData(uuid);
-        if (descibeData != null) {
-            ArtifactXMLUtilities xmlutilities = new ArtifactXMLUtilities();
-            Iterator<Object> it = descibeData.iterator();
-            Node staticNode = xmlutilities.createArtifactElement(document,
-                    "static");
-            Node dynamic = xmlutilities.createArtifactElement(document,
-                    "dynamic");
-            rootNode.appendChild(staticNode);
-            rootNode.appendChild(dynamic);
-            while (it.hasNext()) {
-
-                Object o = it.next();
-                if (o instanceof Collection<?>) {
-                    String name = null;
-                    boolean multiselect = false;
-                    if (o instanceof NamedCollection<?>) {
-                        NamedCollection<?> nc = ((NamedCollection<?>) o);
-                        name = nc.getName();
-                        multiselect = nc.isMultiSelect();
-                    } else {
-                        Object[] names = this.inputValueNames.toArray();
-                        name = names[names.length - 1].toString();
-                    }
-
-                    Element selectNode = xmlutilities.createXFormElement(
-                            document, multiselect ? "select" : "select1");
-                    selectNode.setAttribute("ref", name);
-
-                    Element lableNode = xmlutilities.createXFormElement(
-                            document, "label");
-                    lableNode.setTextContent(RessourceFactory.getInstance()
-                            .getRessource(callMeta.getLanguages(), name, name));
-                    Element choiceNode = xmlutilities.createXFormElement(
-                            document, "choices");
-
-                    Collection<KeyValueDescibeData> values = (Collection<KeyValueDescibeData>) o;
-                    Iterator<KeyValueDescibeData> resultIt = values.iterator();
-                    while (resultIt.hasNext()) {
-                        KeyValueDescibeData result = resultIt.next();
-                        Element itemNode = xmlutilities.createXFormElement(
-                                document, "item");
-
-                        if (result.isSelected()) {
-                            itemNode.setAttribute("selected", "true");
-                        }
-
-                        Element choiceLableNode = xmlutilities
-                                .createXFormElement(document, "label");
-                        choiceLableNode.setTextContent(result.getValue());
-                        itemNode.appendChild(choiceLableNode);
-
-                        Element choicValueNode = xmlutilities
-                                .createXFormElement(document, "value");
-                        choicValueNode.setTextContent("" + result.getKey());
-                        itemNode.appendChild(choicValueNode);
-                        choiceNode.appendChild(itemNode);
-                    }
-                    selectNode.appendChild(lableNode);
-                    selectNode.appendChild(choiceNode);
-
-                    if (!it.hasNext() && this.dataName != null) {
-                        dynamic.appendChild(selectNode);
-                    } else {
-                        staticNode.appendChild(selectNode);
-                    }
-
-                } else if (o instanceof MinMaxDescribeData) {
-                    MinMaxDescribeData minMaxDescibeData = (MinMaxDescribeData) o;
-                    Object min = minMaxDescibeData.getMinValue();
-                    Object max = minMaxDescibeData.getMaxValue();
-                    if (min instanceof GregorianCalendar) {
-                        Date d = ((GregorianCalendar) min).getTime();
-                        min = DateUtils.getPatternedDateAmer(d);
-                    }
 
-                    if (max instanceof GregorianCalendar) {
-                        Date d = ((GregorianCalendar) max).getTime();
-                        max = DateUtils.getPatternedDateAmer(d);
-                    }
-                    
-                    Element groupNode = xmlutilities.createXFormElement(
-                            document, "group");
-                    groupNode.setAttribute("ref", minMaxDescibeData.getName());
-                    Element groupNodeLableNode = xmlutilities
-                            .createXFormElement(document, "label");
-                    groupNodeLableNode.setTextContent(RessourceFactory
-                            .getInstance().getRessource(
-                                    callMeta.getLanguages(),
-                                    minMaxDescibeData.getName(),
-                                    minMaxDescibeData.getName()));
-                    groupNode.appendChild(groupNodeLableNode);
-
-                    Element inputMinNode = xmlutilities.createXFormElement(
-                            document, "input");
-                    inputMinNode.setAttribute("ref", MINVALUEFIELDNAME);
-                    Element inputMinLableNode = xmlutilities
-                            .createXFormElement(document, "label");
-                    inputMinLableNode.setTextContent(RessourceFactory
-                            .getInstance().getRessource(
-                                    callMeta.getLanguages(), MINVALUEFIELDNAME,
-                                    MINVALUEFIELDNAME));
-                    inputMinNode.appendChild(inputMinLableNode);
-
-                    Element inputMinValueNode = xmlutilities
-                            .createXFormElement(document, "value");
-                    inputMinValueNode.setTextContent(min.toString());
-                    inputMinNode.appendChild(inputMinValueNode);
-
-                    Element inputMaxNode = xmlutilities.createXFormElement(
-                            document, "input");
-                    inputMaxNode.setAttribute("ref", MAXVALUEFIELDNAME);
-                    Element inputMaxLableNode = xmlutilities
-                            .createXFormElement(document, "label");
-                    inputMaxLableNode.setTextContent(RessourceFactory
-                            .getInstance().getRessource(
-                                    callMeta.getLanguages(), MAXVALUEFIELDNAME,
-                                    MAXVALUEFIELDNAME));
-                    inputMaxNode.appendChild(inputMaxLableNode);
+    public static boolean inBlackList(String key) {
+        int length = BLACKLIST.length;
+        for (int i = 0; i < length; i++) {
+            if (BLACKLIST[i].equals(key)) {
+                return true;
+            }
+        }
 
-                    Element inputMaxValueNode = xmlutilities
-                            .createXFormElement(document, "value");
-                    inputMaxValueNode.setTextContent(max.toString());
-                    inputMaxNode.appendChild(inputMaxValueNode);
-
-                    groupNode.appendChild(inputMinNode);
-                    groupNode.appendChild(inputMaxNode);
-                    
-                    if (!it.hasNext() && this.dataName != null) {
-                        dynamic.appendChild(groupNode);
-                    } else {
-                        staticNode.appendChild(groupNode);
-                    }
-                } else if (o instanceof SingleValueDescribeData) {
+        return false;
+    }
 
-                    SingleValueDescribeData svdb = (SingleValueDescribeData) o;
-                    
-                    Element groupNode = xmlutilities.createXFormElement(
-                            document, "group");
-                    groupNode.setAttribute("ref",  svdb.getName());
-                    Element groupNodeLableNode = xmlutilities
-                            .createXFormElement(document, "label");
-                    groupNodeLableNode.setTextContent(RessourceFactory
-                            .getInstance().getRessource(
-                                    callMeta.getLanguages(),
-                                    svdb.getName(),
-                                    svdb.getName()));
-                    groupNode.appendChild(groupNodeLableNode);
-
-                    Element inputNode = xmlutilities.createXFormElement(
-                            document, "input");
-                    inputNode.setAttribute("ref", svdb.getName());
 
-                    Element inputLableNode = xmlutilities.createXFormElement(
-                            document, "label");
-                    inputLableNode.setTextContent("");
-                    inputNode.appendChild(inputLableNode);
+    public void describe(
+        Document    document,
+        Node        rootNode,
+        CallContext context,
+        String      uuid)
+    {
+        XMLUtils.ElementCreator xCreator = new XMLUtils.ElementCreator(
+            document,
+            XMLUtils.XFORM_URL,
+            XMLUtils.XFORM_PREFIX
+        );
 
-                    Element inputValueNode = xmlutilities.createXFormElement(
-                            document, "value");
-                    inputValueNode.setTextContent(svdb.getValue());
-                    inputNode.appendChild(inputValueNode);
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX
+        );
 
-                    groupNode.appendChild(inputNode);
-                    if (!it.hasNext() && this.dataName != null) {
-                        dynamic.appendChild(groupNode);
-                    } else {
-                        staticNode.appendChild(groupNode);
-                    }
+        // append dynamic node
+        Node dynamic = (Node) XMLUtils.xpath(
+            rootNode,
+            XPATH_DYNAMIC_UI,
+            XPathConstants.NODE,
+            ArtifactNamespaceContext.INSTANCE
+        );
+
+        describeDynamic(
+            creator, xCreator, document, dynamic, context, uuid);
+
+        // append static nodes
+        Node staticNode = (Node) XMLUtils.xpath(
+            rootNode,
+            XPATH_STATIC_UI,
+            XPathConstants.NODE,
+            ArtifactNamespaceContext.INSTANCE
+        );
+
+        State parent = getParent();
+        if (parent != null && parent instanceof StateBase) {
+            ((StateBase) parent).describeStatic(
+                creator,xCreator, document, staticNode, context,uuid);
+        }
+    }
+
+
+    protected void describeDynamic(
+        XMLUtils.ElementCreator artCreator,
+        XMLUtils.ElementCreator creator,
+        Document                document,
+        Node                    dynamic,
+        CallContext             context,
+        String                  uuid)
+    {
+        CallMeta callMeta = context.getMeta();
+
+        if (dataName == null)
+            return;
+
+        List<Object> descibeData = getDescibeData(uuid);
+        if (descibeData != null) {
+            Iterator<Object> it = descibeData.iterator();
+
+            while (it.hasNext()) {
+                Object o = it.next();
+                if ((!it.hasNext() && dataName != null)) {
+                    appendToDynamicNode(
+                        artCreator, creator, document, dynamic, callMeta, o);
                 }
-
             }
         }
     }
 
-    /**
-     * @see de.intevation.gnv.state.State#getDescibeData()
-     */
-    protected Collection<Object> getDescibeData(String uuid) {
-        if (CacheFactory.getInstance().isInitialized()) {
-            String key = uuid + DESCRIBEDATAKEY;
-            log.debug("Hash for Queryelements: " + key);
-            net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key);
-            if (value != null) {
-                return (Collection<Object>) (value.getObjectValue());
-            }
+
+    protected void describeStatic(
+        XMLUtils.ElementCreator artCreator,
+        XMLUtils.ElementCreator creator,
+        Document                document,
+        Node                    staticNode,
+        CallContext             context,
+        String                  uuid)
+    {
+        State parent = getParent();
+        if (parent instanceof StateBase) {
+            ((StateBase) parent).describeStatic(
+                artCreator, creator, document, staticNode, context, uuid);
         }
-        return null;
+
+        CallMeta callMeta = context.getMeta();
+        appendToStaticNode(artCreator, creator, document, staticNode, callMeta);
     }
-    
-    /**
-     * @see de.intevation.gnv.state.State#getDescibeData()
-     */
-    protected void setDescibeData(String uuid, Collection<Object> describeData) {
-        
-        if (CacheFactory.getInstance().isInitialized()) {
-            String key = uuid + DESCRIBEDATAKEY;
-            log.debug("Hash for Queryelements: " + key);
-            CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, describeData));
+
+
+    protected void appendToStaticNode(
+        XMLUtils.ElementCreator artCreator,
+        XMLUtils.ElementCreator creator,
+        Document                document,
+        Node                    staticNode,
+        CallMeta                callMeta
+    ) {
+        InputData  data = dataName!= null ? inputData.get(dataName) : null;
+
+        if (data == null) {
+            return;
+        }
+
+        Element selectNode = creator.create("select1");
+        creator.addAttr(selectNode, "ref", dataName);
+
+        Element lableNode = creator.create("label");
+        lableNode.setTextContent(RessourceFactory.getInstance()
+                .getRessource(callMeta.getLanguages(), dataName, dataName));
+        Element choiceNode = creator.create("choices");
+
+        artCreator.addAttr(
+            selectNode, "state", getID(), true
+        );
+
+        String[] descriptions = data.getDescription();
+        int              size = descriptions.length;
+
+        for (int i = 0; i < size; i++) {
+            Element itemNode = creator.create("item");
+            String value = data.getValue();
+            String desc  = descriptions[i];
+            desc = desc == null ? value : desc;
+
+            creator.addAttr(itemNode, "selected", "true");
+
+            Element choiceLableNode = creator.create("label");
+            choiceLableNode.setTextContent(desc);
+            itemNode.appendChild(choiceLableNode);
+
+            Element choiceValueNode = creator.create("value");
+            choiceValueNode.setTextContent(value);
+            itemNode.appendChild(choiceValueNode);
+            choiceNode.appendChild(itemNode);
+        }
+
+        selectNode.appendChild(lableNode);
+        selectNode.appendChild(choiceNode);
+
+        staticNode.appendChild(selectNode);
+    }
+
+
+    protected void appendToDynamicNode(
+        XMLUtils.ElementCreator artCreator,
+        XMLUtils.ElementCreator creator,
+        Document                document,
+        Node                    dynamicNode,
+        CallMeta                callMeta,
+        Object                  o
+    ) {
+        if (o instanceof Collection<?>) {
+            String name = null;
+            boolean multiselect = false;
+            if (o instanceof NamedCollection<?>) {
+                NamedCollection<?> nc = ((NamedCollection<?>) o);
+                name = nc.getName();
+                multiselect = nc.isMultiSelect();
+            } else {
+                Object[] names = this.inputValueNames.toArray();
+                name = names[names.length - 1].toString();
+            }
+
+            Element selectNode = creator.create(multiselect?"select":"select1");
+            creator.addAttr(selectNode, "ref", name);
+
+            Element lableNode = creator.create("label");
+            lableNode.setTextContent(RessourceFactory.getInstance()
+                    .getRessource(callMeta.getLanguages(), name, name));
+            Element choiceNode = creator.create("choices");
+
+            Collection<KeyValueDescibeData> values = (Collection<KeyValueDescibeData>) o;
+            Iterator<KeyValueDescibeData> resultIt = values.iterator();
+            while (resultIt.hasNext()) {
+                KeyValueDescibeData result = resultIt.next();
+                Element itemNode = creator.create("item");
+
+                if (result.isSelected()) {
+                    itemNode.setAttribute("selected", "true");
+                }
+
+                Element choiceLableNode = creator.create("label");
+                choiceLableNode.setTextContent(result.getValue());
+                itemNode.appendChild(choiceLableNode);
+
+                Element choicValueNode = creator.create("value");
+                choicValueNode.setTextContent("" + result.getKey());
+                itemNode.appendChild(choicValueNode);
+                choiceNode.appendChild(itemNode);
+            }
+            selectNode.appendChild(lableNode);
+            selectNode.appendChild(choiceNode);
+
+            dynamicNode.appendChild(selectNode);
+        }
+        else if (o instanceof MinMaxDescribeData) {
+            appendMinMaxDescribeData(
+                artCreator,
+                creator,
+                document,
+                dynamicNode,
+                callMeta,
+                o);
+        }
+        else if (o instanceof SingleValueDescribeData) {
+            appendSingleValueDescribeData(
+                artCreator,
+                creator,
+                document,
+                dynamicNode,
+                callMeta,
+                o);
         }
     }
 
-    /**
-     * @see de.intevation.gnv.state.State#getInputData()
-     */
+
+    protected void appendMinMaxDescribeData(
+        XMLUtils.ElementCreator artCreator,
+        XMLUtils.ElementCreator creator,
+        Document                document,
+        Node                    node,
+        CallMeta                callMeta,
+        Object                  o
+    ) {
+        MinMaxDescribeData minMaxDescibeData = (MinMaxDescribeData) o;
+        Object min = minMaxDescibeData.getMinValue();
+        Object max = minMaxDescibeData.getMaxValue();
+        if (min instanceof GregorianCalendar) {
+            Date d = ((GregorianCalendar) min).getTime();
+            min = DateUtils.getPatternedDateAmer(d);
+        }
+
+        if (max instanceof GregorianCalendar) {
+            Date d = ((GregorianCalendar) max).getTime();
+            max = DateUtils.getPatternedDateAmer(d);
+        }
+
+        Element groupNode = creator.create("group");
+        artCreator.addAttr(groupNode, "state", minMaxDescibeData.getState(), true);
+
+        creator.addAttr(groupNode, "ref", minMaxDescibeData.getName());
+        Element groupNodeLableNode = creator.create("label");
+        groupNodeLableNode.setTextContent(RessourceFactory
+                .getInstance().getRessource(
+                        callMeta.getLanguages(),
+                        minMaxDescibeData.getName(),
+                        minMaxDescibeData.getName()));
+        groupNode.appendChild(groupNodeLableNode);
+
+        Element inputMinNode = creator.create("input");
+        creator.addAttr(inputMinNode, "ref", MINVALUEFIELDNAME);
+        Element inputMinLableNode = creator.create("label");
+        inputMinLableNode.setTextContent(RessourceFactory
+                .getInstance().getRessource(
+                        callMeta.getLanguages(), MINVALUEFIELDNAME,
+                        MINVALUEFIELDNAME));
+        inputMinNode.appendChild(inputMinLableNode);
+
+        Element inputMinValueNode = creator.create("value");
+        inputMinValueNode.setTextContent(min.toString());
+        inputMinNode.appendChild(inputMinValueNode);
+
+        Element inputMaxNode = creator.create("input");
+        creator.addAttr(inputMaxNode, "ref", MAXVALUEFIELDNAME);
+        Element inputMaxLableNode = creator.create("label");
+        inputMaxLableNode.setTextContent(RessourceFactory
+                .getInstance().getRessource(
+                        callMeta.getLanguages(), MAXVALUEFIELDNAME,
+                        MAXVALUEFIELDNAME));
+        inputMaxNode.appendChild(inputMaxLableNode);
+
+        Element inputMaxValueNode = creator.create("value");
+        inputMaxValueNode.setTextContent(max.toString());
+        inputMaxNode.appendChild(inputMaxValueNode);
+
+        groupNode.appendChild(inputMinNode);
+        groupNode.appendChild(inputMaxNode);
+
+        node.appendChild(groupNode);
+    }
+
+
+    protected void appendSingleValueDescribeData(
+        XMLUtils.ElementCreator artCreator,
+        XMLUtils.ElementCreator creator,
+        Document                document,
+        Node                    node,
+        CallMeta                callMeta,
+        Object                  o
+    ) {
+        SingleValueDescribeData svdb = (SingleValueDescribeData) o;
+
+        Element groupNode = creator.create("group");
+        artCreator.addAttr(groupNode, "state", svdb.getState(), true);
+        creator.addAttr(groupNode, "ref",  svdb.getName());
+
+        Element groupNodeLableNode = creator.create("label");
+        groupNodeLableNode.setTextContent(RessourceFactory
+                .getInstance().getRessource(
+                        callMeta.getLanguages(),
+                        svdb.getName(),
+                        svdb.getName()));
+        groupNode.appendChild(groupNodeLableNode);
+
+        Element inputNode = creator.create("input");
+        creator.addAttr(inputNode, "ref", svdb.getName());
+
+        Element inputLableNode = creator.create("label");
+        inputLableNode.setTextContent("");
+        inputNode.appendChild(inputLableNode);
+
+        Element inputValueNode = creator.create("value");
+        inputValueNode.setTextContent(svdb.getValue());
+        inputNode.appendChild(inputValueNode);
+
+        groupNode.appendChild(inputNode);
+
+        node.appendChild(groupNode);
+    }
+
+
+    protected void setHash(String uuid) {
+        String newHash = uuid + HASH_ID_SEPARATOR + id + HASH_ID_SEPARATOR;
+        Set    keys    = inputData.keySet();
+
+        int nhash = 0;
+        int shift = 0;
+
+        for (Object o: keys) {
+            nhash ^= inputData.get(o).hashCode() << shift;
+            shift += 2;
+        }
+
+        log.info("### OLD HASH: " + hash);
+        log.info("### NEW HASH: " + (newHash + nhash));
+
+        this.hash = newHash + nhash;
+    }
+
+
+    protected String getHash() {
+        return this.hash;
+    }
+
+
+    public List<Object> getDescibeData(String uuid) {
+        CacheFactory factory = CacheFactory.getInstance();
+        if (factory.isInitialized()) {
+            // we use a cache
+            Cache cache = factory.getCache();
+            String key  = getHash();
+
+            log.debug("Using cache - key: " + key);
+
+            net.sf.ehcache.Element value = cache.get(key);
+            if (value != null) {
+                // element already in cache, so return it.
+                log.debug("Found element in cache.");
+                return (List<Object>) (value.getObjectValue());
+            }
+            else {
+                // element is not in cache yet, so we need to fetch data from
+                // database and put it into cache right now
+                log.debug("Element not in cache, we need to ask the database");
+                try {
+                    String[] filterValues = generateFilterValuesFromInputData();
+                    List<Object> data     = queryDatabase(filterValues, uuid);
+
+                    cache.put(new net.sf.ehcache.Element(key, data));
+
+                    return data;
+                }
+                catch (QueryException qe) {
+                    log.error(qe, qe);
+                }
+            }
+        }
+        else {
+            // we don't use a cache, so we have to query the database every
+            // single time
+            log.debug("Not using cache.");
+            String[] filterValues     = generateFilterValuesFromInputData();
+            Collection<Result> result = null;
+            try {
+                return queryDatabase(filterValues, uuid);
+            }
+            catch (RuntimeException e) {
+                log.error(e, e);
+            }
+            catch (QueryException e) {
+                log.error(e, e);
+            }
+        }
+
+        return null;
+    }
+
+
+    protected List<Object> queryDatabase(String[] filterValues, String uuid)
+    throws QueryException {
+        Collection<Result> result = null;
+
+        if (queryID != null) {
+            QueryExecutor queryExecutor =
+                QueryExecutorFactory.getInstance().getQueryExecutor();
+
+            result = queryExecutor.executeQuery(queryID, filterValues);
+        }
+        return purifyResult(result, uuid);
+    }
+
+
+
+    public Map<String, InputData> inputData() {
+        return inputData;
+    }
+
+
     public Collection<InputData> getInputData() throws StateException {
         return this.inputData != null ? this.inputData.values() : null;
     }
+
+
+    public InputData getInputDataByName(String name) {
+        State state = this;
+
+        while (state != null) {
+            InputData data = state.inputData().get(name);
+            if (data != null) {
+                return data;
+            }
+
+            state = state.getParent();
+        }
+
+        return null;
+    }
+
+
+    public void endOfLife(Object globalContext) {
+        log.debug("end of life of the current state.");
+
+        CacheFactory factory = CacheFactory.getInstance();
+        if (factory.isInitialized()) {
+            Cache cache = factory.getCache();
+            String key  = getHash();
+
+            if (key != null && cache.remove(key)) {
+                log.info("Removed element from cache - key: " + key);
+            }
+        }
+    }
+
+
+    public void cleanup(Object context) {
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/StateFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,16 +1,25 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
-package de.intevation.gnv.state;
 
-import org.apache.log4j.Logger;
-import org.w3c.dom.Node;
+package de.intevation.gnv.state;
 
 import de.intevation.gnv.artifacts.GNVArtifactBase;
 
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Node;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This factory should be used to create new state objects with help of a
+ * configuration segment.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class StateFactory {
 
@@ -28,6 +37,9 @@
         super();
     }
 
+    /**
+     * Return the instance of this class.
+     */
     public static StateFactory getInstance() {
         if (instance == null) {
             instance = new StateFactory();
@@ -35,6 +47,12 @@
         return instance;
     }
 
+    /**
+     * This method creates a new state with help of the information in <i>
+     * configuration</i> and calls its setup method after creation.
+     *
+     * @return the new state.
+     */
     public State createState(Node configuration) {
         log.debug("StateFactory.createState");
         State state = null;
@@ -51,5 +69,5 @@
         }
         return state;
     }
-
 }
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/state/SwitchModeState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state;
+
+import de.intevation.artifacts.common.utils.XMLUtils;
+
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.PreferredLocale;
+
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * This task of this <code>State</code> implementation is to switch between
+ * working with vector or scalar data.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class SwitchModeState extends StateBase {
+
+    public static final String VECTOR_VALUE = "vector";
+    public static final String SCALAR_VALUE = "scalar";
+
+    public static final String RESSOURCE_VECTOR = "vectorvalues";
+    public static final String RESSOURCE_SCALAR = "scalarvalues";
+
+    private static Logger logger = Logger.getLogger(SwitchModeState.class);
+
+    public SwitchModeState() {
+    }
+
+
+    @Override
+    protected void describeDynamic(
+        XMLUtils.ElementCreator artCreator,
+        XMLUtils.ElementCreator creator,
+        Document                document,
+        Node                    dynamic,
+        CallContext             context,
+        String                  uuid)
+    {
+        RessourceFactory ressource = RessourceFactory.getInstance();
+        CallMeta callMeta          = context.getMeta();
+        PreferredLocale[] locales  = callMeta.getLanguages();
+
+        Element selectNode = creator.create("select1");
+        creator.addAttr(selectNode, "ref", dataName);
+
+        Element labelNode = creator.create("label");
+        labelNode.setTextContent(ressource.getRessource(
+            locales, dataName, dataName));
+        selectNode.appendChild(labelNode);
+
+        selectNode.appendChild(createChoices(creator, context));
+        dynamic.appendChild(selectNode);
+        logger.debug("creating dynamic ui elements finished");
+    }
+
+
+    protected Node createChoices(
+        XMLUtils.ElementCreator creator,
+        CallContext             context)
+    {
+        RessourceFactory ressource = RessourceFactory.getInstance();
+        CallMeta callMeta          = context.getMeta();
+        PreferredLocale[] locales  = callMeta.getLanguages();
+
+        Element choiceNodes = creator.create("choices");
+
+        // add choice for scalar values
+        logger.debug("create choice for scalar values");
+        Element scalar = creator.create("item");
+        Element label  = creator.create("label");
+        label.setTextContent(ressource.getRessource(
+            locales, RESSOURCE_SCALAR, RESSOURCE_SCALAR));
+        scalar.appendChild(label);
+
+        Element value = creator.create("value");
+        value.setTextContent(SCALAR_VALUE);
+        scalar.appendChild(value);
+
+        // add choice for vector values
+        logger.debug("create choice for vector values");
+        Element vector = creator.create("item");
+        label  = creator.create("label");
+        label.setTextContent(ressource.getRessource(
+            locales, RESSOURCE_VECTOR, RESSOURCE_VECTOR));
+        vector.appendChild(label);
+
+        value = creator.create("value");
+        value.setTextContent(VECTOR_VALUE);
+        vector.appendChild(value);
+
+        choiceNodes.appendChild(scalar);
+        choiceNodes.appendChild(vector);
+
+        return choiceNodes;
+    }
+
+
+    @Override
+    protected String[] getDescriptionForInputData(
+        InputData data, CallContext context, String uuid)
+    {
+        RessourceFactory ressource = RessourceFactory.getInstance();
+        CallMeta callMeta          = context.getMeta();
+        PreferredLocale[] locales  = callMeta.getLanguages();
+
+        String value = data.getValue();
+
+        if (value != null && value.equals(SCALAR_VALUE)) {
+            return new String[] { ressource.getRessource(
+                locales, RESSOURCE_SCALAR, RESSOURCE_SCALAR) };
+        }
+        else if (value != null && value.equals(VECTOR_VALUE)) {
+            return new String[] { ressource.getRessource(
+                locales, RESSOURCE_VECTOR, RESSOURCE_VECTOR) };
+        }
+
+        return null;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/cache/QueryObject.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state.cache;
+/**
+ * This Class is a Container which carries the
+ * databasequery which belongs to an state.
+ * It is also possible to look up if the query contains a specific
+ * TableName.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class QueryObject {
+
+    /**
+     * The Id of the State the Query belongs to
+     */
+    private String stateId = null;
+
+    /**
+     * The Query which belongs to the State
+     */
+    private String query = null;
+
+    /**
+     * Constructor
+     * @param stateId the Id of the State the Query belongs to
+     * @param query the Query which belongs to the State
+     */
+    public QueryObject(String stateId, String query) {
+        this.stateId = stateId;
+        this.query = query.toUpperCase();
+    }
+
+    /**
+     * Returns the StateId
+     * @return the Stateid
+     */
+    public String getStateId() {
+        return stateId;
+    }
+
+    /**
+     * Returns the Querystring
+     * @return the QueryString
+     */
+    public String getQuery() {
+        return query;
+    }
+
+    /**
+     * Returns true if the given Name of the Table is Contained in the Query
+     * @param tableName the Name of the Table
+     * @return true if the Name of the Table is contained in the Query
+     */
+    public boolean queryContainsTableName(String tableName){
+        return this.query.contains(tableName);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/cache/ThematicDataCacheCleaner.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+/**
+ *
+ */
+package de.intevation.gnv.state.cache;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import net.sf.ehcache.Cache;
+
+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.Config;
+import de.intevation.gnv.artifacts.cache.CacheFactory;
+import de.intevation.gnv.geobackend.base.query.cache.CacheCleaner;
+import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory;
+import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+import de.intevation.gnv.state.StateBase;
+import de.intevation.gnv.utils.ArtifactXMLUtilities;
+
+
+/**
+ * Extended Class of the CacheCleaner.
+ * This Cleaner has the job to cleanup the ThematicData-Cache if it
+ * is necessary.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class ThematicDataCacheCleaner extends CacheCleaner {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(ThematicDataCacheCleaner.class);
+
+    private final static String XPATH_ARTIFACTS =
+                                    "/artifact-database/artifacts/artifact";
+    private final static String XPATH_STATES = "states/state";
+    private final static String XPATH_STATEID = "id";
+    private final static String XPATH_QUERYID = "queryID";
+
+    /**
+     * The Queries that should be Cleaned with its links to the
+     * StateIds.
+     */
+    private Collection<QueryObject> queryObjects = null;
+
+    /**
+     * Constructor
+     */
+    public ThematicDataCacheCleaner() {
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     */
+    public ThematicDataCacheCleaner(Runnable arg0) {
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     */
+    public ThematicDataCacheCleaner(String arg0) {
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     */
+    public ThematicDataCacheCleaner(ThreadGroup arg0, Runnable arg1) {
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     */
+    public ThematicDataCacheCleaner(ThreadGroup arg0, String arg1) {
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     */
+    public ThematicDataCacheCleaner(Runnable arg0, String arg1) {
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     * @param arg2
+     */
+    public ThematicDataCacheCleaner(ThreadGroup arg0, Runnable arg1, String arg2) {
+        this.setUp();
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     * @param arg2
+     * @param arg3
+     */
+    public ThematicDataCacheCleaner(ThreadGroup arg0, Runnable arg1,
+                                    String arg2, long arg3) {
+        this.setUp();
+    }
+
+    /**
+     * Initializes the QueryObjects.
+     * The Queryobjects will be read from the Configuration.
+     * Only Queries which are defined in <code>queryID</code>-Elements
+     * are used.
+     * The other Queries are currently not put into the Cache.
+     */
+    @Override
+    protected void setUp(){
+        super.setUp();
+        this.queryObjects = new ArrayList<QueryObject>();
+        Document configuration = Config.getConfig();
+        NodeList artifactList = Config.getNodeSetXPath(configuration,
+                                                       XPATH_ARTIFACTS);
+        log.debug("ThematicDataCacheCleaner.setUp()");
+        if (artifactList != null && artifactList.getLength() > 0){
+            for (int i = 0; i < artifactList.getLength(); i++){
+                Element currentArtifactNode = (Element)artifactList.item(i);
+
+                String link = currentArtifactNode.getAttribute("xlink:href");
+                if (link != null && link.length() > 0){
+                    String absolutFileName = Config.replaceConfigDir(link);
+                    currentArtifactNode = (Element)new ArtifactXMLUtilities()
+                                           .readConfiguration(absolutFileName);
+                }
+                NodeList stateList = Config.getNodeSetXPath(currentArtifactNode,
+                                                            XPATH_STATES);
+                if (stateList != null && stateList.getLength() > 0){
+                    for (int j = 0; j < stateList.getLength() ; j++){
+                        Element currentStateNode = (Element)stateList.item(j);
+                        String stateId = currentStateNode
+                                          .getAttribute(XPATH_STATEID);
+                        String queryID = Config.getStringXPath(currentStateNode,
+                                                                XPATH_QUERYID);
+                        try {
+                            if (queryID != null){
+                                String query = QueryContainerFactory
+                                                    .getInstance()
+                                                    .getQueryContainer()
+                                                    .getQuery(queryID);
+                                QueryObject qo = new QueryObject(stateId, query);
+                                queryObjects.add(qo);
+                            }
+                        } catch (QueryContainerException e) {
+                            log.error(e,e);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    @Override
+    protected void cleanup() {
+        log.debug("ThematicDataCacheCleaner.cleanup");
+        try {
+            if (queryObjects != null && queryObjects.size() > 0){
+                String[] tableNames = this.getUpdatedTableNames();
+                if (tableNames != null && tableNames.length > 0){
+                    Iterator<QueryObject> it = queryObjects.iterator();
+                    while (it.hasNext()){
+                        QueryObject qo = it.next();
+                        for (int i = 0; i < tableNames.length; i++){
+                            if (qo.queryContainsTableName(tableNames[i])){
+                                String stateId = qo.getStateId();
+                                this.cleanUpCache(stateId);
+                                break;
+                            }
+                        }
+                    }
+                }else{
+                    log.debug("No Tables found to cleanup.");
+                }
+            }else{
+                log.warn("No Queries to clean");
+            }
+        } catch (QueryException e) {
+            log.error(e,e);
+        }
+    }
+
+    /**
+     * Removes the Entries which Keys matches to the <code>stateId</code>
+     * from the Cache.
+     * @param stateId The Id of the State which Entries has to be removed.
+     */
+    private void cleanUpCache(String stateId){
+        log.debug("ThematicDataCacheCleaner.cleanUpCache "+stateId);
+        CacheFactory factory = CacheFactory.getInstance();
+        Cache cache = factory.getCache();
+        List<String> keys = cache.getKeys();
+        String keySample = StateBase.HASH_ID_SEPARATOR +
+                     stateId +
+                     StateBase.HASH_ID_SEPARATOR;
+        if (keys != null && keys.size() > 0){
+            Iterator<String> it = keys.iterator();
+            while (it.hasNext()){
+                String key = it.next();
+                if (key != null && key.contains(keySample)){
+                    boolean removed = cache.remove(key);
+                    if (!removed){
+                        log.warn("Object with Key " +
+                                 key + "could not be removed from Cache");
+                    }else{
+                        log.debug("Object with Key " +
+                                 key + "has been removed from Cache");
+                    }
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/cache/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Classes in this package provide the cleanup mechanism for the
+Thematic-Data-Cache of the Application.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultKeyValueDescribeData.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultKeyValueDescribeData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,57 +1,75 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.describedata;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the default implementation of <code>KeyValueDescibeData</code>. This
+ * class just implements the necessary methods and two constructors.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class DefaultKeyValueDescribeData implements KeyValueDescibeData {
 
-    /**
-     *
-     */
     private static final long serialVersionUID = -924469415242703108L;
 
     private String key;
 
     private String value = null;
 
+    private String state;
+
     private boolean selected = false;
 
+    /**
+     * Creates a new instance of this class with a key-value pair, but no state
+     * and no selection.
+     *
+     * @param key The key.
+     * @param value A value.
+     */
     public DefaultKeyValueDescribeData(String key, String value) {
+        this(key, value, null);
+    }
+
+    /**
+     * Creates a new instance of this class with a key-value pair and the state
+     * this object belongs to.
+     *
+     * @param key The key.
+     * @param value A value.
+     * @param state A state.
+     */
+    public DefaultKeyValueDescribeData(String key, String value, String state) {
         super();
         this.key = key;
         this.value = value;
+        this.state = state;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.KeyValueDescibeData#getKey()
-     */
     public String getKey() {
         return this.key;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.KeyValueDescibeData#getValue()
-     */
     public String getValue() {
         return this.value;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.KeyValueDescibeData#isSelected()
-     */
     public boolean isSelected() {
         return this.selected;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.KeyValueDescibeData#setSelected(boolean)
-     */
     public void setSelected(boolean selected) {
         this.selected = selected;
     }
 
+    public String getState() {
+        return this.state;
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultMinMaxDescribeData.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultMinMaxDescribeData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,55 +1,65 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.describedata;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class DefaultMinMaxDescribeData implements MinMaxDescribeData {
 
-    /**
-     *
-     */
     private static final long serialVersionUID = -2917176219029052295L;
 
     private Object minValue = null;
 
     private Object maxValue = null;
-    
-    private String name = null; 
+
+    private String name = null;
+
+    private String state = null;
 
     private final static String minName = "minvalue";
 
     private final static String maxName = "maxvalue";
 
     /**
-     * Constructor
+     * The default constructor.
+     *
+     * @param name A general name for this object.
+     * @param minValue The min value.
+     * @param maxValue The max value.
+     * @param state The state.
      */
-    public DefaultMinMaxDescribeData(String name, Object minValue, Object maxValue) {
+    public DefaultMinMaxDescribeData(
+        String name,
+        Object minValue,
+        Object maxValue,
+        String state
+    ) {
         super();
         this.name = name;
         this.minValue = minValue;
         this.maxValue = maxValue;
+        this.state    = state;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#getMaxValue()
-     */
     public Object getMaxValue() {
         return this.maxValue;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#getMinValue()
-     */
     public Object getMinValue() {
         return this.minValue;
     }
 
     /**
-     * @see java.lang.Object#toString()
+     * Returns the string representation of this object.
+     *
+     * @return this object as string.
      */
     @Override
     public String toString() {
@@ -57,30 +67,18 @@
                + this.maxValue.toString();
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#getName()
-     */
     public String getMinName() {
         return minName;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#getMaxName()
-     */
     public String getMaxName() {
         return maxName;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#setMaxValue(java.lang.Object)
-     */
     public void setMaxValue(Object maxValue) {
         this.maxValue = maxValue;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.MinMaxDescribeData#setMinValue(java.lang.Object)
-     */
     public void setMinValue(Object minValue) {
         this.minValue = minValue;
     }
@@ -89,4 +87,8 @@
        return this.name;
     }
 
+    public String getState() {
+        return this.state;
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultSingleValueDescribeData.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DefaultSingleValueDescribeData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,45 +1,61 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.describedata;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the default implementation of <code>SingleValueDescribeData</code>.
+ * This object is used to store a single value for a specific name.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class DefaultSingleValueDescribeData implements SingleValueDescribeData {
 
-    /**
-     *
-     */
     private static final long serialVersionUID = 3580176842483316917L;
 
     private String name = null;
 
     private String value = null;
 
+    private String state = null;
+
     /**
-     * Constructor
-     * 
-     * @param name
-     * @param value
+     * Constructor to create new objects without a specific state.
+     *
+     * @param name The name of this object.
+     * @param value The value of this object.
      */
     public DefaultSingleValueDescribeData(String name, String value) {
+        this(name, value, null);
+    }
+
+    /**
+     * Constructor to create new objects with a specific state.
+     *
+     * @param name The name of this object.
+     * @param value The value of this object.
+     * @param state The state this object belongs to.
+     */
+    public DefaultSingleValueDescribeData(
+        String name,
+        String value,
+        String state
+    ) {
         super();
         this.name = name;
         this.value = value;
+        this.state = state;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.SingleValueDescribeData#getName()
-     */
     public String getName() {
         return this.name;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.SingleValueDescribeData#getValue()
-     */
     public String getValue() {
         return this.value;
     }
@@ -48,4 +64,8 @@
         this.value = value;
     }
 
+    public String getState() {
+        return this.state;
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DescribeData.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/DescribeData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,16 +1,22 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.describedata;
 
 import java.io.Serializable;
 
 /**
  * Markerinterface
- * 
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public interface DescribeData extends Serializable {
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/ExtendedKeyValueData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state.describedata;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This implementation improves the <code>DefaultKeyValueDescribeData</code> and
+ * establishes another field to store a further parameter.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ExtendedKeyValueData
+extends      DefaultKeyValueDescribeData
+{
+    private static Logger logger = Logger.getLogger(ExtendedKeyValueData.class);
+
+    /**
+     * A further parameter to be stored at this object.
+     */
+    protected String parameter;
+
+    /**
+     * Default constructor to initialize new objects.
+     *
+     * @param key The key.
+     * @param value The value.
+     * @param state The state - null permitted.
+     * @param parameter A further value.
+     */
+    public ExtendedKeyValueData(
+        String key, String value, String state, String parameter)
+    {
+        super(key, value, state);
+        this.parameter = parameter;
+    }
+
+    /**
+     * Returns the parameter.
+     *
+     * @return the parameter.
+     */
+    public String getParameter() {
+        return parameter;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/KeyValueDescibeData.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/KeyValueDescibeData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,22 +1,58 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.describedata;
 
 import java.io.Serializable;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This interface defines some methods to retrieve a key-value pair, a state
+ * this data belongs to and a boolean property, if this data have been selected.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface KeyValueDescibeData extends Serializable {
 
+    /**
+     * Returns the key of this data object.
+     *
+     * @return the key.
+     */
     public String getKey();
 
+    /**
+     * Returns the value of this data object.
+     *
+     * @return the value.
+     */
     public String getValue();
 
+    /**
+     * Returns the state of this data object.
+     *
+     * @return the state.
+     */
+    public String getState();
+
+    /**
+     * Returns a boolean which defines, if this data pair has been selected or
+     * not.
+     *
+     * @return true, if this pair has been selected - otherwise false.
+     */
     public boolean isSelected();
 
+    /**
+     * Method to change the selection of this data object.
+     *
+     * @param selected Set this value to true, if you want to select this data
+     * object - set it to false, if you want to unselect it.
+     */
     public void setSelected(boolean selected);
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/MinMaxDescribeData.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/MinMaxDescribeData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,26 +1,75 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.describedata;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This interface describes some methods to set and retrieve a min-max value
+ * pair with a specific name.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface MinMaxDescribeData extends DescribeData {
 
+    /**
+     * Returns the min value stored in this object.
+     *
+     * @return the min value.
+     */
     public Object getMinValue();
 
+    /**
+     * Returns the max value stored in this object.
+     *
+     * @return the max value.
+     */
     public Object getMaxValue();
 
+    /**
+     * Sets the min value in this object.
+     *
+     * @param minValue A new min value.
+     */
     public void setMinValue(Object minValue);
 
+    /**
+     * Sets the max value in this object.
+     *
+     * @param maxValue A new max value.
+     */
     public void setMaxValue(Object maxValue);
 
+    /**
+     * Returns the general name of this object.
+     *
+     * @return the name.
+     */
     public String getName();
-    
+
+    /**
+     * Returns the name of the min value.
+     *
+     * @return the name of the min value.
+     */
     public String getMinName();
 
+    /**
+     * Returns the name of this max value.
+     *
+     * @return the name of the max value.
+     */
     public String getMaxName();
 
+    /**
+     * Returns the state this object belongs to.
+     *
+     * @return the state.
+     */
+    public String getState();
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/NamedArrayList.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/NamedArrayList.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,14 +1,21 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.describedata;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the default implementation of <code>NamedCollection</code>.
+ *
+ * @param <E> The type which the objects stored in this object are from.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class NamedArrayList<E> extends ArrayList<E> implements
                                                    NamedCollection<E> {
@@ -23,6 +30,8 @@
 
     /**
      * Constructor
+     *
+     * @param name The name of this collection.
      */
     public NamedArrayList(String name) {
         this.name = name;
@@ -30,8 +39,9 @@
 
     /**
      * Constructor
-     * 
-     * @param initialCapacity
+     *
+     * @param name The name of this collection.
+     * @param initialCapacity The initial capacity of this collection.
      */
     public NamedArrayList(String name, int initialCapacity) {
         super(initialCapacity);
@@ -40,32 +50,25 @@
 
     /**
      * Constructor
-     * 
-     * @param c
+     *
+     * @param name The name of this collection.
+     * @param c the collection whose elements are to be placed into this list.
      */
     public NamedArrayList(String name, Collection<E> c) {
         super(c);
         this.name = name;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.NamedCollection#getName()
-     */
     public String getName() {
         return this.name;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.NamedCollection#isMultiSelect()
-     */
     public boolean isMultiSelect() {
         return multiSelect;
     }
 
-    /**
-     * @see de.intevation.gnv.state.describedata.NamedCollection#setMultiSelect(boolean)
-     */
     public void setMultiSelect(boolean multiSelect) {
         this.multiSelect = multiSelect;
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/NamedCollection.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/NamedCollection.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,19 +1,46 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.describedata;
 
 import java.util.Collection;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This interface describes some methods to retrieve the name of this <code>
+ * Collection</code> and to determine if this <code>Collection</code> is a
+ * single or multiselect object.
+ *
+ * @param <E> The objects in this class need to be of this type.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public interface NamedCollection<E> extends Collection<E> {
 
+    /**
+     * Returns the name of this <code>Collection</code>.
+     *
+     * @return the name.
+     */
     public String getName();
 
+    /**
+     * Determines if this <code>Collection</code> is a multi select object.
+     *
+     * @return true, if it is multi select, otherwise false.
+     */
     public boolean isMultiSelect();
 
+    /**
+     * Change between single and multiselect.
+     *
+     * @param multiSelect true, if this object should be a multiselect,
+     * otherwise false.
+     */
     public void setMultiSelect(boolean multiSelect);
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/SingleValueDescribeData.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/SingleValueDescribeData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,17 +1,46 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.describedata;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This interface defines some methods to store and retrieve key-value pairs.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface SingleValueDescribeData extends DescribeData {
 
+    /**
+     * Returns the name of this object.
+     *
+     * @return the name.
+     */
     public String getName();
 
+    /**
+     * Returns the value stored in this object.
+     *
+     * @return the value.
+     */
     public String getValue();
-    
+
+    /**
+     * Sets the value of this object to <i>value</i>.
+     *
+     * @param value A new value.
+     */
     public void setValue(String value);
+
+    /**
+     * Returns the state this objects belongs to.
+     *
+     * @return the state.
+     */
+    public String getState();
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/describedata/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Classes and interfaces to handle user input.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/exception/StateException.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/exception/StateException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,16 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.exception;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class StateException extends Exception {
 
@@ -23,7 +28,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param message
      */
     public StateException(String message) {
@@ -32,7 +37,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param cause
      */
     public StateException(Throwable cause) {
@@ -41,7 +46,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param message
      * @param cause
      */
@@ -50,3 +55,4 @@
     }
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/exception/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Exception classes to be thrown if error occur in state objects.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerMetaData.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+/**
+ *
+ */
+package de.intevation.gnv.state.layer;
+/**
+ * Beanclass for storing Metainformation to create Shapefiles or Layer
+ * in an WMS-Output.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class LayerMetaData {
+
+    private String table = null;
+    private String geometryType = null;
+    private String where = null;
+    private String columns = null;
+    private String templateID = null;
+    private String[] queryValues = null;
+    private String geometryWKT = null;
+    private String layertitle = null;
+
+    /**
+     * Constructor
+     * @param table the Name of the Databasetable the Data should be fetched from.
+     * @param geometryType the Geometrytype of the Layer
+     * @param where the Query-Statement which should be used to fetch the Data.
+     * @param columns the Columnnames which should be fetched to generate the
+     *                Shapefile
+     * @param templateID the Id of the Template which should be used to create
+     *                   the Mapfileentry.
+     * @param queryValues the Values that should be used to Query the data
+     * @param geometryWKT The Geometry represented by as an WKT to Query the Data.
+     */
+    public LayerMetaData(String table, String geometryType, String where,
+                         String columns, String templateID,
+                         String[] queryValues,String geometryWKT,
+                         String layertitle) {
+        super();
+        this.table        = table;
+        this.geometryType = geometryType;
+        this.where        = where;
+        this.columns      = columns;
+        this.templateID   = templateID;
+        this.queryValues  = queryValues;
+        this.geometryWKT  = geometryWKT;
+        this.layertitle    = layertitle;
+    }
+
+    /**
+     *  Returns the Geometry WKT
+     * @return  the Geometry WKT
+     */
+    public String getGeometryWKT() {
+        return geometryWKT;
+    }
+
+    /**
+     * Returns the Name of the Databasetable the Data should be fetched from.
+     * @return the Name of the Databasetable the Data should be fetched from.
+     */
+    public String getTable() {
+        return table;
+    }
+
+    /**
+     * Returns the Geometrytype of the Layer.
+     * @return the Geometrytype of the Layer.
+     */
+    public String getGeometryType() {
+        return geometryType;
+    }
+
+    /**
+     * Returns the Query-Statement which should be used to fetch the Data.
+     * @return the Query-Statement which should be used to fetch the Data.
+     */
+    public String getWhere() {
+        return where;
+    }
+
+    /**
+     * Returns the Columnnames which should be fetched to generate the
+     * Shapefile
+     * @return the Columnnames which should be fetched to generate the
+     *         Shapefile
+     */
+    public String getColumns() {
+        return columns;
+    }
+
+    /**
+     * Returns the Id of the Template which should be used to create
+     * the Mapfileentry.
+     * @return the Id of the Template which should be used to create
+     *         the Mapfileentry.
+     */
+    public String getTemplateID() {
+        return templateID;
+    }
+
+    /**
+     * Returns the Values that should be used to Query the data.
+     * @return the Values that should be used to Query the data.
+     */
+    public String[] getQueryValues() {
+        return queryValues;
+    }
+
+    /**
+     * Returns the layer title.
+     * @return the layer title.
+     */
+    public String getLayertitle() {
+        return layertitle;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/LayerOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,805 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state.layer;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.io.ParseException;
+import com.vividsolutions.jts.io.WKTReader;
+
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
+import de.intevation.gnv.artifacts.context.GNVArtifactContext;
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.query.QueryExecutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+import de.intevation.gnv.state.InputData;
+import de.intevation.gnv.state.OutputStateBase;
+import de.intevation.gnv.state.exception.StateException;
+import de.intevation.gnv.utils.ArtifactXMLUtilities;
+import de.intevation.gnv.utils.ExclusiveExec;
+import de.intevation.gnv.utils.FileUtils;
+import de.intevation.gnv.utils.MapfileGenerator;
+import de.intevation.gnv.utils.MetaWriter;
+import de.intevation.gnv.utils.ShapeFileWriter;
+
+/**
+ * This <code>OutputState</code> is used for Layer-Products.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class LayerOutputState extends OutputStateBase {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(LayerOutputState.class);
+
+    /**
+     * The UID of this Class.
+     */
+    private static final long serialVersionUID = 9180957321704424049L;
+
+    /**
+     * The Basename of the Templates for the WMS-Exports
+     */
+    public static final String LAYER_MODEL    = "layer";
+
+    /**
+     * The Name of the Shapefile which will be generated.
+     */
+    public static final String SHAPEFILE_NAME   = "data";
+
+    /**
+     * The ID for the Query fetching the Layer from the DB
+     */
+    private String dataQueryID = null;
+
+    /**
+     * The ID for the Query fetching the Geometry from the DB
+     * which should be used to Clip the Layerdata
+     */
+    private String geometryQueryID = null;
+
+    /**
+     * The ID of the Query for fetching the Columnnames of the Table which
+     * should put into the Shapefile.
+     */
+    private String columnQueryID = null;
+
+    /**
+     * The ID of the Query for fetching the Information which kind of Geometry
+     * should be put into the Shapefile.
+     */
+    private String geometryTypeQueryID = null;
+
+    /**
+     * The ID for the Value which will hold the Geometry-Value
+     */
+    private String geometryID = null;
+
+    /**
+     * Flag for synchronized Access of the Shapefile.
+     */
+    private Boolean shapeFileLock = new Boolean(true);
+
+    /**
+     * The Path where the Shapefile is stored.
+     */
+    private String shapeFilePath;
+
+    /**
+     * Constructor
+     */
+    public LayerOutputState() {
+        super();
+    }
+
+    public void out(Document format, Collection<InputData> inputData,
+                    OutputStream outputStream, String uuid,
+                    CallContext callContext) throws StateException {
+        log.debug("LayerOutputState.out");
+        String outputMode = XMLUtils.xpathString(
+                format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE);
+        if (outputMode.equalsIgnoreCase("wms")) {
+
+            Collection<LayerMetaData> layerMetaData =
+                                          this.getRequestedLayerMetadata();
+            if (layerMetaData != null && !layerMetaData.isEmpty()){
+                XMLUtils.toStream(this.getWMS(uuid, callContext,
+                                              layerMetaData,inputData),
+                                  outputStream);
+            }else{
+                this.writeExceptionReport2Stream(outputStream);
+            }
+        }else if (outputMode.equalsIgnoreCase("zip")){
+            Collection<LayerMetaData> layerMetaData =
+                this.getRequestedLayerMetadata();
+
+            if (layerMetaData != null && !layerMetaData.isEmpty()){
+                this.writeZip(uuid, callContext,
+                              outputStream, layerMetaData);
+            }else{
+                this.writeExceptionReport2Stream(outputStream);
+            }
+
+        }
+    }
+
+    /**
+     * Writes an exception to an output stream.
+     *
+     * @param outputStream The output stream used to write the exception to.
+     */
+    private void writeExceptionReport2Stream(OutputStream outputStream) {
+        Document document = XMLUtils.newDocument();
+        ArtifactXMLUtilities.
+        createExceptionReport("No Data to Export", document);
+        XMLUtils.toStream(document,outputStream);
+    }
+
+    /**
+     * Returns the Metadata for the requested Layers for fetching the data
+     * of the Layer and generating the Layer and WMS.
+     * @return the Metadata for the requested Layers
+     */
+    private Collection<LayerMetaData> getRequestedLayerMetadata(){
+        log.debug("LayerOutputState.getRequestedLayerMetadata");
+        Collection<Result> result = this.getData(this.queryID);
+        Collection<LayerMetaData> returnValue = null;
+        if (result != null){
+            QueryExecutor queryExecutor = QueryExecutorFactory.getInstance()
+                                                              .getQueryExecutor();
+            Iterator<Result> it = result.iterator();
+            returnValue = new ArrayList<LayerMetaData>(result.size());
+            while (it.hasNext()){
+                Result resultValue = it.next();
+                String table = resultValue.getString(0);
+                String geometryType = this.getGeometryType(table, queryExecutor);
+                String where = resultValue.getString(1);
+                String columns = this.fetchColumns(table);
+                String templateID = resultValue.getString(2);
+                String layername = resultValue.getString(3);
+                String[] queryValues = null;
+                String geometryWKT = null;
+                if (this.geometryID != null){
+                    InputData geometryInputData =
+                         this.inputData.get(this.geometryID);
+                    if (geometryInputData != null){
+                        try {
+
+                            Collection<Result> geometryData = queryExecutor
+                                                      .executeQuery(this.geometryQueryID,
+                                                                    new String[]{geometryInputData.getValue()});
+                            Iterator<Result> git = geometryData.iterator();
+                            if (git.hasNext()){
+                                Result geometryValue = git.next();
+                                geometryWKT = geometryValue.getString(0);
+                            }
+                        } catch (QueryException e) {
+                            log.error(e,e);
+                        }
+                       queryValues = new String[]{columns,
+                                                  table,
+                                                  where,
+                                                  geometryWKT};
+                    }else{
+                        //Look into the presetting for an WKT
+                        InputData geometryWKTData = this.preSettings != null ?
+                                                    this.preSettings.get("geometry") :
+                                                    null ;
+                        if (geometryWKTData != null){
+                            queryValues = new String[]{columns,
+                                                       table,
+                                                       where,
+                                                       geometryWKTData.getValue()};
+                            geometryWKT = geometryWKTData.getValue();
+                        }else{
+                            queryValues = new String[]{columns,table,where};
+                        }
+                    }
+                }else{
+                    //Look into the presetting for an WKT
+                    InputData geometryWKTData = this.preSettings != null ?
+                                                this.preSettings.get("geometry") :
+                                                null ;
+                    if (geometryWKTData != null){
+                        queryValues = new String[]{columns,
+                                                   table,
+                                                   where,
+                                                   geometryWKTData.getValue()};
+                    }else{
+                        queryValues = new String[]{columns,table,where};
+                    }
+                }
+                returnValue.add(new LayerMetaData(
+                    table, geometryType, where, columns,
+                    templateID, queryValues, geometryWKT, layername));
+            }
+        }
+        return returnValue;
+    }
+
+    /**
+     * Fetches the Data from the Databasebackend.
+     *
+     * @return the resultdata.
+     */
+    protected Collection<Result> fetchData(LayerMetaData layerMetaData, Envelope mbr){
+        log.debug("LayerOutputState.fetchData");
+        Collection<Result> data = null;
+        QueryExecutor queryExecutor = QueryExecutorFactory.getInstance()
+                                                           .getQueryExecutor();
+        try {
+            data  = queryExecutor.executeQuery(dataQueryID,
+                                               layerMetaData.getQueryValues());
+            if (data != null){
+                WKTReader wktReader = new WKTReader();
+                Geometry border = null;
+                if (layerMetaData.getGeometryWKT() != null){
+                    border = wktReader.read(layerMetaData.getGeometryWKT());
+                }
+                Iterator<Result> dataIt = data.iterator();
+                while (dataIt.hasNext()){
+                    // Trim the Geometries using the
+                    // Geometry if one is available.
+                    Result current = dataIt.next();
+                    String currentWKT = current.getString(0);
+                    Geometry currentGeometry = null;
+                    try {
+                        currentGeometry = wktReader.read(currentWKT);
+                    } catch (Exception e) {
+                        log.error("Error parsing Geometry "+ currentWKT);
+                        log.error(e,e);
+                    }
+                    if (currentGeometry != null){
+                        if (border != null){
+                            currentGeometry = currentGeometry.intersection(border);
+                            current.addColumnValue(0, currentGeometry.toText());
+                        }
+                        if (mbr.isNull()){
+                            mbr.init(currentGeometry.getEnvelopeInternal());
+                        }else{
+                            mbr.expandToInclude(currentGeometry.getEnvelopeInternal());
+                        }
+                    }
+                }
+            }
+        } catch (QueryException e) {
+            log.error(e,e);
+        } catch (ParseException e){
+            log.error(e,e);
+        }
+        return data;
+    }
+
+
+    /**
+     * This method determines the geometry type on basis of a table name.
+     *
+     * @param tableName Name of the table in the database.
+     * @param queryExecutor The QueryExecutor.
+     * @return the geometry type as string (e.g. MultiPolygon, Polygon, etc).
+     */
+    private String getGeometryType(String tableName,
+                                   QueryExecutor queryExecutor){
+        String returnValue = null;
+        String[] tables = tableName.toUpperCase().split(",");
+        String[] filter = tables[0].split("\\.");
+        try {
+            Collection<Result> result =
+                queryExecutor.executeQuery(this.geometryTypeQueryID, filter);
+            if (result != null && !result.isEmpty())
+            {
+                int geometryCode = result.iterator().next().getInteger(0);
+                if (geometryCode == 11 ||
+                    geometryCode == 10){
+                    returnValue = "MultiPolygon";
+                }else if (geometryCode == 9 ||
+                          geometryCode == 8){
+                    returnValue = "MultiLineString";
+                }else if (geometryCode == 7){
+                    returnValue = "MultiPoint";
+                }else if (geometryCode == 6){
+                    returnValue = "GeometryCollection";
+                }else if (geometryCode == 5 ||
+                          geometryCode == 4){
+                    returnValue = "Polygon";
+                }else if (geometryCode == 3 ||
+                          geometryCode == 2){
+                    returnValue = "LineString";
+                }else if (geometryCode == 1){
+                    returnValue = "Point";
+                }else if (geometryCode == 0){
+                    returnValue = "Geometry";
+                }
+            }
+        } catch (QueryException e) {
+            log.error(e,e);
+        }
+        return returnValue;
+    }
+
+
+    /**
+     * Fetch the columns of a specific table.
+     *
+     * @param tableName The name of the table.
+     * @return the columns as string.
+     */
+    private String fetchColumns(String tableName){
+        String returnValue = null;
+        try {
+            String[] tables = tableName.toUpperCase().split(",");
+            String[] filter = tables[0].split("\\.");
+            // Only use the first Table the second one will be ignored.
+            QueryExecutor queryExecutor = QueryExecutorFactory.getInstance()
+                                                            .getQueryExecutor();
+            Collection<Result> columnData = queryExecutor.
+                                                executeQuery(this.columnQueryID,
+                                                             filter);
+            if (columnData != null && !columnData.isEmpty()){
+                StringBuffer sb = new StringBuffer();
+                synchronized (sb) {
+                    Iterator<Result> it = columnData.iterator();
+                    while(it.hasNext()){
+                        Result current = it.next();
+                        sb.append(current.getString(0));
+                        if (it.hasNext()){
+                            sb.append(" , ");
+                        }
+                    }
+                }
+                returnValue = sb.toString();
+            }
+        } catch (QueryException e) {
+            log.error(e,e);
+        }
+        return returnValue;
+    }
+
+
+    @Override
+    public void setup(Node configuration) {
+        log.debug("LayerOutputState.setup");
+        super.setup(configuration);
+        this.dataQueryID = Config.getStringXPath(configuration,
+                                                 "queryID-layerdata");
+        this.geometryID = Config.getStringXPath(configuration,
+                                                "inputvalue-geometry");
+        this.geometryQueryID =  Config.getStringXPath(configuration,
+                                                "queryID-geometry");
+
+        this.columnQueryID =   "layer_colums"; //Config.getStringXPath(configuration,
+                                               // "queryID-columns");
+        this.geometryTypeQueryID = "geometry_type";
+    }
+
+
+    /**
+     * Write the resultdata to shapefiles.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @param data The finalized data used for shapefile creation.
+     * @param callContext The CallContext object.
+     * @param geometryType The geometry type.
+     * @return the shapefile path.
+     */
+    protected String writeToShapeFile(
+                                      String             uuid,
+                                      Collection<Result> data,
+                                      CallContext        callContext,
+                                      String geometryType,
+                                      int layerNumber
+                                  ) {
+        boolean success    = false;
+        if (data != null && !data.isEmpty()){
+            File shapeDir = new File(shapeFilePath);
+            try {
+                File shapeFile = new File(shapeDir, createShapeFileName(layerNumber));
+                if (!ShapeFileWriter.writeDataToFile(shapeFile, "data", data,geometryType)){
+                    log.error("writing data into shapefile failed");
+                    return null;
+                }
+                success = true;
+                callContext.afterCall(CallContext.STORE);
+                return shapeFilePath;
+            }
+            finally {
+                if (!success) {
+                    FileUtils.deleteRecursive(shapeDir);
+                }
+            }
+        }else{
+            return null;
+        }
+    }
+
+    /**
+     * Check if the ShapeDir exists and if it exists delete all Contents
+     * in it. If it not exists the Director will be created.
+     * @param baseDir the BaseDirectory for all ShapeDirs
+     * @param uuid the UUID  which is used to create the Directory
+     * @return true if the directory exists or could be created.
+     *         false if the directory could not be created.
+     */
+    private boolean createShapeDir(File baseDir, String uuid){
+        File shapeDir = new File(baseDir, uuid);
+        boolean createdDir = false;
+        synchronized (shapeFileLock) {
+            if (shapeDir.exists()) {
+                FileUtils.deleteContent(shapeDir); // TODO Place on getZip and getWMS
+            }
+            else if (!shapeDir.mkdirs()) {
+                log.error("cannot create directory '"
+                    + shapeDir.getAbsolutePath() + "'");
+                return false;
+            }
+            createdDir = true;
+        }
+        shapeFilePath = shapeDir.getAbsolutePath();
+        return createdDir;
+    }
+
+    /**
+     * Create a zip archive with the shapefiles of the given shapefiles path and
+     * write it to <code>output</code>.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @param callContext The CallContext object.
+     * @param output The output stream.
+     * @param data The data to be written to shapefile.
+     * @param geometryType The geometry type.
+     * @throws StateException if an error occured while zipfile creation.
+     */
+    protected void writeZip(
+            String       uuid,
+            CallContext  callContext,
+            OutputStream output,
+            Collection<LayerMetaData> layerMetaData
+        )
+        throws StateException
+        {
+            try {
+                String p = getShapeFilePath();
+                if (p != null) {
+                    File dir = new File(p);
+                    if (dir.isDirectory()) {
+                        FileUtils.createZipArchive(dir, output);
+                    }
+                }
+                else {
+                    File baseDir = shapefileDirectory(callContext);
+                    if (!this.createShapeDir(baseDir, uuid)){
+                        return;
+                    }
+                    Iterator<LayerMetaData> it = layerMetaData.iterator();
+                    int i = 1;
+                    Envelope mbr = new Envelope();
+                    while(it.hasNext()){
+                        LayerMetaData lmd = it.next();
+                        Collection<Result> data = this.fetchData(lmd, mbr);
+                        p = writeToShapeFile(uuid, data, callContext,lmd.getGeometryType(),i++);
+                    }
+                    if (p != null) {
+                        FileUtils.createZipArchive(new File(p), output);
+                    }
+                }
+            }
+            catch (IOException ioe) {
+                log.error(ioe.getLocalizedMessage(), ioe);
+            }
+        }
+
+    /**
+     * Returns the shapefile path.
+     *
+     * @return the shapefile path.
+     */
+    public String getShapeFilePath() {
+        synchronized (shapeFileLock) {
+            return shapeFilePath;
+        }
+    }
+
+
+    /**
+     * Set the shapefile path.
+     */
+    public void setShapeFilePath(String shapeFilePath) {
+        synchronized (shapeFileLock) {
+            this.shapeFilePath = shapeFilePath;
+        }
+    }
+
+    /**
+     * Returns the basic-directory where the Shapefiles should be placed in.
+     * @param callContext the Context of this Call
+     * @return the Directory where the Shapefiles could be placed in.
+     *         (Please create an own directory in this dir and not put the
+     *          Files directly in it)
+     */
+    private static File shapefileDirectory(CallContext callContext) {
+        // Code was taken from HorizontalCrossSectionMeshOutputState
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+        File dir = (File)context.get(
+            GNVArtifactContext.HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH_KEY);
+        return dir != null
+            ? dir
+            : GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH;
+    }
+
+
+    @Override
+    public void endOfLife(Object globalContext) {
+        super.endOfLife(globalContext);
+        // do it in background
+        new Thread() {
+            @Override
+            public void run() {
+                String path = resetShapeFilePath();
+                if (path == null) {
+                    return;
+                }
+                File dir = new File(path);
+                for (int i = 0; i < 10; ++i) {
+                    if (!dir.exists() || FileUtils.deleteRecursive(dir)) {
+                        MapfileGenerator.getInstance().update();
+                        return;
+                    }
+                    try {
+                        Thread.sleep(10000L);
+                    }
+                    catch (InterruptedException ie) {
+                    }
+                }
+
+                log.error("failed to remove directory '" + path + "'");
+            } // run
+        }.start();
+    }
+
+    /**
+     * Resets the Settings e.g shapeFilePath and templateID
+     * @return
+     */
+    private String resetShapeFilePath() {
+        synchronized (shapeFileLock) {
+            String path = shapeFilePath;
+            shapeFilePath = null;
+            return path;
+        }
+    }
+
+
+    /**
+     * Write data to shapefiles and feed a map service with information about
+     * these shapefiles. The map service can be queried for displaying
+     * corresponding layers as WMS.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @param callContext The CallContext object.
+     * @param layerMetaData The Metadata which is required to create the
+     *                      different Layers.
+     * @param inputData the Parameters which are send by the out-Call.
+     * @return a document with some meta information (shapefile path, geometry
+     * type, time to live of the current artifact, etc).
+     * @throws StateException if an error occured while shapefile writing.
+     */
+    protected Document getWMS(
+        String                    uuid,
+        CallContext               callContext,
+        Collection<LayerMetaData> layerMetaData,
+        Collection<InputData>     inputData)
+    throws StateException
+    {
+        Document document = XMLUtils.newDocument();
+
+        File baseDir  = shapefileDirectory(callContext);
+        File shapeDir = new File(baseDir, uuid);
+
+        boolean success    = false;
+        boolean createdDir = false;
+
+        try {
+            // create shapefile directory or delete content if it already exists
+            synchronized (shapeFileLock) {
+                if (shapeDir.exists()) {
+                    FileUtils.deleteContent(shapeDir);
+                }
+                else if (!shapeDir.mkdirs()) {
+                    log.error("cannot create directory '"
+                        + shapeDir.getAbsolutePath() + "'");
+                    return null;
+                }
+                setShapeFilePath(shapeDir.getAbsolutePath());
+                createdDir = true;
+            }
+
+            // process data
+            Iterator<LayerMetaData> it = layerMetaData.iterator();
+            
+            // create meta file
+            Document meta   = MetaWriter.initMeta();
+            MetaWriter.insertAbstractMeta(callContext, meta);            
+
+            String   path   = getShapeFilePath();
+            String   prefix = getLayerPrefix(inputData);
+
+            if (prefix == null) {
+                prefix = uuid;
+            }
+
+            int layerNumber = 0;
+            Envelope mbr = new Envelope();
+            while (it.hasNext()){
+                LayerMetaData lmd = it.next();
+                layerNumber ++;
+
+                String geometryType = lmd.getGeometryType();
+                String templateId   = lmd.getTemplateID();
+
+                ExclusiveExec.UniqueKey key = ExclusiveExec.INSTANCE.acquire(uuid);
+                try{
+                    Collection<Result> results = this.fetchData(lmd,mbr);
+                    if (results != null && writeToShapeFile(uuid, results,
+                                                         callContext,
+                                                         geometryType,
+                                                         layerNumber) != null) {
+                        String name   = getLayerName(uuid, layerNumber);
+                        String base   = lmd.getLayertitle();
+                        String title  = getLayerTitle(prefix, base);
+                        String data   = getLayerData(
+                            uuid, createShapeFileName(layerNumber));
+                        String type   = determineGeometryType(geometryType);
+                        String status = "OFF";
+                        String model  = findParameterTitle(
+                            geometryType, templateId);
+
+                        MetaWriter.insertLayer(
+                            callContext, meta, name, title,
+                            data, model, type, status);
+                    }
+
+                    success = true;
+
+                    if (meta != null && !it.hasNext()) {
+                        MetaWriter.insertMbr(mbr, "EPSG:4326",meta);
+                        MetaWriter.writeMetaFile(path, meta);
+                        MapfileGenerator.getInstance().update();
+                        return meta;
+                    }
+                }finally{
+                    ExclusiveExec.INSTANCE.release(key);
+                }
+            }
+          
+            return document;
+        }
+        finally {
+            if (!success && createdDir) {
+                FileUtils.deleteRecursive(shapeDir);
+            }
+        }
+    }
+
+    /**
+     * Creates the name of the Shapefile
+     * @param layerNumber the Number of the Layer
+     * @return the create name of the Shapefile.
+     */
+    private String createShapeFileName(int layerNumber) {
+        return SHAPEFILE_NAME+"_"+layerNumber+".shp";
+    }
+
+
+    protected String getLayerName(String uuid, int idx) {
+        return "GNV_" + uuid + "_" + idx;
+    }
+
+
+    protected String getLayerTitle(String prefix, String base) {
+        return "GNV_" + prefix + "_" + base;
+    }
+
+
+    protected String getLayerData(String shapeDir, String filename) {
+        File path = new File(shapeDir, filename);
+
+        return path.toString();
+    }
+
+
+    /**
+     * Returns the parameterType for the Layer.
+     * @param geometryType
+     * @return
+     */
+    private String findParameterTitle(String geometryType, String templateID) {
+        String paramType = LAYER_MODEL+"_"+templateID;
+        if (!MapfileGenerator.getInstance().templateExists(paramType)){
+            // If the template doesn't exist the Defaulttemplates will be used.
+            paramType = LAYER_MODEL+"_"+
+                        this.determineDefaultTemplateName(geometryType);
+        }
+        return paramType;
+    }
+
+    /**
+     * Find the title for a wms layer specified by the user.
+     *
+     * @param inputData A collection with InputData objects.
+     * @return the title.
+     */
+    protected String getLayerPrefix(Collection<InputData> inputData) {
+        for (InputData data: inputData) {
+            String name = data.getName();
+            if (name != null && name.equals("title")) {
+                return (String) data.getValue();
+            }
+        }
+        return null;
+    }
+
+
+    /**
+     * Turns the geometry type into a form used for the templating mechanism
+     * while mapfile generation.
+     *
+     * @param geometryType The original geometry type.
+     * @return a valid geometry type fpr the template mechanism.
+     */
+    private String determineGeometryType(String geometryType){
+        String returnValue = geometryType.toLowerCase();
+        if (returnValue.equalsIgnoreCase("linestring")){
+            returnValue = "Line";
+        }else if (returnValue.equalsIgnoreCase("multilinestring")){
+            returnValue ="Line";
+        }else if (returnValue.equalsIgnoreCase("multipolygon")){
+            returnValue = "Polygon";
+        }
+        return returnValue;
+    }
+
+
+    /**
+     * Determine the default template name if no special template is existing
+     * for this layer.
+     *
+     * @param geometryType The geometry type.
+     * @return a default geometry fitting to the original geometry type.
+     */
+    private String determineDefaultTemplateName(String geometryType){
+        String returnValue = geometryType.toLowerCase();
+        if (returnValue.equalsIgnoreCase("multilinestring")){
+            returnValue ="linestring";
+        }else if (returnValue.equalsIgnoreCase("multipolygon")){
+            returnValue = "polygon";
+        }else if (returnValue.equalsIgnoreCase("multipoint")){
+            returnValue = "point";
+        }
+        return returnValue;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/layer/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+State classes used by artifacts representing Layer to handle input and
+output.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Classes in this package handle specific input/output of artifacts and even play a
+decisive role for creating describe-documents of the current artifact's state.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshCrossOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,100 +1,339 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.profile.horizontal;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Locale;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Node;
+import au.com.bytecode.opencsv.CSVWriter;
 
 import com.vividsolutions.jts.geom.Coordinate;
-import com.vividsolutions.jts.geom.Point;
-import com.vividsolutions.jts.geom.LineString;
 
-import com.vividsolutions.jts.io.ParseException;
-import com.vividsolutions.jts.io.WKTReader;
+import de.intevation.artifacts.common.utils.Config;
 
-import de.intevation.artifactdatabase.Config;
+import de.intevation.artifacts.CallContext;
 
 import de.intevation.gnv.artifacts.cache.CacheFactory;
 
+import de.intevation.gnv.artifacts.context.GNVArtifactContext;
+
 import de.intevation.gnv.chart.Chart;
 import de.intevation.gnv.chart.ChartLabels;
 import de.intevation.gnv.chart.HorizontalCrossProfileChart;
 
-import de.intevation.gnv.geobackend.base.DefaultResultDescriptor;
-import de.intevation.gnv.geobackend.base.ResultDescriptor;
+import de.intevation.gnv.exports.DefaultProfile;
+import de.intevation.gnv.exports.Export;
+import de.intevation.gnv.exports.StringArrayKey;
+
 import de.intevation.gnv.geobackend.base.DefaultResult;
+import de.intevation.gnv.geobackend.base.DefaultResultDescriptor;
 import de.intevation.gnv.geobackend.base.Result;
-
-import de.intevation.gnv.math.Point2d;
-import de.intevation.gnv.math.Interpolation2D;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
 
 import de.intevation.gnv.geobackend.base.query.QueryExecutor;
 import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
-import de.intevation.gnv.geobackend.base.query.exception.QueryException;
-import de.intevation.gnv.geobackend.sde.datasources.ResultSet;
-
-
-import de.intevation.gnv.utils.IndexBuffer;
-import de.intevation.gnv.utils.DistanceCalculator;
 
-import de.intevation.gnv.math.LinearFunction;
-import de.intevation.gnv.math.LinearMetrics;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
 
-import org.apache.commons.math.optimization.fitting.CurveFitter;
+import de.intevation.gnv.math.Interpolation2D;
+import de.intevation.gnv.math.LinearMetrics;
+import de.intevation.gnv.math.Point2d;
 
-import org.apache.commons.math.optimization.general.GaussNewtonOptimizer;
-import org.apache.commons.math.optimization.OptimizationException;
+import de.intevation.gnv.state.InputData;
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.exception.StateException;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import de.intevation.gnv.utils.DistanceCalculator;
+import de.intevation.gnv.utils.StringUtils;
+import de.intevation.gnv.utils.WKTUtils;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
 
 import org.jfree.chart.ChartTheme;
 
+import org.w3c.dom.Node;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * This <code>OutputState</code> is used for 'Horizontalschnitt' products.
  *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:iweinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
-public class HorizontalProfileMeshCrossOutputState extends
-                                                  HorizontalProfileOutputState {
+public class HorizontalProfileMeshCrossOutputState
+extends      HorizontalProfileMeshOutputState
+{
 
     /**
-     *
+     * Constant field which defines the source format of a given datetime.
      */
+    public static final String SRC_FORMAT  = "yyyy.MM.dd HH:mm:ss";
+
+    /**
+     * Constant field which defines the target format of a given datetime.
+     */
+    public static final String DEST_FORMAT = "yyyy-MM-dd HH:mm";
+
+    /**
+     * Source format.
+     */
+    public static DateFormat srcFormat  = new SimpleDateFormat(SRC_FORMAT);
+
+    /**
+     * Target format.
+     */
+    public static DateFormat destFormat = new SimpleDateFormat(DEST_FORMAT);
+
+
+    /**
+     * This class represents an exporter used for exporting 'Horizontale
+     * Schnittprofile' as odv.
+     *
+     * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+     */
+    public class HorizontalProfileMeshCrossODVExporter
+    implements   Export
+    {
+        private ResultDescriptor rd;
+
+        private Collection parameters;
+
+        private int dateIdx;
+        private int paramIdx;
+        private int depthIdx;
+        private int valueIdx;
+        private int shpIdx;
+
+        public HorizontalProfileMeshCrossODVExporter(Collection parameters) {
+            this.parameters = parameters;
+        }
+
+        public void create(
+            Profile      profile,
+            OutputStream outputStream,
+            Collection   result)
+        throws
+            IOException,
+            UnsupportedEncodingException,
+            StateException
+        {
+            CSVWriter writer = new CSVWriter(
+                new OutputStreamWriter(outputStream, profile.getEncoding()),
+                profile.getSeparator(),
+                profile.getQuoteCharacter(),
+                profile.getEscapeCharacter());
+
+            writeData(profile, writer, result);
+
+            writer.close();
+        }
+
+        protected void writeData(
+            Profile            profile,
+            CSVWriter          writer,
+            Collection<Result> results)
+        {
+            log.debug("Put " + results.size() + " elements into odv export.");
+
+            // just write header into odv export
+            String[] header = profile.getHeader();
+            ArrayList<String> headerList = new ArrayList<String>();
+            for (int i= 0; i < header.length; i++){
+                headerList.add(header[i]);
+            }
+
+            ArrayList<String> paramids = new ArrayList<String>();
+
+            Map<StringArrayKey, Map<String,String>> aggregatedRows =
+                new HashMap<StringArrayKey, Map<String,String>>();
+
+            for (Result res: results) {
+                if (rd == null) {
+                    rd       = res.getResultDescriptor();
+                    paramIdx = rd.getColumnIndex("GROUP1");
+                    depthIdx = rd.getColumnIndex("GROUP2");
+                    dateIdx  = rd.getColumnIndex("GROUP3");
+                    shpIdx   = rd.getColumnIndex("SHAPE");
+                    valueIdx = rd.getColumnIndex("YORDINATE");
+                }
+
+                String[] row          = generateRow(res);
+                StringArrayKey key    = new StringArrayKey(row);
+                String parameterValue = res.getString(valueIdx);
+                String parameterID    = res.getString(paramIdx);
+
+                if (!paramids.contains(parameterID)) {
+                    paramids.add(parameterID);
+                    headerList.add(findParamTitle(parameters, parameterID));
+                    headerList.add("QF");
+                }
+
+                Map<String,String> aggregatedRow = aggregatedRows.get(key);
+                if (aggregatedRow != null) {
+                    aggregatedRow.put(parameterID, parameterValue);
+                }
+                else{
+                    Map<String,String> params = new HashMap<String, String>();
+                    params.put(parameterID, parameterValue);
+                    aggregatedRows.put(key, params);
+                }
+            }
+
+            if (header != null){
+                writer.writeNext(headerList.toArray(header));
+            }
+
+            Iterator<StringArrayKey> rows = aggregatedRows.keySet().iterator();
+            int idx = 1;
+            while (rows.hasNext()){
+                StringArrayKey row = rows.next();
+                Map<String,String> params = aggregatedRows.get(row);
+
+                ArrayList<String> rowList = new ArrayList<String>();
+                String[] rowArray = row.getValue();
+                for (int i= 0; i < rowArray.length; i++){
+                    String value = rowArray[i];
+                    if (value != null && value.equals("GNV_STATION")) {
+                        value += "_" + idx++;
+                    }
+                    rowList.add(value);
+                }
+                for (int i = 0; i < paramids.size();i++){
+                    String key = paramids.get(i);
+                    String value = params.get(key);
+                    if (value == null){
+                        value = "";
+                    }
+                    rowList.add(value);
+                    rowList.add("1");
+                }
+                log.debug("Write new line into odv export.");
+                writer.writeNext(rowList.toArray(rowArray));
+            }
+        }
+
+        protected String[] generateRow(Result res) {
+            Date   tmpDate = null;
+            String dateTmp = res.getString(dateIdx);
+            try {
+                tmpDate = srcFormat.parse(dateTmp);
+            }
+            catch (ParseException pe) {
+                log.warn(pe,pe);
+            }
+
+            String shapeTmp = res.getString(shpIdx);
+            Coordinate  p   = WKTUtils.toCoordinate(shapeTmp);
+
+            String cruise   = "GNV_EXPORT";
+            String station  = "GNV_STATION";
+            String type     = "*";
+            String date     = tmpDate != null
+                ? destFormat.format(tmpDate)
+                : dateTmp;
+            String lon      = "" + p.x;
+            String lat      = "" + p.y;
+            String botDepth = "0";
+            String depth    = res.getString(depthIdx);
+
+            return new String[] {
+                cruise, station, type, date, lon, lat, botDepth, depth
+            };
+        }
+
+        /**
+         * This method is used to search specific value coresponding to its key
+         * <code>id</code> and return its description.
+         *
+         * @param values Collection of parameters.
+         * @param id Key used to find the value.
+         *
+         * @return Description of searched value.
+         */
+        protected String findParamTitle(Collection values, String id) {
+            if (values != null){
+                Iterator it = values.iterator();
+                while (it.hasNext()) {
+                    KeyValueDescibeData data = (KeyValueDescibeData) it.next();
+
+                    if (id.equals(data.getKey()))
+                        return data.getValue();
+                }
+            }
+            return "";
+        }
+    } // HorizontalProfileMeshCrossODVExporter
+
+
+    public static final boolean USE_INDEX_BUFFER =
+        Boolean.getBoolean("gnv.horizontal.profile.mesh.cross.index.buffer");
+
     private static final long serialVersionUID = 2205958041745637263L;
-    
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
-    private static Logger log = 
-                  Logger.getLogger(HorizontalProfileMeshCrossOutputState.class);
-    
+    private static Logger log = Logger.getLogger(
+        HorizontalProfileMeshCrossOutputState.class);
 
     private String ijkQueryID = null;
-   
+
     /**
      * Constructor
      */
     public HorizontalProfileMeshCrossOutputState() {
         super();
     }
-    
-    /**
-     * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#setup(org.w3c.dom.Node)
-     */
+
+
     @Override
     public void setup(Node configuration) {
         super.setup(configuration);
         this.ijkQueryID = Config.getStringXPath(configuration,"queryID-ijk");
-        
+
     }
 
 
+    /**
+     * This method creates a chart and returns it.
+     *
+     * @param chartLables Labels used to decorate the chart.
+     * @param theme The theme used to adjust the look of the chart.
+     * @param parameters A collection with parameters this chart contains.
+     * @param measurements A collection with measurement this chart contains.
+     * @param dates A collection with dates this chart contains.
+     * @param result The data collection used to be displayed in this chart.
+     * @param locale The Locale used to determine the language.
+     * @param uuid The uuid of the current artifact.
+     * @param linesVisible A boolean property to determine the visibility of
+     * lines connecting two points in a chart (not used in this chart type).
+     * @param shapesVisible A boolean property to determine the visiblity of
+     * datapoints in this chart (not used in this chart type).
+     * @param callContext The CallContext object.
+     * @return a <code>HorizontalCrossProfileChart</code>.
+     */
     @Override
     protected Chart getChart(
         ChartLabels  chartLables,
@@ -102,16 +341,17 @@
         Collection   parameters,
         Collection   measurements,
         Collection   dates,
-        Collection   result,
+        Object       result,
         Locale       locale,
         String       uuid,
         boolean      linesVisible,
-        boolean      shapesVisible
+        boolean      shapesVisible,
+        CallContext  callContext
     ) {
         Chart chart = null;
         if (CACHE_CHART) {
             log.info("Try to get horizontalprofilemeshcross chart from cache.");
-            chart = (Chart) getChartFromCache(uuid);
+            chart = (Chart) getChartFromCache(uuid, callContext);
         }
 
         if (chart != null)
@@ -124,7 +364,7 @@
             parameters,
             measurements,
             dates,
-            result,
+            (Collection)result,
             null,
             locale,
             linesVisible,
@@ -140,324 +380,153 @@
         return chart;
     }
 
-    @Override
-    protected Collection<Result> getChartResult(String uuid) {
-        log.debug("HorizontalProfileMeshCrossOutputState.getChartResult");
-        Collection<Result> result = null;
-        if (CacheFactory.getInstance().isInitialized()) {
-            String key = uuid + super.getID();
-            log.debug("Hash for Queryelements: " + key);
-            net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key);
-            if (value != null) {
-                result = (Collection<Result>) (value.getObjectValue());
-            }else{
-                
-                if (this.inputData.containsKey("mesh_linestring")){
-                    
-                    try {
-                        // 1. IJK Anfragen für Stuetzpunkte im Netz ausführen.
-                        LineString ls = (LineString)new WKTReader().read(this.inputData
-                                                                         .get("mesh_linestring")
-                                                                         .getValue());
-                        Coordinate[] coords = ls.getCoordinates();
-                        
-                        List<java.awt.Point> points = new ArrayList<java.awt.Point>(coords.length);
-                        
-                        String meshid = this.inputData.get("meshid").getValue();
-                        QueryExecutor queryExecutor = QueryExecutorFactory
-                                                        .getInstance()
-                                                        .getQueryExecutor();
-
-                        ArrayList missingPoints = new ArrayList();
-
-                        String additionWhere = "FEATUREID=FEATUREID";
-
-                        for (int i = 0; i < coords.length; i++) {
-
-                            String wkt = toWKT(coords[i]);
-
-                            result = queryExecutor.executeQuery(this.ijkQueryID,
-                                                               new String[]{meshid,wkt});
-                            if (!result.isEmpty()){
-                                Result resultValue = result.iterator().next();
-                                int iPos = resultValue.getInteger(1);
-                                int jPos = resultValue.getInteger(0);
-                                log.debug("Found Pos "+iPos+"/"+jPos +" for "+wkt);
-                                points.add(i, new java.awt.Point(iPos,jPos));
-                            }else{
-                                log.debug("No i/j Pos found for "+wkt);
-                                missingPoints.add(new Object [] { Integer.valueOf(i), coords[i] });
-                                points.add(i, null);
-                                // Special Case no i,j found for Coordinate
-                            }
-                        }
-
-                        if (missingPoints.size() == coords.length) {
-                            log.debug("cannot create index buffer");
-                        }
-                        else { // generate index filter
-                            boolean remainsMissingPoints = !missingPoints.isEmpty();
-
-                            if (remainsMissingPoints) {
-                                // try to guess the missing (i, j)
-                                CurveFitter iFitter = new CurveFitter(new GaussNewtonOptimizer(true));
-                                CurveFitter jFitter = new CurveFitter(new GaussNewtonOptimizer(true));
 
-                                for (int i = 0, N = points.size(); i < N; ++i) {
-                                    java.awt.Point p = (java.awt.Point)points.get(i);
-                                    if (p != null) {
-                                        Coordinate coord = coords[i];
-                                        iFitter.addObservedPoint(coord.x, p.x);
-                                        jFitter.addObservedPoint(coord.y, p.y);
-                                    }
-                                }
-                                try {
-                                    // XXX: Assumption: (i, j) are created by componentwise linear function.
-                                    // This is surely not correct because (x, y) are in a ellipsoid projection.
-                                    // TODO: use ellipsoid functions and fit with Levenberg Marquardt.
-                                    double [] iParams = iFitter.fit(
-                                        LinearFunction.INSTANCE, new double [] { 1d, 1d });
-
-                                    double [] jParams = jFitter.fit(
-                                        LinearFunction.INSTANCE, new double [] { 1d, 1d });
-
-                                    for (int i = missingPoints.size()-1; i >= 0; --i) {
-                                        Object [] a = (Object [])missingPoints.get(i);
-                                        Coordinate coord = (Coordinate)a[1];
-                                        int pi = (int)Math.round(iParams[0]*coord.x + iParams[1]);
-                                        int pj = (int)Math.round(jParams[0]*coord.y + jParams[1]);
-                                        points.set(
-                                            ((Integer)a[0]).intValue(),
-                                            new java.awt.Point(pi, pj));
-                                    }
+    @Override
+    protected void createODV(
+        OutputStream outputStream, String uuid, CallContext callContext)
+    throws IOException, StateException {
 
-                                    remainsMissingPoints = false; // we filled the gaps
-                                }
-                                catch (FunctionEvaluationException fee) {
-                                    log.error(fee);
-                                }
-                                catch (OptimizationException oe) {
-                                    log.error(oe);
-                                }
-                            }
+        String [] COLUMN_HEADER = {
+            "Cruise",
+            "Station",
+            "Type",
+            "yyyy-mm-dd hh:mm",
+            "Lon (°E)",
+            "Lat (°N)",
+            "Bot. Depth [m]",
+            "Depth [m]"
+        };
 
-                            if (!remainsMissingPoints) {
-                                // TODO: Make Tablenames and Columns Configurable
-                                IndexBuffer ib = new IndexBuffer(
-                                    points, 
-                                    "MEDIAN.MESHPOINT.IPOSITION", 
-                                    "MEDIAN.MESHPOINT.JPOSITION" );
-                                additionWhere = ib.toWhereClause();
-                                log.debug("Additional Where Clause = "+additionWhere);
-                                // 2. Aus diesen Stuetzpunkten den Resultset generieren.
-                            }
-                        } // if generate index filter
-                        
-                        String[] filterValues = this.generateFilterValuesFromInputData();
-                        String[] addedFilterValues = new String[filterValues.length+1];
-                        System.arraycopy(filterValues, 0, addedFilterValues, 0, filterValues.length);
-                        addedFilterValues[filterValues.length] = additionWhere;
-                        
-                        result = process(
-                            Arrays.asList(coords),
-                            queryExecutor.executeQuery(
-                                this.queryID,
-                                addedFilterValues));
-                        
-                    } catch (ParseException e) {
-                        log.error(e,e);
-                    }catch (QueryException e) {
-                        log.error(e,e);
-                    }
-                }else{
-                    // TODO: definieren was passiert wenn kein linestring vorhanden ist.
-                }
-                
-                if (CacheFactory.getInstance().isInitialized()) {
-                    CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, result));
-                }
-                
+        Export.Profile ODV_PROFILE = new DefaultProfile(
+            COLUMN_HEADER,
+            '\t',
+            CSVWriter.NO_QUOTE_CHARACTER,
+            CSVWriter.NO_ESCAPE_CHARACTER,
+            "ODV",
+            "ISO-8859-1");
+
+        Collection<Result> result = (Collection<Result>) getChartResult(
+            uuid, callContext);
+
+        if (result == null) {
+            log.error("No data for export found.");
+            return;
+        }
+
+        Export export = new HorizontalProfileMeshCrossODVExporter(
+            getParameters(uuid));
+
+        export.create(ODV_PROFILE, outputStream, result);
+    }
+
+
+	private static int numSamples(CallContext callContext) {
+		GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+		Integer samples = (Integer)context.get(
+			GNVArtifactContext.HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES_KEY);
+		return samples != null
+			? samples.intValue()
+			: GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SAMPLES;
+	}
+
+    @Override
+    protected Object getChartResult(String uuid, CallContext callContext) {
+        log.debug("HorizontalProfileMeshCrossOutputState.getChartResult");
+
+        String key = getHash();
+        if (CacheFactory.getInstance().isInitialized()) {
+            log.debug("Using cache - key: " + key);
+            net.sf.ehcache.Element value = CacheFactory.getInstance().getCache().get(key);
+
+            if (value != null) {
+                log.debug("Found element in cache.");
+                return (Collection<Result>) (value.getObjectValue());
             }
         }
+
+        log.debug("Not using cache or element not found.");
+        Collection<Result> result = null;
+
+        InputData meshLine = inputData.get("mesh_linestring");
+        InputData meshId   = inputData.get("meshid");
+
+        if (meshLine == null) {
+            log.error("mesh_linestring is not defined");
+            throw new IllegalStateException("missing mesh_linestring");
+        }
+
+        if (meshId == null) {
+            log.error("meshid is not defined");
+            throw new IllegalStateException("missing meshid");
+        }
+
+        Coordinate [] coords = WKTUtils.toCoordinates(
+            meshLine.getValue());
+
+        if (coords == null) {
+            throw new IllegalStateException("cannot read coordinates");
+        }
+
+        try {
+            String additionWhere = USE_INDEX_BUFFER
+                ? WKTUtils.worldCoordinatesToIndex(
+                    coords,
+                    result,
+                    meshId.getValue(),
+                    ijkQueryID)
+                : WKTUtils.TRUE_EXPRESSION;
+
+            String[] addedFilterValues = StringUtils.append(
+                generateFilterValuesFromInputData(),
+                additionWhere);
+
+            QueryExecutor queryExecutor = QueryExecutorFactory
+                .getInstance()
+                .getQueryExecutor();
+
+            result = process(
+                Arrays.asList(coords),
+                numSamples(callContext),
+                queryExecutor.executeQuery(
+                queryID,
+                addedFilterValues));
+        }
+        catch (QueryException e) {
+            log.error(e,e);
+        }
+
+        if (CacheFactory.getInstance().isInitialized()) {
+            CacheFactory.getInstance().getCache().put(new net.sf.ehcache.Element(key, result));
+        }
+
         return result;
     }
 
 
-    @Override
-    protected String createChartSubtitle(Locale locale, String uuid) {
-        log.debug("create chart subtitle for horizontal crossprofile charts.");
-        String subtitle = createTimePeriod(locale, uuid);
-
-        return subtitle;
-    }
-
-    private static final String [] COLUMN_BLACKLIST = {
-        "MEDIAN.MESHPOINT.JPOSITION",
-        "MEDIAN.MESHPOINT.IPOSITION"
-    };
-
-    private static final boolean blacklisted(String column) {
-        for (int i = 0; i < COLUMN_BLACKLIST.length; ++i) {
-            if (COLUMN_BLACKLIST.equals(column)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private static boolean different(Result a, Result b, int [] indices) {
-        for (int i = 0; i < indices.length; ++i) {
-            String oa = a.getString(indices[i]);
-            String ob = b.getString(indices[i]);
-
-            if (oa == null && ob == null)  {
-                continue;
-            }
-
-            if (oa == null || ob == null) {
-                return true;
-            }
-
-            if (!oa.equals(ob)) {
-                log.debug("+++++++++++++++ differs ++++++++++++++");
-                log.debug("   " + oa + " != " + ob);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private static final String [] DIFF_COLUMS = {
-        "GROUP1",
-        "GROUP2",
-        "GROUP3"
-    };
-
-    public static final class SectionHandler
-    implements                Interpolation2D.Consumer
-    {
-        private ArrayList<Point2d> points;
-        private List<Coordinate>   path;
-        private Collection<Result> output;
-        private Result             prototyp;
-        private ResultDescriptor   descriptor;
-
-        public SectionHandler() {
-        }
-
-        public SectionHandler(
-            List<Coordinate>   path,
-            Collection<Result> output,
-            ResultDescriptor   descriptor
-        ) {
-            this.path       = path;
-            this.output     = output;
-            this.descriptor = descriptor;
-            points = new ArrayList<Point2d>();
-        }
-
-        public void finish() {
-            if (!points.isEmpty()) {
-                double distance = toKM(
-                    DistanceCalculator.calculateDistance(path));
-                
-                if (distance > EPSILON) {
-
-                    Interpolation2D.interpolate(
-                        path,
-                        points,
-                        0d,
-                        distance,
-                        INTERPOLATION_STEPS,
-                        LinearMetrics.INSTANCE,
-                        this);
-                }
-
-                points.clear();
-            }
-        }
-
-        public void setPrototyp(Result prototyp) {
-            this.prototyp = prototyp;
-        }
-
-        public void handle(Result result) {
-            Coordinate coordinate = 
-                toCoordinate(result.getString("SHAPE"));
-            double value = result.getDouble("YORDINATE");
-            int iPos     = result.getInteger("MEDIAN.MESHPOINT.JPOSITION");
-            int jPos     = result.getInteger("MEDIAN.MESHPOINT.JPOSITION");
-            Point2d p = new Point2d(
-                coordinate.x,
-                coordinate.y,
-                value,
-                iPos, jPos);
-            points.add(p);
-        }
-
-        public void interpolated(Coordinate coordinate) {
-            DefaultResult result = new DefaultResult(descriptor);
-            ResultDescriptor pd = prototyp.getResultDescriptor();
-
-            int pcolums = pd.getColumnCount();
-            for (int i = 0, j = 0; i < pcolums; ++i) {
-                String colname = pd.getColumnName(i);
-                if (blacklisted(colname)) {
-                    continue;
-                }
-                if (colname.equals("SHAPE")) {
-                    result.addColumnValue(j, toWKT(coordinate));
-                }
-                else if (colname.equals("YORDINATE")) {
-                    result.addColumnValue(j, Double.valueOf(coordinate.z));
-                }
-                else {
-                    result.addColumnValue(j, prototyp.getObject(i));
-                }
-                ++j;
-            }
-            output.add(result);
-        }
-    } // class SectionHandler
-
-    public static final double NAUTICAL_MILE = 1852.216d;
-    public static final double KILOMETER     = 1000d;
-
-    public static final double toKM(double distance) {
-        return (distance * NAUTICAL_MILE) / KILOMETER;
-    }
-
-    public static final double EPSILON = 1e-5d;
-    public static final int    INTERPOLATION_STEPS =
-        Integer.getInteger("interpolation.steps", 500).intValue();
-
-    public static Coordinate toCoordinate(String shape) {
-        try {
-            return ((Point)(new WKTReader().read(shape))).getCoordinate();
-        }
-        catch (ParseException pe) {
-            log.error(pe);
-        }
-        return null;
-    }
-
-    public static String toWKT(Coordinate coordinate) {
-        StringBuilder sb = new StringBuilder("POINT(");
-        sb.append(coordinate.x)
-          .append(' ')
-          .append(coordinate.y)
-          .append(')');
-        return sb.toString();
-    }
-
-    protected Collection<Result> process(
+    /**
+     * Prepares the input data for chart creation.
+     *
+     * @param path The coordinates describing the path the data is processed
+     * for.
+     * @param numSamples Number of samples.
+     * @param input The input data.
+     * @return finalized data ready for chart creation.
+     */
+    public static Collection<Result> process(
         List<Coordinate>   path,
+		int                numSamples,
         Collection<Result> input
     ) {
-        log.debug("------  number of points before processing: " + input.size());
+		boolean debug = log.isDebugEnabled();
+
+		if (debug) {
+			log.debug("--- number of points before processing: " + input.size());
+			log.debug("    number samples: " + numSamples);
+		}
+
         ArrayList<Result> output = new ArrayList<Result>();
 
-
         Result last = null;
 
         int [] diffColums = null;
@@ -475,9 +544,11 @@
                 DefaultResultDescriptor resultDescriptor =
                     new DefaultResultDescriptor();
 
+                log.debug("------------------------------------------------------");
                 for (int j = 0; j < columns; ++j) {
                     String columnName = rd.getColumnName(j);
-                    if (!blacklisted(columnName)) {
+                    if (!StringUtils.contains(COLUMN_BLACKLIST, columnName)) {
+                        log.debug("!!! COLUMN NAME: " + columnName);
                         resultDescriptor.addColumn(
                             columnName,
                             rd.getColumnClassName(j));
@@ -486,13 +557,14 @@
 
                 sectionHandler = new SectionHandler(
                     path,
+					numSamples,
                     output,
                     resultDescriptor);
 
                 sectionHandler.setPrototyp(result);
             }
 
-            if (last != null && different(last, result, diffColums)) {
+            if (last != null && WKTUtils.different(last, result, diffColums)) {
                 sectionHandler.finish();
                 sectionHandler.setPrototyp(result);
             }
@@ -506,8 +578,129 @@
             sectionHandler.finish();
         }
 
-        log.debug("------  number of points after processing: " + output.size());
+		if (debug) {
+			log.debug("--- number of points after processing: " + output.size());
+		}
 
         return output;
     }
+
+
+    private static final String [] DIFF_COLUMS = {
+        "GROUP1",
+        "GROUP2",
+        "GROUP3"
+    };
+
+    private static final String [] COLUMN_BLACKLIST = {
+        "MEDIAN.MESHPOINT.JPOSITION",
+        "MEDIAN.MESHPOINT.IPOSITION"
+    };
+
+    public static final double EPSILON = 1e-5d;
+
+    public static final class SectionHandler
+    implements                Interpolation2D.Consumer
+    {
+        private ArrayList<Point2d> points;
+        private List<Coordinate>   path;
+        private Collection<Result> output;
+        private Result             prototyp;
+        private ResultDescriptor   descriptor;
+        private boolean            lastWasSuccess;
+		private int                numSamples;
+
+        public SectionHandler() {
+        }
+
+        public SectionHandler(
+            List<Coordinate>   path,
+			int                numSamples,
+            Collection<Result> output,
+            ResultDescriptor   descriptor
+        ) {
+            this.path       = path;
+			this.numSamples = numSamples;
+            this.output     = output;
+            this.descriptor = descriptor;
+            points          = new ArrayList<Point2d>();
+            lastWasSuccess  = true;
+        }
+
+        public void finish() {
+            if (!points.isEmpty()) {
+                double distance = WKTUtils.toKM(
+                    DistanceCalculator.calculateDistance(path));
+
+                if (distance > EPSILON) {
+
+                    Interpolation2D.interpolate(
+                        path,
+                        points,
+                        0d,
+                        distance,
+                        numSamples,
+                        LinearMetrics.INSTANCE,
+                        this);
+                }
+
+                points.clear();
+            }
+            lastWasSuccess = true;
+        }
+
+        public void setPrototyp(Result prototyp) {
+            this.prototyp = prototyp;
+        }
+
+        public void handle(Result result) {
+            Coordinate coordinate =
+                WKTUtils.toCoordinate(result.getString("SHAPE"));
+            double value = result.getDouble("YORDINATE");
+            int iPos     = result.getInteger("IPOSITION");
+            int jPos     = result.getInteger("JPOSITION");
+            Point2d p = new Point2d(
+                coordinate.x,
+                coordinate.y,
+                value,
+                iPos, jPos);
+            points.add(p);
+        }
+
+        public void interpolated(Coordinate coordinate, boolean success) {
+
+            if (!success && !lastWasSuccess) {
+                // only insert null if last was valid.
+                // This prevents flooding the result set with nulls
+                // if interpolating over a large gap.
+                return;
+            }
+
+            DefaultResult result = new DefaultResult(descriptor);
+            ResultDescriptor pd = prototyp.getResultDescriptor();
+
+            int pcolums = pd.getColumnCount();
+            for (int i = 0, j = 0; i < pcolums; ++i) {
+                String colname = pd.getColumnName(i);
+                if (StringUtils.contains(COLUMN_BLACKLIST, colname)) {
+                    continue;
+                }
+                if (colname.equals("SHAPE")) {
+                    result.addColumnValue(j, WKTUtils.toWKT(coordinate));
+                }
+                else if (colname.equals("YORDINATE")) {
+                    result.addColumnValue(j, success
+                        ? Double.valueOf(coordinate.z)
+                        : null);
+                }
+                else {
+                    result.addColumnValue(j, prototyp.getObject(i));
+                }
+                ++j;
+            }
+            output.add(result);
+            lastWasSuccess = success;
+        }
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state.profile.horizontal;
+
+import java.util.Locale;
+
+import org.apache.log4j.Logger;
+
+public class HorizontalProfileMeshOutputState
+extends      HorizontalProfileOutputState
+{
+    private static Logger logger =
+        Logger.getLogger(HorizontalProfileMeshOutputState.class);
+
+
+    public HorizontalProfileMeshOutputState() {
+        super();
+    }
+
+
+    /**
+     * Creates and returns the subtitle of a chart.
+     *
+     * @param locale The Locale used to adjust the language of the subtitle.
+     * @param uuid The UUID of the current artifact.
+     * @return the timeperiod of this chart and the start coordinate.
+     */
+    @Override
+    protected String createChartSubtitle(Locale locale, String uuid) {
+        logger.debug("create chart subtitle.");
+
+        StringBuilder sb = new StringBuilder();
+        String time      = getData(locale, "dateid");
+        if (time != null) {
+            sb.append(time);
+        }
+
+        String coordinate = getData(locale, "mesh_point");
+        if (coordinate != null) {
+            sb.append("\n");
+            sb.append(coordinate);
+        }
+
+        String depth = getData(locale, "depthid");
+        if (depth != null) {
+            sb.append("\n");
+            sb.append(depth);
+        }
+
+        return sb.toString();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileMeshVectorOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state.profile.horizontal;
+
+import au.com.bytecode.opencsv.CSVWriter;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.artifacts.cache.CacheFactory;
+
+import de.intevation.gnv.chart.Chart;
+import de.intevation.gnv.chart.ChartLabels;
+import de.intevation.gnv.chart.HorizontalProfileVectorChart;
+
+import de.intevation.gnv.exports.DefaultExport;
+import de.intevation.gnv.exports.DefaultProfile;
+import de.intevation.gnv.exports.Export;
+import de.intevation.gnv.exports.Export.Profile;
+import de.intevation.gnv.exports.SimpleOdvDataCollector;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.utils.VectorDataProcessor;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.exception.StateException;
+
+import de.intevation.gnv.statistics.Statistics;
+import de.intevation.gnv.statistics.HorizontalProfileVectorStatistics;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import java.util.Collection;
+import java.util.Locale;
+import java.util.Map;
+
+import net.sf.ehcache.Cache;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.ChartTheme;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class HorizontalProfileMeshVectorOutputState
+extends      HorizontalProfileMeshOutputState
+{
+    private static Logger logger =
+        Logger.getLogger(HorizontalProfileMeshVectorOutputState.class);
+
+    public static final String[] RESULT_COLUMNS = {
+        "YORDINATE", "SHAPE",
+        "GROUP1",    "GROUP2",    "GROUP3",
+        "IPOSITION", "JPOSITION",
+        "DATAID",    "MESHID",
+        "SERIES"
+    };
+
+
+    public static final String[] ODV_COLUMN_HEADERS = {
+        "Cruise",
+        "Station",
+        "Type",
+        "yyyy-mm-dd hh:mm",
+        "Lon (°E)",
+        "Lat (°N)",
+        "Bot. Depth [m]",
+        "Depth [m]",
+        "QF",
+        "XComponent",
+        "QF",
+        "YComponent",
+        "QF",
+        "ZComponent",
+        "QF",
+        "Speed",
+        "QF",
+        "Direction",
+        "QF"
+    };
+
+
+    public static final String[] ODV_PROFILE_NAMES = {
+        "CRUISE",
+        "STATION",
+        "TYPE",
+        "TIMEVALUE",
+        "SHAPE",
+        "BOTDEPTH",
+        "DEPTH",
+        "QF",
+        "XCOMPONENT",
+        "QF",
+        "YCOMPONENT",
+        "QF",
+        "ZCOMPONENT",
+        "QF",
+        "SPEED",
+        "QF",
+        "DIRECTION",
+        "QF"};
+
+
+    @Override
+    protected Object getChartResult(String uuid, CallContext callContext) {
+        logger.debug("Fetch data for horizontalprofile chart with vector data");
+        CacheFactory factory = CacheFactory.getInstance();
+
+        if (factory.isInitialized()) {
+            // we use a cache
+            logger.info("Using cache.");
+            Cache cache = factory.getCache();
+            String key  = "chart_" + getHash();
+
+            net.sf.ehcache.Element value = cache.get(key);
+            if (value != null) {
+                logger.debug("Found element in cache.");
+                return value.getObjectValue();
+            }
+            else {
+                logger.debug("Element not in cache, we ask the database");
+                Collection<Result> res = (Collection<Result>)getData(queryID);
+                res = VectorDataProcessor.process(res, RESULT_COLUMNS);
+                logger.debug("Got " + res.size() + " elements from database.");
+
+                cache.put(new net.sf.ehcache.Element(key, res));
+
+                return res;
+            }
+        }
+        else {
+            // we don't use a cache, so we have to query the database every
+            // single time
+            logger.info("Not using a cache.");
+            return VectorDataProcessor.process(
+                getData(queryID), RESULT_COLUMNS);
+        }
+    }
+
+
+    @Override
+    protected Chart getChart(
+        ChartLabels  chartLables,
+        ChartTheme   theme,
+        Collection   parameters,
+        Collection   measurements,
+        Collection   dates,
+        Object       result,
+        Locale       locale,
+        String       uuid,
+        boolean      linesVisible,
+        boolean      shapesVisible,
+        CallContext  callContext
+    ) {
+        Chart chart = new HorizontalProfileVectorChart(
+            chartLables,
+            theme,
+            parameters,
+            measurements,
+            dates,
+            (Collection)result,
+            timeGapDefinitions,
+            locale,
+            linesVisible,
+            shapesVisible
+        );
+        chart.generateChart();
+
+        return chart;
+    }
+
+
+    @Override
+    protected Chart[] getHistograms(
+        String      uuid,
+        CallContext callContext,
+        Collection<KeyValueDescibeData>  parameters,
+        Collection<KeyValueDescibeData>  measurements,
+        Collection<KeyValueDescibeData>  dates,
+        Map         requestParameter
+    ) {
+        Collection results = (Collection) getChartResult(uuid, callContext);
+        ChartTheme theme   = createStyle(callContext);
+
+        return VectorDataProcessor.getHistograms(
+            uuid, callContext, results, theme, requestParameter);
+    }
+
+
+    @Override
+    protected void createODV(
+        OutputStream outputStream, Collection result, String uuid)
+    throws IOException, StateException
+    {
+        logger.info("Start exporting " + result.size() + " items to odv.");
+        Export export = new DefaultExport(
+            new SimpleOdvDataCollector(ODV_PROFILE_NAMES));
+
+        Profile profile = new DefaultProfile(
+            ODV_COLUMN_HEADERS,
+            '\t',
+            CSVWriter.NO_QUOTE_CHARACTER,
+            CSVWriter.NO_ESCAPE_CHARACTER,
+            "ODV",
+            "ISO-8859-1");
+
+        export.create(profile, outputStream, result);
+    }
+
+
+    protected Statistics getStatisticsGenerator() {
+        return new HorizontalProfileVectorStatistics();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/HorizontalProfileOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,15 +1,17 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.profile.horizontal;
 
-import com.vividsolutions.jts.geom.Point;
-import com.vividsolutions.jts.io.WKTReader;
-import com.vividsolutions.jts.io.ParseException;
-
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Collection;
 import java.util.Date;
@@ -17,17 +19,20 @@
 import java.util.Locale;
 
 import org.apache.log4j.Logger;
-
 import org.jfree.chart.ChartTheme;
 
+import de.intevation.artifacts.CallContext;
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
 import de.intevation.gnv.chart.Chart;
 import de.intevation.gnv.chart.ChartLabels;
 import de.intevation.gnv.chart.HorizontalProfileChart;
 import de.intevation.gnv.exports.DefaultExport;
+import de.intevation.gnv.exports.DefaultProfile;
 import de.intevation.gnv.exports.ShapeDataCollector;
-import de.intevation.gnv.exports.DefaultProfile;
 import de.intevation.gnv.exports.Export.Profile;
 import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.state.InputData;
+import de.intevation.gnv.state.State;
 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
 import de.intevation.gnv.state.exception.StateException;
 import de.intevation.gnv.state.timeseries.TimeSeriesOutputState;
@@ -35,17 +40,26 @@
 import de.intevation.gnv.statistics.Statistics;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This <code>OutputState</code> is used for 'Horizontalprofile' products.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class HorizontalProfileOutputState
 extends      TimeSeriesOutputState
-{    
-    public static final String [] HORIZONTAL_PROFILE_COLUMNS = {
+{
+    public static final String [] HORIZONTAL_PROFILE_MESH_COLUMNS = {
         "SHAPE",
         "YORDINATE",
-        "GROUP1"
-        // "GROUP2",
+        "GROUP1",
+        "MESHID"
+    };
+
+    public static final String [] HORIZONTAL_PROFILE_MEASUREMENT_COLUMNS = {
+        "SHAPE",
+        "YORDINATE",
+        "GROUP1",
+        "SURVEYID"
     };
 
 
@@ -54,7 +68,7 @@
         "Latitude",
         "Value",
         "ParameterID",
-        //"MeshID"
+        "MeshID"
     };
 
 
@@ -63,8 +77,9 @@
         "Latitude",
         "Value",
         "ParameterID",
-        //"SurveyID"
+        "SurveyID"
     };
+
     /**
      * The UID of this class
      */
@@ -114,6 +129,24 @@
     }
 
 
+    /**
+     * This method creates a chart and returns it.
+     *
+     * @param chartLables Labels used to decorate the chart.
+     * @param theme The theme used to adjust the look of the chart.
+     * @param parameters A collection with parameters this chart contains.
+     * @param measurements A collection with measurement this chart contains.
+     * @param dates A collection with dates this chart contains.
+     * @param result The data collection used to be displayed in this chart.
+     * @param locale The Locale used to determine the language.
+     * @param uuid The uuid of the current artifact.
+     * @param linesVisible A boolean property to determine the visibility of
+     * lines connecting two points in a chart (not used in this chart type).
+     * @param shapesVisible A boolean property to determine the visiblity of
+     * datapoints in this chart (not used in this chart type).
+     * @param callContext The CallContext object.
+     * @return a <code>HorizontalProfileChart</code>.
+     */
     @Override
     protected Chart getChart(
         ChartLabels  chartLables,
@@ -121,17 +154,18 @@
         Collection   parameters,
         Collection   measurements,
         Collection   dates,
-        Collection   result,
+        Object       result,
         Locale       locale,
         String       uuid,
         boolean      linesVisible,
-        boolean      shapesVisible
+        boolean      shapesVisible,
+        CallContext  callContext
     ) {
         Chart chart = null;
 
         if (CACHE_CHART) {
             log.info("Try to get horizontalprofile chart from cache.");
-            chart = (Chart) getChartFromCache(uuid);
+            chart = (Chart) getChartFromCache(uuid, callContext);
         }
 
         if (chart != null)
@@ -144,7 +178,7 @@
             parameters,
             measurements,
             dates,
-            result,
+            (Collection)result,
             null,
             locale,
             linesVisible,
@@ -161,9 +195,6 @@
     }
 
 
-    /**
-     * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#getStatisticsGenerator()
-     */
     @Override
     protected Statistics getStatisticsGenerator() {
         return new HorizontalProfileStatistics();
@@ -183,7 +214,7 @@
 
         Profile profile = null;
         int     dataid  = res.getInteger("DATAID").intValue();
-
+        DefaultExport export = null;
         // on meshes
         if (dataid == 2) {
             profile =  new DefaultProfile(
@@ -193,6 +224,8 @@
                 '"',
                 "CSV",
                 "ISO-8859-1");
+            export = new DefaultExport(
+                    new ShapeDataCollector(HORIZONTAL_PROFILE_MESH_COLUMNS));
         }
 
         // on measurements
@@ -204,14 +237,23 @@
                 '"',
                 "CSV",
                 "ISO-8859-1");
+            export = new DefaultExport(
+                    new ShapeDataCollector(HORIZONTAL_PROFILE_MEASUREMENT_COLUMNS));
         }
 
-        DefaultExport export = new DefaultExport(
-            new ShapeDataCollector(HORIZONTAL_PROFILE_COLUMNS));
+
         export.create(profile, out, results);
     }
 
 
+    /**
+     * Creates and returns the chart title.
+     *
+     * @param locale The Locale used to adjust the language of the title.
+     * @param uuid The UUID of the current artifact.
+     * @return the name of the selected fis.
+     */
+    @Override
     protected String createChartTitle(Locale locale, String uuid) {
         String fisName = getFisName(locale);
         log.debug("created title for horizontal profile chart: " + fisName);
@@ -220,76 +262,68 @@
     }
 
 
+    @Override
     protected String createChartSubtitle(Locale locale, String uuid) {
-        log.debug("create chart subtitle.");
-        String subtitle = createTimePeriod(locale, uuid);
+        log.debug("Create subtitle for horizontalprofile chart on meshes.");
 
-        // ODV results contain meta information about cruise, station and so on
-        Collection results = getODVResult(uuid);
-        if (results != null) {
-            Iterator iter   = results.iterator();
-            Result   result = iter.hasNext() ? (Result) iter.next() : null;
-
-            subtitle += subtitle.length() != 0 ? "\n" : "";
-            subtitle += createMetaChartSubtitle(locale, result);
+        StringBuilder sb  = new StringBuilder();
+        String ship       = getData(locale, "vehicleid");
+        if (ship != null) {
+            sb.append(ship);
         }
 
-        return subtitle;
+        String cruise = getData(locale, "cruiseid");
+        if (cruise != null) {
+            if (ship != null)
+                sb.append("\n");
+
+            sb.append(cruise);
+        }
+
+        String track = getData(locale, "trackid");
+        if (track != null) {
+            if (cruise != null)
+                sb.append("\n");
+
+            sb.append(track);
+        }
+
+        return sb.toString();
     }
 
 
-    protected String createMetaChartSubtitle(Locale locale, Result result) {
-        log.debug("Fetch meta information and put it into subtitle.");
-        if (result == null)
-            return "";
-
-        StringBuilder meta      = new StringBuilder();
-        WKTReader     wktReader = new WKTReader();
-
-
-        for (int i = 0; i < CHART_TITLE_META.length; i++) {
-            String qry = CHART_TITLE_META[i];
-
-            if (qry.equals("SHAPE")) {
-                try {
-                    Point p = (Point) wktReader.read(result.getString(qry));
-
-                    meta.append(getMessage(locale,"coordinate","coordinate"));
-                    meta.append(": ");
+    protected String getData(Locale locale, String data) {
+        InputData input = null;
 
-                    log.debug(
-                        "Add " + qry + " to meta information of subtitle: "
-                        + p.toString()
-                    );
-                    meta.append(p.getX() + ", " + p.getY());
-                }
-                catch (ParseException pe) {
-                    log.warn("Error while parsing point.", pe);
-                }
-            }
-            else {
-                log.debug(
-                    "Add " + qry + " to meta information of subtitle: "
-                    + result.getString(qry)
-                );
-                meta.append(getMessage(
-                    locale,
-                    CHART_TITLE_META_RESSOURCES[i],
-                    CHART_TITLE_META_RESSOURCES[i]
-                ));
-                meta.append(": ");
-                meta.append(result.getString(qry));
-            }
+        State parent = this;
+        do {
+            input = inputData.get(data);
 
-            if (i != CHART_TITLE_META.length-1)
-                meta.append("\n");
+            if (input != null)
+                break;
+        }
+        while ((parent = parent.getParent()) != null);
+
+        if (input == null) {
+            log.warn("No data found for: " + data);
+           return null;
         }
 
-        log.debug("Meta title for chart: " + meta.toString());
-        return meta.toString();
+        String value = input.getDescription(input.getValue());
+        String title = RessourceFactory.getInstance().getRessource(
+            locale, data, data);
+
+        return (title + ": " + value);
     }
 
 
+    /**
+     * Creates a timeperiod taking account for all data items used in charts.
+     *
+     * @param locale The Locale used to adjust the language of the subtitle.
+     * @param uuid The UUID of the current artifact.
+     * @return a human readable timeperiod.
+     */
     protected String createTimePeriod(Locale locale, String uuid) {
         log.debug("create time period for chart subtitle.");
         String subTitle = null;
@@ -327,7 +361,7 @@
                     endDate = current;
                 }
             }
-            catch (java.text.ParseException pe) {
+            catch (ParseException pe) {
                 log.warn("Error while parsing date: " + data.getValue(), pe);
             }
         }
@@ -342,3 +376,4 @@
         return subTitle;
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/NorthSouthEastWestState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,67 +1,89 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.profile.horizontal;
 
-import java.util.ArrayList;
-import java.util.Collection;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
 
-import de.intevation.artifacts.CallMeta;
 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+
 import de.intevation.gnv.geobackend.base.Result;
+
 import de.intevation.gnv.state.StateBase;
+
 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
 import de.intevation.gnv.state.describedata.NamedArrayList;
 import de.intevation.gnv.state.describedata.NamedCollection;
+
 import de.intevation.gnv.state.exception.StateException;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This states handles coordinate inputs.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class NorthSouthEastWestState extends StateBase {
 
-    
+
     /**
      * The UID of this Class
      */
     private static final long serialVersionUID = -7989531326553305293L;
 
+    protected String ipos;
+    protected String jpos;
+
     /**
      * Constructor
      */
     public NorthSouthEastWestState() {
     }
 
-    /**
-     * @see de.intevation.gnv.state.StateBase#purifyResult(java.util.Collection, java.lang.String)
-     */
-    @Override
-    protected void purifyResult(Collection<Result> result, String uuid) {
-    }
-    
-    /**
-     * @see de.intevation.gnv.state.StateBase#initialize(java.lang.String, de.intevation.artifacts.CallMeta)
-     */
+
     @Override
-    public void initialize(String uuid, CallMeta callMeta)
-                                                          throws StateException {
-        Collection<Object> describeData = this.getDescibeData(uuid);
-        if (describeData == null) {
-            describeData = new ArrayList<Object>();
-        }
-        NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(
-                this.dataName, 2);
+    protected List<Object> purifyResult(Collection<Result> result, String uuid) {
+        List<Object> describeData = new ArrayList<Object>();
+
+        NamedCollection<KeyValueDescibeData> keyValueDescibeData =
+            new NamedArrayList<KeyValueDescibeData>(dataName, 2);
+
         keyValueDescibeData.setMultiSelect(super.dataMultiSelect);
-        keyValueDescibeData.add(new DefaultKeyValueDescribeData("IPOSITION",
-                RessourceFactory.getInstance().getRessource(
-                        callMeta.getLanguages(), "iposition", "iposition")));
-        keyValueDescibeData.add(new DefaultKeyValueDescribeData("JPOSITION",
-                RessourceFactory.getInstance().getRessource(
-                        callMeta.getLanguages(), "jposition", "jposition")));
+        keyValueDescibeData.add(new DefaultKeyValueDescribeData(
+            "IPOSITION", ipos));
+        keyValueDescibeData.add(new DefaultKeyValueDescribeData(
+            "JPOSITION", jpos));
         describeData.add(keyValueDescibeData);
+
+        return describeData;
     }
 
 
+    @Override
+    public void initialize(String uuid, CallContext context)
+    throws StateException
+    {
+        CallMeta callMeta        = context.getMeta();
+        RessourceFactory factory = RessourceFactory.getInstance();
+
+        // XXX Workarround - we need these strings in purifyResult, but have no
+        // CallMeta object there which is necessary to get resources from
+        // RessourceFactory. Storing the strings here is not nice, because the
+        // Locale object could change!
+        ipos = factory.getRessource(
+            callMeta.getLanguages(), "iposition", "iposition");
+        jpos = factory.getRessource(
+            callMeta.getLanguages(), "jposition", "jposition");
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontal/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+State classes used by artifacts representing 'Horizontalprofile' to handle input
+and output.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/HorizontalCrossSectionMeshOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,146 +1,961 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.profile.horizontalcrosssection;
 
+import java.awt.Dimension;
+import java.io.File;
 import java.io.IOException;
 import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Iterator;
-import java.util.Locale;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
-
-import org.jfree.chart.ChartTheme;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
 
-import au.com.bytecode.opencsv.CSVWriter;
-import de.intevation.gnv.chart.Chart;
-import de.intevation.gnv.chart.ChartLabels;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.MultiLineString;
+import com.vividsolutions.jts.geom.MultiPolygon;
+import com.vividsolutions.jts.geom.Polygon;
+
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
+import de.intevation.gnv.artifacts.cache.CacheFactory;
+import de.intevation.gnv.artifacts.context.GNVArtifactContext;
 import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+import de.intevation.gnv.geobackend.sde.datasources.RasterObject;
+import de.intevation.gnv.math.AreaInterpolation;
+import de.intevation.gnv.math.AttributedPoint2ds;
+import de.intevation.gnv.math.Point2d;
+import de.intevation.gnv.math.QueriedXYDepth;
+import de.intevation.gnv.raster.ExternalIndexConverter;
+import de.intevation.gnv.raster.IsoAttributeGenerator;
+import de.intevation.gnv.raster.JTSMultiLineStringProducer;
+import de.intevation.gnv.raster.JTSMultiPolygonProducer;
+import de.intevation.gnv.raster.Palette;
+import de.intevation.gnv.raster.PaletteManager;
+import de.intevation.gnv.raster.Raster;
+import de.intevation.gnv.raster.Vectorizer;
+import de.intevation.gnv.state.InputData;
+import de.intevation.gnv.state.OutputStateBase;
 import de.intevation.gnv.state.exception.StateException;
-import de.intevation.gnv.state.timeseries.TimeSeriesOutputState;
-import de.intevation.gnv.statistics.Statistics;
+import de.intevation.gnv.utils.ExclusiveExec;
+import de.intevation.gnv.utils.FileUtils;
+import de.intevation.gnv.utils.MapfileGenerator;
+import de.intevation.gnv.utils.MetaWriter;
+import de.intevation.gnv.utils.Pair;
+import de.intevation.gnv.utils.ShapeFileWriter;
+import de.intevation.gnv.utils.StringUtils;
+import de.intevation.gnv.utils.WKTUtils;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public class HorizontalCrossSectionMeshOutputState 
-                                      extends TimeSeriesOutputState {
+public class HorizontalCrossSectionMeshOutputState
+extends      OutputStateBase
+{
+    private static Logger log = Logger
+        .getLogger(HorizontalCrossSectionMeshOutputState.class);
 
-    private static Logger log = Logger
-    .getLogger(HorizontalCrossSectionMeshOutputState.class);
-    
     /**
      * The UID of this Class
      */
     private static final long serialVersionUID = 3233620652465061860L;
 
+    public static final boolean USE_INDEX_BUFFER =
+        Boolean.getBoolean("gnv.horizontal.cross.section.mesh.index.buffer");
+
+    /**
+     * Shapefile name for isolines.
+     */
+    public static final String ISOLINES_NAME  = "isolines.shp";
+
+    /**
+     * Shapefile name for polygons.
+     */
+    public static final String POLYGON_NAME   = "polygons.shp";
+
+    public static final String LAYER_MODEL    = "horizontalcrosssection";
+
+    private String ijkQueryID;
+
+    private Boolean shapeFileLock = new Boolean(true);
+
+    private String shapeFilePath;
+    
+    private Envelope  bbox = null;
+
     /**
      * Constructor
      */
     public HorizontalCrossSectionMeshOutputState() {
-        super();
-        super.domainLable = "chart.horizontalcrosssection.title.xaxis";
     }
 
     @Override
-    protected Chart getChart(
-        ChartLabels  chartLables,
-        ChartTheme   theme,
-        Collection   parameters,
-        Collection   measurements,
-        Collection   dates,
-        Collection   result,
-        Locale       locale,
-        String       uuid,
-        boolean      linesVisible,
-        boolean      shapesVisible
-    ) {
-        Chart chart = null;
-
-        if (CACHE_CHART) {
-            log.info("Try to get horizontalcrosssection chart from cache.");
-            chart = (Chart) getChartFromCache(uuid);
+    public void initialize(String uuid, CallContext callContext)
+    throws StateException {
+        super.initialize(uuid, callContext);
+        if (log.isDebugEnabled()) {
+            log.debug("initialize output state " + uuid);
         }
-
-        if (chart != null)
-            return chart;
+        // fill the cache
+        getResult(uuid, callContext);
+    }
 
-        log.info("Chart not in cache yet.");
-        
-        log.warn("This sort of chart is not implemented yet.");
-        /* TODO Implement a special chart for this sort of charts.
-        chart = new HorizontalProfileChart(
-            chartLables,
-            chartTheme,
-            parameters,
-            measurements,
-            result,
-            dates,
-            locale
-        );
-        chart.generateChart();
+    /**
+     * Returns the shapefile directory path.
+     *
+     * @return the shapefile path.
+     */
+    public String getShapeFilePath() {
+        synchronized (shapeFileLock) {
+            return shapeFilePath;
+        }
+    }
 
-        if (CACHE_CHART) {
-            log.info("Put chart into cache.");
-            purifyChart(chart, uuid);
+    /**
+     * Set the shapefile path.
+     *
+     * @param shapeFilePath Destination path to write shapefiles.
+     */
+    public void setShapeFilePath(String shapeFilePath) {
+        synchronized (shapeFileLock) {
+            this.shapeFilePath = shapeFilePath;
         }
-        */
+    }
 
-        return chart;
+    /**
+     * Method to reset the shapefile path.
+     *
+     * @return the old path.
+     */
+    public String resetShapeFilePath() {
+        synchronized (shapeFileLock) {
+            String path = shapeFilePath;
+            shapeFilePath = null;
+            return path;
+        }
     }
 
 
     /**
-     * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#getStatisticsGenerator()
-     */
-    @Override
-    protected Statistics getStatisticsGenerator() {
-        return null; //Statistiken werden nicht für diesen Out-Typ unterstützt.
-    }
-    
-    /**
-     * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#createCSV(java.io.OutputStream,
-     *      java.util.Collection)
+     * This method removes all shapefiles which might have been written by this
+     * artifact and resets the shapefile path.
+     *
+     * @param globalContext CallContext
      */
     @Override
-    protected void createCSV(OutputStream outputStream,
-                             Collection<Result> chartResult)
-                                            throws UnsupportedEncodingException,
-                                                   IOException,
-                                                   StateException {
-        if (chartResult != null) {
-            try {
-                CSVWriter writer = new CSVWriter(new OutputStreamWriter(
-                        outputStream, "ISO-8859-1"), ','); 
-                // USE THIS ENCODING BECAUSE OF
-                // PROBLEMS WITH EXCEL AND UTF-8
-                Iterator<Result> it = chartResult.iterator();
-                while (it.hasNext()) {
-                    Result result = it.next();
-                    int i = 0;
-                    String[] entries = new String[5];
-                    entries[i++] = result.getString("SHAPE");
-                    entries[i++] = result.getString("YORDINATE");
-                    entries[i++] = result.getString("IPOSITION");
-                    entries[i++] = result.getString("JPOSITION");
-                    entries[i++] = result.getString("KPOSITION");
-                    writer.writeNext(entries);
+    public void endOfLife(Object globalContext) {
+        super.endOfLife(globalContext);
+
+        // do it in background
+        new Thread() {
+            @Override
+            public void run() {
+                String path = resetShapeFilePath();
+
+                if (path == null) {
+                    return;
                 }
-                writer.close();
-            } catch (Exception e) {
-                log.error(e,e);
-                throw new StateException(
-                "Exception occured while parsing an Point from WKT.");
-            }
-        } else {
-            log.error("No Data given for generating an CSV-File.");
-            throw new StateException(
-                    "No Data given for generating an CSV-File.");
+
+                File dir = new File(path);
+
+                for (int i = 0; i < 10; ++i) {
+                    if (!dir.exists() || FileUtils.deleteRecursive(dir)) {
+                        MapfileGenerator.getInstance().update();
+                        return;
+                    }
+
+                    try {
+                        Thread.sleep(10000L);
+                    }
+                    catch (InterruptedException ie) {
+                    }
+                }
+
+                log.error("failed to remove directory '" + path + "'");
+            } // run
+        }.start();
+    }
+
+
+    /**
+     * This out target has two options:<br>
+     * <ol>
+     *  <li>zip: Write the resulting data to shapefiles and export them as
+     * zip-archive.</li>
+     *  <li>wms: Write the resulting data to shapefiles and feed a map service
+     * with a layer displaying these shapefiles.</li>
+     * </ol>
+     *
+     * @param format
+     * @param inputData
+     * @param outputStream
+     * @param uuid
+     * @param callContext
+     * @throws StateException
+     */
+    public void out(
+        Document              format,
+        Collection<InputData> inputData,
+        OutputStream          outputStream,
+        String                uuid,
+        CallContext           callContext
+    )
+    throws StateException
+    {
+        String outputMode = XMLUtils.xpathString(
+            format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE);
+
+        if (outputMode == null) {
+            throw new StateException("cannot find outputMode or mime");
+        }
+
+        outputMode = outputMode.toLowerCase();
+
+        if (log.isDebugEnabled()) {
+            log.debug("---- asking for: " + outputMode);
+        }
+
+        if ("zip".equals(outputMode)) {
+            writeZip(uuid, callContext, outputStream);
+        }
+        else if ("wms".equals(outputMode)) {
+            XMLUtils.toStream(
+                getWMS(uuid, callContext, inputData),
+                outputStream);
+        }
+        else {
+            throw new StateException("unsupported output mode");
         }
     }
 
+    /**
+     * Create a zip archive with the shapefiles of the given shapefiles path and
+     * write it to <code>output</code>.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @param callContext The CallContext object.
+     * @param output The output stream.
+     * @throws StateException if an error occured while zipfile creation.
+     */
+    protected void writeZip(
+        String       uuid,
+        CallContext  callContext,
+        OutputStream output
+    )
+    throws StateException
+    {
+        try {
+            String p = getShapeFilePath();
+            if (p != null) {
+                File dir = new File(p);
+                if (dir.isDirectory()) {
+                    FileUtils.createZipArchive(dir, output);
+                }
+            }
+            else {
+                AttributedPoint2ds result = getResult(uuid, callContext);
+                ExclusiveExec.UniqueKey k = ExclusiveExec.INSTANCE.acquire(uuid);
+                if (result != null
+                && (p = writeToShapeFile(uuid, result, callContext)) != null) {
+                    FileUtils.createZipArchive(new File(p), output);
+                    ExclusiveExec.INSTANCE.release(k);
+                }
+            }
+        }
+        catch (IOException ioe) {
+            log.error(ioe.getLocalizedMessage(), ioe);
+        }
+    }
+
+    /**
+     * Write data to shapefiles and feed a map service with information about
+     * these shapefiles. The map service can be queried for displaying
+     * corresponding layers as WMS.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @param callContext The CallContext object.
+     * @param inputData A collection with some input data.
+     * @return a document with some meta information (shapefile path, geometry
+     * type, time to live of the current artifact, etc).
+     * @throws StateException if an error occured while shapefile writing.
+     */
+    protected Document getWMS(
+        String                uuid,
+        CallContext           callContext,
+        Collection<InputData> inputData
+    )
+    throws StateException
+    {
+        Document document = XMLUtils.newDocument();
+
+        Element pathElement = document.createElement("path");
+        document.appendChild(pathElement);
+
+        String path  = getShapeFilePath();
+
+        if (path != null && new File(path).isDirectory()) {
+            Document meta = MetaWriter.initMeta();
+            MetaWriter.insertAbstractMeta(callContext, meta);
+
+            String prefix = getLayerPrefix(inputData);
+            if (prefix == null) {
+                prefix = uuid;
+            }
+
+            // append polygon meta
+            String model  = findParameterType(callContext);
+            String type   = "POLYGON";
+            String name   = getLayerName(uuid, type);
+            String title  = getLayerTitle(prefix, type);
+            String data   = getLayerData(uuid, POLYGON_NAME);
+            String status = "OFF";
+            MetaWriter.insertLayer(
+                callContext, meta, name, title, data, model, type, status);
+
+            // append isoline meta
+            model += "_isolines";
+            type  = "LINE";
+            name  = getLayerName(uuid, type);
+            title = getLayerTitle(prefix, type);
+            data  = getLayerData(uuid, ISOLINES_NAME);
+            MetaWriter.insertLayer(
+                callContext, meta, name, title, data, model, type, status);
+
+            if (meta != null) {
+                MetaWriter.insertMbr(this.bbox, "EPSG:4326", meta);
+                MetaWriter.writeMetaFile(path, meta);
+                MapfileGenerator.getInstance().update();
+                return meta;
+            }
+
+            pathElement.setTextContent(path);
+        }
+        else {
+            AttributedPoint2ds result = getResult(uuid, callContext);
+            ExclusiveExec.UniqueKey key = ExclusiveExec.INSTANCE.acquire(uuid);
+            try{
+            if (result != null
+            && (path = writeToShapeFile(uuid, result, callContext)) != null) {
+                Document meta = MetaWriter.initMeta();
+                MetaWriter.insertAbstractMeta(callContext, meta);
+
+                String prefix = getLayerPrefix(inputData);
+                if (prefix == null) {
+                    prefix = uuid;
+                }
+
+                // append polygon meta
+                String model  = findParameterType(callContext);
+                String type   = "POLYGON";
+                String name   = getLayerName(uuid, type);
+                String title  = getLayerTitle(prefix, type);
+                String data   = getLayerData(uuid, POLYGON_NAME);
+                String status = "OFF";
+                MetaWriter.insertLayer(
+                    callContext, meta, name, title, data, model, type, status);
+
+                // append isoline meta
+                model += "_isolines";
+                type   = "LINE";
+                name   = getLayerName(uuid, type);
+                title  = getLayerTitle(prefix, type);
+                data   = getLayerData(uuid, ISOLINES_NAME);
+                MetaWriter.insertLayer(
+                    callContext, meta, name, title, data, model, type, status);
+
+                if (meta != null) {
+                    MetaWriter.insertMbr(this.bbox, "EPSG:4326", meta);
+                    MetaWriter.writeMetaFile(path, meta);
+                    MapfileGenerator.getInstance().update();
+                    return meta;
+                }
+
+                pathElement.setTextContent(path);
+            }
+            }finally{
+                ExclusiveExec.INSTANCE.release(key);
+            }
+        }
+
+        return document;
+    }
+
+    /**
+     * Find the parameter name which is used during mapfile creation in
+     * MapfileGenerator.
+     *
+     * @param callContext The CallContext object.
+     * @return the parameter name of the current parameterization.
+     */
+    protected String findParameterType(CallContext callContext) {
+        InputData inputParam = inputData.get("parameterid");
+
+        Map<Integer, PaletteManager> paletteManagers = getPalettes(callContext);
+
+        if (inputParam == null || paletteManagers == null) {
+            log.warn("Parameter-id not found.");
+            return LAYER_MODEL;
+        }
+        else {
+            Integer parameterId = Integer.parseInt(inputParam.getValue());
+            PaletteManager paletteManager = paletteManagers.get(parameterId);
+
+            return LAYER_MODEL + "_" + paletteManager.getName();
+        }
+    }
+
+
+    /**
+     * Find the title for a wms layer specified by the user.
+     *
+     * @param inputData A collection with InputData objects.
+     * @return the title.
+     */
+    protected String getLayerPrefix(Collection<InputData> inputData) {
+        for (InputData data: inputData) {
+            String name = data.getName();
+            if (name != null && name.equals("title")) {
+                return (String) data.getValue();
+            }
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Returns the name of the layer.
+     *
+     * @param uuid The uuid the the current session. It is the base part of the
+     * layername.
+     * @param type The type of the layer ('POLYGON' or 'LINE').
+     * @return the name of the layer.
+     */
+    protected String getLayerName(String uuid, String type) {
+        return "GNV_" + uuid + "-" + type;
+    }
+
+    /**
+     * Returns the layer title.
+     *
+     * @param prefix A prefix (null not permitted).
+     * @param type The layer type.
+     * @return the title of the layer.
+     */
+    protected String getLayerTitle(String prefix, String type) {
+        return "GNV_" + prefix + "-" + type;
+    }
+
+
+    /**
+     * Returns the path to the shapefile that serves the layer data.
+     *
+     * @param shapeDir The shapefile directory.
+     * @param filename The name of the shapefile.
+     * @return the relative path to the shapefile.
+     */
+    protected String getLayerData(String shapeDir, String filename) {
+        File path = new File(shapeDir, filename);
+
+        return path.toString();
+    }
+
+    /**
+     * Write the resulting data to shapefiles.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @param result The finalized data used for shapefile creation.
+     * @param callContext The CallContext object.
+     * @return the shapefile path.
+     */
+    protected String writeToShapeFile(
+        String             uuid,
+        AttributedPoint2ds result,
+        CallContext        callContext
+    ) {
+        File baseDir = shapefileDirectory(callContext);
+
+        File shapeDir = new File(baseDir, uuid);
+
+        boolean success    = false;
+        boolean createdDir = false;
+
+        try {
+            synchronized (shapeFileLock) {
+                if (shapeDir.exists()) {
+                    FileUtils.deleteContent(shapeDir);
+                }
+                else if (!shapeDir.mkdirs()) {
+                    log.error("cannot create directory '"
+                        + shapeDir.getAbsolutePath() + "'");
+                    return null;
+                }
+                createdDir = true;
+            }
+
+            Map<Integer, MultiPolygon> polygons = result.getPolygons();
+
+            List<Pair<Object, MultiLineString>> isolines =
+                result.getLineStrings();
+
+            File polygonsFile = new File(shapeDir, POLYGON_NAME);
+            File isolinesFile = new File(shapeDir, ISOLINES_NAME);
+
+            if (!ShapeFileWriter.writeMultiPolygonsToFile(
+                polygonsFile,
+                (Integer)result.getAttribute("parameter"),
+                (Integer)result.getAttribute("layer"),
+                (Date)   result.getAttribute("date"),
+                polygons)
+            ) {
+                log.error("writing polygons failed");
+                return null;
+            }
+
+            if (!ShapeFileWriter.writeMultiLineStringsToFile(
+                isolinesFile,
+                (Integer)result.getAttribute("parameter"),
+                (Integer)result.getAttribute("layer"),
+                (Date)   result.getAttribute("date"),
+                isolines)
+            ) {
+                log.error("writing isolines failed");
+                return null;
+            }
+
+            shapeFilePath = shapeDir.getAbsolutePath();
+            success = true;
+
+            callContext.afterCall(CallContext.STORE);
+
+            return shapeFilePath;
+        }
+        finally {
+            if (!success && createdDir) {
+                FileUtils.deleteRecursive(shapeDir);
+            }
+        }
+    }
+
+
+    /**
+     * Return the processed results ready for being written to shapefile.
+     *
+     * @param uuid The UUID of the current artifacts.
+     * @param callContext The CallContext object.
+     * @return the processed data.
+     * @throws StateException if an error occured while processing data.
+     */
+    protected AttributedPoint2ds getResult(String uuid, CallContext callContext)
+    throws StateException
+    {
+        CacheFactory cf  = CacheFactory.getInstance();
+        String       key = getHash();
+
+        if (cf.isInitialized()) {
+            log.debug("Using cache - key: " + key);
+            net.sf.ehcache.Element value = cf.getCache().get(key);
+            if (value != null) {
+                log.debug("Found element in cache.");
+                return (AttributedPoint2ds)value.getObjectValue();
+            }
+        }
+
+        log.debug("Not using cache or element not found.");
+        AttributedPoint2ds result = produceResult(callContext);
+
+        if (result != null && cf.isInitialized()) {
+            cf.getCache().put(new net.sf.ehcache.Element(key, result));
+        }
+
+        return result;
+    }
+
+    /**
+     * Query the database for result data and turn it into a useful format to
+     * write this data into shapefiles.
+     *
+     * @param callContext The CallContext object.
+     * @return the processed data.
+     * @throws StateException if an error occured while processing data.
+     */
+    protected AttributedPoint2ds produceResult(CallContext callContext)
+    throws StateException
+    {
+        InputData meshPolygon = inputData.get("mesh_polygon");
+        InputData meshId      = inputData.get("meshid");
+
+        if (meshPolygon == null) {
+            log.error("mesh_polygon is not defined");
+            throw new StateException("missing mesh_linestring");
+        }
+
+        if (meshId == null) {
+            log.error("meshid is not defined");
+            throw new StateException("missing meshid");
+        }
+
+        Polygon p = WKTUtils.toPolygon(meshPolygon.getValue());
+
+        if (p == null) {
+            log.error("no valid polygon");
+            throw new StateException("no valid polygon");
+        }
+
+        try {
+            Envelope env  = p.getEnvelopeInternal();
+
+            this.bbox = env;
+            String additionWhere;
+
+            if (USE_INDEX_BUFFER) {
+                Coordinate [] coords = new Coordinate [] {
+                    new Coordinate(env.getMinX(), env.getMinY()),
+                    new Coordinate(env.getMinX(), env.getMaxY()),
+                    new Coordinate(env.getMaxX(), env.getMaxY()),
+                    new Coordinate(env.getMaxX(), env.getMinY()) };
+
+                additionWhere =
+                    WKTUtils.worldEnvelopeCoordinatesToIndex(
+                        coords,
+                        meshId.getValue(),
+                        ijkQueryID);
+            }
+            else {
+                additionWhere = WKTUtils.TRUE_EXPRESSION;
+            }
+
+            String[] addedFilterValues = StringUtils.append(
+                generateFilterValuesFromInputData(),
+                additionWhere);
+
+            QueryExecutor queryExecutor = QueryExecutorFactory
+                .getInstance()
+                .getQueryExecutor();
+
+            return process(
+                env,
+                p,
+                callContext,
+                preProcess(
+                    queryExecutor.executeQuery(
+                        queryID,
+                        addedFilterValues)));
+        }
+        catch (QueryException e) {
+            log.error(e,e);
+        }
+
+        throw new StateException("no result produced");
+    }
+
+    /**
+     * First step of finalizing the data returned from database.
+     *
+     * @param results Resulting data from database.
+     * @return the pre-processed data which is still not useful for being
+     * written to shapefiles.
+     */
+    public AttributedPoint2ds preProcess(Collection<Result> results) {
+
+        boolean debug = log.isDebugEnabled();
+
+        if (debug) {
+            log.debug("--- preProcess: " + results.size() + " results");
+        }
+
+        AttributedPoint2ds ap2ds = new AttributedPoint2ds();
+
+        ArrayList<Point2d> points = new ArrayList<Point2d>(results.size());
+
+        int sIdx = -1;
+        int iIdx = -1;
+        int jIdx = -1;
+        int vIdx = -1;
+
+        boolean firstWarn = true;
+
+        for (Result result: results) {
+
+            if (sIdx == -1) {
+                ResultDescriptor rd = result.getResultDescriptor();
+                sIdx     = rd.getColumnIndex("SHAPE");
+                iIdx     = rd.getColumnIndex("IPOSITION");
+                jIdx     = rd.getColumnIndex("JPOSITION");
+                vIdx     = rd.getColumnIndex("YORDINATE");
+                int kIdx = rd.getColumnIndex("KPOSITION");
+                int tIdx = rd.getColumnIndex("TIMEVALUE");
+                int pIdx = rd.getColumnIndex("PARAMETERID");
+
+                if (sIdx == -1 || iIdx == -1
+                ||  jIdx == -1 || kIdx == -1
+                ||  vIdx == -1 || tIdx == -1
+                ||  pIdx == -1
+                ) {
+                    log.error("missing column in result set");
+                    return null;
+                }
+
+                ap2ds.setAttribute("date",      result.getDate(tIdx));
+                ap2ds.setAttribute("parameter", result.getInteger(pIdx));
+                ap2ds.setAttribute("layer",     result.getInteger(kIdx));
+            }
+            Coordinate coord = WKTUtils.toCoordinate(result.getString(sIdx));
+            if (coord == null) {
+                if (firstWarn) {
+                    firstWarn = false;
+                    log.warn("cannot fetch coordinate from result");
+                }
+                continue;
+            }
+            double v = result.getDouble(vIdx);
+            int    i = result.getInteger(iIdx);
+            int    j = result.getInteger(jIdx);
+
+            Point2d p2d = new Point2d(coord.x, coord.y, v, i, j);
+            points.add(p2d);
+
+        }
+        ap2ds.setPoints(points);
+
+        return ap2ds;
+    }
+
+    /**
+     * The last step of finalizing the data. The returned data is useful for
+     * shapefile creation.
+     *
+     * @param boundingBox The bounding box.
+     * @param polygon A polygon.
+     * @param callContext CallContext.
+     * @param input The pre-processed data.
+     * @return the finalized data ready for shapefile creation.
+     */
+    public AttributedPoint2ds process(
+        Envelope           boundingBox,
+        Polygon            polygon,
+        CallContext        callContext,
+        AttributedPoint2ds input
+    ) {
+        if (input == null) {
+            log.error("no data to interpolate");
+            return null;
+        }
+
+        Integer parameterId =
+            (Integer)input.getAttribute("parameter"); // XXX: hardcoded
+
+        if (parameterId == null) {
+            log.error("missing parameter id");
+            return null;
+        }
+
+        Map<Integer, PaletteManager> paletteManagers =
+            getPalettes(callContext);
+
+        PaletteManager paletteManager = paletteManagers.get(parameterId);
+
+        if (paletteManager == null) {
+            log.error("no palette found for parameter id " + parameterId);
+            return null;
+        }
+
+        boolean debug = log.isDebugEnabled();
+
+        if (debug) {
+            log.debug("interpolation");
+        }
+
+        AreaInterpolation interpolation =
+            new AreaInterpolation();
+
+        int numSamples          = numSamples(callContext);
+        int groundInterpolation = getGroundInterpolation(callContext);
+        int extrapolationRounds = extrapolationRounds(callContext);
+
+        if (!interpolation.interpolate(
+            input.getPoints(),
+            boundingBox,
+            new Dimension(numSamples, numSamples),
+            new QueriedXYDepth(groundInterpolation),
+            extrapolationRounds
+        )) {
+            log.error("interpolation failed");
+            return null;
+        }
+
+        // Do the post processing
+        Raster raster = new Raster(
+            interpolation.getRaster(),
+            numSamples);
+
+        // TODO: Filter operations.
+
+        if (debug) {
+            log.debug("to indexed raster");
+        }
+
+        // scan for regions with base palette
+        Palette basePalette = paletteManager.getBase();
+
+        int [] intRaster = raster.toIndexed(basePalette);
+
+        // produce JFreeChart compatible polygons
+
+        if (debug) {
+            log.debug("vectorize indexed raster");
+        }
+
+        // produce JTS compatible polygons
+
+        JTSMultiPolygonProducer jtsmpp = new JTSMultiPolygonProducer(
+            polygon,
+            boundingBox.getMinX(), boundingBox.getMinY(),
+            boundingBox.getMaxX(), boundingBox.getMaxY());
+
+        int numRegions = new Vectorizer(intRaster, numSamples)
+            .process(jtsmpp);
+
+        Map<Integer, MultiPolygon> polygons = jtsmpp.getMultiPolygons(
+            new ExternalIndexConverter(basePalette));
+
+        jtsmpp.clear(); jtsmpp = null; // help gc
+
+        int numColors = polygons.size();
+
+        if (debug) {
+            log.debug("number of regions: " + numRegions);
+            log.debug("number of colors:  " + numColors);
+        }
+        // generate iso lines
+
+        int numIso;
+
+             if (numColors <  5) { numIso = 5; }
+        else if (numColors < 10) { numIso = 2; }
+        else                     { numIso = 0; }
+
+        Palette isoPalette;
+
+        if (numIso == 0) { // same palette
+            isoPalette = basePalette;
+            /* intRaster = intRaster; */
+        }
+        else {
+            isoPalette = paletteManager.getLevel(numIso);
+            intRaster  = raster.toIndexed(isoPalette);
+        }
+
+        JTSMultiLineStringProducer jtslsp = new JTSMultiLineStringProducer(
+            polygon,
+            boundingBox.getMinX(), boundingBox.getMinY(),
+            boundingBox.getMaxX(), boundingBox.getMaxY());
+
+        numRegions = new Vectorizer(false, intRaster, numSamples)
+            .process(jtslsp);
+
+        IsoAttributeGenerator iag = new IsoAttributeGenerator(isoPalette);
+
+        List<Pair<Object, MultiLineString>> lineStrings =
+            jtslsp.getMultiLineStrings(iag);
+
+        jtslsp.clear(); jtslsp = null; // help gc
+
+        input.setInterpolation(interpolation);
+
+        input.setPolygons(polygons);
+        input.setLineStrings(lineStrings);
+
+        return input;
+    }
+
+
+    @Override
+    public void setup(Node configuration) {
+        super.setup(configuration);
+        this.ijkQueryID = Config.getStringXPath(configuration,"queryID-ijk");
+
+    }
+
+    private static int numSamples(CallContext callContext) {
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+        Integer samples = (Integer)context.get(
+            GNVArtifactContext.HORIZONTAL_CROSS_SECTION_SAMPLES_KEY);
+        return samples != null
+            ? samples.intValue()
+            : GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_SAMPLES;
+    }
+
+    private static int extrapolationRounds(CallContext callContext) {
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+        Integer extrapolationRounds = (Integer)context.get(
+            GNVArtifactContext.HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS_KEY);
+        return extrapolationRounds != null
+            ? extrapolationRounds.intValue()
+            : GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_EXTRAPOLATION_ROUNDS;
+    }
+
+    private static File shapefileDirectory(CallContext callContext) {
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+        File dir = (File)context.get(
+            GNVArtifactContext.HORIZONTAL_CROSS_SECTION_RESULT_SHAPEFILE_PATH_KEY);
+        return dir != null
+            ? dir
+            : GNVArtifactContext.DEFAULT_HORIZONTAL_CROSS_SECTION_PROFILE_SHAPEFILE_PATH;
+    }
+
+    private static int getGroundInterpolation(CallContext callContext) {
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+
+        String interpolation = (String)context.get(
+            GNVArtifactContext.HORIZONTAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY);
+
+        return RasterObject.getInterpolationType(interpolation);
+    }
+
+    private static Map<Integer, PaletteManager> getPalettes(
+        CallContext callContext
+    ) {
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+        Map<Integer, PaletteManager> palettes =
+            (Map<Integer, PaletteManager>)context.get(
+                GNVArtifactContext.PALETTES_KEY);
+        return palettes != null
+            ? palettes
+            : new HashMap<Integer, PaletteManager>();
+    }
+
+
+    @Override
+    public void cleanup(Object context) {
+        resetShapeFilePath();
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/horizontalcrosssection/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+State classes used by artifacts representing 'Horizontalschnitte' to handle input
+and output.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+DOCUMENT ME!
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileMeshVectorOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state.profile.vertical;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.artifacts.cache.CacheFactory;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.utils.VectorDataProcessor;
+
+import java.util.Collection;
+
+import net.sf.ehcache.Cache;
+
+import org.apache.log4j.Logger;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class VerticalProfileMeshVectorOutputState
+extends      VerticalProfileVectorOutputState
+{
+    public static final String[] RESULT_COLUMNS = {
+        "YORDINATE", "XORDINATE", "KPOSITION",
+        "GROUP1",    "GROUP2",    "GROUP3",
+        "DATAID",    "FEATUREID", "MESHID",
+        "SERIES"
+    };
+
+    private static Logger logger =
+        Logger.getLogger(VerticalProfileMeshVectorOutputState.class);
+
+
+    @Override
+    protected Object getChartResult(String uuid, CallContext callContext) {
+        logger.debug("Fetch chart data for vertical profile with vector data.");
+        CacheFactory factory = CacheFactory.getInstance();
+
+        if (factory.isInitialized()) {
+            // we use a cache
+            logger.info("Using cache.");
+            Cache cache = factory.getCache();
+            String key  = "chart_" + getHash();
+
+            net.sf.ehcache.Element value = cache.get(key);
+            if (value != null) {
+                logger.debug("Found element in cache.");
+                return value.getObjectValue();
+            }
+            else {
+                logger.debug("Element not in cache, we ask the database");
+                Collection<Result> res = (Collection<Result>)getData(queryID);
+                logger.debug("Got " + res.size() + " elements from db.");
+
+                res = VectorDataProcessor.process(res, RESULT_COLUMNS);
+                cache.put(new net.sf.ehcache.Element(key, res));
+
+                return res;
+            }
+        }
+        else {
+            // we don't use a cache, so we have to query the database every
+            // single time
+            logger.info("Not using a cache.");
+            return VectorDataProcessor.process(
+                getData(queryID), RESULT_COLUMNS);
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,38 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.profile.vertical;
 
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.chart.Chart;
+import de.intevation.gnv.chart.ChartLabels;
+import de.intevation.gnv.chart.VerticalProfileChart;
+
+import de.intevation.gnv.exports.DefaultDataCollector;
+import de.intevation.gnv.exports.DefaultExport;
+import de.intevation.gnv.exports.DefaultProfile;
+
+import de.intevation.gnv.exports.Export.Profile;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.state.exception.StateException;
+
+import de.intevation.gnv.state.timeseries.TimeSeriesOutputState;
+
+import de.intevation.gnv.statistics.Statistics;
+import de.intevation.gnv.statistics.VerticalProfileStatistics;
+
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.Locale;
@@ -14,58 +41,61 @@
 
 import org.jfree.chart.ChartTheme;
 
-import de.intevation.gnv.chart.Chart;
-import de.intevation.gnv.chart.ChartLabels;
-import de.intevation.gnv.chart.VerticalProfileChart;
-import de.intevation.gnv.exports.DefaultExport;
-import de.intevation.gnv.exports.DefaultDataCollector;
-import de.intevation.gnv.exports.DefaultProfile;
-import de.intevation.gnv.exports.Export.Profile;
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.exception.StateException;
-import de.intevation.gnv.state.timeseries.TimeSeriesOutputState;
-import de.intevation.gnv.statistics.Statistics;
-import de.intevation.gnv.statistics.VerticalProfileStatistics;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class VerticalProfileOutputState extends TimeSeriesOutputState {
 
     public static final String [] VERTICAL_PROFILE_COLUMNS = {
         "XORDINATE", // not quite sure if this is depth
         "YORDINATE",
-        "GROUP1"
-        // "GROUP2",
-        // "GROUP3"
+        "GROUP1",
+        "FEATUREID",
+        "TIMESERIESID"
+    };
+
+    public static final String [] VERTICAL_PROFILE_MESH_COLUMNS = {
+        "XORDINATE", // not quite sure if this is depth
+        "YORDINATE",
+        "GROUP1",
+        "FEATUREID",
+        "MESHID"
+    };
+
+    public static final String [] VERTICAL_PROFILE_MEASUREMENT_COLUMNS = {
+        "XORDINATE", // not quite sure if this is depth
+        "YORDINATE",
+        "GROUP1",
+        "FEATUREID",
+        "SERIESID"
     };
 
 
     public static final String [] VERTICAL_MESH_CSV_COLUMN_LABEL = {
         "CentralDepth",
         "Value",
-        "ParameterID"
-        // TODO "FeatureID",
-        // TODO "MeshID"
+        "ParameterID",
+        "FeatureID",
+        "MeshID"
     };
 
 
     public static final String [] VERTICAL_TIMESERIES_CSV_COLUMN_LABEL = {
         "Depth",
         "Value",
-        "ParameterID"
-        // TODO FeatureID missing
-        // TODO TimeseriesID missing
+        "ParameterID",
+        "FeatureID",
+        "TimeseriesID"
     };
 
 
     public static final String [] VERTICAL_MEASUREMENT_CSV_COLUMN_LABEL = {
         "Depth",
         "Value",
-        "ParameterID"
-        // TODO FeatureID missing
-        // TODO SeriesID missing
+        "ParameterID",
+        "FeatureID",
+        "SeriesID"
     };
 
 
@@ -78,7 +108,7 @@
             .getLogger(TimeSeriesOutputState.class);
 
     /**
-     * Constructor
+     * Creates a new VerticalProfileOutputState object.
      */
     public VerticalProfileOutputState() {
         super();
@@ -93,17 +123,18 @@
         Collection  parameters,
         Collection  measurements,
         Collection  dates,
-        Collection  result,
+        Object      result,
         Locale      locale,
         String      uuid,
         boolean     linesVisible,
-        boolean     shapesVisible
+        boolean     shapesVisible,
+        CallContext callContext
     ) {
         Chart chart = null;
 
         if (CACHE_CHART) {
             log.info("Try to get verticalprofile chart from cache.");
-            chart = (Chart) getChartFromCache(uuid);
+            chart = (Chart) getChartFromCache(uuid, callContext);
         }
 
         if (chart != null)
@@ -116,7 +147,7 @@
             parameters,
             measurements,
             dates,
-            result,
+            (Collection)result,
             null,
             locale,
             linesVisible,
@@ -133,19 +164,28 @@
     }
 
 
+    /**
+     * Creates a csv file of the resulting data and writes it to output stream.
+     *
+     * @param out The output stream.
+     * @param results The data used to create the csv file.
+     * @throws UnsupportedEncodingException if the encoding is not supported.
+     * @throws IOException if an error occured while writing to output stream.
+     * @throws StateException if an error occured while creating the csv file.
+     */
     @Override
     protected void createCSV(OutputStream out, Collection<Result> results)
     throws UnsupportedEncodingException, IOException, StateException
     {
-        Iterator iter = results.iterator();
-        Result   res  = iter.hasNext() ? (Result) iter.next() : null;
+        Iterator<Result> iter = results.iterator();
+        Result   res  = iter.hasNext() ? iter.next() : null;
 
         if (res == null)
             return;
 
         Profile profile = null;
         int     dataid  = res.getInteger("DATAID").intValue();
-
+        DefaultExport export = null;
         // on meshes
         if (dataid == 2) {
             profile =  new DefaultProfile(
@@ -155,6 +195,8 @@
                 '"',
                 "CSV",
                 "ISO-8859-1");
+            export = new DefaultExport(
+                    new DefaultDataCollector(VERTICAL_PROFILE_MESH_COLUMNS));
         }
 
         // on timeseries
@@ -166,6 +208,8 @@
                 '"',
                 "CSV",
                 "ISO-8859-1");
+            export = new DefaultExport(
+                    new DefaultDataCollector(VERTICAL_PROFILE_COLUMNS));
         }
 
         // on measurements
@@ -177,26 +221,23 @@
                 '"',
                 "CSV",
                 "ISO-8859-1");
+            export = new DefaultExport(
+                    new DefaultDataCollector(VERTICAL_PROFILE_MEASUREMENT_COLUMNS));
         }
-
-        DefaultExport export = new DefaultExport(
-            new DefaultDataCollector(VERTICAL_PROFILE_COLUMNS));
         export.create(profile, out, results);
     }
 
 
+    @Override
     protected String createChartSubtitle(Locale locale, String uuid) {
         return getSelectedFeatureName(uuid);
     }
 
 
-
-    /**
-     * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#getStatisticsGenerator()
-     */
     @Override
     protected Statistics getStatisticsGenerator() {
         return new VerticalProfileStatistics();
     }
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/VerticalProfileVectorOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state.profile.vertical;
+
+import au.com.bytecode.opencsv.CSVWriter;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.artifacts.cache.CacheFactory;
+
+import de.intevation.gnv.chart.Chart;
+import de.intevation.gnv.chart.ChartLabels;
+import de.intevation.gnv.chart.VerticalProfileVectorChart;
+
+import de.intevation.gnv.exports.DefaultExport;
+import de.intevation.gnv.exports.DefaultProfile;
+import de.intevation.gnv.exports.Export;
+import de.intevation.gnv.exports.Export.Profile;
+import de.intevation.gnv.exports.SimpleOdvDataCollector;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.utils.VectorDataProcessor;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.exception.StateException;
+
+import de.intevation.gnv.statistics.Statistics;
+import de.intevation.gnv.statistics.VerticalProfileVectorStatistics;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import java.util.Collection;
+import java.util.Locale;
+import java.util.Map;
+
+import net.sf.ehcache.Cache;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.ChartTheme;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class VerticalProfileVectorOutputState
+extends      VerticalProfileOutputState
+{
+    private static Logger logger =
+        Logger.getLogger(VerticalProfileVectorOutputState.class);
+
+    public static final String[] RESULT_COLUMNS = {
+        "YORDINATE", "XORDINATE",
+        "GROUP1",    "GROUP2",     "GROUP3",
+        "DATAID",    "FEATUREID",  "TIMESERIESID",
+        "SERIES"
+    };
+
+
+    public static final String[] ODV_COLUMN_HEADERS = {
+        "Cruise",
+        "Station",
+        "Type",
+        "yyyy-mm-dd hh:mm",
+        "Lon (°E)",
+        "Lat (°N)",
+        "Bot. Depth [m]",
+        "Depth [m]",
+        "QF",
+        "XComponent",
+        "QF",
+        "YComponent",
+        "QF",
+        "ZComponent",
+        "QF",
+        "Speed",
+        "QF",
+        "Direction",
+        "QF"
+    };
+
+    public static final String[] ODV_PROFILE_NAMES = {
+        "CRUISE",
+        "STATION",
+        "TYPE",
+        "TIMEVALUE",
+        "SHAPE",
+        "BOTDEPTH",
+        "DEPTH",
+        "QF",
+        "XCOMPONENT",
+        "QF",
+        "YCOMPONENT",
+        "QF",
+        "ZCOMPONENT",
+        "QF",
+        "SPEED",
+        "QF",
+        "DIRECTION",
+        "QF"};
+
+
+    @Override
+    protected Object getChartResult(String uuid, CallContext callContext) {
+        logger.debug("Fetch chart data for vertical profile with vector data.");
+        CacheFactory factory = CacheFactory.getInstance();
+
+        if (factory.isInitialized()) {
+            // we use a cache
+            logger.info("Using cache.");
+            Cache cache = factory.getCache();
+            String key  = "chart_" + getHash();
+
+            net.sf.ehcache.Element value = cache.get(key);
+            if (value != null) {
+                logger.debug("Found element in cache.");
+                return value.getObjectValue();
+            }
+            else {
+                logger.debug("Element not in cache, we ask the database");
+                Collection<Result> res = (Collection<Result>)getData(queryID);
+                logger.debug("Got " + res.size() + " elements from db.");
+
+                res = VectorDataProcessor.process(res, RESULT_COLUMNS);
+                cache.put(new net.sf.ehcache.Element(key, res));
+
+                return res;
+            }
+        }
+        else {
+            // we don't use a cache, so we have to query the database every
+            // single time
+            logger.info("Not using a cache.");
+            return VectorDataProcessor.process(
+                getData(queryID), RESULT_COLUMNS);
+        }
+    }
+
+
+    @Override
+    protected Chart getChart(
+        ChartLabels  chartLables,
+        ChartTheme   theme,
+        Collection   parameters,
+        Collection   measurements,
+        Collection   dates,
+        Object       result,
+        Locale       locale,
+        String       uuid,
+        boolean      linesVisible,
+        boolean      shapesVisible,
+        CallContext  callContext
+    ) {
+        Chart chart = new VerticalProfileVectorChart(
+            chartLables,
+            theme,
+            parameters,
+            measurements,
+            dates,
+            (Collection)result,
+            timeGapDefinitions,
+            locale,
+            linesVisible,
+            shapesVisible
+        );
+        chart.generateChart();
+
+        return chart;
+    }
+
+
+    @Override
+    protected Chart[] getHistograms(
+        String      uuid,
+        CallContext callContext,
+        Collection<KeyValueDescibeData>  parameters,
+        Collection<KeyValueDescibeData>  measurements,
+        Collection<KeyValueDescibeData>  dates,
+        Map         requestParameter
+    ) {
+        Collection results = (Collection) getChartResult(uuid, callContext);
+        ChartTheme theme   = createStyle(callContext);
+
+        return VectorDataProcessor.getHistograms(
+            uuid, callContext, results, theme, requestParameter);
+    }
+
+
+    @Override
+    protected void createODV(
+        OutputStream outputStream, Collection result, String uuid)
+    throws IOException, StateException
+    {
+        logger.info("Start exporting " + result.size() + " items to odv.");
+        Export export = new DefaultExport(
+            new SimpleOdvDataCollector(ODV_PROFILE_NAMES));
+
+        Profile profile = new DefaultProfile(
+            ODV_COLUMN_HEADERS,
+            '\t',
+            CSVWriter.NO_QUOTE_CHARACTER,
+            CSVWriter.NO_ESCAPE_CHARACTER,
+            "ODV",
+            "ISO-8859-1");
+
+        export.create(profile, outputStream, result);
+    }
+
+
+    protected Statistics getStatisticsGenerator() {
+        return new VerticalProfileVectorStatistics();
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/vertical/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+State classes used by artifacts representing 'Vertikalprofile' to handle input
+and output.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/OutputHelper.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state.profile.verticalcrosssection;
+
+import de.intevation.gnv.jfreechart.CompactXYItems;
+import de.intevation.gnv.jfreechart.PolygonSeries;
+
+import de.intevation.gnv.math.Interpolation3D;
+
+import gnu.trove.TDoubleArrayList;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class OutputHelper
+{
+    private static Logger log = Logger.getLogger(OutputHelper.class);
+
+    public static final double EPS = 1e-5d;
+
+    private OutputHelper() {
+    }
+
+
+    /**
+     * Creates a PolygonSeries representing the seabed used to be displayed in a
+     * 2D-chart.
+     *
+     * @param interpolation The interpolation which supports information about
+     * the max depth, the cell width and height.
+     * @param fill The fill color as integer.
+     * @return a PolygonSeries representing the seabed.
+     */
+    public static PolygonSeries createSeabedPolygon(
+        Interpolation3D interpolation,
+        Integer         fill
+    ) {
+        double maxDepth   = interpolation.getMaxDepth();
+        double cellWidth  = interpolation.getCellWidth();
+        double cellHeight = interpolation.getCellHeight();
+
+        double [] depths = interpolation.getDepths();
+
+        double x = 0d;
+
+        TDoubleArrayList vertices = new TDoubleArrayList();
+
+        PolygonSeries ps = new PolygonSeries();
+
+        for (int i = 0; i < depths.length; ++i, x += cellWidth) {
+            double depth = depths[i];
+
+            if (vertices.isEmpty()) {
+                if (Double.isNaN(depth) || depth == maxDepth) {
+                    continue;
+                }
+                if (depth > 0d) depth = 0d;
+                vertices.add(x); vertices.add(maxDepth);
+                vertices.add(x); vertices.add(depth);
+                vertices.add(x+cellWidth); vertices.add(depth);
+            }
+            else { // in polygon
+                if (Double.isNaN(depth) || depth == maxDepth) {
+                    vertices.add(x); vertices.add(maxDepth);
+                    ps.addRing(new CompactXYItems(vertices.toNativeArray()));
+                    vertices.reset();
+                }
+                else {
+                    if (depth > 0d) depth = 0d;
+                    int N = vertices.size();
+                    if (N > 2 && Math.abs(depth - vertices.get(N-1)) < EPS) {
+                        vertices.set(N-2, x+cellWidth);
+                    }
+                    else {
+                        vertices.add(vertices.get(N-2)); vertices.add(depth);
+                        vertices.add(x+cellWidth); vertices.add(depth);
+                    }
+                }
+            }
+        } // for all depths
+
+        if (!vertices.isEmpty()) {
+            vertices.add(vertices.get(vertices.size()-2));
+            vertices.add(maxDepth);
+            ps.addRing(new CompactXYItems(vertices.toNativeArray()));
+        }
+
+        if (ps.getItemCount() == 0) {
+            return null;
+        }
+
+        ps.setAttribute("fill", fill);
+
+        return ps;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,46 +1,111 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
-package de.intevation.gnv.state.profile.verticalcrosssection;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Locale;
-
-import org.apache.log4j.Logger;
-
-import org.jfree.chart.ChartTheme;
+package de.intevation.gnv.state.profile.verticalcrosssection;
 
 import au.com.bytecode.opencsv.CSVWriter;
 
-import com.vividsolutions.jts.geom.Point;
-import com.vividsolutions.jts.io.ParseException;
-import com.vividsolutions.jts.io.WKTReader;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Paint;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
 
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.Element;
+
+import org.apache.log4j.Logger;
+import org.jfree.chart.ChartTheme;
+
+import com.vividsolutions.jts.geom.Coordinate;
+
+import de.intevation.artifacts.CallContext;
+import de.intevation.gnv.artifacts.cache.CacheFactory;
+import de.intevation.gnv.artifacts.context.GNVArtifactContext;
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
 import de.intevation.gnv.chart.Chart;
 import de.intevation.gnv.chart.ChartLabels;
-import de.intevation.gnv.chart.ChartStyle;
-import de.intevation.gnv.chart.exception.TechnicalChartException;
+import de.intevation.gnv.chart.VerticalCrossSectionChart;
+import de.intevation.gnv.exports.DefaultProfile;
+import de.intevation.gnv.exports.Export;
+import de.intevation.gnv.exports.VerticalCrossODVExport;
 import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+import de.intevation.gnv.geobackend.sde.datasources.RasterObject;
+import de.intevation.gnv.jfreechart.PolygonDataset;
+import de.intevation.gnv.jfreechart.PolygonSeries;
+import de.intevation.gnv.math.AttributedXYColumns;
+import de.intevation.gnv.math.HeightValue;
+import de.intevation.gnv.math.IJKey;
+import de.intevation.gnv.math.Interpolation3D;
+import de.intevation.gnv.math.LinearMetrics;
+import de.intevation.gnv.math.QueriedXYDepth;
+import de.intevation.gnv.math.XYColumn;
+import de.intevation.gnv.raster.Filter;
+import de.intevation.gnv.raster.IsoAttributeGenerator;
+import de.intevation.gnv.raster.IsoPolygonSeriesProducer;
+import de.intevation.gnv.raster.Palette;
+import de.intevation.gnv.raster.PaletteManager;
+import de.intevation.gnv.raster.PolygonDatasetProducer;
+import de.intevation.gnv.raster.Raster;
+import de.intevation.gnv.raster.Vectorizer;
+import de.intevation.gnv.state.InputData;
 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
 import de.intevation.gnv.state.exception.StateException;
 import de.intevation.gnv.state.timeseries.TimeSeriesOutputState;
 import de.intevation.gnv.statistics.Statistics;
-import de.intevation.gnv.statistics.VerticalProfileStatistics;
+import de.intevation.gnv.statistics.VerticalCrossSectionStatistics;
+import de.intevation.gnv.utils.DistanceCalculator;
+import de.intevation.gnv.utils.StringUtils;
+import de.intevation.gnv.utils.WKTUtils;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class VerticalCrossSectionOutputState extends TimeSeriesOutputState {
 
-    private static Logger log = Logger
-    .getLogger(VerticalCrossSectionOutputState.class);
-    
+    public static final String CHART_TYPE = "verticalcrosssection";
+
+    public static final Integer GROUND_FILL_INDEX = Integer.valueOf(-2);
+
+    public static final boolean USE_INDEX_BUFFER =
+        Boolean.getBoolean("gnv.vertical.cross.section.index.buffer");
+
+    public static final String[] ATTRIBUTE_LIST = {
+        "SHAPE",
+        "Z",
+        "YORDINATE",
+        "IPOSITION",
+        "JPOSITION",
+        "KPOSITION"
+    };
+
+    private static Logger log = Logger.getLogger(
+        VerticalCrossSectionOutputState.class);
+
+    private String ijkQueryID = "horizontalprofile_meshpoint_cross_ij";
+
+    private String rangeLabel;
+
     /**
      * The UID of this Class
      */
@@ -52,128 +117,637 @@
     public VerticalCrossSectionOutputState() {
         super();
         super.domainLable = "chart.verticalcrosssection.title.xaxis";
+        this.rangeLabel   = "chart.verticalcrosssection.title.yaxis";
     }
 
     @Override
+    public void initialize(String uuid, CallContext callContext)
+    throws StateException {
+        super.initialize(uuid, callContext);
+
+        getChartResult(uuid, callContext);
+    }
+
+    @Override
+    protected ChartLabels createChartLabels(Locale locale, String uuid) {
+        RessourceFactory factory = RessourceFactory.getInstance();
+        InputData input          = inputData.get(parameterValuesName);
+        String parameterName     = input.getDescription()[0];
+
+        if (parameterName == null)
+            parameterName = "parameterid";
+
+        return new ChartLabels(
+            createChartTitle(locale, uuid),
+            createChartSubtitle(locale, uuid),
+            factory.getRessource(locale, domainLable, domainLable),
+            factory.getRessource(locale, rangeLabel, rangeLabel),
+            parameterName
+        );
+    }
+
+
+    @Override
+    protected String createChartSubtitle(Locale locale, String uuid) {
+        InputData data = inputData.get(dateValueName);
+        String date    = data.getDescription()[0];
+
+        if (date == null)
+            date = "dateid";
+
+        RessourceFactory factory = RessourceFactory.getInstance();
+        String chartType         = factory.getRessource(
+            locale, CHART_TYPE, CHART_TYPE);
+
+        return chartType + ": " + date;
+    }
+
+
+    @Override
+    protected Object getChartResult(String uuid, CallContext callContext) {
+        log.debug("VerticalCrossSectionOutputState.getChartResult");
+        String key = getHash();
+
+        CacheFactory factory = CacheFactory.getInstance();
+        if (factory.isInitialized()) {
+            log.info("Using a cachce - key: " + key);
+            Cache cache = factory.getCache();
+
+            Element element = cache.get(key);
+            if (element != null)
+                return element.getObjectValue();
+
+            log.debug("No results in cache yet.");
+            Object obj = getData(uuid, callContext);
+            cache.put(new Element(key, obj));
+
+            return obj;
+        }
+        else {
+            log.info("Not using a cache.");
+            return getData(uuid, callContext);
+        }
+    }
+
+
+    /**
+     * Retrieves the data used to create a VerticalCrossProfileChart.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @param callContext The CallContext object.
+     * @return the data used to create a VerticalCrossProfileChart.
+     */
+    protected Object getData(String uuid, CallContext callContext) {
+        Collection<Result> result = null;
+        InputData meshId          = inputData.get("meshid");
+        String    meshLine        = getLineString();
+
+        if (meshLine == null) {
+            log.error("mesh_linestring is not defined");
+            throw new IllegalStateException("missing mesh_linestring");
+        }
+
+        if (meshId == null) {
+            log.error("meshid is not defined");
+            throw new IllegalStateException("missing meshid");
+        }
+
+        Coordinate [] coords = WKTUtils.toCoordinates(
+            meshLine);
+
+        if (coords == null) {
+            throw new IllegalStateException("cannot read coordinates");
+        }
+
+        try {
+            String additionWhere = USE_INDEX_BUFFER
+                ? WKTUtils.worldCoordinatesToIndex(
+                    coords,
+                    result,
+                    meshId.getValue(),
+                    ijkQueryID)
+                : WKTUtils.TRUE_EXPRESSION;
+
+            String[] addedFilterValues = StringUtils.append(
+                generateFilterValuesFromInputData(),
+                additionWhere);
+
+            QueryExecutor exec = QueryExecutorFactory
+                .getInstance()
+                .getQueryExecutor();
+
+            result = exec.executeQuery(queryID, addedFilterValues);
+        }
+        catch (QueryException qe) {
+            log.error(qe, qe);
+        }
+
+        Object obj = process(
+            Arrays.asList(coords),
+            preProcess(result),
+            callContext);
+
+        return obj;
+    }
+
+
+    protected String getLineString() {
+        InputData meshLine = inputData.get("mesh_linestring");
+
+        return meshLine != null ? meshLine.getValue() : null;
+    }
+
+
+    @Override
+    protected String getSelectedInputDataName(String uuid, String id) {
+        Collection values = getCollection(id, uuid);
+
+        if (values != null) {
+            Iterator it = values.iterator();
+
+            while (it.hasNext()) {
+                KeyValueDescibeData data = (KeyValueDescibeData) it.next();
+
+                if (data.isSelected()) {
+                    return data.getValue();
+                }
+            }
+        }
+        return null;
+    }
+
+    private static int getGroundInterpolation(CallContext callContext) {
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+
+        String interpolation = (String)context.get(
+            GNVArtifactContext.VERTICAL_CROSS_SECTION_GROUND_INTERPOLATION_KEY);
+
+        return RasterObject.getInterpolationType(interpolation);
+    }
+
+    private static Dimension getRasterSize(CallContext callContext) {
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+        Dimension size = (Dimension)context.get(
+            GNVArtifactContext.VERTICAL_CROSS_SECTION_SAMPLES_KEY);
+        return size != null
+            ? size
+            : GNVArtifactContext.DEFAULT_VERTICAL_CROSS_SECTION_SAMPLES;
+    }
+
+    private static List<Filter.Factory> getFilterFactories(
+        CallContext callContext
+    ) {
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+        List<Filter.Factory> factories = (List<Filter.Factory>)context.get(
+            GNVArtifactContext.VERTICAL_CROSS_SECTION_FILTER_FACTORIES_KEY);
+        return factories != null
+            ? factories
+            : new ArrayList<Filter.Factory>();
+    }
+
+    private static Map<Integer, PaletteManager> getPalettes(
+        CallContext callContext
+    ) {
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+        Map<Integer, PaletteManager> palettes =
+            (Map<Integer, PaletteManager>)context.get(
+                GNVArtifactContext.PALETTES_KEY);
+        return palettes != null
+            ? palettes
+            : new HashMap<Integer, PaletteManager>();
+    }
+
+    private static Paint getGroundFill(CallContext callContext) {
+        GNVArtifactContext context =
+            (GNVArtifactContext)callContext.globalContext();
+        Paint fill = (Paint)context.get(
+            GNVArtifactContext.VERTICAL_CROSS_SECTION_GROUND_FILL_KEY);
+        return fill != null
+            ? fill
+            : GNVArtifactContext.DEFAULT_VERTICAL_CROSS_SECTION_GROUND_FILL;
+    }
+
+    public static final double EPSILON = 1e-5d;
+
+
+    /**
+     * Finalize the data used for chart generation. Isolines are added, colors
+     * are assigned to polygons and the seabed is added.
+     *
+     * @param path The path which have been inserted while parameterization.
+     * @param columns The data used to be displayed in a 2D chart.
+     * @param callContext The CallContext object.
+     * @return the finalized data ready for chart generation.
+     */
+    protected Object process(
+        List<Coordinate>    path,
+        AttributedXYColumns columns,
+        CallContext         callContext
+    ) {
+        Integer parameterId =
+            (Integer)columns.getAttribute("GROUP1"); // XXX: hardcoded
+
+        if (parameterId == null) {
+            log.error("missing parameter id");
+            return null;
+        }
+
+        Map<Integer, PaletteManager> paletteManagers =
+            getPalettes(callContext);
+
+        PaletteManager paletteManager = paletteManagers.get(parameterId);
+
+        if (paletteManager == null) {
+            log.error("no palette found for parameter id " + parameterId);
+            return null;
+        }
+
+        boolean debug = log.isDebugEnabled();
+
+        if (debug) {
+            log.debug("using palette '" + paletteManager.getName() + "'");
+        }
+
+        Dimension            rasterSize      = getRasterSize(callContext);
+        List<Filter.Factory> filterFactories = getFilterFactories(callContext);
+        Interpolation3D      interpolation   = new Interpolation3D(rasterSize);
+
+        double distance = DistanceCalculator.calculateDistance(path);
+
+        if (distance < EPSILON) {
+            log.warn("distance too short for interpolation");
+            return null;
+        }
+
+        boolean success = interpolation.interpolate(
+            path,
+            columns.getXYColumns(),
+            0d,
+            distance,
+            LinearMetrics.INSTANCE,
+            new QueriedXYDepth(
+                getGroundInterpolation(callContext)));
+
+        if (!success) {
+            log.warn("interpolation failed");
+            return null;
+        }
+
+        // Do the post processing
+        Raster raster = new Raster(
+            interpolation.getRaster(),
+            rasterSize.width);
+
+        for (Filter.Factory factory: filterFactories) {
+            raster = factory.create().filter(raster);
+        }
+
+        if (debug) {
+            log.debug("to indexed raster");
+        }
+
+        // scan for regions with base palette
+        Palette basePalette = paletteManager.getBase();
+
+        int [] intRaster = raster.toIndexed(basePalette);
+
+        // produce JFreeChart compatible polygons
+
+        if (debug) {
+            log.debug("vectorize indexed raster");
+        }
+
+        double maxDepth = interpolation.getMaxDepth();
+
+        PolygonDatasetProducer pdsp = new PolygonDatasetProducer(
+            0, 0,
+            distance, maxDepth);
+
+        int numRegions = new Vectorizer(intRaster, rasterSize.width)
+            .process(pdsp);
+
+        PolygonDataset pds = pdsp.getPolygonDataset();
+
+        // Count number of colors before generating seabed
+        // because its used to determine the number of iso lines.
+        int numColors = pds.getSeriesCount();
+
+        if (debug) {
+            log.debug("number of regions: " + numRegions);
+            log.debug("number of colors:  " + numColors);
+        }
+
+        // generate seabed polygon
+
+        PolygonSeries seabed = OutputHelper.createSeabedPolygon(
+            interpolation,
+            GROUND_FILL_INDEX);
+
+        if (seabed != null) {
+            pds.addSeries(seabed);
+        }
+
+        // generate iso lines
+
+        int numIso;
+
+             if (numColors <  5) { numIso = 5; }
+        else if (numColors < 10) { numIso = 2; }
+        else                     { numIso = 0; }
+
+        Palette isoPalette;
+
+        if (numIso == 0) { // same palette
+            isoPalette = basePalette;
+            /* intRaster = intRaster; */
+        }
+        else {
+            isoPalette = paletteManager.getLevel(numIso);
+            intRaster  = raster.toIndexed(isoPalette);
+        }
+
+        IsoPolygonSeriesProducer ipsp = new IsoPolygonSeriesProducer(
+            0, 0,
+            distance, maxDepth);
+
+        numRegions = new Vectorizer(false, intRaster, rasterSize.width)
+            .process(ipsp);
+
+        IsoAttributeGenerator iag = new IsoAttributeGenerator(isoPalette);
+        Collection<PolygonSeries> ps = ipsp.getSeries(iag);
+        ipsp.clear();
+
+        if (debug) {
+            log.debug("num of iso regions: " + numRegions);
+            log.debug("num of iso series:  " + ps.size());
+        }
+
+        pds.addAllSeries(ps);
+
+        columns.setInterpolation(interpolation);
+        columns.setPolygonDataset(pds);
+
+        return columns;
+    }
+
+
+    /**
+     * Pre-process the data returned by database query. The resulting data is
+     * not ready for chart creation!
+     *
+     * @param results Data returned by database.
+     * @return Pre-processed data which is not ready for chart creation yet.
+     */
+    protected AttributedXYColumns preProcess(Collection results) {
+
+        AttributedXYColumns attColumns = new AttributedXYColumns();
+        Map<IJKey, XYColumn> map       = new HashMap<IJKey, XYColumn>(1013);
+        Iterator   iter                = results.iterator();
+
+        int sIdx = -1;
+        int iIdx = -1;
+        int jIdx = -1;
+        int kIdx = -1;
+        int vIdx = -1;
+        int zIdx = -1;
+
+        while (iter.hasNext()) {
+            Result result = (Result) iter.next();
+
+            if (sIdx == -1) {
+                ResultDescriptor rd = result.getResultDescriptor();
+                int columnCount     = rd.getColumnCount();
+
+                sIdx = rd.getColumnIndex("SHAPE");
+                iIdx = rd.getColumnIndex("IPOSITION");
+                jIdx = rd.getColumnIndex("JPOSITION");
+                kIdx = rd.getColumnIndex("KPOSITION");
+                vIdx = rd.getColumnIndex("YORDINATE");
+                zIdx = rd.getColumnIndex("Z");
+
+                for (int i = 0; i < columnCount; i++) {
+                    String colName = rd.getColumnName(i);
+
+                    if (!StringUtils.contains(ATTRIBUTE_LIST, colName)) {
+                        attColumns.setAttribute(
+                            colName,
+                            result.getObject(colName));
+                    }
+                }
+            }
+
+            double v = result.getDouble(vIdx);
+            double z = result.getDouble(zIdx);
+            int    i = result.getInteger(iIdx);
+            int    j = result.getInteger(jIdx);
+            int    k = result.getInteger(kIdx);
+
+            IJKey key = new IJKey(i, j);
+
+            XYColumn col = (XYColumn)map.get(key);
+
+            if (col == null) {
+                Coordinate coord = WKTUtils.toCoordinate(result.getString(sIdx));
+                if (coord == null) coord = new Coordinate();
+                col = new XYColumn(coord.x, coord.y, i, j);
+                map.put(key, col);
+            }
+
+            col.add(new HeightValue(z, v, k));
+        }
+
+        ArrayList<XYColumn> cols = new ArrayList<XYColumn>(map.values());
+        attColumns.setXYColumns(cols);
+
+        return attColumns;
+    }
+
+
+    /**
+     * This <code>getChart</code> method returns a 2D VerticalCrossSectionChart
+     * displaying polygon data with isolines and a legend describing the colors
+     * used in that chart.
+     *
+     * @param chartLables Labels used to decorate the chart.
+     * @param theme The theme used to adjust the look of the chart.
+     * @param parameters A collection with parameters this chart contains.
+     * @param measurements A collection with measurement this chart contains.
+     * @param dates A collection with dates this chart contains.
+     * @param result The data collection used to be displayed in this chart.
+     * @param locale The Locale used to determine the language.
+     * @param uuid The uuid of the current artifact.
+     * @param linesVisible A boolean property to determine the visibility of
+     * lines connecting two points in a chart (not used in this chart type).
+     * @param shapesVisible A boolean property to determine the visiblity of
+     * datapoints in this chart (not used in this chart type).
+     * @param callContext The CallContext object.
+     * @return a 2D chart representing the data as polygons.
+     */
+    @Override
     protected Chart getChart(
         ChartLabels  chartLables,
         ChartTheme   theme,
         Collection   parameters,
         Collection   measurements,
         Collection   dates,
-        Collection   result,
+        Object       result,
         Locale       locale,
         String       uuid,
         boolean      linesVisible,
-        boolean      shapesVisible
+        boolean      shapesVisible,
+        CallContext  callContext
     ) {
         Chart chart = null;
 
         if (CACHE_CHART) {
             log.info("Try to get verticalcrosssection chart from cache.");
-            chart = (Chart) getChartFromCache(uuid);
+            chart = (Chart) getChartFromCache(uuid, callContext);
         }
 
         if (chart != null)
             return chart;
 
         log.info("Chart not in cache yet.");
-        
-        log.warn("This sort of chart is not implemented yet.");
-        /* TODO Implement a special chart for this sort of charts.
-        chart = new VerticalProfileChart(
-            chartLables,
-            chartTheme,
-            parameters,
-            measurements,
-            result,
-            dates,
-            locale
-        );
+
+        if (!(result instanceof AttributedXYColumns)) {
+            log.error("result of wrong type");
+            return null;
+        }
+
+        AttributedXYColumns columns = (AttributedXYColumns)result;
+
+        Integer parameterId =
+            (Integer)columns.getAttribute("GROUP1"); // XXX: hardcoded
+
+        if (parameterId == null) {
+            log.error("missing parameter id");
+            return null;
+        }
+
+        Map<Integer, PaletteManager> paletteManagers =
+            getPalettes(callContext);
+
+        PaletteManager paletteManager = paletteManagers.get(parameterId);
+
+        if (paletteManager == null) {
+            log.error("no palette found for parameter id " + parameterId);
+            return null;
+        }
+
+        HashMap<Integer, Paint> special = new HashMap<Integer, Paint>();
+        special.put(GROUND_FILL_INDEX, getGroundFill(callContext));
+
+        chart = new VerticalCrossSectionChart(
+            columns,
+            paletteManager.getBase(),
+            special,
+            locale,
+            chartLables);
+
         chart.generateChart();
+        ((VerticalCrossSectionChart)chart).setBackgroundPaint(Color.WHITE);
 
         if (CACHE_CHART) {
             log.info("Put chart into cache.");
             purifyChart(chart, uuid);
         }
-        */
 
         return chart;
     }
 
-    /**
-     * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#createChart(java.io.OutputStream,
-     *      java.util.Collection, java.util.Collection, java.lang.String,
-     *      de.intevation.gnv.chart.ChartStyle,
-     *      de.intevation.gnv.chart.ChartLabels)
-     */
-    /*
+
     @Override
-    protected void createChart(OutputStream outputStream,
-                               Collection<KeyValueDescibeData> parameters,
-                               Collection<KeyValueDescibeData> measurements,
-                               Collection<KeyValueDescibeData> dates,
-                               ChartStyle chartStyle, ChartLabels chartLables,
-                               String uuid) throws IOException,
-                                           TechnicalChartException {
-        new VerticalCrossSectionChartFactory().createProfileChart(chartLables,
-                chartStyle, parameters, measurements, dates, outputStream, this
-                        .getChartResult(uuid));
+    protected Statistics getStatisticsGenerator() {
+        return new VerticalCrossSectionStatistics();
     }
-    */
 
     /**
-     * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#getStatisticsGenerator()
-     */
-    @Override
-    protected Statistics getStatisticsGenerator() {
-        return new VerticalProfileStatistics();
-    }
-    
-    /**
-     * @see de.intevation.gnv.state.timeseries.TimeSeriesOutputState#createCSV(java.io.OutputStream, java.util.Collection)
+     * Nothing happens here. <b>This method should never be called</b> until
+     * there is a wise implementation of a csv representation of the polygon
+     * data.
+     *
+     * @param outputStream The output stream used to write the csv file to.
+     * @param chartResult  The data used to be written to csv file.
+     * @throws UnsupportedEncodingException if the encoding is not supported.
+     * @throws IOException if an error occured while writing to output stream.
+     * @throws StateException if an error occured while csv file creation.
      */
     @Override
-    protected void createCSV(OutputStream outputStream,
-                             Collection<Result> chartResult)
-                                                            throws UnsupportedEncodingException,
-                                                            IOException,
-                                                            StateException {
-        if (chartResult != null) {
-            try {
-                CSVWriter writer = new CSVWriter(new OutputStreamWriter(
-                        outputStream, "ISO-8859-1"), ','); 
-                // USE THIS ENCODING BECAUSE OF
-                // PROBLEMS WITH EXCEL AND UTF-8
-                Iterator<Result> it = chartResult.iterator();
-                WKTReader wktReader = new WKTReader();
-                while (it.hasNext()) {
-                    Result result = it.next();
-                    int i = 0;
-                    String[] entries = new String[9];
-                    Point p = (Point)wktReader.read(result.getString("SHAPE"));
-                    entries[i++] = ""+p.getX();
-                    entries[i++] = ""+p.getY();
-                    entries[i++] = result.getString("Z");
-                    entries[i++] = result.getString("YORDINATE");
-                    entries[i++] = result.getString("GROUP1");
-                    entries[i++] = result.getString("GROUP2");
-                    entries[i++] = result.getString("IPOSITION");
-                    entries[i++] = result.getString("JPOSITION");
-                    entries[i++] = result.getString("KPOSITION");
-                    writer.writeNext(entries);
-                }
-                writer.close();
-            } catch (ParseException e) {
-                log.error(e,e);
-                throw new StateException(
-                "Exception occured while parsing an Point from WKT.");
-            }
-        } else {
-            log.error("No Data given for generating an CSV-File.");
-            throw new StateException(
-                    "No Data given for generating an CSV-File.");
-        }
+    protected void createCSV(
+        OutputStream       outputStream,
+        Collection<Result> chartResult
+    )
+    throws UnsupportedEncodingException, IOException, StateException
+    {
+        // TODO: Implement a substitution which makes sense.
     }
 
+    @Override
+    protected void createODV(
+        OutputStream outputStream,
+        String       uuid,
+        CallContext  callContext)
+    throws IOException, StateException
+    {
+        // 'Profilschnitte' contain one parameter only
+        Collection tmp            = getParameters(uuid);
+        KeyValueDescibeData param = (KeyValueDescibeData) tmp.toArray()[0];
+
+        String [] COLUMN_HEADER = {
+            "Cruise",
+            "Station",
+            "Type",
+            "yyyy-mm-dd hh:mm",
+            "Lon (°E)",
+            "Lat (°N)",
+            "Bot. Depth [m]",
+            "Depth [m]",
+            "QF",
+            param.getValue()
+        };
+
+        Export.Profile ODV_PROFILE = new DefaultProfile(
+            COLUMN_HEADER,
+            '\t',
+            CSVWriter.NO_QUOTE_CHARACTER,
+            CSVWriter.NO_ESCAPE_CHARACTER,
+            "ODV",
+            "ISO-8859-1");
+
+        Object chartResult = getChartResult(uuid, callContext);
+
+        if (chartResult == null) {
+            log.error("No data for export found.");
+            return;
+        }
+
+        List result = new ArrayList(1);
+        result.add(chartResult);
+
+        InputData data = inputData.get(dateValueName);
+        String    date = data.getDescription()[0];
+
+        Interpolation3D interpol = ((AttributedXYColumns)
+            chartResult).getInterpolation();
+
+        Coordinate[] coords = interpol.getCoordinates();
+        double[]     depth  = interpol.getDepths();
+        double[]     raster = interpol.getRaster();
+
+        Export export = new VerticalCrossODVExport(
+            interpol.getCoordinates(),
+            interpol.getCellHeight(),
+            interpol.getCellWidth(),
+            interpol.getRaster(),
+            date,
+            interpol.getWidth(),
+            interpol.getHeight());
+
+        export.create(ODV_PROFILE, outputStream, null);
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/VerticalCrossSectionParallelOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state.profile.verticalcrosssection;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.CoordinateSequence;
+import com.vividsolutions.jts.geom.impl.CoordinateArraySequenceFactory;
+
+import com.vividsolutions.jts.io.WKTWriter;
+
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import de.intevation.gnv.geobackend.base.query.QueryExecutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
+
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+
+import de.intevation.gnv.state.InputData;
+
+import de.intevation.gnv.utils.WKTUtils;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Locale;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class VerticalCrossSectionParallelOutputState
+extends      VerticalCrossSectionOutputState
+{
+    public static final String QUERY_LINESTRING =
+        "verticalcrosssection_mesh_parallel_linestring";
+
+    private static Logger logger =
+        Logger.getLogger(VerticalCrossSectionParallelOutputState.class);
+
+    @Override
+    protected String getLineString() {
+        Coordinate[] coordinates = null;
+
+        try {
+            String[] filters = generateFilterValues();
+
+            QueryExecutor exec = QueryExecutorFactory
+                .getInstance()
+                .getQueryExecutor();
+
+            Collection results = exec.executeQuery(QUERY_LINESTRING, filters);
+            Iterator   iter    = results.iterator();
+
+            coordinates = new Coordinate[results.size()];
+            int sIdx    = -1;
+            int idx     = 0;
+
+            while (iter.hasNext()) {
+                Result result = (Result) iter.next();
+
+                if (sIdx == -1) {
+                    ResultDescriptor rd = result.getResultDescriptor();
+                    sIdx = rd.getColumnIndex("SHAPE");
+                }
+
+                logger.debug(result.getString(sIdx));
+                Coordinate c = WKTUtils.toCoordinate(result.getString(sIdx));
+
+                coordinates[idx++] = c;
+            }
+        }
+        catch (QueryException qe) {
+            logger.error(qe, qe);
+        }
+
+        CoordinateArraySequenceFactory factory =
+            CoordinateArraySequenceFactory.instance();
+
+        if (coordinates == null)
+            return null;
+
+        CoordinateSequence seq = factory.create(coordinates);
+        return seq != null ? WKTWriter.toLineString(seq) : null;
+    }
+
+
+    protected String[] generateFilterValues() {
+        String[] filters = new String[7];
+
+        InputData parameterid = inputData.get("parameterid");
+        InputData timevalue   = inputData.get("dateid");
+        InputData meshid      = inputData.get("meshid");
+        InputData axisid      = inputData.get("axisid");
+        InputData meshpoint   = inputData.get("mesh_point");
+
+        filters[0] = parameterid.getValue();
+        filters[1] = "to_date('" + timevalue.getValue() + "', 'YYYY.MM.DD HH24:MI:SS')";
+        filters[2] = meshid.getValue();
+        filters[3] = meshid.getValue();
+        filters[4] = axisid.getValue();
+        filters[5] = axisid.getValue();
+        filters[6] = meshpoint.getValue();
+
+        return filters;
+    }
+
+
+    @Override
+    protected String createChartSubtitle(Locale locale, String uuid) {
+        String subtitle = super.createChartSubtitle(locale, uuid);
+
+        InputData data = inputData.get("mesh_point");
+        if (data == null)
+            return subtitle;
+
+        RessourceFactory factory = RessourceFactory.getInstance();
+        String coordinate        = factory.getRessource(
+            locale, "coordinate", "coordinate");
+
+        subtitle += "\n" + coordinate + ": ";
+        subtitle += data.getDescription(data.getValue());
+
+        return subtitle;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/profile/verticalcrosssection/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+State classes used by artifacts representing 'Profilschnitte' to handle input and
+output.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,60 +1,69 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.state.timeseries;
 
 import java.io.IOException;
-import java.io.File;
 import java.io.OutputStream;
-import java.io.FileOutputStream;
 import java.io.UnsupportedEncodingException;
+
+import java.text.DateFormat;
+import java.text.NumberFormat;
+import java.text.ParseException;
+
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.Vector;
 
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerFactoryConfigurationError;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
 import org.apache.log4j.Logger;
+import org.jfree.chart.ChartTheme;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-import org.jfree.chart.ChartTheme;
-
 import au.com.bytecode.opencsv.CSVWriter;
-import de.intevation.artifactdatabase.Config;
-import de.intevation.artifactdatabase.XMLUtils;
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
-import de.intevation.artifacts.CallContext;
-import de.intevation.artifacts.PreferredLocale;
 import de.intevation.gnv.artifacts.context.GNVArtifactContext;
-import de.intevation.gnv.artifacts.context.GNVArtifactContextFactory;
 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
 import de.intevation.gnv.chart.Chart;
 import de.intevation.gnv.chart.ChartLabels;
+import de.intevation.gnv.chart.DefaultHistogram;
 import de.intevation.gnv.chart.TimeSeriesChart;
 import de.intevation.gnv.chart.XMLChartTheme;
 import de.intevation.gnv.chart.exception.TechnicalChartException;
 import de.intevation.gnv.exports.ChartExportHelper;
-import de.intevation.gnv.exports.DefaultExport;
 import de.intevation.gnv.exports.DefaultDataCollector;
+import de.intevation.gnv.exports.DefaultExport;
+import de.intevation.gnv.exports.DefaultProfile;
+import de.intevation.gnv.exports.Export;
+import de.intevation.gnv.exports.ODVExport;
 import de.intevation.gnv.exports.SimpleOdvDataCollector;
-import de.intevation.gnv.exports.DefaultProfile;
 import de.intevation.gnv.exports.Export.Profile;
 import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.histogram.HistogramHelper;
 import de.intevation.gnv.state.InputData;
 import de.intevation.gnv.state.OutputStateBase;
+import de.intevation.gnv.state.State;
+import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.describedata.MinMaxDescribeData;
+import de.intevation.gnv.state.describedata.NamedArrayList;
 import de.intevation.gnv.state.describedata.NamedCollection;
 import de.intevation.gnv.state.exception.StateException;
 import de.intevation.gnv.statistics.Statistic;
@@ -66,19 +75,26 @@
 import de.intevation.gnv.timeseries.gap.TimeGap;
 import de.intevation.gnv.utils.ArtifactXMLUtilities;
 
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class TimeSeriesOutputState extends OutputStateBase {
 
+    /**
+     * A boolean property to enable caching of charts after they have been
+     * created. This property can be adjusted via system property 'cache.chart'.
+     * 'true' of 'false' are valid options - defaults to 'false'.<br>
+     * <b>NOTE:</b> If chart caching is enabled, charts aren't sensible to
+     * changes in the parameterization anymore, after a first chart has been
+     * created for an artifact.
+     */
     protected static final boolean CACHE_CHART =
         Boolean.parseBoolean(System.getProperty("cache.chart", "false"));
 
-    protected static final boolean PDF_FORMAT_LANDSCAPE =
-        Boolean.parseBoolean(System.getProperty("export.pdf.landscape","true"));
-
+    /**
+     * Supported image export formats.
+     */
     protected static final String[] IMG_EXPORT_FORMAT = {
         "PNG", "JPEG", "GIF"
     };
@@ -94,15 +110,23 @@
     private static Logger log = Logger
             .getLogger(TimeSeriesOutputState.class);
 
-    private static List<TimeGap> timeGapDefinitions = null;
+    protected List<TimeGap> timeGapDefinitions = null;
 
+    /**
+     * Key in resource bundle the x-axis title is stored.
+     */
     protected String domainLable = "chart.timeseries.title.xaxis";
 
     protected String featureValuesName = "featureid";
     protected String parameterValuesName = "parameterid";
     protected String measuremenValueName = "measurementid";
     protected String dateValueName = "dateid";
+    protected String timeIntervalValueName = "timeinterval";
 
+
+    /**
+     * Array used to specify the columns used in csv exports.
+     */
     public static final String [] TIMESERIES_CSV_PROFILE_COLUMNS = {
         "XORDINATE",
         "YORDINATE",
@@ -112,6 +136,9 @@
     };
 
 
+    /**
+     * Column labels used in csv exports.
+     */
     public static final String [] TIMESERIES_TIMESERIES_CSV_COLUMN_LABEL = {
         "Date/Time",
         "Value",
@@ -120,6 +147,10 @@
         "TimeseriesID"
     };
 
+
+    /**
+     * Array used to specify the column in csv exports on meshes.
+     */
     public static final String [] TIMESERIES_MESH_CSV_COLUMN_LABEL = {
         "Date/Time",
         "Value",
@@ -128,35 +159,40 @@
         "MeshID"
     };
 
+
+    /**
+     * Array used to specify the columns in odv exports.
+     */
     public static final String [] TIMESERIES_ODV_PROFILE_NAMES = {
           "CRUISE",
           "STATION",
           "TYPE",
+          "TIMEVALUE",
           "SHAPE",
           "BOTDEPTH",
           "DEPTH",
-          "TIMEVALUE",
-          "DATAVALUE",
-          "PARAMETER"
+          "QF"
     };
 
 
+    /**
+     * Column labels used in odv exports.
+     */
     public static final String [] ODV_COLUMN_HEADER = {
         "Cruise",
         "Station",
         "Type",
-        "Longitude [deegrees_east]",
-        "Latitude [deegrees_north]",
+        "yyyy-mm-dd hh:mm",
+        "Lon (°E)",
+        "Lat (°N)",
         "Bot. Depth [m]",
         "Depth [m]",
-        "Date/Time",
-        "Value",
-        "Parameterid"
+        "QF"
     };
 
+
     /**
      * Profile for exporting data to odv
-     * TODO Change TIMESERIES_PROFILE_NAMES, which belong to CSV exports
      */
     public static final Profile TIMESERIES_ODV_PROFILE =
         new DefaultProfile(
@@ -167,6 +203,7 @@
             "ODV",
             "ISO-8859-1");
 
+
     /**
      * Constructor
      */
@@ -174,208 +211,280 @@
         super();
     }
 
+
     /**
-     * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String,
-     *      java.util.Collection, java.io.OutputStream, java.lang.String,
-     *      de.intevation.artifacts.CallMeta)
+     * Calls <code>getChartResult</code> which puts the data used for chart
+     * creation into cache. This redruces waiting periods after selecting an
+     * output type.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @param context The CallContext object.
+     * @throws StateException if an error occured while fetching the data used
+     * for chart creation.
+     */
+    @Override
+    public void initialize(String uuid, CallContext context)
+    throws StateException
+    {
+        getChartResult(uuid, context);
+    }
+
+
+    /**
+     * This out target has following modes:<br>
+     * <ol>
+     *  <li>chart: Creates a chart displaying the data corresponding to the
+     * current parameterization. A chart has following export modes:<br>
+     *      <ol>
+     *          <li>img: Image representation of a chart.</li>
+     *          <li>pdf: PDF representation of a chart.</li>
+     *          <li>svg: SVG representation of a chart.</li>
+     *      </ol>
+     * All selected parameters are drawn into a single chart.<br>
+     *  </li>
+     *  <li>histogram: Creates a histogram displaying the data corresponding to
+     * the current parameterization. A histogram has following export modes:<br>
+     *      <ol>
+     *          <li>img: Image representation of a histogram.</li>
+     *          <li>pdf: PDF representation of a histogram.</li>
+     *          <li>svg: SVG representation of a histogram.</li>
+     *      </ol>
+     * A single histogram is created for each selected parameter.<br>
+     *  </li>
+     *  <li>statistic: Creates a statistic with important figures.</li>
+     *  <li>csv: Creates a csv file.</li>
+     *  <li>odv: Creates a odv file.</li>
+     * </ol>
+     *
+     * @param format Document which contains some export specific information.
+     * @param inputData Contains some meta information to adjust the export
+     * (e.g. width and height of a chart).
+     * @param outputStream The output stream used to return the export.
+     * @param uuid The UUID of the current artifact.
+     * @param callContext The CallContext object.
+     * @throws StateException if an error occured while creating the export
+     * object.
      */
     public void out(
-        Document format,
+        Document              format,
         Collection<InputData> inputData,
-        OutputStream outputStream,
-        String uuid,
-        CallContext callContext
+        OutputStream          outputStream,
+        String                uuid,
+        CallContext           callContext
     ) throws StateException
     {
         log.debug("TimeSeriesOutputTransition.out");
 
-        String outputMode = Config.getStringXPath(
-            format,
-            "action/out/@name"
-        );
-        String mimeType   = Config.getStringXPath(
-            format,
-            "action/out/mime-type/@value"
-        );
+        String outputMode = XMLUtils.xpathString(
+            format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE);
+
+        String mode       = XMLUtils.xpathString(
+            format, XPATH_EXPORT_MODE, ArtifactNamespaceContext.INSTANCE);
+
+        if (mode == null || mode.equals("")) {
+            mode = "img";
+        }
+
+        String mimeType = XMLUtils.xpathString(
+            format, XPATH_MIME_TYPE, ArtifactNamespaceContext.INSTANCE);
 
         CallMeta callMeta         = callContext.getMeta();
 
+        int chartWidth   = 600;
+        int chartHeight  = 400;
+        boolean sVisible = false;
+        int binCount     = 0;
+        int binWidth     = 0;
+
+        Map requestParameter = new HashMap();
+
+        // lines are always visible. if lines should be configurable we need a
+        // parameter in the user interface
+        boolean lVisible = true;
+
         try {
+            if (inputData != null) {
+                Iterator<InputData> it = inputData.iterator();
+                while (it.hasNext()) {
+                    InputData ip      = it.next();
+                    String optionName = ip.getName().trim();
+                    requestParameter.put(optionName, ip.getValue());
+
+                    if (optionName.equals("width")) {
+                        chartWidth = Integer.parseInt(ip.getValue());
+                    }
+                    else if (optionName.equals("height")) {
+                        chartHeight = Integer.parseInt(ip.getValue());
+                    }
+                    else if (optionName.equals("points")) {
+                        sVisible = Boolean.parseBoolean(ip.getValue());
+                    }
+                }
+            }
+        } catch (NumberFormatException e) {
+            log.warn(e, e);
+            XMLUtils.toStream(
+                feedFailure("not.a.number"),
+                outputStream);
+            return;
+        }
+
+        try {
+            Collection<KeyValueDescibeData> parameters   =
+                getParameters(uuid);
+            Collection<KeyValueDescibeData> measurements =
+                getMeasurements(uuid);
+            Collection<KeyValueDescibeData> dates        =
+                getDates(uuid);
+
+            Locale[] serverLocales =
+                RessourceFactory.getInstance().getLocales();
+            Locale locale          =
+                callMeta.getPreferredLocale(serverLocales);
+
+            ChartLabels chartLables = createChartLabels(locale, uuid);
+
+            log.debug(
+                "Best locale - regarding intersection of server and " +
+                "browser locales -  is " + locale.toString()
+            );
+
+            String exportFormat = getExportFormat(mimeType);
+
+            // CHART
             if (outputMode.equalsIgnoreCase("chart")) {
                 log.debug("Chart will be generated.");
-                int chartWidth = 600;
-                int chartHeight = 400;
-                try {
-                    if (inputData != null) {
-                        Iterator<InputData> it = inputData.iterator();
-                        while (it.hasNext()) {
-                            InputData ip = it.next();
-                            if (ip.getName().equalsIgnoreCase("width")) {
-                                chartWidth = Integer.parseInt(ip.getValue());
-                            } else if (ip.getName().equalsIgnoreCase("height")) {
-                                chartHeight = Integer.parseInt(ip.getValue());
-                            }
-                        }
-                    }
-                } catch (NumberFormatException e) {
-                    log.error(e, e);
-                    throw new StateException(e);
-                }
-
-                PreferredLocale[] locales = callMeta.getLanguages();
-                Locale[] serverLocales    =
-                    RessourceFactory.getInstance().getLocales();
-                Locale locale             =
-                    callMeta.getPreferredLocale(serverLocales);
 
-                log.debug(
-                    "Best locale - regarding intersection of server and " +
-                    "browser locales -  is " + locale.toString()
-                );
-
-                Collection parameters   = this.getCleanedParameters(uuid);
-                Collection measurements = this.getMeasurements(uuid);
-                Collection dates        = this.getDates(uuid);
+                if (mode.equalsIgnoreCase("img")) {
+                    createChart(
+                        outputStream,
+                        parameters,
+                        measurements,
+                        dates,
+                        chartLables,
+                        callContext,
+                        uuid,
+                        exportFormat,
+                        locale,
+                        chartWidth,
+                        chartHeight,
+                        lVisible,
+                        sVisible,
+                        callContext
+                    );
+                }
+                else if (mode.equalsIgnoreCase("pdf")) {
+                    callContext.putContextValue("chart.width", chartWidth);
+                    callContext.putContextValue("chart.height", chartHeight);
+                    callContext.putContextValue("shapes.visible", sVisible);
+                    callContext.putContextValue("lines.visible", lVisible);
+                    callContext.putContextValue("locale", locale);
 
-                ChartLabels chartLables = new ChartLabels(
-                    createChartTitle(locale, uuid),
-                    createChartSubtitle(locale, uuid),
-                    RessourceFactory.getInstance().getRessource(
+                    createPDF(
+                        outputStream,
+                        parameters,
+                        measurements,
+                        dates,
+                        chartLables,
+                        uuid,
+                        "A4",
+                        callContext
+                    );
+                }
+                else if (mode.equalsIgnoreCase("svg")) {
+                    createSVG(
+                        outputStream,
+                        getParameters(uuid),
+                        getMeasurements(uuid),
+                        getDates(uuid),
+                        createChartLabels(locale, uuid),
+                        uuid,
                         locale,
-                        domainLable,
-                        domainLable
-                    )
-                );
+                        chartWidth,
+                        chartHeight,
+                        lVisible,
+                        sVisible,
+                        callContext
+                    );
+                }
+            }
+            // HISTOGRAM
+            else if (outputMode.equalsIgnoreCase("histogram")) {
+                requestParameter.put("locale", locale);
 
-                String exportFormat = getExportFormat(mimeType);
-
-                // TODO Remove this and parse input data
-                boolean linesVisible = true;
-                boolean shapesVisible = true;
-
-                this.createChart(
-                    outputStream,
+                Chart[] histograms = getHistograms(
+                    uuid,
+                    callContext,
                     parameters,
                     measurements,
                     dates,
-                    chartLables,
-                    callContext,
-                    uuid,
-                    exportFormat,
-                    locale,
-                    chartWidth,
-                    chartHeight,
-                    linesVisible,
-                    shapesVisible
-                );
-            }
-            else if (outputMode.equalsIgnoreCase("pdf")) {
-                log.debug("Output mode == pdf");
-
-                Locale[] serverLocales    =
-                    RessourceFactory.getInstance().getLocales();
-                Locale locale             =
-                    callMeta.getPreferredLocale(serverLocales);
-
-                // TODO Remove this and parse input data
-                boolean linesVisible = true;
-                boolean shapesVisible = true;
-
-                log.debug(
-                    "Best locale - regarding intersection of server and " +
-                    "browser locales -  is " + locale.toString()
-                );
+                    requestParameter);
 
-                createPDF(
-                    outputStream,
-                    getCleanedParameters(uuid),
-                    getMeasurements(uuid),
-                    getDates(uuid),
-                    new ChartLabels(
-                        createChartTitle(locale, uuid),
-                        createChartSubtitle(locale, uuid),
-                        RessourceFactory.getInstance().getRessource(
-                            locale,
-                            domainLable,
-                            domainLable
-                        )
-                    ),
-                    uuid,
-                    "A4",
-                    true,
-                    linesVisible,
-                    shapesVisible,
-                    locale,
-                    callContext
-                );
-            }
-            else if (outputMode.equalsIgnoreCase("svg")) {
-                log.debug("Output mode == svg");
-                int width  = 600;
-                int height = 400;
-
-                // TODO Remove this and parse input data
-                boolean linesVisible = true;
-                boolean shapesVisible = true;
+                if (mode.equalsIgnoreCase("img")) {
+                    ChartExportHelper.exportHistograms(
+                        outputStream,
+                        histograms,
+                        exportFormat,
+                        chartWidth,
+                        chartHeight
+                    );
+                }
+                else if (mode.equalsIgnoreCase("pdf")) {
+                    callContext.putContextValue("chart.width", chartWidth);
+                    callContext.putContextValue("chart.height", chartHeight);
 
-                Locale[] serverLocales    =
-                    RessourceFactory.getInstance().getLocales();
-                Locale locale             =
-                    callMeta.getPreferredLocale(serverLocales);
-
-                log.debug(
-                    "Best locale - regarding intersection of server and " +
-                    "browser locales -  is " + locale.toString()
-                );
-
-                createSVG(
-                    outputStream,
-                    getCleanedParameters(uuid),
-                    getMeasurements(uuid),
-                    getDates(uuid),
-                    new ChartLabels(
-                        createChartTitle(locale, uuid),
-                        createChartSubtitle(locale, uuid),
-                        RessourceFactory.getInstance().getRessource(
-                            locale,
-                            domainLable,
-                            domainLable
-                        )
-                    ),
-                    uuid,
-                    locale,
-                    width,
-                    height,
-                    linesVisible,
-                    shapesVisible,
-                    callContext
-                );
+                    ChartExportHelper.exportHistogramsAsPDF(
+                        outputStream,
+                        histograms,
+                        "A4",
+                        50F, 50F, 50F, 50F,
+                        callContext
+                    );
+                }
+                else if (mode.equalsIgnoreCase("svg")) {
+                    ChartExportHelper.exportHistogramsAsSVG(
+                        outputStream,
+                        histograms,
+                        null,
+                        chartWidth,
+                        chartHeight
+                    );
+                }
             }
             else if (outputMode.equalsIgnoreCase("csv")) {
                 log.debug("CSV-File will be generated.");
-                Collection<Result> chartResult = this.getChartResult(uuid);
-                this.createCSV(outputStream, chartResult);
+                Object result = getChartResult(uuid, callContext);
+                if (result instanceof Collection) {
+                    this.createCSV(
+                        outputStream,
+                        (Collection<Result>)result);
+                }
             } else if (outputMode.equalsIgnoreCase("statistics")) {
                 log.debug("Statistics will be generated.");
-                Statistics s = getStatisticsGenerator();
-                Collection<Result> chartResult = this.getChartResult(uuid);
-                Collection<KeyValueDescibeData> parameters = 
-                                                this.getParameters(uuid);
-                Collection<KeyValueDescibeData> measurements = 
-                                                this.getMeasurements(uuid);
-                Collection<KeyValueDescibeData> dates = 
-                                                this.getDates(uuid);
-                Collection<StatisticSet> statistics = 
-                                      s.calculateStatistics(chartResult,
-                                                            parameters,
-                                                            measurements,
-                                                            dates);
-                Document doc = this.writeStatistics2XML(statistics);
-                this.writeDocument2OutputStream(doc, outputStream);
-            } else if (outputMode.equalsIgnoreCase("odv")) {
-                
-                Collection<Result> odvResult = this.getODVResult(uuid);
-                this.createODV(outputStream, odvResult);
+
+                Collection<StatisticSet> statistics;
+
+                Statistics s      = getStatisticsGenerator();
+                Object     result = getChartResult(uuid, callContext);
+
+                if (result != null && s != null) {
+                    statistics = s.calculateStatistics(
+                        result,
+                        parameters,
+                        measurements,
+                        dates);
+                }
+                else {
+                    statistics = new ArrayList<StatisticSet>();
+                }
+
+                Document doc = writeStatistics2XML(statistics, locale);
+
+                XMLUtils.toStream(doc, outputStream);
+
+            }
+            else if (outputMode.equalsIgnoreCase("odv")) {
+                createODV(outputStream, uuid, callContext);
             }
         } catch (IOException e) {
             log.error(e, e);
@@ -390,6 +499,59 @@
     }
 
 
+    protected Chart[] getHistograms(
+        String      uuid,
+        CallContext callContext,
+        Collection<KeyValueDescibeData>  parameters,
+        Collection<KeyValueDescibeData>  measurements,
+        Collection<KeyValueDescibeData>  dates,
+        Map         requestParameter
+    ) {
+        Locale locale = (Locale) requestParameter.get("locale");
+
+        Collection results = (Collection) getChartResult(uuid, callContext);
+        ChartTheme theme   = createStyle(callContext);
+
+        Object[][] data = HistogramHelper.prepareHistogramData(
+            results, parameters, measurements, dates);
+
+        int size           = data.length;
+        Chart[] histograms = new Chart[size];
+
+        for (int i = 0; i < size; i++) {
+            ChartLabels labels = HistogramHelper.createHistogramLabels(
+                uuid, callContext, locale, data[i]);
+
+            histograms[i] = new DefaultHistogram(
+                labels, data[i], theme, requestParameter);
+        }
+
+        return histograms;
+    }
+
+    /**
+     * @param outputStream
+     * @param uuid
+     * @throws IOException
+     * @throws StateException
+     */
+    protected void createODV(OutputStream outputStream,
+                             String uuid,
+                             CallContext callContext)
+                                                    throws IOException,
+                                                    StateException {
+        Collection<Result> odvResult = this.getODVResult(uuid);
+        this.createODV(outputStream, odvResult,uuid);
+    }
+
+
+    /**
+     * Retrieves the export format (e.g. png, gif, jpeg).
+     *
+     * @param mime Export format specified by the incoming  request.
+     * @return <i>mime</i> if it is supported - otherwise the first format in
+     * {@link #IMG_EXPORT_FORMAT}.
+     */
     protected String getExportFormat(String mime) {
         for(int i = 0; i < IMG_EXPORT_FORMAT.length; i++) {
             if (mime.trim().toUpperCase().indexOf(IMG_EXPORT_FORMAT[i]) > 0)
@@ -401,6 +563,14 @@
     }
 
 
+    /**
+     * Returns a collection containing all selected KeyValueDescibeData objects
+     * of <i>parameters</i>.
+     *
+     * @param parameters A collection with KeyValueDescibeData objects.
+     * @return a collection cleaned from unselected objects.
+     * @deprecated
+     */
     protected Collection getCleanedParameters(Collection parameters) {
         Iterator iter        = parameters.iterator();
         Collection parameter = new Vector(parameters);
@@ -414,11 +584,28 @@
     }
 
 
+    /**
+     * Calls {@link #getCleanedParameters(java.util.Collection)} with the
+     * collection returned by {@link #getParameters(java.lang.String)}.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @return a cleaned collection.
+     */
     protected Collection getCleanedParameters(String uuid) {
         return getCleanedParameters(getParameters(uuid));
     }
 
 
+    /**
+     * Create a csv file representing the data corresponding to the current
+     * parameterization.
+     *
+     * @param out The output stream used to export the csv file.
+     * @param results The data used for csv file creation.
+     * @throws UnsupportedEncodingException if the encoding is not supported.
+     * @throws IOException if an error occured while writing to output stream.
+     * @throws StateException if an error occured while creating the csv file.
+     */
     protected void createCSV(OutputStream out, Collection<Result> results)
     throws UnsupportedEncodingException, IOException, StateException
     {
@@ -460,13 +647,24 @@
 
 
     /**
-     * TODO Result is not used at the moment. Change result with correct data.
+     * Create an odv file representing the data corresponding to the current
+     * parameterization.
+     *
+     * @param outputStream The output stream used to export the odv file.
+     * @param result The data used for odv file creation.
+     * @param uuid The UUID of the current artifact.
+     * @throws IOException if an error occured while writing to output stream.
+     * @throws StateException if an error occured while creating the odv file.
      */
-    protected void createODV(OutputStream outputStream, Collection result)
+    protected void createODV(OutputStream outputStream,
+                             Collection result,
+                             String uuid)
     throws IOException, StateException {
 
-        DefaultExport export = new DefaultExport(new SimpleOdvDataCollector(
-            TIMESERIES_ODV_PROFILE_NAMES));
+        Export export = new ODVExport(new SimpleOdvDataCollector(
+            TIMESERIES_ODV_PROFILE_NAMES),
+            this.getParameters(uuid),
+            this.getStartTime());
 
         if (result == null)
             log.error("#################### RESULT == NULL #################");
@@ -474,52 +672,69 @@
     }
 
     /**
-     * @return
+     * Method that returns the Starttime of an TimeSeries or
+     * null if it is not a TimeSeries.
+     * @return the Starttime of an TimeSeries or null if it is not a TimeSeries.
+     */
+    protected String getStartTime(){
+        InputData data = inputData.get(this.timeIntervalValueName);
+        if (data != null){
+            Object describeData = data.getObject();
+            if (describeData instanceof MinMaxDescribeData){
+                String value = ((MinMaxDescribeData)describeData)
+                                .getMinValue().toString();
+                return value.substring(0,value.lastIndexOf(':'));
+            }
+            return null;
+        }else{
+            return null;
+        }
+
+    }
+
+    /**
+     * Returns the statistic generator.
+     *
+     * @return the statistic generator.
      */
     protected Statistics getStatisticsGenerator() {
         Statistics s = new TimeseriesStatistics();
         return s;
     }
 
-    protected void writeDocument2OutputStream(Document document, OutputStream os) {
 
-        try {
-            TransformerFactory transformerFactory = TransformerFactory
-                    .newInstance();
-            Transformer transformer = transformerFactory.newTransformer();
-            DOMSource source = new DOMSource(document);
-            StreamResult result = new StreamResult(os);
-            transformer.transform(source, result);
-        } catch (TransformerConfigurationException e) {
-            log.error(e, e);
-        } catch (TransformerFactoryConfigurationError e) {
-            log.error(e, e);
-        } catch (TransformerException e) {
-            log.error(e, e);
-        }
-    }
-
-    protected Document writeStatistics2XML( Collection<StatisticSet> statistic) {
+    /**
+     * Writes the statistic into an xml document.
+     *
+     * @param statistic Statistic to be written to xml document.
+     * @return the xml document containing the statistic.
+     */
+    protected Document writeStatistics2XML(
+        Collection<StatisticSet> statistic, Locale locale)
+    {
         ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
         Document doc = XMLUtils.newDocument();
+
+        NumberFormat format = NumberFormat.getInstance(locale);
+
         if (statistic != null) {
-            Node statisticResults = xmlUtilities.createArtifactElement(doc,
+            Node statisticResults = ArtifactXMLUtilities.createArtifactElement(doc,
                     "statistics");
             doc.appendChild(statisticResults);
             Iterator<StatisticSet> it = statistic.iterator();
             while (it.hasNext()) {
                 StatisticSet set = it.next();
-                Element setElement = xmlUtilities.createArtifactElement(doc,
+                Element setElement = ArtifactXMLUtilities.createArtifactElement(doc,
                                                                        "statistic");
                 setElement.setAttribute("name", set.getName());
-                
+
                 Iterator<Statistic> sit = set.getStatistics().iterator();
                 while (sit.hasNext()){
                     Statistic s = sit.next();
-                    Element result = xmlUtilities.createArtifactElement(doc,
+                    Element result = ArtifactXMLUtilities.createArtifactElement(doc,
                     "statistic-value");
                     result.setAttribute("name", s.getKey());
-                    result.setAttribute("value", s.getStringValue());
+                    result.setAttribute("value", format.format(s.getValue()));
                     setElement.appendChild(result);
                 }
                 statisticResults.appendChild(setElement);
@@ -530,6 +745,12 @@
     }
 
 
+    /**
+     * Returns the name of the selected feature.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @return the name of the selectef feature.
+     */
     protected String getSelectedFeatureName(String uuid) {
         Collection values = getCollection(featureValuesName, uuid);
 
@@ -538,25 +759,36 @@
 
             while (it.hasNext()) {
                 KeyValueDescibeData data = (KeyValueDescibeData) it.next();
+                return data.getValue();
+            }
 
-                if (data.isSelected()) {
-                    return data.getValue();
-                }
-            }
+            return "";
         }
-        return null;
+        return "";
     }
 
 
     /**
-     * @param outputStream
-     * @param parameters
-     * @param measurements
-     * @param timeSeriesName
-     * @param chartStyle
-     * @param chartLables
-     * @throws IOException
-     * @throws TechnicalChartException
+     * Creates a chart and writes it to <i>outputStream</i>.
+     *
+     * @param outputStream The stream used to write the chart to.
+     * @param parameters A collection with parameters.
+     * @param measurements A collection with measurements.
+     * @param dates A collection with dates.
+     * @param chartLables The labels used to decorate the chart.
+     * @param context The CallContext.
+     * @param uuid The UUID of the current artifact.
+     * @param exportFormat The format the chart used to be exported as.
+     * @param locale The Locale to specify the language.
+     * @param width The width of the chart.
+     * @param height The height of the chart.
+     * @param linesVisible A boolean property to determine the visibility of
+     * lines connecting two datapoins.
+     * @param shapesVisible A boolean property to determine the visibility of
+     * datapoints.
+     * @param callContext The CallContext object.
+     * @throws IOException if an error occured while writing to output stream.
+     * @throws TechnicalChartException if an error occured while chart creation.
      */
     protected void createChart(
         OutputStream outputStream,
@@ -571,7 +803,8 @@
         int          width,
         int          height,
         boolean      linesVisible,
-        boolean      shapesVisible
+        boolean      shapesVisible,
+        CallContext  callContext
     )
     throws IOException, TechnicalChartException
     {
@@ -582,11 +815,12 @@
             parameters,
             measurements,
             dates,
-            getChartResult(uuid),
+            getChartResult(uuid, callContext),
             locale, // Locale
             uuid,
             linesVisible,
-            shapesVisible
+            shapesVisible,
+            callContext
         );
 
         if (chart == null) {
@@ -609,6 +843,25 @@
     }
 
 
+    /**
+     * Creates a chart and writes it as pdf to <i>outputStream</i>.
+     *
+     * @param outputStream The stream used to write the chart to.
+     * @param parameters A collection with parameters.
+     * @param measurements A collection with measurements.
+     * @param dates A collection with dates.
+     * @param chartLables The labels used to decorate the chart.
+     * @param uuid The UUID of the current artifact.
+     * @param exportFormat The format the chart used to be exported as.
+     * @param landscape A boolean property to determine the alignment of the
+     * chart.
+     * @param linesVisible A boolean property to determine the visibility of
+     * lines connecting two datapoins.
+     * @param shapesVisible A boolean property to determine the visibility of
+     * datapoints.
+     * @param locale The Locale to specify the language.
+     * @param context The CallContext object.
+     */
     protected void createPDF(
         OutputStream outputStream,
         Collection   parameters,
@@ -617,10 +870,6 @@
         ChartLabels  chartLables,
         String       uuid,
         String       exportFormat,
-        boolean      landscape,
-        boolean      linesVisible,
-        boolean      shapesVisible,
-        Locale       locale,
         CallContext  context
     ) {
         Chart chart = getChart(
@@ -629,11 +878,12 @@
             parameters,
             measurements,
             dates,
-            getChartResult(uuid),
-            locale,
+            getChartResult(uuid, context),
+            (Locale) context.getContextValue("locale"),
             uuid,
-            linesVisible,
-            shapesVisible
+            Boolean.TRUE.equals(context.getContextValue("lines.visible")),
+            Boolean.TRUE.equals(context.getContextValue("shapes.visible")),
+            context
         );
 
         if (chart == null) {
@@ -645,25 +895,30 @@
             outputStream,
             chart.generateChart(),
             "A4",
-            PDF_FORMAT_LANDSCAPE,
-            50F, 50F, 50F, 50F
+            50F, 50F, 50F, 50F,
+            context
         );
-
-        try {
-            OutputStream toFile = new FileOutputStream("/vol1/home/iweinzierl/tmp/test.svg");
-            ChartExportHelper.exportSVG(
-                toFile,
-                chart.generateChart(),
-                null,
-                600, 400
-            );
-            toFile.flush();
-            toFile.close();
-        }
-        catch(Exception e) { log.debug("ERROR WHLILE TEST."); }
     }
 
 
+    /**
+     * Creates a chart and writes it as svg to <i>outputStream</i>.
+     *
+     * @param outputStream The stream used to write the chart to.
+     * @param parameters A collection with parameters.
+     * @param measurements A collection with measurements.
+     * @param dates A collection with dates.
+     * @param chartLables The labels used to decorate the chart.
+     * @param uuid The UUID of the current artifact.
+     * @param locale The Locale to specify the language.
+     * @param width The width of the chart.
+     * @param height The height of the chart.
+     * @param linesVisible A boolean property to determine the visibility of
+     * lines connecting two datapoins.
+     * @param shapesVisible A boolean property to determine the visibility of
+     * datapoints.
+     * @param callContext The CallContext object.
+     */
     protected void createSVG(
         OutputStream outputStream,
         Collection   parameters,
@@ -684,11 +939,12 @@
             parameters,
             measurements,
             dates,
-            getChartResult(uuid),
+            getChartResult(uuid, callContext),
             locale,
             uuid,
             linesVisible,
-            shapesVisible
+            shapesVisible,
+            callContext
         );
 
         if (chart == null) {
@@ -700,30 +956,51 @@
             outputStream,
             chart.generateChart(),
             null,
-            600, 400
+            width, height
         );
 
         log.debug("svg export finished.");
     }
 
 
+    /**
+     * This method creates a chart and returns it. In normal case, this is the
+     * only method to be overriden by subclasses to create other types of
+     * charts.
+     *
+     * @param chartLables Labels used to decorate the chart.
+     * @param theme The theme used to adjust the look of the chart.
+     * @param parameters A collection with parameters this chart contains.
+     * @param measurements A collection with measurement this chart contains.
+     * @param dates A collection with dates this chart contains.
+     * @param result The data collection used to be displayed in this chart.
+     * @param locale The Locale used to determine the language.
+     * @param uuid The uuid of the current artifact.
+     * @param linesVisible A boolean property to determine the visibility of
+     * lines connecting two points in a chart (not used in this chart type).
+     * @param shapesVisible A boolean property to determine the visiblity of
+     * datapoints in this chart (not used in this chart type).
+     * @param callContext The CallContext object.
+     * @return a timeseries chart.
+     */
     protected Chart getChart(
         ChartLabels  chartLables,
         ChartTheme   theme,
         Collection   parameters,
         Collection   measurements,
         Collection   dates,
-        Collection   result,
+        Object       result,
         Locale       locale,
         String       uuid,
         boolean      linesVisible,
-        boolean      shapesVisible
+        boolean      shapesVisible,
+        CallContext  callContext
     ) {
         Chart chart = null;
 
         if (CACHE_CHART) {
             log.info("Try to get timeseries chart from cache.");
-            chart = (Chart) getChartFromCache(uuid);
+            chart = (Chart) getChartFromCache(uuid, callContext);
         }
 
         if (chart != null)
@@ -736,7 +1013,7 @@
             parameters,
             measurements,
             dates,
-            result,
+            (Collection)result,
             timeGapDefinitions,
             locale,
             linesVisible,
@@ -752,6 +1029,13 @@
         return chart;
     }
 
+
+    /**
+     * Fetches the ChartTheme from <i>callContext</i> and returns it.
+     *
+     * @param callContext CallContext objects storing a chart theme.
+     * @return a chart theme.
+     */
     protected ChartTheme createStyle(CallContext callContext) {
         log.debug("Fetch chart theme from global context");
 
@@ -759,24 +1043,98 @@
             (GNVArtifactContext) callContext.globalContext();
 
         XMLChartTheme theme = (XMLChartTheme) context.get(
-            GNVArtifactContextFactory.CHARTTEMPLATE
-        );
+            GNVArtifactContext.CHART_TEMPLATE_KEY);
 
         return theme;
     }
 
+    /**
+     * Creates a ChartLabels object storing different labels used to decorate a
+     * chart.
+     *
+     * @param locale The Locale object to adjust the language of labels.
+     * @param uuid The UUID of the current artifact.
+     * @return the chart labels.
+     */
+    protected ChartLabels createChartLabels(Locale locale, String uuid) {
+        return new ChartLabels(
+            createChartTitle(locale, uuid),
+            createChartSubtitle(locale, uuid),
+            RessourceFactory.getInstance().getRessource(
+                locale,
+                domainLable,
+                domainLable
+            )
+        );
+    }
 
+
+    /**
+     * Creates and returns the chart title.
+     *
+     * @param locale The Locale used to adjust the language of the title.
+     * @param uuid The UUID of the current artifact.
+     * @return the name of the selected fis.
+     */
     protected String createChartTitle(Locale locale, String uuid) {
         return getFisName(locale);
 
     }
 
 
+    /**
+     * Creates and returns the subtitle of a chart. The subtitle in this class
+     * contains the station and the time interval.
+     *
+     * @param locale The Locale used to adjust the language of the subtitle.
+     * @param uuid The UUID of the current artifact.
+     * @return the selected feature.
+     */
     protected String createChartSubtitle(Locale locale, String uuid) {
-        return getSelectedFeatureName(uuid);
+        String subtitle = "";
+        subtitle       += getSelectedFeatureName(uuid);
+
+        InputData data = inputData.get(timeIntervalValueName);
+        if (data != null){
+            Object describeData = data.getObject();
+            if (describeData instanceof MinMaxDescribeData) {
+                MinMaxDescribeData tmp = (MinMaxDescribeData) describeData;
+
+                DateFormat format = DateFormat.getDateTimeInstance(
+                    DateFormat.MEDIUM, DateFormat.SHORT, locale);
+
+                String lDateStr = (String) tmp.getMinValue();
+                String rDateStr = (String) tmp.getMaxValue();
+
+                try {
+                    Date lDate = srcFormat.parse(lDateStr);
+                    Date rDate = srcFormat.parse(rDateStr);
+
+                    String interval = format.format(lDate);
+                    interval       += " - ";
+                    interval       += format.format(rDate);
+
+                    if (subtitle != null && subtitle.length() > 0)
+                        subtitle += ", ";
+
+                    subtitle += interval;
+                }
+                catch (ParseException pe) {
+                    log.error(pe, pe);
+                }
+            }
+        }
+
+        return subtitle;
     }
 
 
+    /**
+     * Returns the selected fis name.
+     *
+     * @param locale The Locale object used to adjust the language.
+     * @return the name of the fis.
+     */
     protected String getFisName(Locale locale) {
         String    returnValue = "";
         InputData input       = inputData.get("fisname");
@@ -794,13 +1152,58 @@
     }
 
 
+    /**
+     * Returns the name of the selected object in the collection specified by
+     * <i>key</i>.
+     *
+     * @param uuid The UUID of the current artifat.
+     * @param key A key to specify a collection.
+     * @return the name of the selected item.
+     */
+    protected String getSelectedInputDataName(String uuid, String key) {
+        Collection values = getCollection(key, uuid);
+
+        if (values != null) {
+            Iterator it = values.iterator();
+
+            while (it.hasNext()) {
+                KeyValueDescibeData data = (KeyValueDescibeData) it.next();
+
+                if (data.isSelected()) {
+                    return data.getValue();
+                }
+            }
+        }
+        return null;
+    }
+
+
+    /**
+     * Returns a collection of selected parameters.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @return selected parameters.
+     */
     protected Collection<KeyValueDescibeData> getParameters(String uuid) {
         return this.getCollection(parameterValuesName, uuid);
     }
 
+    /**
+     * Returns a collection of selected measurements.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @return selected measurements.
+     */
     protected Collection<KeyValueDescibeData> getMeasurements(String uuid) {
         return this.getCollection(measuremenValueName, uuid);
     }
+
+    /**
+     * Returns a collection of selected dates.
+     *
+     * @param uuid The UUID of the current artifact.
+     * @return selected dates.
+     */
     protected Collection<KeyValueDescibeData> getDates(String uuid) {
         return this.getCollection(dateValueName,uuid);
     }
@@ -823,7 +1226,12 @@
         if (measurementNameValue != null) {
             this.measuremenValueName = measurementNameValue;
         }
-        
+        String timeIntervalValue = Config.getStringXPath(configuration,
+                "value-names/value-name[@name='timeinterval']/@value");
+        if (timeIntervalValue != null){
+            this.timeIntervalValueName = timeIntervalValue;
+        }
+
         String dateNameValue = Config.getStringXPath(configuration,
         "value-names/value-name[@name='date']/@value");
         if (dateNameValue != null) {
@@ -840,8 +1248,8 @@
                         gapDefinition = (Element)new ArtifactXMLUtilities().
                                                      readConfiguration(absolutFileName);
                     }
-                    
-                    NodeList gapDefinitions = Config.getNodeSetXPath(gapDefinition, 
+
+                    NodeList gapDefinitions = Config.getNodeSetXPath(gapDefinition,
                                                                     "/time-gaps/time-gap");
                     if (gapDefinition != null){
                         timeGapDefinitions = new ArrayList<TimeGap>(gapDefinitions.
@@ -852,37 +1260,59 @@
                             int key = Integer.parseInt(gapNode.getAttribute("key"));
                             int value = Integer.parseInt(gapNode.getAttribute("gap"));
                             log.info("Add new Timegap: "+key+" "+value+" "+ unit);
-                            timeGapDefinitions.add(new DefaultTimeGap(unit, 
-                                                                      key, 
+                            timeGapDefinitions.add(new DefaultTimeGap(unit,
+                                                                      key,
                                                                       value));
                         }
                     }
-                    
                 }
             }
         }
     }
-    
+
+
     /**
-     * @param collectionName
-     * @return
+     * Creates a <code>NamedArrayList</code> storing some <code>
+     * KeyValueDescibeData</code> objects found in the input data with the key
+     * <i>collectionName</i>.
+     *
+     * @param collectionName String to specify the input data.
+     * @param uuid The UUID of the current artifact.
+     * @return a collection with values from input data.
      */
     protected Collection<KeyValueDescibeData> getCollection(
-                                                            String collectionName, 
-                                                            String uuid) {
-        Iterator<Object> it = this.getDescibeData(uuid).iterator();
-        while (it.hasNext()) {
+        String collectionName,
+        String uuid)
+    {
+        log.debug("Search for input data: " + collectionName);
+        NamedCollection<KeyValueDescibeData> c = new NamedArrayList<KeyValueDescibeData>(collectionName);
 
-            Object o = it.next();
+        InputData data = null;
+        State parent   = this;
+        do {
+            data = parent.inputData().get(collectionName);
 
-            if (o instanceof NamedCollection<?>) {
-                NamedCollection<KeyValueDescibeData> nc = (NamedCollection<KeyValueDescibeData>) o;
-                if (nc.getName().equals(collectionName)) {
-                    return nc;
-                }
+            if (data != null) {
+                break;
             }
         }
-        return null;
+        while ((parent = parent.getParent()) != null);
+
+        if (data == null) {
+            log.warn("No collection found with name: " + collectionName);
+            return c;
+        }
+
+        String[] descs  = data.getDescription();
+        String[] values = data.splitValue();
+        int        size = values.length;
+
+        for (int i = 0; i < size; i++){
+            c.add(new DefaultKeyValueDescribeData(
+                values[i], descs[i], getID()));
+        }
+
+        return c;
     }
 }
 // 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/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.state.timeseries;
+
+import au.com.bytecode.opencsv.CSVWriter;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.artifacts.cache.CacheFactory;
+
+import de.intevation.gnv.chart.Chart;
+import de.intevation.gnv.chart.ChartLabels;
+import de.intevation.gnv.chart.TimeSeriesVectorChart;
+
+import de.intevation.gnv.exports.DefaultExport;
+import de.intevation.gnv.exports.DefaultProfile;
+import de.intevation.gnv.exports.Export;
+import de.intevation.gnv.exports.Export.Profile;
+import de.intevation.gnv.exports.SimpleOdvDataCollector;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.utils.VectorDataProcessor;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.exception.StateException;
+
+import de.intevation.gnv.statistics.Statistics;
+import de.intevation.gnv.statistics.TimeseriesVectorStatistics;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import java.util.Collection;
+import java.util.Locale;
+import java.util.Map;
+
+import net.sf.ehcache.Cache;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.ChartTheme;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class TimeSeriesVectorOutputState extends TimeSeriesOutputState {
+
+    private static Logger logger =
+        Logger.getLogger(TimeSeriesVectorOutputState.class);
+
+    public static final String[] RESULT_COLUMNS = {
+       "YORDINATE", "XORDINATE", "GROUP1", "GROUP2", "GROUP3", "GAPID", "SERIES"
+    };
+
+    public static final String[] ODV_COLUMN_HEADERS = {
+        "Cruise",
+        "Station",
+        "Type",
+        "yyyy-mm-dd hh:mm",
+        "Lon (°E)",
+        "Lat (°N)",
+        "Bot. Depth [m]",
+        "Depth [m]",
+        "QF",
+        "XComponent",
+        "QF",
+        "YComponent",
+        "QF",
+        "ZComponent",
+        "QF",
+        "Speed",
+        "QF",
+        "Direction",
+        "QF"
+    };
+
+    public static final String[] ODV_PROFILE_NAMES = {
+        "CRUISE",
+        "STATION",
+        "TYPE",
+        "TIMEVALUE",
+        "SHAPE",
+        "BOTDEPTH",
+        "DEPTH",
+        "QF",
+        "XCOMPONENT",
+        "QF",
+        "YCOMPONENT",
+        "QF",
+        "ZCOMPONENT",
+        "QF",
+        "SPEED",
+        "QF",
+        "DIRECTION",
+        "QF"};
+
+    public TimeSeriesVectorOutputState() {
+    }
+
+
+    @Override
+    protected Object getChartResult(String uuid, CallContext callContext) {
+        logger.debug("OutputStateBase.getChartResult");
+        CacheFactory factory = CacheFactory.getInstance();
+
+        if (factory.isInitialized()) {
+            // we use a cache
+            logger.info("Using cache.");
+            Cache cache = factory.getCache();
+            String key  = "chart_" + getHash();
+
+            net.sf.ehcache.Element value = cache.get(key);
+            if (value != null) {
+                logger.debug("Found element in cache.");
+                return value.getObjectValue();
+            }
+            else {
+                logger.debug("Element not in cache, we ask the database");
+                Collection<Result> res = (Collection<Result>)getData(queryID);
+                res = VectorDataProcessor.process(res, RESULT_COLUMNS);
+                cache.put(new net.sf.ehcache.Element(key, res));
+
+                return res;
+            }
+        }
+        else {
+            // we don't use a cache, so we have to query the database every
+            // single time
+            logger.info("Not using a cache.");
+            return VectorDataProcessor.process(
+                getData(queryID), RESULT_COLUMNS);
+        }
+    }
+
+
+    @Override
+    protected Chart getChart(
+        ChartLabels  chartLables,
+        ChartTheme   theme,
+        Collection   parameters,
+        Collection   measurements,
+        Collection   dates,
+        Object       result,
+        Locale       locale,
+        String       uuid,
+        boolean      linesVisible,
+        boolean      shapesVisible,
+        CallContext  callContext
+    ) {
+        Chart chart = new TimeSeriesVectorChart(
+            chartLables,
+            theme,
+            parameters,
+            measurements,
+            dates,
+            (Collection)result,
+            timeGapDefinitions,
+            locale,
+            linesVisible,
+            shapesVisible
+        );
+        chart.generateChart();
+
+        return chart;
+    }
+
+
+    @Override
+    protected Chart[] getHistograms(
+        String      uuid,
+        CallContext callContext,
+        Collection<KeyValueDescibeData>  parameters,
+        Collection<KeyValueDescibeData>  measurements,
+        Collection<KeyValueDescibeData>  dates,
+        Map         requestParameter
+    ) {
+        Collection results = (Collection) getChartResult(uuid, callContext);
+        ChartTheme theme   = createStyle(callContext);
+
+        return VectorDataProcessor.getHistograms(
+            uuid, callContext, results, theme, requestParameter);
+    }
+
+
+    @Override
+    protected void createODV(
+        OutputStream outputStream, Collection result, String uuid)
+    throws IOException, StateException
+    {
+        logger.info("Start exporting " + result.size() + " items to odv.");
+        Export export = new DefaultExport(
+            new SimpleOdvDataCollector(ODV_PROFILE_NAMES));
+
+        Profile profile = new DefaultProfile(
+            ODV_COLUMN_HEADERS,
+            '\t',
+            CSVWriter.NO_QUOTE_CHARACTER,
+            CSVWriter.NO_ESCAPE_CHARACTER,
+            "ODV",
+            "ISO-8859-1");
+
+        export.create(profile, outputStream, result);
+    }
+
+
+    protected Statistics getStatisticsGenerator() {
+        return new TimeseriesVectorStatistics();
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+State classes used by artifacts representing 'Zeitserien' to handle input and
+output.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/AbstractStatistics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.statistics;
+
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+
+import org.apache.commons.math.stat.regression.SimpleRegression;
+
+import org.apache.log4j.Logger;
+
+/**
+ * An abstract implementation of <code>Statistics</code> with a default
+ * implementation of the {@link #generateStatisticsValues(org.apache.commons.math.stat.descriptive.DescriptiveStatistics, org.apache.commons.math.stat.regression.SimpleRegression, java.lang.String)}
+ * method.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public abstract class AbstractStatistics
+implements            Statistics
+{
+    private static Logger log = Logger.getLogger(
+        AbstractStatistics.class);
+
+    public AbstractStatistics() {
+    }
+
+    /**
+     * This method takes a statistics object and puts relevant values into a
+     * <code>StatisticSet</code>.
+     *
+     * @param lStatistics A statistics object.
+     * @param lRegression A simple regression.
+     * @param statisticName Name for the resulting statistic.
+     * @return a set of statistics.
+     */
+    protected StatisticSet generateStatisticsValues(
+        DescriptiveStatistics lStatistics,
+        SimpleRegression      lRegression,
+        String                statisticName
+    ) {
+        StatisticSet statisticSet = new StatisticSet(statisticName);
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.arithmeticMean",
+                lStatistics.getMean()));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.kurtosis",
+                lStatistics.getKurtosis()));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.max",
+                lStatistics.getMax()));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.min",
+                lStatistics.getMin()));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.n",
+                lStatistics.getN()));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.percentile.90",
+                lStatistics.getPercentile(90)));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.percentile.75",
+                lStatistics.getPercentile(75)));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.percentile.50",
+                lStatistics.getPercentile(50)));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.percentile.10",
+                lStatistics.getPercentile(10)));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.deviation",
+                lStatistics.getStandardDeviation()));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.variance",
+                lStatistics.getVariance()));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.intercept",
+                lRegression.getIntercept()));
+
+        statisticSet.addStatistic(
+            new Statistic(
+                "gnviewer.statistics.descriptive.slope",
+                lRegression.getSlope()));
+
+        return statisticSet;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
+
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalProfileStatistics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.statistics;
 
 import java.sql.SQLException;
@@ -17,19 +22,21 @@
 import de.intevation.gnv.utils.DistanceCalculator;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This class is used to create a statistic for 'Horizontalprofil' products.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class HorizontalProfileStatistics extends TimeseriesStatistics {
-    
+
     private static Logger log = Logger.getLogger(HorizontalProfileStatistics.class);
 
     private WKTReader wktReader = new WKTReader();
-    
+
     private DistanceCalculator dc = new DistanceCalculator();
-    
+
     private double distance = 0;
-    
+
     /**
      * Constructor
      */
@@ -37,17 +44,15 @@
         super();
     }
 
-    /**
-     * @see de.intevation.gnv.statistics.TimeseriesStatistics#calculateXOrdinateValue(de.intevation.gnv.geobackend.base.Result, de.intevation.gnv.geobackend.base.Result)
-     */
+
     @Override
     protected double calculateXOrdinateValue(Result previousRow,Result row)
                      throws SQLException {
         try {
             Point start = (Point)this.wktReader.read(previousRow.getString("SHAPE"));
             Point current = (Point)this.wktReader.read(row.getString("SHAPE"));
-            double delta = this.dc.calculateDistance(start, current);
-            
+            double delta = DistanceCalculator.calculateDistance(start, current);
+
             if (!Double.isNaN(delta)){
                 this.distance = this.distance + delta;
             }
@@ -57,9 +62,7 @@
         return this.distance;
     }
 
-    /**
-     * @see de.intevation.gnv.statistics.TimeseriesStatistics#generateStatisticsName(java.lang.String, java.lang.String, java.lang.String, java.util.Collection, java.util.Collection, java.util.Collection)
-     */
+
     @Override
     protected String generateStatisticsName(
                                             String break1,
@@ -68,14 +71,12 @@
                                             Collection<KeyValueDescibeData> parameters,
                                             Collection<KeyValueDescibeData> measurements,
                                             Collection<KeyValueDescibeData> dates) {
-        return (this.findValueTitle(parameters, break1)+ " "+ 
+        return (this.findValueTitle(parameters, break1)+ " "+
                 this.findValueTitle(measurements,break2)).trim()+" "+
                 this.findValueTitle(dates,break3);
     }
-    
-    /**
-     * @see de.intevation.gnv.statistics.TimeseriesStatistics#clearStatistics()
-     */
+
+
     @Override
     protected void clearStatistics() {
         log.debug("HorizontalProfileStatistics.clearStatistics");
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/HorizontalProfileVectorStatistics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.statistics;
+
+import com.vividsolutions.jts.geom.Point;
+import com.vividsolutions.jts.io.ParseException;
+import com.vividsolutions.jts.io.WKTReader;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import de.intevation.gnv.utils.DistanceCalculator;
+
+import java.sql.SQLException;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class HorizontalProfileVectorStatistics
+extends      VectorStatistics
+{
+
+    private static Logger logger =
+        Logger.getLogger(HorizontalProfileVectorStatistics.class);
+
+    private WKTReader wktReader = new WKTReader();
+
+    private double distance;
+
+
+    public HorizontalProfileVectorStatistics() {
+        distance = 0;
+    }
+
+
+    protected void clear() {
+        distance = 0;
+    }
+
+
+    protected int getValueIdx(ResultDescriptor rd) {
+        return rd.getColumnIndex("YORDINATE");
+    }
+
+
+    protected double calculateXOrdinateValue(Result prev, Result row)
+    throws SQLException
+    {
+        try {
+            Point start   = (Point) wktReader.read(prev.getString("SHAPE"));
+            Point current = (Point) wktReader.read(row.getString("SHAPE"));
+
+            double delta = DistanceCalculator.calculateDistance(start, current);
+
+            distance = !Double.isNaN(delta) ? distance + delta : distance;
+        }
+        catch (ParseException e) {
+            logger.error(e,e);
+        }
+        return distance;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistic.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistic.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,61 +1,81 @@
-/**
- * Title:           Statistic, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v 1.2 2007/12/21 12:31:15 blume Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     14.12.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: blume $
- * modified on:     $Date: 2007/12/21 12:31:15 $
- * Version:         $Revision: 1.2 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.statistics;
-
-import org.apache.log4j.Logger;
-
-/**
- * The class <code>Statistic</code> fulfills the following purposes:
- * <ol>
- * <li></li>
- * </ol>
- * 
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 14.12.2007 09:38:18
- */
-public class Statistic {
-
-    /**
-     * Default Logging instance
-     */
-    private static Logger sLogger = Logger.getLogger(Statistic.class);
-    private static boolean sDebug = sLogger.isDebugEnabled();
-
-    private double mValue;
-    private String mKey;
-
-    public Statistic(String pKey, double pValue) {
-        mKey = pKey;
-        mValue = pValue;
-    }
-
-    public double getValue() {
-        return mValue;
-    }
-
-    public String getKey() {
-        return mKey;
-    }
-
-    public String getStringValue() {
-        java.text.DecimalFormat df = new java.text.DecimalFormat("#.##");
-        return df.format(mValue);
-    }
-
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+/**
+ * Title:           Statistic, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v 1.2 2007/12/21 12:31:15 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistic.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     14.12.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2007/12/21 12:31:15 $
+ * Version:         $Revision: 1.2 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.statistics;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class stores a double value with a specific key.
+ *
+ * @author blume
+ */
+public class Statistic {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(Statistic.class);
+    private static boolean sDebug = sLogger.isDebugEnabled();
+
+    private double mValue;
+    private String mKey;
+
+    /**
+     * Creates a new Statistic with a given key and a value.
+     * @param pKey The key.
+     * @param pValue The value.
+     */
+    public Statistic(String pKey, double pValue) {
+        mKey = pKey;
+        mValue = pValue;
+    }
+
+    /**
+     * Returns the value.
+     * @return the value.
+     */
+    public double getValue() {
+        return mValue;
+    }
+
+    /**
+     * Returns the key.
+     * @return the key.
+     */
+    public String getKey() {
+        return mKey;
+    }
+
+    /**
+     * Turns the value into string representation and returns it.<br>
+     * <b>Attention:</b> This method doesn't take a locale into account.
+     *
+     * @return the value as string.
+     */
+    public String getStringValue() {
+        java.text.DecimalFormat df = new java.text.DecimalFormat("#.##");
+        return df.format(mValue);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/StatisticSet.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/StatisticSet.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,40 +1,60 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.statistics;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * A container to store several statistics.
  *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class StatisticSet {
 
-    
+
     private String name = null;
-    
+
     private Collection<Statistic> statistics = new ArrayList<Statistic>();
-    
+
     /**
      * Constructor
+     * @param name Name of this container.
      */
     public StatisticSet(String name) {
         this.name = name;
     }
-    
-    
+
+
+    /**
+     * Add a further statistic to this container.
+     *
+     * @param statistic A statistic.
+     */
     public void addStatistic(Statistic statistic){
         this.statistics.add(statistic);
     }
-    
+
+    /**
+     * Returns all statistics in this container.
+     * @return all statistics.
+     */
     public Collection<Statistic> getStatistics(){
         return this.statistics;
     }
-    
+
+    /**
+     * Returns the name of this container.
+     * @return the name.
+     */
     public String getName(){
         return this.name;
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistics.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/Statistics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,55 +1,59 @@
-/**
- * Title:           Statistics, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistics.java,v 1.2 2008/01/30 12:38:34 blume Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistics.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     14.12.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: blume $
- * modified on:     $Date: 2008/01/30 12:38:34 $
- * Version:         $Revision: 1.2 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.statistics;
-
-import java.util.Collection;
-
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.describedata.KeyValueDescibeData;
-import de.intevation.gnv.statistics.exception.StatisticsException;
-
-/**
- * The interface <code>Statistics</code> fulfills the following purposes:
- * <ol>
- * <li>Providng a marker interface for statistics.</li>
- * </ol>
- * 
- * @author blume
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 14.12.2007 09:34:32
- */
-public interface Statistics {
-
-   /**
-    * 
-    * @param resultSet
-    * @param parameters
-    * @param measurements
-    * @param dates
-    * @return
-    * @throws StatisticsException
-    */
-    public Collection<StatisticSet>  calculateStatistics(
-                                                     Collection<Result> resultSet,
-                                                     Collection<KeyValueDescibeData> parameters,
-                                                     Collection<KeyValueDescibeData> measurements,
-                                                     Collection<KeyValueDescibeData> dates
-                                                     )
-                                                    throws StatisticsException;
-
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+/**
+ * Title:           Statistics, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistics.java,v 1.2 2008/01/30 12:38:34 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/Statistics.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     14.12.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2008/01/30 12:38:34 $
+ * Version:         $Revision: 1.2 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.statistics;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+
+import de.intevation.gnv.statistics.exception.StatisticsException;
+
+import java.util.Collection;
+
+/**
+ * This interface defines one single method to calculate a statistic for a
+ * given data set.
+ *
+ * @author blume
+ */
+public interface Statistics {
+
+   /**
+    * This method takes a data set and creates a statistic from it.
+    *
+    * @param resultSet The resulting statistic is about this data set.
+    * @param parameters A collection of parameters.
+    * @param measurements A collection of measurements.
+    * @param dates A collection of dates.
+    * @return a collection of statistics.
+    * @throws StatisticsException if an error occured while creating the
+    * statistic.
+    */
+    public Collection<StatisticSet>  calculateStatistics(
+         Object                          resultSet,
+         Collection<KeyValueDescibeData> parameters,
+         Collection<KeyValueDescibeData> measurements,
+         Collection<KeyValueDescibeData> dates
+    )
+    throws StatisticsException;
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/TimeseriesStatistics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,235 +1,234 @@
-/**
- * Title:           TimeseriesStatistics, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/TimeseriesStatistics.java,v 1.3 2008/08/18 14:50:33 drewnak Exp $
- * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/TimeseriesStatistics.java,v $
- * created by:      Stefan Blume (blume)
- * erstellt am:     06.12.2007
- * Copyright:       con terra GmbH, 2005
- *
- * modified by:     $Author: drewnak $
- * modified on:     $Date: 2008/08/18 14:50:33 $
- * Version:         $Revision: 1.3 $
- * TAG:             $Name:  $
- * locked from:     $Locker:  $
- * CVS State:       $State: Exp $
- * Project:         $ProjectName$
- */
-package de.intevation.gnv.statistics;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
-import org.apache.commons.math.stat.regression.SimpleRegression;
-import org.apache.log4j.Logger;
-
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.describedata.KeyValueDescibeData;
-import de.intevation.gnv.statistics.exception.StatisticsException;
-
-/**
- * The class <code>TimeseriesStatistics</code> fulfills the following purposes:
- * <ol>
- * <li></li>
- * </ol>
- * 
- * @author blume
- * @author Tim Englich <tim.englich@intevation.de>
- * @version 1.0
- * @serial 1.0
- * @see
- * @since 06.12.2007 18:02:27
- */
-public class TimeseriesStatistics implements Statistics {
-
-    /**
-     * Default Logging instance
-     */
-    private static Logger log = Logger.getLogger(TimeseriesStatistics.class);
-
-    /**
-     * Constructor
-     */
-    public TimeseriesStatistics() {
-        super();
-    }
-
-    /**
-     * @see de.intevation.gnv.statistics.Statistics#calculateStatistics(java.util.Collection, java.util.Collection, java.util.Collection, java.util.Collection)
-     */
-    public Collection<StatisticSet> calculateStatistics(
-                                                     Collection<Result> resultSet,
-                                                     Collection<KeyValueDescibeData> parameters,
-                                                     Collection<KeyValueDescibeData> measurements,
-                                                     Collection<KeyValueDescibeData> dates
-                                                     )
-                                                     throws StatisticsException {
-        this.clearStatistics();
-        DescriptiveStatistics lStatistics = null;
-        SimpleRegression lRegression = null;
-        Collection<StatisticSet> statisticSets = new ArrayList<StatisticSet>();
-        String break1, break2, break3;
-        int lSeries = 1;
-        try {
-
-            Iterator<Result> resultIterator = resultSet.iterator();
-            if (resultIterator.hasNext()) {
-                Result row = resultIterator.next();
-                Result previousRow = row;
-                break1 = row.getString("GROUP1");
-                break2 = row.getString("GROUP2");
-                break3 = row.getString("GROUP3");
-                lRegression = new SimpleRegression();
-                lStatistics = new DescriptiveStatistics();
-                while (resultIterator.hasNext()) {
-
-                    if (!break1.equals(row.getString("GROUP1"))
-                        || !break2.equals(row.getString("GROUP2"))
-                        || !break3.equals(row.getString("GROUP3"))
-                        ) {
-                        String statisticsName = this.generateStatisticsName(break1, break2, 
-                                                                            break3, parameters, 
-                                                                            measurements, dates);
-                        statisticSets.add(this.generateStatisticsValues(lStatistics, 
-                                                                        lRegression,
-                                                                        statisticsName));
-
-                        lStatistics.clear();
-                        lRegression.clear();
-                        
-                        this.clearStatistics();
-
-                        lStatistics.addValue(row.getDouble("YORDINATE"));
-                        Double x = this.calculateXOrdinateValue(previousRow,row);
-                        lRegression.addData(x, row.getDouble("YORDINATE"));
-
-                        break1 = row.getString("GROUP1");
-                        break2 = row.getString("GROUP2");
-                        break3 = row.getString("GROUP3");
-                        previousRow = row;
-                        row = resultIterator.next();
-                        lSeries++;
-                    } else {
-
-                        lStatistics.addValue(row.getDouble("YORDINATE"));
-                        Double x = this.calculateXOrdinateValue(previousRow, row);
-                        lRegression.addData(x, row.getDouble("YORDINATE"));
-                        previousRow = row;
-                        row = resultIterator.next();
-                    }
-
-                }
-                
-                lStatistics.addValue(row.getDouble("YORDINATE"));
-                Double x = this.calculateXOrdinateValue(previousRow, row);
-                lRegression.addData(x, row.getDouble("YORDINATE"));
-                
-                String statisticsName = this.generateStatisticsName(break1, break2, 
-                                                                    break3, parameters, 
-                                                                    measurements, dates);
-                
-                statisticSets.add(this.generateStatisticsValues(lStatistics, 
-                                                                lRegression, 
-                                                                statisticsName));
-                lStatistics.clear();
-                lRegression.clear();
-            }
-        } catch (Exception e) {
-            log.error(e.getMessage(), e);
-        }
-
-        return statisticSets;
-    }
-
-    protected void clearStatistics(){}
-    
-    /**
-     * 
-     * @param break1
-     * @param break2
-     * @param break3
-     * @param parameters
-     * @param measurements
-     * @param dates
-     * @return
-     */
-    protected String generateStatisticsName(String break1, 
-                                            String break2,
-                                            String break3,
-                                            Collection<KeyValueDescibeData> parameters,
-                                            Collection<KeyValueDescibeData> measurements,
-                                            Collection<KeyValueDescibeData> dates){
-        log.debug("TimeseriesStatistics.generateStatisticsName");
-        return this.findValueTitle(parameters,break1)+ " "+
-               this.findValueTitle(measurements,break2) + "m";
-    }
-    
-    
-    protected String findValueTitle(Collection<KeyValueDescibeData> values,
-                                  String id) {
-        log.debug("TimeseriesStatistics.findValueTitle "+ id);
-        if (values != null) {
-            Iterator<KeyValueDescibeData> it = values.iterator();
-            while (it.hasNext()) {
-                KeyValueDescibeData data = it.next();
-                if (id.equals(data.getKey())) {
-                    return data.getValue();
-                }
-            }
-        }
-        return "";
-    }
-    protected double calculateXOrdinateValue(Result previousRow, Result row) throws SQLException {
-        return new Double((row.getDate("XORDINATE")).getTime() / 1000 / 3600);
-    }
-
-    /**
-     * @param lStatistics
-     * @param lRegression
-     * @param lStats
-     * @param lSeries
-     */
-    private StatisticSet generateStatisticsValues(DescriptiveStatistics lStatistics,
-                                     SimpleRegression lRegression, String  statisticName) {
-        
-        StatisticSet statisticSet = new StatisticSet(statisticName);
-        
-        statisticSet.addStatistic(new Statistic(
-                "gnviewer.statistics.descriptive.arithmeticMean", lStatistics
-                        .getMean()));
-        statisticSet.addStatistic(new Statistic(
-                "gnviewer.statistics.descriptive.kurtosis", lStatistics
-                        .getKurtosis()));
-        statisticSet.addStatistic(new Statistic("gnviewer.statistics.descriptive.max",
-                lStatistics.getMax()));
-        statisticSet.addStatistic(new Statistic("gnviewer.statistics.descriptive.min",
-                lStatistics.getMin()));
-        statisticSet.addStatistic(new Statistic("gnviewer.statistics.descriptive.n",
-                lStatistics.getN()));
-        statisticSet.addStatistic(new Statistic(
-                "gnviewer.statistics.descriptive.percentile.90", lStatistics
-                        .getPercentile(90)));
-        statisticSet.addStatistic(new Statistic(
-                "gnviewer.statistics.descriptive.percentile.75", lStatistics
-                        .getPercentile(75)));
-        statisticSet.addStatistic(new Statistic(
-                "gnviewer.statistics.descriptive.percentile.50", lStatistics
-                        .getPercentile(50)));
-        statisticSet.addStatistic(new Statistic(
-                "gnviewer.statistics.descriptive.percentile.10", lStatistics
-                        .getPercentile(10)));
-        statisticSet.addStatistic(new Statistic(
-                "gnviewer.statistics.descriptive.deviation", lStatistics
-                        .getStandardDeviation()));
-        statisticSet.addStatistic(new Statistic(
-                "gnviewer.statistics.descriptive.variance", lStatistics
-                        .getVariance()));
-        statisticSet.addStatistic(new Statistic(
-                "gnviewer.statistics.descriptive.intercept", lRegression
-                        .getIntercept()));
-        statisticSet.addStatistic(new Statistic("gnviewer.statistics.descriptive.slope",
-                lRegression.getSlope()));
-        return statisticSet;
-    }
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+/**
+ * Title:           TimeseriesStatistics, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/TimeseriesStatistics.java,v 1.3 2008/08/18 14:50:33 drewnak Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/output/statistics/TimeseriesStatistics.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     06.12.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: drewnak $
+ * modified on:     $Date: 2008/08/18 14:50:33 $
+ * Version:         $Revision: 1.3 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.statistics;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+
+import de.intevation.gnv.statistics.exception.StatisticsException;
+
+import java.sql.SQLException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+
+import org.apache.commons.math.stat.regression.SimpleRegression;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class is used to create a statistic in timeseries products.
+ *
+ * @author blume
+ */
+public class TimeseriesStatistics
+extends      AbstractStatistics
+{
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger log = Logger.getLogger(TimeseriesStatistics.class);
+
+    /**
+     * Constructor
+     */
+    public TimeseriesStatistics() {
+    }
+
+
+    public Collection<StatisticSet> calculateStatistics(
+        Object                          result,
+        Collection<KeyValueDescibeData> parameters,
+        Collection<KeyValueDescibeData> measurements,
+        Collection<KeyValueDescibeData> dates
+    )
+    throws StatisticsException {
+
+        if (!(result instanceof Collection)) {
+            return new ArrayList<StatisticSet>();
+        }
+
+        Collection<Result> resultSet = (Collection<Result>)result;
+
+        clearStatistics();
+
+        DescriptiveStatistics lStatistics = null;
+        SimpleRegression lRegression = null;
+        Collection<StatisticSet> statisticSets = new ArrayList<StatisticSet>();
+        String break1, break2, break3;
+        int lSeries = 1;
+
+        if (resultSet == null) {
+            return statisticSets;
+        }
+
+        int b1Idx = -1;
+        int b2Idx = -1;
+        int b3Idx = -1;
+        int yIdx  = -1;
+        try {
+
+            Iterator<Result> resultIterator = resultSet.iterator();
+            if (resultIterator.hasNext()) {
+                Result row = resultIterator.next();
+                Result previousRow = row;
+
+                if (b1Idx == -1) {
+                    ResultDescriptor rd = row.getResultDescriptor();
+                    b1Idx = rd.getColumnIndex("GROUP1");
+                    b2Idx = rd.getColumnIndex("GROUP2");
+                    b3Idx = rd.getColumnIndex("GROUP3");
+                    yIdx  = rd.getColumnIndex("YORDINATE");
+
+                    if (b1Idx == -1 || b2Idx == -1 || b3Idx == -1 || yIdx == -1) {
+                        return statisticSets;
+                    }
+                }
+                break1 = row.getString(b1Idx);
+                break2 = row.getString(b2Idx);
+                break3 = row.getString(b3Idx);
+                lRegression = new SimpleRegression();
+                lStatistics = new DescriptiveStatistics();
+                while (resultIterator.hasNext()) {
+
+                    if (!break1.equals(row.getString(b1Idx))
+                        || !break2.equals(row.getString(b2Idx))
+                        || !break3.equals(row.getString(b3Idx))
+                        ) {
+                        String statisticsName = generateStatisticsName(
+                            break1, break2,
+                            break3, parameters,
+                            measurements, dates);
+
+                        statisticSets.add(
+                            generateStatisticsValues(
+                                lStatistics,
+                                lRegression,
+                                statisticsName));
+
+                        lStatistics.clear();
+                        lRegression.clear();
+
+                        clearStatistics();
+
+                        Double yValue = row.getDouble(yIdx);
+
+                        if (yValue != null) {
+                            lStatistics.addValue(yValue);
+                            Double x = calculateXOrdinateValue(previousRow,row);
+                            lRegression.addData(x, yValue);
+                        }
+
+                        break1 = row.getString(b1Idx);
+                        break2 = row.getString(b2Idx);
+                        break3 = row.getString(b3Idx);
+                        previousRow = row;
+                        row = resultIterator.next();
+                        lSeries++;
+                    } else {
+
+                        Double value = row.getDouble(yIdx);
+                        if (value != null) {
+                            lStatistics.addValue(value.doubleValue());
+                            Double x = calculateXOrdinateValue(previousRow,row);
+                            lRegression.addData(x, value.doubleValue());
+                        }
+                        previousRow = row;
+                        row = resultIterator.next();
+                    }
+
+                }
+
+                Double yValue = row.getDouble(yIdx);
+
+                if (yValue != null) {
+                    lStatistics.addValue(yValue);
+                    Double x = calculateXOrdinateValue(previousRow, row);
+                    lRegression.addData(x, yValue);
+                }
+
+                String statisticsName = generateStatisticsName(
+                    break1, break2,
+                    break3, parameters,
+                    measurements, dates);
+
+                statisticSets.add(generateStatisticsValues(
+                    lStatistics,
+                    lRegression,
+                    statisticsName));
+                lStatistics.clear();
+                lRegression.clear();
+            }
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+
+        return statisticSets;
+    }
+
+    /**
+     * Nothing is done here.
+     */
+    protected void clearStatistics(){}
+
+
+    protected String generateStatisticsName(String break1,
+                                            String break2,
+                                            String break3,
+                                            Collection<KeyValueDescibeData> parameters,
+                                            Collection<KeyValueDescibeData> measurements,
+                                            Collection<KeyValueDescibeData> dates){
+        log.debug("TimeseriesStatistics.generateStatisticsName");
+        return this.findValueTitle(parameters,break1)+ " "+
+               this.findValueTitle(measurements,break2) + "m";
+    }
+
+
+    protected String findValueTitle(Collection<KeyValueDescibeData> values,
+                                  String id) {
+        log.debug("TimeseriesStatistics.findValueTitle "+ id);
+        if (values != null) {
+            Iterator<KeyValueDescibeData> it = values.iterator();
+            while (it.hasNext()) {
+                KeyValueDescibeData data = it.next();
+                if (id.equals(data.getKey())) {
+                    return data.getValue();
+                }
+            }
+        }
+        return "";
+    }
+
+
+    protected double calculateXOrdinateValue(Result previousRow, Result row) throws SQLException {
+        return new Double((row.getDate("XORDINATE")).getTime() / 1000 / 3600);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/TimeseriesVectorStatistics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.statistics;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import java.sql.SQLException;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class TimeseriesVectorStatistics
+extends      VectorStatistics
+{
+    public TimeseriesVectorStatistics() {
+    }
+
+
+    protected void clear() {
+        // nothing to clear
+    }
+
+
+    protected int getValueIdx(ResultDescriptor rd) {
+        return rd.getColumnIndex("YORDINATE");
+    }
+
+
+    protected double calculateXOrdinateValue(Result prev, Result row)
+    throws SQLException
+    {
+        return new Double((row.getDate("XORDINATE")).getTime() / 1000 / 3600);
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VectorStatistics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.statistics;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+
+import de.intevation.gnv.statistics.exception.StatisticsException;
+
+import java.sql.SQLException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+
+import org.apache.commons.math.stat.regression.SimpleRegression;
+
+import org.apache.log4j.Logger;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public abstract class VectorStatistics
+extends      AbstractStatistics
+{
+    private static Logger logger =
+        Logger.getLogger(VectorStatistics.class);
+
+    private ResultDescriptor rd;
+
+
+    public VectorStatistics() {
+    }
+
+
+    public Collection<StatisticSet> calculateStatistics(
+        Object                          result,
+        Collection<KeyValueDescibeData> parameters,
+        Collection<KeyValueDescibeData> measurements,
+        Collection<KeyValueDescibeData> dates
+    ) throws StatisticsException {
+        if (!(result instanceof Collection))
+            return new ArrayList<StatisticSet>();
+
+        Collection<Result>     results = (Collection<Result>) result;
+        Collection<StatisticSet> stats = new ArrayList<StatisticSet>();
+
+        SimpleRegression lRegression      = new SimpleRegression();
+        DescriptiveStatistics lStatistics = new DescriptiveStatistics();
+
+        Result previous   = null;
+        Result row        = null;
+        String seriesName = null;
+        int valueIdx      = -1;
+        int seriesIdx     = -1;
+
+        Iterator<Result> iter = results.iterator();
+
+        while (iter.hasNext()) {
+            row      = iter.next();
+            previous = previous == null ? row : previous;
+
+            if (rd == null || seriesIdx == -1) {
+                rd        = row.getResultDescriptor();
+                valueIdx  = getValueIdx(rd);
+                seriesIdx = rd.getColumnIndex("SERIES");
+            }
+
+            if (seriesName != null
+            && !row.getString(seriesIdx).equals(seriesName))
+            {
+                stats.add(generateStatisticsValues(
+                    lStatistics, lRegression, seriesName));
+
+                lStatistics.clear();
+                lRegression.clear();
+
+                clear();
+            }
+
+            Double yValue = getValue(row, valueIdx);
+
+            if (yValue != null) {
+                lStatistics.addValue(yValue);
+
+                try {
+                    double x = calculateXOrdinateValue(previous, row);
+                    lRegression.addData(x, yValue);
+                }
+                catch (SQLException sqle) {
+                    logger.warn(sqle, sqle);
+                }
+            }
+
+            seriesName = row.getString(seriesIdx);
+            previous   = row;
+        }
+
+        if (seriesName != null && row != null) {
+            stats.add(generateStatisticsValues(
+                lStatistics, lRegression, seriesName));
+
+            lStatistics.clear();
+            lRegression.clear();
+        }
+
+        return stats;
+    }
+
+
+    protected Double getValue(Result row, int idx) {
+        return row.getDouble(idx);
+    }
+
+
+    abstract protected void clear();
+
+    abstract protected int getValueIdx(ResultDescriptor rd);
+
+    abstract protected double calculateXOrdinateValue(Result prev, Result now)
+    throws SQLException;
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalCrossSectionStatistics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.statistics;
+
+import de.intevation.gnv.math.AttributedXYColumns;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+
+import de.intevation.gnv.statistics.exception.StatisticsException;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+
+/**
+ * This class is used to create a statistic in 'Profilschnitt' products.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public class VerticalCrossSectionStatistics
+extends      AbstractStatistics
+{
+    private static Logger log = Logger.getLogger(
+        VerticalCrossSectionStatistics.class);
+
+    public VerticalCrossSectionStatistics() {
+    }
+
+
+    public Collection<StatisticSet> calculateStatistics(
+         Object                          result,
+         Collection<KeyValueDescibeData> parameters,
+         Collection<KeyValueDescibeData> measurements,
+         Collection<KeyValueDescibeData> dates
+    )
+    throws StatisticsException {
+
+        boolean debug = log.isDebugEnabled();
+
+        if (debug) {
+            log.debug("calculateStatistics --------------");
+        }
+
+        ArrayList<StatisticSet> statisticSet =
+            new ArrayList<StatisticSet>();
+
+        if (!(result instanceof AttributedXYColumns)) {
+            log.error("wrong type of result");
+            return statisticSet;
+        }
+        AttributedXYColumns columns = (AttributedXYColumns)result;
+
+        return statisticSet;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalProfileStatistics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,17 +1,25 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.statistics;
 
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+
 import java.sql.SQLException;
+
 import java.util.Collection;
 
-import de.intevation.gnv.geobackend.base.Result;
-import de.intevation.gnv.state.describedata.KeyValueDescibeData;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This class is used to create a statistic in 'Vertikalprofil' products.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class VerticalProfileStatistics extends TimeseriesStatistics {
 
@@ -35,11 +43,9 @@
                                             Collection<KeyValueDescibeData> parameters,
                                             Collection<KeyValueDescibeData> measurements,
                                             Collection<KeyValueDescibeData> dates) {
-        
-        return (this.findValueTitle(parameters, break1)+ " "+ 
+
+        return (this.findValueTitle(parameters, break1)+ " "+
                this.findValueTitle(measurements,break2)).trim();
     }
-    
-    
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/VerticalProfileVectorStatistics.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.statistics;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import java.sql.SQLException;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class VerticalProfileVectorStatistics
+extends      VectorStatistics
+{
+    public VerticalProfileVectorStatistics() {
+    }
+
+
+    protected void clear() {
+        // nothing to clear
+    }
+
+
+    protected int getValueIdx(ResultDescriptor rd) {
+        return rd.getColumnIndex("YORDINATE");
+    }
+
+
+    protected double calculateXOrdinateValue(Result prev, Result row)
+    throws SQLException
+    {
+        return row.getDouble("XORDINATE");
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/exception/StatisticsException.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/exception/StatisticsException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,16 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.statistics.exception;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class StatisticsException extends Exception {
 
@@ -22,7 +27,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param arg0
      */
     public StatisticsException(String arg0) {
@@ -31,7 +36,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param arg0
      */
     public StatisticsException(Throwable arg0) {
@@ -40,7 +45,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param arg0
      * @param arg1
      */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/exception/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains exception classes used to be thrown if error occur while
+generating statistics.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/statistics/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains classes and interfaces used to create statistics for the
+different types of artifacts.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/TimeSeriesArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,20 +1,31 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.timeseries;
 
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+
+import de.intevation.gnv.artifacts.GNVArtifactBase;
+
 import org.apache.log4j.Logger;
+
 import org.w3c.dom.Document;
 
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.artifacts.CallContext;
-import de.intevation.gnv.artifacts.GNVArtifactBase;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * Artifact used for product timeseries product.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ *
  */
 public class TimeSeriesArtifact extends GNVArtifactBase {
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
@@ -34,24 +45,17 @@
         this.name = "timeSeries";
     }
 
-    /**
-     * @see de.intevation.artifactdatabase.DefaultArtifact#describe(org.w3c.dom.Document, de.intevation.artifacts.CallContext)
-     */
+
     @Override
-    public Document describe(Document data, CallContext context) {
-        log.debug("TimeSeriesArtifact.describe");
-        return super.createDescibeOutput(context.getMeta(), 
-                super.identifier,
-                this.getIncludeUIFromDocument(data));
-    }
-
-    /**
-     * @see de.intevation.gnv.artifacts.GNVArtifactBase#setup(java.lang.String,
-     *      de.intevation.artifacts.ArtifactFactory, java.lang.Object)
-     */
-    @Override
-    public void setup(String identifier, ArtifactFactory factory, Object context) {
+    public void setup(
+        String          identifier,
+        ArtifactFactory factory,
+        Object          context,
+        CallMeta        meta,
+        Document        data
+    ) {
         log.debug("TimeSeriesArtifact.setup");
-        super.setup(identifier, factory, context);
+        super.setup(identifier, factory, context, meta, data);
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/TimeSeriesMeshArtifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/TimeSeriesMeshArtifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,19 +1,28 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.timeseries;
 
+/**
+ * Artifact used for timeseries on meshes.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
 public class TimeSeriesMeshArtifact extends TimeSeriesArtifact {
 
-    /**
-     *
-     */
     private static final long serialVersionUID = 5680432486700275986L;
 
     /**
-     * 
      * Constructor
      */
     public TimeSeriesMeshArtifact() {
         super();
         super.name = super.name + "Mesh";
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/gap/DefaultTimeGap.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/gap/DefaultTimeGap.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,37 +1,45 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.timeseries.gap;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * The default implementation of <code>TimeGap</code>.
  *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
-public class DefaultTimeGap implements TimeGap{
+public class DefaultTimeGap implements TimeGap {
 
     /**
      * The UNIT of the TimeGap
      * See the Constants in de.intevation.gnv.timeseries.gap.TimeGap
      */
     private String unit;
-    
+
     /**
-     * The Key of the TimeGap which must be äquivalent to the
+     * The Key of the TimeGap which must be equivalent to the
      * Key used in the DWH
      */
     private int key;
-    
+
     /**
      * The Value of the Gap.
      * Use the Unit and the Time Constants to Calculate the
      * value in Milliseconds
      */
     private int value;
-    
+
     /**
      * Constructor
-     * @param unit
-     * @param key
-     * @param value
+     *
+     * @param unit Unit of this value.
+     * @param key The key of this time gap.
+     * @param value The value of this gap.
      */
     public DefaultTimeGap(String unit, int key, int value) {
         super();
@@ -40,25 +48,20 @@
         this.value = value;
     }
 
-    /**
-     * @see de.intevation.gnv.timeseries.gap.TimeGap#getUnit()
-     */
+
     public String getUnit() {
         return this.unit;
     }
 
-    /**
-     * @see de.intevation.gnv.timeseries.gap.TimeGap#getKey()
-     */
+
     public int getKey() {
         return this.key;
     }
 
-    /**
-     * @see de.intevation.gnv.timeseries.gap.TimeGap#getValue()
-     */
+
     public int getValue() {
         return this.value;
     }
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/gap/TimeGap.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/gap/TimeGap.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,35 +1,57 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.timeseries.gap;
-public interface TimeGap {
-    
+
+import java.io.Serializable;
+
+/**
+ * A class representing a timegap. <code>TimeGap</code>s are used in timeseries
+ * charts to identify gaps taking account for the resolution of the x-axis
+ * range.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public interface TimeGap extends Serializable {
+
     public final static String TIME_UNIT_MINUTE = "m";
     public final static String TIME_UNIT_HOUR = "h";
     public final static String TIME_UNIT_DAY = "D";
     public final static String TIME_UNIT_WEEK = "W";
     public final static String TIME_UNIT_MONTH = "M";
     public final static String TIME_UNIT_YEAR = "Y";
-    
+
     public final static long  MINUTE_IN_MILLIS = 60 * 1000;
     public final static long  HOUR_IN_MILLIS = 60 * MINUTE_IN_MILLIS;
     public final static long  DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS;
     public final static long  WEEK_IN_MILLIS = 7 * DAY_IN_MILLIS;
-    
-    
+
+
     /**
      * Returns the Lookup-Key for the TimeGap
-     * @return
+     *
+     * @return the timegap key.
      */
     int getKey();
-    
+
     /**
      * Returns the Value of the TimeValue in the Unit which is also given.
-     * @return
+     *
+     * @return the timegap value.
      */
     int getValue();
-    
+
     /**
      * Returns the Unit of the Timegap (e.g. Minutes, Hours, Days, Weeks, Months, Years)
-     * @return
+     *
+     * @return the timegap unit.
      */
     String getUnit();
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/gap/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package provides classes and interfaces representing time gaps used in
+timerseries charts.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/timeseries/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains classes providing specific artifacts representing
+'Zeitserien'.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/DefaultTransition.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/DefaultTransition.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,12 +1,19 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.transition;
 
 import de.intevation.gnv.state.State;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * The default implementation of a <code>Transition</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class DefaultTransition extends TransitionBase {
@@ -23,11 +30,10 @@
         super();
     }
 
-    /**
-     * @see de.intevation.gnv.transition.Transition#isValid(de.intevation.gnv.state.State)
-     */
+
     public boolean isValid(State state) {
         return true;
     }
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/PresettingsValueCompareTransition.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.transition;
+
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Node;
+
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.gnv.state.InputData;
+import de.intevation.gnv.state.State;
+
+/**
+ * Class which supports the possibility to validate if a
+ * Transition could be done using simple Valuecompare Operations.
+ * The Compareoperations will use the preSettings of an Artifact.
+ * At this Time equal and notequal-operations are supported.
+ * The Comparation is casesensitive.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class PresettingsValueCompareTransition extends TransitionBase {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(PresettingsValueCompareTransition.class);
+
+    /**
+     * The Name of the Datafield the Value  that should be compared
+     * should be fetched from.
+     */
+    private String dataName = null;
+    /**
+     * The Value that should be set to the State.
+     */
+    private String dataValue = null;
+    /**
+     * The Operation that should be used (equal notequal)
+     */
+    private String operator = null;
+
+    /**
+     * The UID of this Class.
+     */
+    private static final long serialVersionUID = -7846722158776823205L;
+
+    /**
+     * Constructor
+     */
+    public PresettingsValueCompareTransition() {
+        super();
+    }
+
+
+    public boolean isValid(State state) {
+        Map<String, InputData> preSettings = state.getPreSettings();
+        if (preSettings != null){
+            boolean dataAvailable = preSettings.containsKey(dataName);
+            if (dataAvailable){
+                if (operator.equals("equal")){
+                    return preSettings.get(dataName).getValue().startsWith(dataValue);
+                }else if (operator.equals("notequal")){
+                    return !preSettings.get(dataName).getValue().startsWith(dataValue);
+                }
+            }
+        }
+        if (operator.equals("notequal")){
+            return true;
+        }
+        return false;
+    }
+
+
+    @Override
+    public void setup(Node configuration) {
+        super.setup(configuration);
+        this.dataName = Config.getStringXPath(configuration,"condition/@inputvalue");
+        this.dataValue = Config.getStringXPath(configuration,"condition/@value");
+        this.operator = Config.getStringXPath(configuration,"condition/@operator");
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/Transition.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/Transition.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,37 +1,47 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.transition;
 
+import de.intevation.gnv.state.State;
+
 import java.io.Serializable;
 
 import org.w3c.dom.Node;
 
-import de.intevation.gnv.state.State;
-
 /**
- * 
- * @author Tim Englich <tim.englich@intevation.de>
+ * This interface describes basic methods necessary for a transition model.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public interface Transition extends Serializable{
-    
+
     /**
      * Returns the ID of the State from which the Transition could be used
      * @return the ID of the State from which the Transition could be used
      */
     public String getFrom();
-    
+
     /**
      * Returns the ID of the State where it is possible to go as next.
      * @return the ID of the State where it is possible to go as next.
      */
     public String getTo();
-    
+
     /**
      * Determines if it is possible to go along this Transition or not.
      * @param state the current State
-     * @return
+     * @return true, if this transition is valid for the given state - otherwise
+     * false.
      */
     public boolean isValid(State state);
-    
+
     /**
      * Configures the Transition.
      * @param configuration
@@ -39,3 +49,4 @@
     public void setup(Node configuration);
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,14 +1,21 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.transition;
 
+import de.intevation.artifacts.common.utils.Config;
+
 import org.w3c.dom.Node;
 
-import de.intevation.artifactdatabase.Config;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * An abstract implementation of <code>Transition</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public abstract class TransitionBase implements Transition {
@@ -19,7 +26,7 @@
     private static final long serialVersionUID = -8542097519466477977L;
 
     private String from = null;
-    
+
     private String to = null;
     /**
      * Constructor
@@ -27,26 +34,20 @@
     public TransitionBase() {
     }
 
-    /**
-     * @see de.intevation.gnv.transition.Transition#getFrom()
-     */
+
     public String getFrom() {
         return this.from;
     }
 
-    /**
-     * @see de.intevation.gnv.transition.Transition#getTo()
-     */
+
     public String getTo() {
         return this.to;
     }
-    
-    /**
-     * @see de.intevation.gnv.transition.Transition#setup(org.w3c.dom.Node)
-     */
+
+
     public void setup(Node configuration) {
       this.from = Config.getStringXPath(configuration,"from/@state");
       this.to = Config.getStringXPath(configuration,"to/@state");
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.transition;
 
 import org.apache.log4j.Logger;
@@ -9,8 +14,9 @@
 import de.intevation.gnv.artifacts.GNVArtifactBase;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This Factoryclass instantiates Objects of Type Transition.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class TransitionFactory {
 
@@ -19,6 +25,9 @@
      */
     private static Logger log = Logger.getLogger(GNVArtifactBase.class);
 
+    /**
+     * The Singleton instance of the Transitionfactory.
+     */
     private static TransitionFactory instance = null;
 
     /**
@@ -28,6 +37,10 @@
         super();
     }
 
+    /**
+     * Returns the Instance of this Class.
+     * @return the Instance of this Class.
+     */
     public static TransitionFactory getInstance() {
         if (instance == null) {
             instance = new TransitionFactory();
@@ -35,6 +48,13 @@
         return instance;
     }
 
+    /**
+     * Creates a new Transition using the Configuration that is provided by the
+     * XML-Node.
+     * @param configuration The configuration that should be used to initialize
+     *                      the new Transition
+     * @return a new Transition.
+     */
     public Transition createTransition(Node configuration) {
         log.debug("TransitionFactory.createTransition");
         Transition state = null;
@@ -51,5 +71,5 @@
         }
         return state;
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/ValueCompareTransition.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.transition;
 
 import java.util.Iterator;
@@ -8,13 +13,17 @@
 import org.apache.log4j.Logger;
 import org.w3c.dom.Node;
 
-import de.intevation.artifactdatabase.Config;
+import de.intevation.artifacts.common.utils.Config;
 import de.intevation.gnv.state.InputData;
 import de.intevation.gnv.state.State;
 import de.intevation.gnv.state.exception.StateException;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * Class which supports the possibility to validate if a
+ * Transition could be done using simple Valuecompare Operations.
+ * At this Time equal and notequal-operations are supported.
+ * The Comparation is casesensitive.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class ValueCompareTransition extends TransitionBase {
@@ -23,17 +32,27 @@
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(ValueCompareTransition.class);
-    
-    private String dataName = null;
-    private String dataValue = null;
-    private String operator = null;
-    
     /**
      * The UID of this Class.
      */
     private static final long serialVersionUID = -7846722158776823205L;
 
     /**
+     * The Name of the Datafield the Value  that should be compared
+     * should be fetched from.
+     */
+    private String dataName = null;
+    /**
+     * The Value that should be set to the State.
+     */
+    private String dataValue = null;
+    /**
+     * The Operation that should be used (equal notequal)
+     */
+    private String operator = null;
+
+
+    /**
      * Constructor
      */
     public ValueCompareTransition() {
@@ -41,10 +60,12 @@
     }
 
     /**
+     * validates if a Transition is valid and could be used using simple
+     * Comparevalue-Operations.
      * @see de.intevation.gnv.transition.Transition#isValid(de.intevation.gnv.state.State)
      */
     public boolean isValid(State state) {
-        
+
         try {
             Iterator<InputData> it = state.getInputData().iterator();
             while (it.hasNext()){
@@ -70,6 +91,7 @@
         return false;
     }
 
+
     @Override
     public void setup(Node configuration) {
         super.setup(configuration);
@@ -77,6 +99,5 @@
         this.dataValue = Config.getStringXPath(configuration,"condition/@value");
         this.operator = Config.getStringXPath(configuration,"condition/@operator");
     }
-    
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package contains interfaces and classes providing the Transitionlogic to 
+switch between different States and validate if the Transition to an State is 
+possible or not.
+</body>
+</html>
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactFactoryUtilities.java	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/**
- *
- */
-package de.intevation.gnv.utils;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
-import de.intevation.artifacts.ArtifactFactory;
-
-/**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
- */
-public class ArtifactFactoryUtilities {
-    /**
-     * the logger, used to log exceptions and additonaly information
-     */
-    private static Logger log = Logger
-            .getLogger(ArtifactFactoryUtilities.class);
-
-    /**
-     * Constructor
-     */
-    public ArtifactFactoryUtilities() {
-    }
-
-    public ArtifactFactory createArtitfactFactor(Document config,
-                                                 Node artifactFactoryNode) {
-        String className = artifactFactoryNode.getTextContent();
-
-        ArtifactFactory factory = null;
-
-        try {
-            Class clazz = Class.forName(className);
-            factory = (ArtifactFactory) clazz.newInstance();
-        } catch (ClassNotFoundException cnfe) {
-            log.error(cnfe.getLocalizedMessage(), cnfe);
-        } catch (InstantiationException ie) {
-            log.error(ie.getLocalizedMessage(), ie);
-        } catch (ClassCastException cce) {
-            log.error(cce.getLocalizedMessage(), cce);
-        } catch (IllegalAccessException iae) {
-            log.error(iae.getLocalizedMessage(), iae);
-        }
-
-        if (factory != null) {
-            factory.setup(config, artifactFactoryNode);
-            log.info("Registering '" + factory.getName()
-                     + "' as artifact factory.");
-        }
-        return factory;
-    }
-}
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ArtifactXMLUtilities.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.utils;
 
 import java.io.ByteArrayInputStream;
@@ -30,8 +35,10 @@
 import de.intevation.artifacts.ArtifactNamespaceContext;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This class provides some methods for creating and working with xml documents.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class ArtifactXMLUtilities implements Serializable {
     /**
@@ -49,23 +56,35 @@
     public static final String XFORM_PREFIX = "xform";
 
     /**
-     * Constructor
+     * Constructor.<br>
+     * <b>Note:</b> It should not be necessary to create an object of this
+     * class - which is a helper class. Call static methods instead.
      */
     public ArtifactXMLUtilities() {
     }
 
     /**
-     * @param document
-     * @return
+     * Creates an <code>Element</code> and returns it.
+     *
+     * @param document A document
+     * @param name Name of a node.
+     * @return an Element.
      */
-    public Element createArtifactElement(Document document, String name) {
+    public static Element createArtifactElement(Document document, String name) {
         Element node = document.createElementNS(
                 ArtifactNamespaceContext.NAMESPACE_URI, name);
         node.setPrefix(ArtifactNamespaceContext.NAMESPACE_PREFIX);
         return node;
     }
 
-    public String writeDocument2String(Document document) {
+
+    /**
+     * Turns an xml document into a string.
+     *
+     * @param document An xml document.
+     * @return String representation of <i>document</i>.
+     */
+    public static String writeDocument2String(Document document) {
         try {
             TransformerFactory transformerFactory = TransformerFactory
                     .newInstance();
@@ -85,6 +104,12 @@
         return null;
     }
 
+    /**
+     * Read a document from input stream.
+     *
+     * @param inputStream The input stream.
+     * @return the document read from stream.
+     */
     public static Document readDocument(InputStream inputStream) {
         Document returnValue = null;
         try {
@@ -102,50 +127,101 @@
         return returnValue;
     }
 
+
     public Document reInitDocument(Document document) {
         try {
-            byte[] barray = this.writeDocument2String(document).getBytes(
+            byte[] barray = ArtifactXMLUtilities.writeDocument2String(document).getBytes(
                     "UTF-8");
             InputStream inputStream = new ByteArrayInputStream(barray);
-            return this.readDocument(inputStream);
+            return ArtifactXMLUtilities.readDocument(inputStream);
         } catch (UnsupportedEncodingException e) {
             log.error(e, e);
         }
         return document;
     }
 
-    public Element createXFormElement(Document document, String name) {
+
+    /**
+     * Creates an <code>Element</code> with {@link #XFORM_PREFIX} and <i>name
+     * </i>.
+     *
+     * @param document A document.
+     * @param name The node name.
+     * @return the created element.
+     */
+    public static Element createXFormElement(Document document, String name) {
         Element node = document.createElementNS(XFORM_URL, name);
         node.setPrefix(XFORM_PREFIX);
         return node;
     }
 
-    public Document createExceptionReport(String message, Document document) {
+    /**
+     * Creates an exception node.
+     *
+     * @param message The message in the node.
+     * @param document A document.
+     * @return the document containing the exception node.
+     */
+    public static Document createExceptionReport(String message, Document document) {
         log.debug("ArtifactXMLUtilities.createExceptionReport");
-        Element exceptionReportNode = this.createArtifactElement(document,
+        Element exceptionReportNode = createArtifactElement(document,
                 "exceptionreport");
         document.appendChild(exceptionReportNode);
-        Element exceptionNode = this.createArtifactElement(document,
+        Element exceptionNode = createArtifactElement(document,
                 "exception");
         exceptionNode.setTextContent(message);
         exceptionReportNode.appendChild(exceptionNode);
         return document;
     }
 
-    public Document createSuccessReport(String message, Document document) {
+    /**
+     * Creates an input exception node.
+     *
+     * @param msg The message in the node.
+     * @param doc A document.
+     * @return the document containing the exception node.
+     */
+    public static Document createInputExceptionReport(String msg, Document doc) {
+        Element exceptionReportNode = createArtifactElement(
+            doc,"exceptionreport");
+        Element exceptionNode = createArtifactElement(
+            doc,"exception");
+        Element inputNode = createArtifactElement(
+            doc, "input");
+        inputNode.setTextContent(msg);
+        exceptionNode.appendChild(inputNode);
+        exceptionReportNode.appendChild(exceptionNode);
+        doc.appendChild(exceptionReportNode);
+        return doc;
+    }
+
+    /**
+     * Creates a success node.
+     *
+     * @param message The message.
+     * @param document A document.
+     * @return the document containing the success node.
+     */
+    public static Document createSuccessReport(String message, Document document) {
         log.debug("ArtifactXMLUtilities.creatSuccessReport");
-        Element reportNode = this.createArtifactElement(document, "result");
+        Element reportNode = createArtifactElement(document, "result");
         document.appendChild(reportNode);
-        Element successNode = this.createArtifactElement(document, "success");
+        Element successNode = createArtifactElement(document, "success");
         successNode.setTextContent(message);
         reportNode.appendChild(successNode);
         return document;
     }
-    
+
+    /**
+     * Read <i>fileName</i> and return the first child node.
+     *
+     * @param fileName An xml document.
+     * @return the first child node in this document.
+     */
     public Node readConfiguration(String fileName){
         try {
             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-            factory.setValidating(false); 
+            factory.setValidating(false);
             return factory.newDocumentBuilder().parse(fileName).getChildNodes().item(0);
         } catch (SAXException e) {
             log.error(e,e);
@@ -158,5 +234,5 @@
             return null;
         }
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/DistanceCalculator.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/DistanceCalculator.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,74 +1,103 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.utils;
 
+import com.vividsolutions.jts.geom.Coordinate;
 import com.vividsolutions.jts.geom.Point;
-import com.vividsolutions.jts.geom.Coordinate;
 
 import java.util.List;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * A helper class to calculate distances between points and coordinates.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class DistanceCalculator {
 
     private final static double flattening = 1.0 / 298.257233563;
-    
+
     private final static double earthRadius = 6378137.0 / 1000.0 ;
-    
+
     /**
      * Constructor
      */
     public DistanceCalculator() {
     }
-    
+
+
+    /**
+     * Calculates the distance between two points.
+     *
+     * @param p1 First point.
+     * @param p2 Second point.
+     * @return the distance.
+     */
     public static double calculateDistance(Point p1, Point p2){
         return calculateDistance(p1.getCoordinate(), p2.getCoordinate());
     }
 
+
+    /**
+     * Calculates the distance between two coordinates.
+     *
+     * @param p1 First coordinate.
+     * @param p2 Second coordinate.
+     * @return the distance.
+     */
     public static double calculateDistance(Coordinate p1, Coordinate p2){
         double resultValue = 0.0;
-        
+
         double b1 = p1.y;
         double b2 = p2.y;
-        
+
         double l1 = p1.x;
         double l2 = p2.x;
-        
-        
+
+
         double F = (b1 + b2) / 2.0;
         double G = (b1 - b2) / 2.0;
         double l = (l1 - l2) / 2.0;
-        
+
         F = (Math.PI / 180.0) * F;
         G = (Math.PI / 180.0) * G;
         l = (Math.PI / 180.0) * l;
-        
+
         double S = ((Math.sin(G) * Math.sin(G)) * ((Math.cos(l) * Math.cos(l))))+
                    ((Math.cos(F) * Math.cos(F)) * ((Math.sin(l) * Math.sin(l))));
-        
+
         double C = ((Math.cos(G) * Math.cos(G)) * ((Math.cos(l) * Math.cos(l))))+
                    ((Math.sin(F) * Math.sin(F)) * ((Math.sin(l) * Math.sin(l))));
-        
+
         double w = Math.atan(Math.sqrt((S/C)));
-        
+
         double D = 2.0 * w * earthRadius;
-        
+
         double R = Math.sqrt((S*C)) / w;
-        
+
         double H1 = (3.0 * R - 1.0 ) / (2.0 * C);
         double H2 = (3.0 * R + 1.0 ) / (2.0 * S);
-        
-        resultValue = D * (1 + (flattening * H1 * (Math.sin(F) * Math.sin(F)) * 
-                                                  (Math.cos(G) * Math.cos(G))) - 
-                           (flattening * H2 * (Math.cos(F) * Math.cos(F)) * 
+
+        resultValue = D * (1 + (flattening * H1 * (Math.sin(F) * Math.sin(F)) *
+                                                  (Math.cos(G) * Math.cos(G))) -
+                           (flattening * H2 * (Math.cos(F) * Math.cos(F)) *
                                               (Math.sin(G) * Math.sin(G))));
-        
+
         return resultValue;
     }
 
+    /**
+     * Calculates the length of a path specified by coordinates in <i>path</i>.
+     *
+     * @param path A list of coordinates.
+     * @return the length of the given path.
+     */
     public static final double calculateDistance(List<Coordinate> path) {
         int N = path.size();
         if (N < 2) {
@@ -82,3 +111,4 @@
     }
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ExclusiveExec.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.utils;
+
+import java.util.HashMap;
+
+/**
+ * This class can be used to synchronize threads with a given key. To use this
+ * synchronization, you first need to do call {@link #acquire(java.lang.Object)}
+ * to retrieve a {@link UniqueKey}. After this, you can call the code being
+ * synchronized. After this execution, you need to call
+ * {@link #release(UniqueKey)} with your token you retrieved from {@link
+ * #acquire(java.lang.Object)}. A thread needs to wait for another thread if their keys
+ * are equal. Threads with different keys don't need to wait for each other.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public final class ExclusiveExec
+{
+    /**
+     * The only instance of this singleton.
+     */
+    public static final ExclusiveExec INSTANCE = new ExclusiveExec();
+
+    private HashMap tokens;
+
+    /**
+     * This class represents a unique key with a reference counter.
+     */
+    public static class UniqueKey {
+        Object key;
+        int [] refs;
+
+        /**
+         * Constructs a new UniqueKey.
+         *
+         * @param key The key of this unique key.
+         */
+        public UniqueKey(Object key) {
+            this.key = key;
+            refs = new int[1];
+        }
+    }
+
+    /**
+     * Private constructor. Use {@link #INSTANCE} instead.
+     */
+    private ExclusiveExec() {
+        tokens = new HashMap();
+    }
+
+    /**
+     * This method serves a {@link UniqueKey} and starts a synchronized code
+     * block.
+     *
+     * @param key The key used to identify same threads.
+     * @return UniqueKey. Use this object to call {@link #release(UniqueKey)}
+     * at the end of your code being synchronized.
+     */
+    public UniqueKey acquire(Object key) {
+
+        try {
+            UniqueKey internalKey = null;
+            synchronized (tokens) {
+                internalKey = (UniqueKey)tokens.get(key);
+
+                if (internalKey == null) {
+                    tokens.put(key, internalKey = new UniqueKey(key));
+                }
+            }
+
+            synchronized (internalKey) {
+                ++internalKey.refs[0];
+                while (internalKey.refs[0] > 1) {
+                    internalKey.wait(10000L);
+                }
+            }
+
+            return internalKey;
+        }
+        catch (InterruptedException ie) {
+            return null;
+        }
+    }
+
+    /**
+     * This method releases a lock. Call this method at the end of your code
+     * being synchronized.
+     *
+     * @param internalKey Token retrieved by {@link #acquire(Object)}.
+     */
+    public void release(UniqueKey internalKey) {
+        if (internalKey != null) {
+            synchronized (internalKey) {
+                if (--internalKey.refs[0] < 1) {
+                    synchronized (tokens) {
+                        tokens.remove(internalKey.key);
+                    }
+                }
+                internalKey.notifyAll();
+            }
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/FileUtils.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.utils;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import java.util.Stack;
+
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ * A helper class to provide some methods for working with files and
+ * directories.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public final class FileUtils
+{
+    private FileUtils() {
+    }
+
+    /**
+     * Deletes everything in a directory.
+     *
+     * @param dir The directory.
+     */
+    public final static void deleteContent(File dir) {
+        if (dir == null || !dir.isDirectory()) {
+            return;
+        }
+
+        File[] files = dir.listFiles();
+        if (files != null) {
+            for (File file: files) {
+                deleteRecursive(file);
+            }
+        }
+
+        return;
+    }
+
+    /**
+     * Delete <i>file</i> and everything in <i>file</i> if it is a directory.
+     *
+     * @param file The file or directory.
+     * @return true, if deletion was successful - otherwise false.
+     */
+    public final static boolean deleteRecursive(File file) {
+
+        if (file == null) {
+            return false;
+        }
+
+        if (file.isDirectory()) {
+            File [] files = file.listFiles();
+            if (files != null) {
+                for (File sub: files) {
+                    if (!deleteRecursive(sub)) {
+                        return false;
+                    }
+                }
+            }
+        }
+
+        return file.delete();
+    }
+
+    /**
+     * Put the given file or directory into a zip archive.
+     *
+     * @param file The file or directory.
+     * @param outputStream The stream to write the archive to.
+     * @throws IOException if an error occured while zip creation or writing to
+     * output stream.
+     */
+    public static void createZipArchive(
+        File         file,
+        OutputStream outputStream
+    )
+    throws IOException
+    {
+        ZipOutputStream out = new ZipOutputStream(outputStream);
+
+        if (file.isFile()) {
+            copyFileToZip("", file, out);
+        }
+        else if (file.isDirectory()) {
+
+            Stack<PrefixDir> stack = new Stack<PrefixDir>();
+            stack.push(new PrefixDir(file.getName() + "/", file));
+
+            while (!stack.isEmpty()) {
+                PrefixDir pd = stack.pop();
+
+                ZipEntry dirEntry = new ZipEntry(pd.prefix);
+                out.putNextEntry(dirEntry);
+                out.closeEntry();
+
+                File [] files = pd.dir.listFiles();
+                if (files != null) {
+                    for (File sub: files) {
+                        if (sub.isDirectory()) {
+                            stack.push(new PrefixDir(
+                                pd.prefix + sub.getName() + "/",
+                                sub));
+                        }
+                        else if (sub.isFile()) {
+                            copyFileToZip(pd.prefix, sub, out);
+                        }
+                    }
+                }
+            }
+        }
+
+        out.finish();
+    }
+
+    /**
+     * A class representing a directory with a prefix.
+     */
+    private static final class PrefixDir {
+
+        String prefix;
+        File   dir;
+
+        public PrefixDir(String prefix, File dir) {
+            this.prefix = prefix;
+            this.dir    = dir;
+        }
+
+    } // class PrefixDir
+
+    /**
+     * Write a file to zip archive.
+     *
+     * @param prefix A prefix.
+     * @param file The file.
+     * @param out The output stream.
+     * @throws IOException if an error occured while writing to zip output
+     * stream.
+     */
+    private static void copyFileToZip(
+        String          prefix,
+        File            file,
+        ZipOutputStream out
+    )
+    throws IOException
+    {
+        String   entryName = prefix + file.getName();
+        ZipEntry entry     = new ZipEntry(entryName);
+        out.putNextEntry(entry);
+        InputStream in = null;
+        try {
+            in =
+                new BufferedInputStream(
+                new FileInputStream(file), 20*1024);
+
+            byte [] buf = new byte[2048];
+
+            int r;
+            while ((r = in.read(buf)) > 0) {
+                out.write(buf, 0, r);
+            }
+        }
+        finally {
+            if (in != null) {
+                try { in.close(); }
+                catch (IOException ioe) {}
+            }
+        }
+        out.closeEntry();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/IndexBuffer.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/IndexBuffer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,15 +1,23 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.utils;
 
+import java.awt.Point;
+
 import java.awt.geom.Point2D;
 
-import java.awt.Point;
-
 import java.util.List;
 
 /**
  * Create buffers around integer pairs (i_1..n), j_1..n).
  *
- * @author Sascha L. Teichmann (sascha.teichmann@intevation.de)
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class IndexBuffer
 {
@@ -166,4 +174,4 @@
         return new Point2D.Double(p.y, -p.x);
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/InputValidator.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/InputValidator.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,31 +1,42 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.utils;
 
-import java.util.Date;
-
-import org.apache.commons.validator.GenericValidator;
-import org.apache.log4j.Logger;
-
 import com.vividsolutions.jts.geom.Coordinate;
 import com.vividsolutions.jts.geom.GeometryFactory;
 import com.vividsolutions.jts.geom.Point;
 
+import com.vividsolutions.jts.io.ParseException;
+import com.vividsolutions.jts.io.WKTReader;
+
 import de.intevation.gnv.geobackend.util.DateUtils;
+
 import de.intevation.gnv.utils.exception.ValidationException;
 
+import java.util.Date;
+
+import org.apache.commons.validator.GenericValidator;
+
+import org.apache.log4j.Logger;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ *
  */
 public class InputValidator {
     /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(InputValidator.class);
-    
-    
+
+
     public final static String NODATASELECTEDVALUE = "n/n";
 
     /**
@@ -35,7 +46,17 @@
         super();
     }
 
-    public boolean isInputValid(String minInput, String maxInput, String type) {
+    /**
+     * Validates the input of a range of double or date values. The input values
+     * need to be valid double or date values. <i>minInput</i> needs to be
+     * smaller or equal <i>maxInput</i>.
+     *
+     * @param minInput The lower bound.
+     * @param maxInput The upper bound.
+     * @param type One of 'Date' or 'Double'.
+     * @return true, if the input is valid, otherwise false.
+     */
+    public static boolean isInputValid(String minInput, String maxInput, String type) {
         log.debug("InputValidator.isInputValid " + minInput + " " + maxInput + " " +type);
         boolean returnValue = false;
         if ("Date".equalsIgnoreCase(type)) {
@@ -59,14 +80,44 @@
         log.debug("Is valid? " + returnValue);
         return returnValue;
     }
-    
-    public boolean isInputValid(String input, String type) {
+
+    /**
+     * Validates an input.
+     *
+     * @param input The input value.
+     * @param type The input value type.
+     * @return true if the input is valid, otherwise false.
+     */
+    public static boolean isInputValid(String input, String type) {
+        if (input.length() == 0 || input.equals("")) {
+            return false;
+        }
+
         log.debug("InputValidator.isInputValid " + input + " " + type);
+
+        // Let's check polygons and linestrings first, because they might
+        // contain comma. A splitting at comma characters wouldn't be good here.
+        if ("Polygon".equalsIgnoreCase(type) || "Linestring".equalsIgnoreCase(type))
+        {
+            try {
+                WKTReader reader = new WKTReader();
+                reader.read(input);
+
+                return true;
+            }
+            catch (ParseException pe) {
+                log.warn(pe, pe);
+                return false;
+            }
+        }
+
+        // Check all the other input here
         boolean returnValue = false;
         String[] values = input.split(",");
+
         for (int i = 0; i < values.length; i++) {
             boolean valid;
-            
+
             if (NODATASELECTEDVALUE.equals(values[i].trim())){
                 valid = true;
             } else if ("Integer".equalsIgnoreCase(type)) {
@@ -81,7 +132,7 @@
             } else if ("Date".equalsIgnoreCase(type)) {
                 valid = GenericValidator.isDate(values[i].trim(),
                         DateUtils.DATE_PATTERN, true);
-            } else if ("Point".equalsIgnoreCase(type)) {
+            } else if ("Point".equalsIgnoreCase(type) || "Geometry".equals(type)) {
                 valid = GenericValidator.matchRegexp(values[i], "[0-9]"); // TODO:
                                                                           // FIXME:
                                                                           // VALIDATE
@@ -93,7 +144,7 @@
                                                                 // REGEXP
             } else if ("Coordinate".equalsIgnoreCase(type)) {
                     try {
-                        valid = this.getPointValue(values[i]) != null;
+                        valid = getPointValue(values[i]) != null;
                     } catch (ValidationException e) {
                         log.debug(e.getMessage());
                         valid = false;
@@ -111,44 +162,94 @@
         log.debug("Is valid? " + returnValue);
         return returnValue;
     }
-    
-    
-    public Point getPointValue(String value) throws ValidationException{
+
+
+    /**
+     * Returns a point from wkt string.
+     *
+     * @param value The wkt string.
+     * @return a point.
+     * @throws ValidationException if <i>value</i> is not valid.
+     */
+    public static Point getPointValue(String value) throws ValidationException{
         log.debug("InputValidator.getPointValue " + value);
-        String[] s, p;
-        
-        double x=0,y=0;
-        log.info("Position :"+value);
-        s = value.split(" ");
-        if (s.length != 2) {
-              throw new ValidationException("Kein Blank separiert Breite und Länge");
+
+        if (value.toLowerCase().startsWith("point")){
+            try {
+                return (Point)new WKTReader().read(value);
+            } catch (ParseException e) {
+                log.error(e,e);
+                throw new ValidationException(e);
+            }
+        }else{
+            String[] s, p;
+
+            double x=0,y=0;
+            log.info("Position :"+value);
+            s = value.split(" ");
+            if (s.length != 2) {
+                  throw new ValidationException("Kein Blank separiert Breite und Länge");
+            }
+            p = s[0].split("[nNsS]");
+            try {
+                if (p.length == 1)
+                    y = new Double(p[0]);
+                else
+                    y = new Double(p[0]) +   new Double(p[1]) / new Double(60.);
+                if (s[0].toLowerCase().contains("s"))
+                    y = -y;
+            }
+            catch (Exception e) {
+                throw new ValidationException("Kein N|S oder nicht im ersten Substring, zB 56n42");
+
+            }
+            p = s[1].split("[eEwW]");
+            try {
+                if (p.length ==1)
+                    x = new Double(p[0]);
+                else
+                    x = new Double(p[0]) +  new Double(p[1]) / new Double(60.) ;
+                if (s[1].toLowerCase().contains("w"))
+                    x = -x;
+            }
+            catch (Exception e) {
+                throw new ValidationException("Kein E|W oder nicht im zweiten Substring");
+            }
+            return new GeometryFactory().createPoint(new Coordinate(x,y));
         }
-        p = s[0].split("[nNsS]");
-        try {
-            if (p.length == 1)
-                y = new Double(p[0]);
-            else
-                y = new Double(p[0]) +   new Double(p[1]) / new Double(60.);
-            if (s[0].toLowerCase().contains("s"))
-                y = -y;
-        }
-        catch (Exception e) {
-            throw new ValidationException("Kein N|S oder nicht im ersten Substring, zB 56n42");
-        
-        } 
-        p = s[1].split("[eEwW]");
-        try {
-            if (p.length ==1)
-                x = new Double(p[0]);
-            else
-                x = new Double(p[0]) +  new Double(p[1]) / new Double(60.) ;
-            if (s[1].toLowerCase().contains("w"))
-                x = -x;
-        }
-        catch (Exception e) {
-            throw new ValidationException("Kein E|W oder nicht im zweiten Substring");
-        } 
-        return new GeometryFactory().createPoint(new Coordinate(x,y));
     }
 
+
+    /**
+     * Makes sure that <i>tmp</i> is between <i>lo</i> and <i>up</i>.
+     *
+     * @param tmp The value to validate.
+     * @param lo The lower range bound.
+     * @param up The upper range bound.
+     * @return true, if tmp is valid, otherwise false.
+     */
+    public static boolean isDateValid(Date tmp, Date lo, Date up) {
+        // take the time in seconds to compare
+        long tmpTime = tmp.getTime() / 1000;
+        long tmpLow  = lo.getTime() / 1000;
+        long tmpUp   = up.getTime() / 1000;
+
+        if (log.isDebugEnabled()) {
+            log.debug("Date validation...");
+            log.debug("-> lower bound [sec]: " + tmpLow);
+            log.debug("-> upper bound [sec]: " + tmpUp);
+            log.debug("-> input data  [sec]: " + tmpTime);
+        }
+
+        // XXX There is a buffer of 1 second for the valid range of the time.
+        if (tmpTime < (tmpLow-1) || tmpTime > (tmpUp+1)) {
+            log.warn(
+                "Date [" + tmp.toString() + "] is out of range ["
+                + lo.toString() + " to "+ up.toString() + "].");
+            return false;
+        }
+
+        return true;
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MapfileGenerator.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,596 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.utils;
+
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.artifacts.common.utils.XMLUtils;
+
+import de.intevation.artifacts.ArtifactNamespaceContext;
+
+import de.intevation.gnv.wms.LayerInfo;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.xml.xpath.XPathConstants;
+
+import org.apache.log4j.Logger;
+
+import org.apache.velocity.Template;
+import org.apache.velocity.VelocityContext;
+
+import org.apache.velocity.app.VelocityEngine;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * This class iterates over a bunch of directories, searches for meta
+ * information coresponding to shapefiles and creates a mapfile which is used by
+ * a <i>MapServer</i>.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class MapfileGenerator
+extends Thread
+{
+    /**
+     * The configured template path.
+     */
+    public static final String TEMPLATE_PATH =
+        "/artifact-database/gnv/map-generator/templates/path/text()";
+
+    /**
+     * The configured template mapfile.
+     */
+    public static final String TEMPLATE_MAPFILE =
+        "/artifact-database/gnv/map-generator/templates/maptemplate/text()";
+
+    /**
+     * The configured mapfile path.
+     */
+    public static final String MAPFILE_PATH =
+        "/artifact-database/gnv/map-generator/mapfile/@path";
+
+    /**
+     * The configured shapefile base directory where the subdirectories for each
+     * artifact are stored.
+     */
+    public static final String SHAPEFILE_BASE_DIR =
+        "/artifact-database/gnv/shapefile-directory/@path";
+
+    /**
+     * The configured velocity logfile.
+     */
+    public static final String VELOCITY_LOGFILE =
+        "/artifact-database/velocity/logfile/@path";
+
+    /**
+     * The URL for calling the mapserver
+     */
+    public static final String MAPSERVER_URL =
+        "/artifact-database/mapserver/server/@path";
+
+    /**
+     * The name of the file storing meta information coresponding to shapefiles.
+     */
+    public static final String META_FILE_NAME = "meta.xml";
+
+    /**
+     * The XPath to layer nodes in the meta information xml file.
+     */
+    public static final String XPATH_LAYER        = "/art:meta/art:layer";
+
+    public static final String XPATH_LAYER_NAME   = "art:name";
+    public static final String XPATH_LAYER_TITLE  = "art:title";
+    public static final String XPATH_LAYER_TYPE   = "art:type";
+    public static final String XPATH_LAYER_DATA   = "art:data";
+    public static final String XPATH_LAYER_STATUS = "art:status";
+    public static final String XPATH_LAYER_MODEL  = "art:model";
+
+    protected static final long SLEEPTIME = 10 * 1000L; // 10 seconds
+
+    private static Logger logger = Logger.getLogger(MapfileGenerator.class);
+
+    private static MapfileGenerator instance;
+
+    private File   mapfile;
+    private String mapServerUrl;
+    private String shapefileDirectory;
+    private String templatePath;
+    private String velocityLogfile;
+
+    private VelocityEngine velocityEngine;
+    private boolean lock[];
+
+
+
+    private MapfileGenerator() {
+        lock = new boolean[1];
+    }
+
+
+    /**
+     * A main method which can be used to create a mapfile without a running
+     * artifact server.<br>
+     * <b>NOTE:</b> This method is not implemented yet!
+     *
+     * @param args Arguments.
+     */
+    public static void main(String[] args) {
+        // TODO IMPLEMENT ME
+    }
+
+
+    /**
+     * Returns the instance of this generator.
+     *
+     * @return the instance.
+     */
+    public static synchronized MapfileGenerator getInstance() {
+        if (instance == null) {
+            instance = new MapfileGenerator();
+            instance.setDaemon(true);
+            instance.start();
+        }
+
+        return instance;
+    }
+
+
+    /**
+     * Triggers the mapfile generation process.
+     */
+    public void update() {
+        synchronized (lock) {
+            logger.debug("update");
+            lock[0] = true;
+            lock.notify();
+        }
+    }
+
+
+    /**
+     * Thread to generate a mapfile.
+     */
+    @Override
+    public void run() {
+        logger.debug("Start MapfileGenerator thread...");
+        try {
+            for (;;) {
+                synchronized (lock) {
+                    while (!lock[0]) {
+                        lock.wait(SLEEPTIME);
+                    }
+                    lock[0] = false;
+                }
+
+                logger.debug("Start sync process now...");
+                generate();
+            }
+        }
+        catch (InterruptedException ie) {
+            logger.debug("MapfileGenerator thread got an interrupt.");
+        }
+        finally {
+            logger.debug("THREAD END");
+        }
+    }
+
+    /**
+     * Method to check the existance of a template file.
+     *
+     * @param templateID The name of a template.
+     * @return true, of the template exists - otherwise false.
+     */
+    public boolean templateExists(String templateID){
+        Template template = getTemplateByName(templateID);
+        return template != null;
+    }
+
+
+    /**
+     * Method which starts searching for meta information file and mapfile
+     * generation.
+     */
+    protected void generate() {
+        File basedir       = new File(getShapefileBaseDir());
+        List layers        = new ArrayList();
+        searchMetaInformation(basedir, layers);
+        writeMapfile(layers);
+    }
+
+
+    /**
+     * Returns the VelocityEngine used for the template mechanism.
+     *
+     * @return the velocity engine.
+     */
+    protected VelocityEngine getVelocityEngine() {
+        if (velocityEngine == null) {
+            velocityEngine = new VelocityEngine();
+            try {
+                setupVelocity(velocityEngine);
+            }
+            catch (Exception e) {
+                logger.error(e, e);
+                return null;
+            }
+        }
+        return velocityEngine;
+    }
+
+
+    /**
+     * Initialize velocity.
+     *
+     * @param engine Velocity engine.
+     * @throws Exception if an error occured while initializing velocity.
+     */
+    protected void setupVelocity(VelocityEngine engine)
+    throws Exception
+    {
+        engine.setProperty(
+            "input.encoding",
+            "UTF-8");
+
+        engine.setProperty(
+            VelocityEngine.RUNTIME_LOG,
+            getVelocityLogfile());
+
+        engine.setProperty(
+            "resource.loader",
+            "file");
+
+        engine.setProperty(
+            "file.resource.loader.path",
+            getTemplateBaseDir());
+
+        engine.init();
+    }
+
+
+    /**
+     * Returns the path specifying the logfile for velocity.
+     *
+     * @return Velocity logfile path.
+     */
+    protected String getVelocityLogfile() {
+        if (velocityLogfile == null)
+            velocityLogfile = Config.getStringXPath(VELOCITY_LOGFILE);
+
+        return velocityLogfile;
+    }
+
+
+    /**
+     * Returns the base directory storing the templates.
+     *
+     * @return the template base directory.
+     */
+    protected String getTemplateBaseDir() {
+        if (templatePath == null) {
+            templatePath = Config.getStringXPath(TEMPLATE_PATH);
+            templatePath = Config.replaceConfigDir(templatePath);
+        }
+
+        return templatePath;
+    }
+
+
+    /**
+     * Returns the URL for calling the MapServer.
+     *
+     * @return the url for calling the MapServer.
+     */
+    protected String getMapServerUrl() {
+        if (mapServerUrl == null) {
+            mapServerUrl = Config.getStringXPath(MAPSERVER_URL);
+            mapServerUrl = Config.replaceConfigDir(mapServerUrl);
+        }
+
+        return mapServerUrl;
+    }
+
+
+    /**
+     * Returns a template specified by <i>model</i>.
+     *
+     * @param model The name of the template.
+     * @return a template.
+     */
+    protected Template getTemplateByName(String model) {
+        if (model.indexOf(".vm") < 0) {
+            model = model.concat(".vm");
+        }
+
+        try {
+            VelocityEngine engine = getVelocityEngine();
+            if (engine == null) {
+                logger.error("Error while fetching VelocityEngine.");
+                return null;
+            }
+
+            return engine.getTemplate(model);
+        }
+        catch (Exception e) {
+            logger.warn(e, e);
+        }
+
+        return null;
+    }
+
+
+    /**
+     * Returns the mapfile  template.
+     *
+     * @return the mapfile template.
+     * @throws Exception if an error occured while reading the configuration.
+     */
+    protected Template getMapfileTemplate()
+    throws Exception
+    {
+        String mapfileName = Config.getStringXPath(TEMPLATE_MAPFILE);
+        return getTemplateByName(mapfileName);
+    }
+
+
+    /**
+     * Returns the base directory storing the shapefiles.
+     *
+     * @return the shapefile base directory.
+     */
+    protected String getShapefileBaseDir() {
+        if (shapefileDirectory == null) {
+            shapefileDirectory = Config.getStringXPath(SHAPEFILE_BASE_DIR);
+            shapefileDirectory = Config.replaceConfigDir(shapefileDirectory);
+        }
+
+        return shapefileDirectory;
+    }
+
+
+    /**
+     * Returns the mapfile.
+     *
+     * @return the mapfile.
+     */
+    protected File getMapfile() {
+        if (mapfile == null) {
+            String tmp = Config.getStringXPath(MAPFILE_PATH);
+            tmp        = Config.replaceConfigDir(tmp);
+            mapfile    = new File(tmp);
+        }
+
+        return mapfile;
+    }
+
+
+    /**
+     * Search for meta information file in <i>file</i> and store the layer
+     * information in <i>store</i> if a meta file was found.
+     *
+     * @param file The root directory to be searched for meta files.
+     * @param store A list storing <code>LayerInfo</code> objects.
+     */
+    protected void searchMetaInformation(File file, List store) {
+        if (file.isDirectory()) {
+            File[] files = file.listFiles();
+
+            if (files != null && files.length != 0) {
+                int size = files.length;
+                for (File tmp: files) {
+                    searchMetaInformation(tmp, store);
+                }
+            }
+        }
+        else if (file.getName().equals(META_FILE_NAME)) {
+            LayerInfo[] info = parseMeta(file);
+
+            int infoSize = info.length;
+            for (int j = 0; j < infoSize; j++) {
+                if (info[j] != null) {
+                    store.add(info[j]);
+                }
+            }
+        }
+    }
+
+
+    /**
+     * Parses a meta information file and returns necessary information as
+     * <code>LayerInfo</code> array.
+     *
+     * @param file Meta information file.
+     * @return Array of LayerInfo objects.
+     */
+    protected LayerInfo[] parseMeta(File file) {
+        Document meta = XMLUtils.parseDocument(file);
+        List layers   = new ArrayList();
+
+        NodeList layerset = (NodeList) XMLUtils.xpath(
+            meta,
+            XPATH_LAYER,
+            XPathConstants.NODESET,
+            ArtifactNamespaceContext.INSTANCE);
+
+        int size = layerset.getLength();
+        for (int i = 0; i < size; i++) {
+            LayerInfo info = parseLayer(layerset.item(i));
+
+            if (info != null && !info.isEmpty() && !info.isBroken()) {
+                layers.add(info);
+            }
+            else {
+                logger.warn("Found broken LayerInfo object.");
+            }
+        }
+
+        return (LayerInfo[]) layers.toArray(new LayerInfo[layers.size()]);
+    }
+
+
+    /**
+     * Parses a node storing layer information and returns them.
+     *
+     * @param layer Node storing information about a layer.
+     * @return a LayerInfo object.
+     */
+    protected LayerInfo parseLayer(Node layer) {
+        LayerInfo info  = new LayerInfo();
+
+        String name = parseLayerAttr(layer, XPATH_LAYER_NAME);
+        if (name != null && !name.equals("")) {
+            info.setName(name);
+        }
+
+        String title = parseLayerAttr(layer, XPATH_LAYER_TITLE);
+        if (title != null && !title.equals("")) {
+            info.setTitle(title);
+        }
+        else {
+            info.setTitle(name);
+        }
+
+        String model = parseLayerAttr(layer, XPATH_LAYER_MODEL);
+        if (model != null && !model.equals("")) {
+            info.setModel(model);
+        }
+
+        String type = parseLayerAttr(layer, XPATH_LAYER_TYPE);
+        if (type != null && !type.equals("")) {
+            info.setType(type);
+        }
+
+        String data = parseLayerAttr(layer, XPATH_LAYER_DATA);
+        if (data != null && !data.equals("")) {
+            info.setData(data);
+        }
+
+        String status = parseLayerAttr(layer, XPATH_LAYER_STATUS);
+        if (status != null && !status.equals("")) {
+            info.setStatus(status);
+        }
+
+        return info;
+    }
+
+
+    /**
+     * Parses attributes in layer nodes.
+     *
+     * @param node A node containing layer information.
+     * @param xpath XPath specifying an attribute.
+     * @return Attribute as string.
+     */
+    protected String parseLayerAttr(Node node, String xpath) {
+        return (String) XMLUtils.xpath(
+            node,
+            xpath,
+            XPathConstants.STRING,
+            ArtifactNamespaceContext.INSTANCE);
+    }
+
+
+    /**
+     * Creates a mapfile with the layer information stored in <i>layers</i>.
+     *
+     * @param layers Layer information.
+     */
+    protected void writeMapfile(List layers) {
+        String tmpMapName = "mapfile" + new Date().getTime();
+
+        int layersize         = layers.size();
+        StringBuilder sb      = new StringBuilder();
+        StringWriter sw       = null;
+        LayerInfo info        = null;
+
+        for (int i = 0; i < layersize; i++) {
+            sw   = new StringWriter();
+            info = (LayerInfo) layers.get(i);
+
+            Template layerTemplate  = getTemplateByName(info.getModel());
+            VelocityContext context = new VelocityContext();
+            context.put("info", info);
+
+            try {
+                layerTemplate.merge(context, sw);
+                sb.append(sw.toString());
+            }
+            catch (IOException ioe) {
+                logger.warn("Error while filling layer template.");
+                logger.warn(ioe, ioe);
+            }
+        }
+
+        File   map    = getMapfile();
+        Writer writer = null;
+        File   tmp    = null;
+
+        try {
+            tmp = new File(map.getParent(), tmpMapName);
+
+            tmp.createNewFile();
+            writer   = new FileWriter(tmp);
+
+            VelocityContext context = new VelocityContext();
+            context.put("MAPSERVERURL", getMapServerUrl());
+            context.put("LAYERS", sb.toString());
+
+            Template mapTemplate = getMapfileTemplate();
+            if (mapTemplate == null) {
+                logger.warn("No mapfile template found.");
+                return;
+            }
+
+            mapTemplate.merge(context, writer);
+
+            // we need to create a temporary mapfile first und rename it into
+            // real mapfile because we don't run into race conditions on this
+            // way. (iw)
+            tmp.renameTo(map);
+        }
+        catch (FileNotFoundException fnfe) {
+            logger.error(fnfe, fnfe);
+        }
+        catch (IOException ioe) {
+            logger.error(ioe, ioe);
+        }
+        catch (Exception e) {
+            logger.error(e, e);
+        }
+        finally {
+            try {
+                // close file writer
+                if (writer != null) {
+                    writer.close();
+                }
+
+                // remove temporary mapfile if an error occured and it still
+                // exists
+                if (tmp.exists()) {
+                    tmp.delete();
+                }
+            }
+            catch (IOException ioe) {
+                logger.debug(ioe, ioe);
+            }
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MetaWriter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.utils;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.text.DecimalFormat;
+import java.util.Date;
+
+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 com.vividsolutions.jts.geom.Envelope;
+
+import de.intevation.artifacts.common.utils.XMLUtils;
+import de.intevation.artifacts.ArtifactNamespaceContext;
+import de.intevation.artifacts.CallContext;
+import de.intevation.gnv.artifacts.context.GNVArtifactContext;
+import de.intevation.gnv.wms.LayerInfo;
+
+/**
+ * This class provides some methods to create files storing meta information
+ * about wms layers and a map service which serves these layers.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class MetaWriter {
+
+    private static Logger logger = Logger.getLogger(MetaWriter.class);
+
+    public static final String NODE_MAPSERVER = "mapserver";
+    public static final String NODE_SERVER    = "server";
+    public static final String NODE_MAP       = "map";
+    public static final String NODE_TTL       = "ttl";
+
+    public static final String META_FILE_NAME = "meta.xml";
+
+    public static final String XPATH_META = "/art:meta";
+    public static final String XPATH_MAPSERVER = "art:meta/art:"+NODE_MAPSERVER;
+
+    /**
+     * Constructor.
+     */
+    private MetaWriter() {
+    }
+
+
+    /**
+     * Just create a new document and insert the root node.
+     *
+     * @return the meta document with necessary root node.
+     */
+    public static Document initMeta() {
+        Document meta = XMLUtils.newDocument();
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            meta,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element root = creator.create("meta");
+        meta.appendChild(root);
+
+        return meta;
+    }
+
+    public static boolean insertLayer(
+        CallContext context,
+        Document    document,
+        String      name,
+        String      title,
+        String      data,
+        String      model,
+        String      type,
+        String      status
+    ) {
+        if (document == null) {
+            document = initMeta();
+        }
+
+        Node meta = (Node) XMLUtils.xpath(
+            document,
+            XPATH_META,
+            XPathConstants.NODE,
+            ArtifactNamespaceContext.INSTANCE);
+
+        if (meta == null) {
+            logger.error("No meta node was found in the given document. "
+                + "Cannot insert layer!");
+            return false;
+        }
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        Element layerEl  = creator.create(LayerInfo.LAYER);
+        Element nameEl   = creator.create(LayerInfo.LAYER_NAME);
+        Element titleEl  = creator.create(LayerInfo.LAYER_TITLE);
+        Element dataEl   = creator.create(LayerInfo.LAYER_DATA);
+        Element modelEl  = creator.create(LayerInfo.LAYER_MODEL);
+        Element typeEl   = creator.create(LayerInfo.LAYER_TYPE);
+        Element statusEl = creator.create(LayerInfo.LAYER_STATUS);
+
+        modelEl.setTextContent(model);
+        nameEl.setTextContent(name);
+        titleEl.setTextContent(title);
+        typeEl.setTextContent(type);
+        statusEl.setTextContent(status);
+        dataEl.setTextContent(data);
+
+        layerEl.appendChild(modelEl);
+        layerEl.appendChild(nameEl);
+        layerEl.appendChild(titleEl);
+        layerEl.appendChild(dataEl);
+        layerEl.appendChild(typeEl);
+        layerEl.appendChild(statusEl);
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("--------------- WMS LAYER PARAMS ---------------");
+            logger.debug("Name  : " + name);
+            logger.debug("Title : " + title);
+            logger.debug("Data  : " + data);
+            logger.debug("Type  : " + type);
+            logger.debug("Model : " + model);
+            logger.debug("Status: " + status);
+        }
+
+        meta.appendChild(layerEl);
+
+        return true;
+    }
+
+    /**
+     * Method to write the <i>meta</i> document down to a file.
+     *
+     * @param path The destination of the file.
+     * @param meta The xml document storing the meta information.
+     */
+    public static boolean insertMbr(Envelope mbr, String srs, Document meta) {
+        Node mapserverNode = (Node) XMLUtils.xpath(
+                meta,
+                XPATH_MAPSERVER,
+                XPathConstants.NODE,
+                ArtifactNamespaceContext.INSTANCE);
+        if (mapserverNode != null){
+            XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+                    meta,
+                    ArtifactNamespaceContext.NAMESPACE_URI,
+                    ArtifactNamespaceContext.NAMESPACE_PREFIX);
+            Element bboxNode = creator.create("Box");
+            bboxNode.setAttribute("srsName", srs);
+            Element coordinateNode = creator.create("coordinates");
+
+            DecimalFormat formatter = new DecimalFormat("###.############");
+            coordinateNode.setTextContent(formatter.format(mbr.getMinX()).replace(',', '.') +","+ 
+                                          formatter.format(mbr.getMinY()).replace(',', '.')+" "+
+                                          formatter.format(mbr.getMaxX()).replace(',', '.') +","+ 
+                                          formatter.format(mbr.getMaxY()).replace(',', '.'));
+            mapserverNode.appendChild(bboxNode);
+            bboxNode.appendChild(coordinateNode);
+        }
+        return true;
+    }
+    /**
+     * Method to write the <i>meta</i> document down to a file.
+     *
+     * @param path The destination of the file.
+     * @param meta The xml document storing the meta information.
+     */
+    public static boolean writeMetaFile(String path, Document meta) {
+        try {
+            File metaFile = new File(path, META_FILE_NAME);
+
+            if (metaFile.exists()) {
+                logger.info("Delete old meta information file.");
+                metaFile.delete();
+            }
+
+            if (!metaFile.createNewFile() || !metaFile.canWrite()) {
+                logger.error("Error while writing meta file: "+metaFile.toString());
+                return false;
+            }
+
+            OutputStream out = null;
+            boolean success = false;
+            try {
+                out = new FileOutputStream(metaFile);
+                success = XMLUtils.toStream(meta, out);
+            }
+            finally {
+                if (out != null) {
+                    try { out.close(); }
+                    catch (IOException ioe) {}
+                }
+            }
+
+            if (!success && metaFile.exists()) {
+                metaFile.delete();
+            }
+
+            return success;
+        }
+        catch (FileNotFoundException fnfe) {
+            logger.error(fnfe);
+            return false;
+        }
+        catch (IOException ioe) {
+            logger.error(ioe, ioe);
+            return false;
+        }
+    }
+
+
+    /**
+     * Append meta information about the mapservice itself.
+     *
+     * @param callContext The CallContext object.
+     * @param document The meta information document.
+     * @param meta The element where the new information need to be appended to.
+     */
+    public static void insertAbstractMeta(
+        CallContext callContext,
+        Document    document
+    ) {
+        if (document == null) {
+            document = initMeta();
+        }
+
+        Node meta = (Node) XMLUtils.xpath(
+            document,
+            XPATH_META,
+            XPathConstants.NODE,
+            ArtifactNamespaceContext.INSTANCE);
+
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            ArtifactNamespaceContext.NAMESPACE_URI,
+            ArtifactNamespaceContext.NAMESPACE_PREFIX);
+
+        GNVArtifactContext context =
+            (GNVArtifactContext) callContext.globalContext();
+
+        String server = (String)
+            context.get(GNVArtifactContext.MAPSERVER_SERVER_PATH_KEY);
+
+        String map = (String)
+            context.get(GNVArtifactContext.MAPSERVER_MAP_PATH_KEY);
+
+        Long time  = callContext.getTimeToLive();
+        time       = time != null ? time + new Date().getTime() : null;
+        String ttl = time != null ? time.toString() : null;
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("MAPSERVER PATH: " + server);
+            logger.debug("MAP PATH: " + map);
+            logger.debug("TTL: " + ttl);
+        }
+
+        Element mapserver  = creator.create(NODE_MAPSERVER);
+        Element serverPath = creator.create(NODE_SERVER);
+        Element mapPath    = creator.create(NODE_MAP);
+        Element timetolive = creator.create(NODE_TTL);
+
+        mapPath.setTextContent(map);
+        serverPath.setTextContent(server);
+        timetolive.setTextContent(ttl);
+
+        mapserver.appendChild(serverPath);
+        mapserver.appendChild(mapPath);
+        mapserver.appendChild(timetolive);
+        meta.appendChild(mapserver);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/Pair.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.utils;
+
+import java.io.Serializable;
+
+/**
+ * @param <A>
+ * @param <B>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public final class Pair<A, B>
+implements         Serializable
+{
+    private A a;
+    private B b;
+
+    private Pair() {
+    }
+
+    public Pair(A a, B b) {
+        this.a = a;
+        this.b = b;
+    }
+
+    public A getA() {
+        return a;
+    }
+
+    public B getB() {
+        return b;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/ShapeFileWriter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,495 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.MalformedURLException;
+import java.text.NumberFormat;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.geotools.data.DataStoreFactorySpi;
+import org.geotools.data.DataUtilities;
+import org.geotools.data.DefaultTransaction;
+import org.geotools.data.FeatureStore;
+import org.geotools.data.Transaction;
+import org.geotools.data.shapefile.ShapefileDataStore;
+import org.geotools.data.shapefile.ShapefileDataStoreFactory;
+import org.geotools.feature.FeatureCollection;
+import org.geotools.feature.FeatureCollections;
+import org.geotools.feature.SchemaException;
+import org.geotools.feature.simple.SimpleFeatureBuilder;
+import org.geotools.referencing.crs.DefaultGeographicCRS;
+import org.opengis.feature.simple.SimpleFeature;
+import org.opengis.feature.simple.SimpleFeatureType;
+
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.MultiLineString;
+import com.vividsolutions.jts.geom.MultiPolygon;
+import com.vividsolutions.jts.io.ParseException;
+import com.vividsolutions.jts.io.WKTReader;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+/**
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public final class ShapeFileWriter
+{
+    private static Logger log = Logger.getLogger(
+        ShapeFileWriter.class);
+
+    private static NumberFormat format = NumberFormat.getInstance();
+
+    /**
+     * Precision used to format double values.
+     */
+    public static final int DOUBLE_PRECISION = 3;
+
+    static {
+        format.setMaximumFractionDigits(DOUBLE_PRECISION);
+    }
+
+    private ShapeFileWriter() {
+    }
+
+
+    /**
+     * Write multilinestrings to shapefile.
+     *
+     * @param shapeFile Shapefile.
+     * @param parameterId The parameter id.
+     * @param layer The layer.
+     * @param date The date.
+     * @param multiLineStrings The multilinestring.
+     * @return true, if shapefile writing was successful - otherwise false.
+     */
+    public static boolean writeMultiLineStringsToFile(
+        File                                shapeFile,
+        Integer                             parameterId,
+        Integer                             layer,
+        Date                                date,
+        List<Pair<Object, MultiLineString>> multiLineStrings
+    ) {
+        return writeMultiLineStringsToFile(
+            shapeFile,
+            parameterId,
+            layer,
+            date,
+            multiLineStrings,
+            "isolines");
+    }
+
+
+    /**
+     * Write multilinestrings to shapefile.
+     *
+     * @param shapeFile Shapefile.
+     * @param parameterId The parameter id.
+     * @param layer The layer.
+     * @param date The date.
+     * @param multiLineStrings The multilinestring.
+     * @param name A name.
+     * @return true, if shapefile writing was successful - otherwise false.
+     */
+    public static boolean writeMultiLineStringsToFile(
+        File                                shapeFile,
+        Integer                             parameterId,
+        Integer                             layer,
+        Date                                date,
+        List<Pair<Object, MultiLineString>> multiLineStrings,
+        String                              name
+    ) {
+        Map<String, Serializable> params = new HashMap<String, Serializable>();
+
+        try {
+            params.put("url", shapeFile.toURI().toURL());
+        }
+        catch (MalformedURLException mue) {
+            log.error(mue.getLocalizedMessage(), mue);
+            return false;
+        }
+
+        params.put("create spatial index", Boolean.TRUE);
+
+
+        if (name == null) {
+            name = shapeFile.getName();
+        }
+
+        SimpleFeatureType TYPE;
+
+        try {
+            TYPE = DataUtilities.createType(
+                name,
+                "geom:MultiLineString:srid=4326," +
+                "PARAMETER:Integer," +
+                "LAYER:Integer,"     +
+                "DATE:Date,"         +
+                "VALUE:Double,"       +
+                "DESC:String");
+        }
+        catch (SchemaException se) {
+            log.error(se.getLocalizedMessage(), se);
+            return false;
+        }
+
+        SimpleFeatureBuilder featureBuilder =
+            new SimpleFeatureBuilder(TYPE);
+
+        FeatureCollection<SimpleFeatureType, SimpleFeature> collection =
+            FeatureCollections.newCollection();
+
+        for (Pair<Object, MultiLineString> pair: multiLineStrings) {
+            featureBuilder.add(pair.getB());
+            featureBuilder.add(parameterId);
+            featureBuilder.add(layer);
+            featureBuilder.add(date);
+            featureBuilder.add(pair.getA());
+            featureBuilder.add(value2description(asDouble(pair.getA())));
+            SimpleFeature feature = featureBuilder.buildFeature(null);
+            collection.add(feature);
+        }
+
+        DataStoreFactorySpi dataStoreFactory = new ShapefileDataStoreFactory();
+
+        Transaction transaction = null;
+
+        boolean success = false;
+        try {
+            ShapefileDataStore newDataStore =
+                (ShapefileDataStore)dataStoreFactory.createNewDataStore(params);
+
+            newDataStore.createSchema(TYPE);
+            newDataStore.forceSchemaCRS(DefaultGeographicCRS.WGS84);
+
+            transaction = new DefaultTransaction("create");
+
+            String typeName = newDataStore.getTypeNames()[0];
+
+            FeatureStore<SimpleFeatureType, SimpleFeature> featureStore =
+                (FeatureStore<SimpleFeatureType, SimpleFeature>)
+                    newDataStore.getFeatureSource(typeName);
+
+            featureStore.setTransaction(transaction);
+
+            featureStore.addFeatures(collection);
+            transaction.commit();
+            success = true;
+        }
+        catch (IOException ioe) {
+            log.error(ioe.getLocalizedMessage(), ioe);
+        }
+        finally {
+            if (transaction != null) {
+                if (!success) {
+                    try { transaction.rollback(); }
+                    catch (IOException ioe) {}
+                }
+                try { transaction.close(); }
+                catch (IOException ioe) {}
+            }
+        }
+
+        return success;
+    }
+
+
+    /**
+     * Write multipolygon to file.
+     *
+     * @param shapeFile The shapefile.
+     * @param parameterId The parameter id.
+     * @param layer The layer.
+     * @param date The date.
+     * @param multiPolygons Multipolygons.
+     * @return true, if shapefile writing was successful - otherwise false.
+     */
+    public static boolean writeMultiPolygonsToFile(
+        File                       shapeFile,
+        Integer                    parameterId,
+        Integer                    layer,
+        Date                       date,
+        Map<Integer, MultiPolygon> multiPolygons
+    ) {
+        return writeMultiPolygonsToFile(
+            shapeFile,
+            parameterId,
+            layer,
+            date,
+            multiPolygons,
+            "polygons");
+    }
+
+
+    /**
+     * Write data to shapefile.
+     *
+     * @param shapeFile The shapefile.
+     * @param name The name.
+     * @param data The data.
+     * @param geometryType The geometry type.
+     * @return true, if shapefile writing was successful - otherwise false.
+     */
+    public static boolean writeDataToFile(File shapeFile,
+                                          String name,
+                                          Collection<Result> data,
+                                          String geometryType){
+
+        WKTReader wktReader = new WKTReader();
+
+        Map<String, Serializable> params = new HashMap<String, Serializable>();
+
+        try {
+            params.put("url", shapeFile.toURI().toURL());
+        }
+        catch (MalformedURLException mue) {
+            log.error(mue.getLocalizedMessage(), mue);
+            return false;
+        }
+
+        params.put("create spatial index", Boolean.TRUE);
+
+
+        if (name == null) {
+            name = shapeFile.getName();
+        }
+
+        SimpleFeatureType type = null;
+        SimpleFeatureBuilder featureBuilder = null;
+        FeatureCollection<SimpleFeatureType, SimpleFeature> collection =
+            FeatureCollections.newCollection();
+        int j = 0;
+        for (Result result: data) {
+            j++;
+            try {
+                Geometry g = wktReader.read(result.getString(0));
+                ResultDescriptor rd = result.getResultDescriptor();
+                int columns = rd.getColumnCount();
+                if (type == null){
+                    try {
+                        String schema = "geom:"+geometryType+":srid=4326";
+                        for (int i = 1; i < columns; i++){
+                            schema+=","+rd.getColumnName(i)+
+                                    ":"+rd.getColumnClassName(i);
+                        }
+                        type = DataUtilities.createType(name, schema);
+                    }
+                    catch (SchemaException se) {
+                        log.error(se.getLocalizedMessage(), se);
+                        return false;
+                    }
+                    featureBuilder = new SimpleFeatureBuilder(type);
+                }
+                featureBuilder.add(g);
+                for (int i = 1; i < columns; i++){
+                    featureBuilder.add(result.getObject(i));
+                }
+                SimpleFeature feature = featureBuilder.buildFeature(null);
+                collection.add(feature);
+            } catch (ParseException e) {
+                log.error("cannot create geometry "+j+" for "+result.getString(0));
+            } catch (java.lang.IllegalArgumentException e){
+                log.error("cannot create geometry for "+result.getString(0));
+            }
+        }
+
+        DataStoreFactorySpi dataStoreFactory = new ShapefileDataStoreFactory();
+
+        Transaction transaction = null;
+
+        boolean success = false;
+        try {
+            ShapefileDataStore newDataStore =
+                (ShapefileDataStore)dataStoreFactory.createNewDataStore(params);
+
+            newDataStore.createSchema(type);
+            newDataStore.forceSchemaCRS(DefaultGeographicCRS.WGS84);
+
+            transaction = new DefaultTransaction("create");
+
+            String typeName = newDataStore.getTypeNames()[0];
+
+            FeatureStore<SimpleFeatureType, SimpleFeature> featureStore =
+                (FeatureStore<SimpleFeatureType, SimpleFeature>)
+                    newDataStore.getFeatureSource(typeName);
+
+            featureStore.setTransaction(transaction);
+
+            featureStore.addFeatures(collection);
+            transaction.commit();
+            success = true;
+        }
+        catch (IOException ioe) {
+            log.error(ioe.getLocalizedMessage(), ioe);
+        }
+        finally {
+            if (transaction != null) {
+                if (!success) {
+                    try { transaction.rollback(); }
+                    catch (IOException ioe) {}
+                }
+                try { transaction.close(); }
+                catch (IOException ioe) {}
+            }
+        }
+
+        return true;
+    }
+
+
+    /**
+     * Write multipolygons to file.
+     *
+     * @param shapeFile The shapefile.
+     * @param parameterId The parameter id.
+     * @param layer The layer.
+     * @param date The date.
+     * @param multiPolygons Multipolygons.
+     * @param name A name.
+     * @return true, if shapefile writing was successful - otherwise false.
+     */
+    public static boolean writeMultiPolygonsToFile(
+        File                       shapeFile,
+        Integer                    parameterId,
+        Integer                    layer,
+        Date                       date,
+        Map<Integer, MultiPolygon> multiPolygons,
+        String                     name
+    ) {
+        Map<String, Serializable> params = new HashMap<String, Serializable>();
+
+        try {
+            params.put("url", shapeFile.toURI().toURL());
+        }
+        catch (MalformedURLException mue) {
+            log.error(mue.getLocalizedMessage(), mue);
+            return false;
+        }
+
+        params.put("create spatial index", Boolean.TRUE);
+
+
+        if (name == null) {
+            name = shapeFile.getName();
+        }
+
+        SimpleFeatureType TYPE;
+
+        try {
+            TYPE = DataUtilities.createType(
+                name,
+                "geom:MultiPolygon:srid=4326," +
+                "PARAMETER:Integer," +
+                "LAYER:Integer,"     +
+                "DATE:Date,"         +
+                "CLASS:Integer");
+        }
+        catch (SchemaException se) {
+            log.error(se.getLocalizedMessage(), se);
+            return false;
+        }
+
+        SimpleFeatureBuilder featureBuilder =
+            new SimpleFeatureBuilder(TYPE);
+
+        FeatureCollection<SimpleFeatureType, SimpleFeature> collection =
+            FeatureCollections.newCollection();
+
+        for (Map.Entry<Integer, MultiPolygon> entry:
+            multiPolygons.entrySet()
+        ) {
+            featureBuilder.add(entry.getValue());
+            featureBuilder.add(parameterId);
+            featureBuilder.add(layer);
+            featureBuilder.add(date);
+            featureBuilder.add(entry.getKey());
+            SimpleFeature feature = featureBuilder.buildFeature(null);
+            collection.add(feature);
+        }
+
+        DataStoreFactorySpi dataStoreFactory = new ShapefileDataStoreFactory();
+
+        Transaction transaction = null;
+
+        boolean success = false;
+        try {
+            ShapefileDataStore newDataStore =
+                (ShapefileDataStore)dataStoreFactory.createNewDataStore(params);
+
+            newDataStore.createSchema(TYPE);
+            newDataStore.forceSchemaCRS(DefaultGeographicCRS.WGS84);
+
+            transaction = new DefaultTransaction("create");
+
+            String typeName = newDataStore.getTypeNames()[0];
+
+            FeatureStore<SimpleFeatureType, SimpleFeature> featureStore =
+                (FeatureStore<SimpleFeatureType, SimpleFeature>)
+                    newDataStore.getFeatureSource(typeName);
+
+            featureStore.setTransaction(transaction);
+
+            featureStore.addFeatures(collection);
+            transaction.commit();
+            success = true;
+        }
+        catch (IOException ioe) {
+            log.error(ioe.getLocalizedMessage(), ioe);
+        }
+        finally {
+            if (transaction != null) {
+                if (!success) {
+                    try { transaction.rollback(); }
+                    catch (IOException ioe) {}
+                }
+                try { transaction.close(); }
+                catch (IOException ioe) {}
+            }
+        }
+
+        return success;
+    }
+
+    /**
+     * Returns an object as Double.
+     *
+     * @param a An object.
+     * @return Object <i>a</i> as Double. If <i>a</i> is not a double and no
+     * number, 0d is returned.
+     */
+    private static final Double asDouble(Object a) {
+        if (a instanceof Double) {
+            return (Double)a;
+        }
+        if (a instanceof Number) {
+            return Double.valueOf(((Number)a).doubleValue());
+        }
+        return 0d;
+    }
+
+    /**
+     * Turns a double value into a string representation taking account of the
+     * locale.
+     *
+     * @param value A double value.
+     * @return The double value formatted as string.
+     */
+    private static final String value2description(Double value) {
+        return format.format(value);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/StringUtils.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.utils;
+
+/**
+ * Helper class which supports some methods for working with strings.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+ */
+public final class StringUtils
+{
+    private StringUtils() {
+    }
+
+    /**
+     * Append a string to a string array.
+     *
+     * @param haystack String array.
+     * @param straw String to append.
+     * @return the new string array.
+     */
+    public static final String [] append(String [] haystack, String straw) {
+        if (haystack == null) {
+            return new String [] { straw };
+        }
+        String [] nhaystack = new String[haystack.length + 1];
+        System.arraycopy(haystack, 0, nhaystack, 0, haystack.length);
+        nhaystack[haystack.length] = straw;
+        return nhaystack;
+    }
+
+    /**
+     * Checks the existence of a string in a given string array.
+     *
+     * @param haystack String array.
+     * @param needle String for being checked.
+     * @return true, if the string is contained in <i>haystack</i> - else false.
+     */
+    public static final boolean contains(String [] haystack, String needle) {
+        if (haystack == null) {
+            return false;
+        }
+
+        if (needle == null) {
+            for (int i = haystack.length - 1; i >= 0; --i) {
+                if (haystack[i] == null) {
+                    return true;
+                }
+            }
+        }
+        else {
+            for (int i = haystack.length - 1; i >= 0; --i) {
+                String straw = haystack[i];
+                if (straw != null && straw.equals(needle)) {
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/VectorDataProcessor.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.utils;
+
+import de.intevation.artifacts.CallContext;
+
+import de.intevation.gnv.chart.Chart;
+import de.intevation.gnv.chart.ChartLabels;
+import de.intevation.gnv.chart.DefaultHistogram;
+
+import de.intevation.gnv.geobackend.base.DefaultResult;
+import de.intevation.gnv.geobackend.base.DefaultResultDescriptor;
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+import de.intevation.gnv.histogram.HistogramHelper;
+
+import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import org.jfree.chart.ChartTheme;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public final class VectorDataProcessor {
+
+    private static Logger logger = Logger.getLogger(VectorDataProcessor.class);
+
+    public static Collection<Result> process(
+        Collection<Result> input, String[] columnNames)
+    {
+        logger.info("Process vector data (" + input.size() + " items)");
+
+        ResultDescriptor outDescriptor = initResultDescriptor(columnNames);
+        ResultDescriptor inDescriptor  = null;
+        int[]            inIndices     = null;
+        int              columns       = -1;
+
+        Map series = new HashMap();
+
+        // for each result of the incoming result 
+        for (Result result: input) {
+            if (inDescriptor == null || inIndices == null) {
+                inDescriptor = result.getResultDescriptor();
+                inIndices    = inDescriptor.getColumnIndices(columnNames);
+                columns      = inDescriptor.getColumnCount();
+            }
+
+            // for each column of the incoming result object
+            for (int i = 0; i < columns; i++) {
+                String name = inDescriptor.getColumnName(i);
+
+                if (!StringUtils.contains(columnNames, name)) {
+                    List list = (List) series.get(name);
+                    if (list == null)
+                        list = new ArrayList();
+
+                    Result out   = new DefaultResult(outDescriptor);
+                    Object value = result.getObject(i);
+
+                    // skipp results that have no data value
+                    if (value == null)
+                        continue;
+
+                    out.addColumnValue(0, value);
+
+                    // add meta data to result object
+                    // TODO: Maybe we could do this one single time, because the
+                    // TODO: meta data will not change
+                    for (int j = 1; j < inIndices.length -1; j++) {
+                        out.addColumnValue(j, result.getObject(inIndices[j]));
+                    }
+
+                    // add the name of the component to distinguish between
+                    // different series later in the chart creation
+                    out.addColumnValue(inIndices.length-1, name);
+
+                    list.add(out);
+                    series.put(name, list);
+                }
+            }
+        }
+
+        // finally, we put all lists together
+        Iterator iter = series.values().iterator();
+        List   output = new ArrayList();
+        while (iter.hasNext()) {
+            output.addAll((Collection)iter.next());
+        }
+
+        logger.info("Data processing created " + output.size() + " elements.");
+        return output;
+    }
+
+
+    public static ResultDescriptor initResultDescriptor(String[] columnNames) {
+        logger.debug("Init ResultDescriptor for outgoing results.");
+
+        ResultDescriptor desc = new DefaultResultDescriptor();
+
+        for (String name: columnNames) {
+            desc.addColumn(name, "java.lang.String");
+        }
+
+        logger.debug("Outgoing ResultDescriptor has " + desc.getColumnCount() +
+                     " columns");
+        return desc;
+    }
+
+
+    public static Chart[] getHistograms(
+        String                          uuid,
+        CallContext                     callContext,
+        Collection<KeyValueDescibeData> results,
+        ChartTheme                      theme,
+        Map                             requestParameter
+    ) {
+        Locale locale = (Locale) requestParameter.get("locale");
+
+        Object[][] data = HistogramHelper.prepareVectorialHistogramData(results);
+        int        size = data.length;
+
+        Chart[]    histograms = new Chart[size];
+
+        for (int i = 0; i < size; i++) {
+            ChartLabels labels = HistogramHelper.createHistogramLabels(
+                uuid, callContext, locale, data[i]);
+
+            histograms[i] = new DefaultHistogram(
+                labels, data[i], theme, requestParameter);
+        }
+
+        return histograms;
+    }
+}
+// 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/gnv-artifacts/src/main/java/de/intevation/gnv/utils/WKTUtils.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,505 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.utils;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.Point;
+import com.vividsolutions.jts.geom.Polygon;
+
+import com.vividsolutions.jts.io.ParseException;
+import com.vividsolutions.jts.io.WKTReader;
+
+import de.intevation.gnv.artifacts.ressource.RessourceFactory;
+
+import de.intevation.gnv.geobackend.base.Result;
+
+import de.intevation.gnv.geobackend.base.query.QueryExecutor;
+import de.intevation.gnv.geobackend.base.query.QueryExecutorFactory;
+
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+
+import de.intevation.gnv.math.LinearFunction;
+
+import java.text.MessageFormat;
+import java.text.NumberFormat;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Locale;
+
+import org.apache.commons.math.FunctionEvaluationException;
+
+import org.apache.commons.math.optimization.OptimizationException;
+
+import org.apache.commons.math.optimization.fitting.CurveFitter;
+
+import org.apache.commons.math.optimization.general.GaussNewtonOptimizer;
+
+import org.apache.log4j.Logger;
+
+/**
+ * A helper class which supports some useful methods to work with wkt strings.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public abstract class WKTUtils {
+
+    private static Logger log = Logger.getLogger(WKTUtils.class);
+
+    public static final double NAUTICAL_MILE = 1852.216d;
+    public static final double KILOMETER     = 1000d;
+
+    public static final String I_NAME = "MEDIAN.MESHPOINT.IPOSITION";
+    public static final String J_NAME = "MEDIAN.MESHPOINT.JPOSITION";
+
+    public static final String TRUE_EXPRESSION = "FEATUREID=FEATUREID";
+
+    public static final String[] COORDINATE_OUT_FORMAT = {
+        "coordinate.template.northeast",
+        "coordinate.template.southeast",
+        "coordinate.template.northwest",
+        "coordinate.template.southwest"
+    };
+
+    public static final String DEFAULT_COORDINATE_TEMPLATE =
+        "{0}\u00b0N {1}'' {2}\u00b0E {3}''";
+
+    /**
+     * Checks the difference of two <code>Result</code>s.
+     *
+     * @param a A Result.
+     * @param b Another Result.
+     * @param indices Indices to be checked.
+     * @return true, if <i>a</i> and <i>b</i> are different - otherwise false.
+     */
+    public static boolean different(Result a, Result b, int [] indices) {
+        for (int i = 0; i < indices.length; ++i) {
+            String oa = a.getString(indices[i]);
+            String ob = b.getString(indices[i]);
+
+            if (oa == null && ob == null)  {
+                continue;
+            }
+
+            if (oa == null || ob == null) {
+                return true;
+            }
+
+            if (!oa.equals(ob)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Turns a wkt string into a coordinate.
+     *
+     * @param shape A wkt string.
+     * @return wkt string as coordinate.
+     */
+    public static Coordinate toCoordinate(String shape) {
+        try {
+            return shape != null
+                ? ((Point)(new WKTReader().read(shape))).getCoordinate()
+                : null;
+        }
+        catch (ParseException pe) {
+            log.error(pe);
+        }
+		catch (ClassCastException cce) {
+			log.error("cannot read WKT point", cce);
+		}
+        return null;
+    }
+
+    /**
+     * Turns a wkt string into a polygon.
+     *
+     * @param shape A wkt string.
+     * @return wkt string as polygon.
+     */
+    public static Polygon toPolygon(String shape) {
+        try {
+            return (Polygon)new WKTReader().read(shape);
+        }
+        catch (ParseException pe) {
+            log.error(pe);
+        }
+		catch (ClassCastException cce) {
+			log.error("cannot read WKT polygon", cce);
+		}
+        return null;
+    }
+
+    /**
+     * Returns a distance in km.
+     *
+     * @param distance A distance.
+     * @return distance in km.
+     */
+    public static final double toKM(double distance) {
+        return (distance * NAUTICAL_MILE) / KILOMETER;
+    }
+
+
+    /**
+     * Turns a coordinate into a wkt string.
+     *
+     * @param coordinate A coordinate.
+     * @return the coordinate as wkt string.
+     */
+    public static String toWKT(Coordinate coordinate) {
+        StringBuilder sb = new StringBuilder("POINT(");
+        sb.append(coordinate.x)
+          .append(' ')
+          .append(coordinate.y)
+          .append(')');
+        return sb.toString();
+    }
+
+
+    public static final String indexBox(
+        java.awt.Point a,
+        java.awt.Point b,
+        String         iName,
+        String         jName
+    ) {
+        int minI = Math.min(a.x, b.x) - 1;
+        int maxI = Math.max(a.x, b.x) + 1;
+        int minJ = Math.min(a.y, b.y) - 1;
+        int maxJ = Math.max(a.y, b.y) + 1;
+        StringBuilder sb = new StringBuilder("(")
+                          .append(iName).append(" >= ").append(minI)
+          .append(" AND ").append(iName).append(" <= ").append(maxI)
+          .append(" AND ").append(jName).append(" >= ").append(minJ)
+          .append(" AND ").append(jName).append(" <= ").append(maxJ)
+          .append(')');
+        return sb.toString();
+    }
+
+    public static final String diagonalBox(List<java.awt.Point> points) {
+
+        if (points.get(0) != null && points.get(2) != null) {
+            return indexBox(
+                points.get(0), points.get(2),
+                I_NAME,
+                J_NAME);
+        }
+
+        if (points.get(1) != null && points.get(3) != null) {
+            return indexBox(
+                points.get(1), points.get(3),
+                I_NAME,
+                J_NAME);
+        }
+
+        return null;
+    }
+
+    public static String worldEnvelopeCoordinatesToIndex(
+         Coordinate []       coords,
+         String              meshid,
+         String              ijkQueryID
+    )
+    throws QueryException
+    {
+        List<java.awt.Point> points =
+            new ArrayList<java.awt.Point>(coords.length);
+
+        ArrayList<Object []> missingPoints =
+            new ArrayList<Object []>();
+
+        createIJKPoints(coords, meshid, ijkQueryID, points, missingPoints);
+
+        String additionWhere = null;
+
+        if (missingPoints.size() == coords.length) {
+            log.debug("cannot create index buffer");
+        }
+        else {
+            additionWhere = diagonalBox(points);
+
+            if (additionWhere == null) {
+                // 3 Points are missing or are on one side of the envelope
+                boolean remainsMissingPoints = calculateIJ4MissingPoints(
+                    coords, points, missingPoints);
+
+                if (!remainsMissingPoints) {
+                    additionWhere = diagonalBox(points);
+                }
+            }
+        }
+
+        return additionWhere != null
+            ? additionWhere
+            : TRUE_EXPRESSION;
+    }
+
+    public static String worldCoordinatesToIndex(
+		Coordinate []       coords,
+        Collection<Result>  result,
+		String              meshid,
+        String              ijkQueryID
+    )
+	throws QueryException
+    {
+        List<java.awt.Point> points = new ArrayList<java.awt.Point>(coords.length);
+
+        ArrayList<Object []> missingPoints = new ArrayList<Object []>();
+
+        createIJKPoints(coords, meshid, ijkQueryID, points, missingPoints);
+
+        String additionWhere = TRUE_EXPRESSION;
+
+        if (missingPoints.size() == coords.length) {
+            log.debug("cannot create index buffer");
+        }
+        else { // generate index filter
+            boolean remainsMissingPoints = calculateIJ4MissingPoints(
+                coords, points, missingPoints);
+
+            if (!remainsMissingPoints) {
+                // TODO: Make Tablenames and Columns Configurable
+                IndexBuffer ib = new IndexBuffer(
+                    points,
+                    I_NAME,
+                    J_NAME );
+                additionWhere = ib.toWhereClause();
+                log.debug("Additional Where Clause = "+additionWhere);
+            }
+        } // if generate index filter
+
+        return additionWhere;
+    }
+
+
+    /**
+     * @param coords
+     * @param points
+     * @param missingPoints
+     * @return
+     */
+    private static boolean calculateIJ4MissingPoints(
+        Coordinate []        coords,
+        List<java.awt.Point> points,
+        ArrayList<Object[]>  missingPoints
+    ) {
+        boolean remainsMissingPoints = !missingPoints.isEmpty();
+
+        if (remainsMissingPoints) {
+            // try to guess the missing (i, j)
+            CurveFitter iFitter = new CurveFitter(new GaussNewtonOptimizer(true));
+            CurveFitter jFitter = new CurveFitter(new GaussNewtonOptimizer(true));
+
+            for (int i = 0, N = points.size(); i < N; ++i) {
+                java.awt.Point p = (java.awt.Point)points.get(i);
+                if (p != null) {
+                    Coordinate coord = coords[i];
+                    iFitter.addObservedPoint(coord.x, p.x);
+                    jFitter.addObservedPoint(coord.y, p.y);
+                }
+            }
+            try {
+                // XXX: Assumption: (i, j) are created by componentwise linear function.
+                // This is surely not correct because (x, y) are in a ellipsoid projection.
+                // TODO: use ellipsoid functions and fit with Levenberg Marquardt.
+                double [] iParams = iFitter.fit(
+                    LinearFunction.INSTANCE, new double [] { 1d, 1d });
+
+                double [] jParams = jFitter.fit(
+                    LinearFunction.INSTANCE, new double [] { 1d, 1d });
+
+                for (int i = missingPoints.size()-1; i >= 0; --i) {
+                    Object [] a = (Object [])missingPoints.get(i);
+                    Coordinate coord = (Coordinate)a[1];
+                    int pi = (int)Math.round(iParams[0]*coord.x + iParams[1]);
+                    int pj = (int)Math.round(jParams[0]*coord.y + jParams[1]);
+                    points.set(
+                        ((Integer)a[0]).intValue(),
+                        new java.awt.Point(pi, pj));
+                }
+
+                remainsMissingPoints = false; // we filled the gaps
+            }
+            catch (FunctionEvaluationException fee) {
+                log.error(fee);
+            }
+            catch (OptimizationException oe) {
+                log.error(oe);
+            }
+        }
+        return remainsMissingPoints;
+    }
+
+
+    /**
+     * @param coords
+     * @param meshid
+     * @param ijkQueryID
+     * @param points
+     * @param missingPoints
+     * @throws QueryException
+     */
+    private static void createIJKPoints(
+        Coordinate[]         coords,
+        String               meshid,
+        String               ijkQueryID,
+        List<java.awt.Point> points,
+        ArrayList<Object []> missingPoints
+    )
+    throws QueryException
+    {
+        boolean debug = log.isDebugEnabled();
+
+        QueryExecutor queryExecutor = QueryExecutorFactory
+            .getInstance()
+            .getQueryExecutor();
+
+        for (int i = 0; i < coords.length; i++) {
+
+            String wkt = toWKT(coords[i]);
+
+            Collection<Result> result = queryExecutor.executeQuery(
+                ijkQueryID,
+                new String [] {meshid, wkt});
+
+            if (!result.isEmpty()) {
+                Result resultValue = result.iterator().next();
+                int iPos = resultValue.getInteger(1);
+                int jPos = resultValue.getInteger(0);
+                if (debug) {
+                    log.debug("Found Pos "+iPos+"/"+jPos +" for "+wkt);
+                }
+                points.add(i, new java.awt.Point(iPos,jPos));
+            }
+            else {
+                if (debug) {
+                    log.debug("No i/j Pos found for "+wkt);
+                }
+                missingPoints.add(new Object [] { Integer.valueOf(i), coords[i] });
+                points.add(i, null);
+                // Special Case no i,j found for Coordinate
+            }
+        }
+    }
+
+	public static Coordinate [] toCoordinates(String wkt) {
+		try {
+			LineString ls = (LineString)new WKTReader().read(wkt);
+			return ls.getCoordinates();
+		}
+		catch (ParseException pe) {
+			log.error("cannot read WKT line string", pe);
+		}
+		catch (ClassCastException cce) {
+			log.error("cannot read WKT line string", cce);
+		}
+		return null;
+	}
+
+    /**
+     * Turns a wkt coordinate into a string format using the default locale of
+     * the virtual machine.
+     *
+     * @param wkt A wkt coordinate.
+     * @return A formatted coordinate.
+     */
+    public static String toText(String wkt) {
+        return toText(Locale.getDefault(), wkt);
+    }
+
+    /**
+     * Turns a point into a string format using the default locale of the
+     * virtual machine.
+     *
+     * @param p A point.
+     * @return A point formatted as string.
+     */
+    public static String toText(Point p) {
+        return toText(Locale.getDefault(), toWKT(p.getCoordinate()));
+    }
+
+    /**
+     * Turns a point into a string format using a given locale.
+     *
+     * @param locale A locale.
+     * @param p A point.
+     * @return a point formatted as string.
+     */
+    public static String toText(Locale locale, Point p) {
+        return toText(locale, toWKT(p.getCoordinate()));
+    }
+
+    /**
+     * Turns a wkt coordiante into a formatted text using a given locale.
+     *
+     * @param locale A locale.
+     * @param wkt A wkt coordinate.
+     * @return a formatted coordinate.
+     */
+    public static String toText(Locale locale, String wkt) {
+        String formattedCoordinate = null;
+        try {
+            Point p = (Point)new WKTReader().read(wkt);
+            double lat = p.getY();
+            double lon =p.getX();
+
+            int choice = 0;
+
+            if (lat <0 ) {
+                choice += 1;
+                lat=-lat;
+            }
+
+            if (lon <0 ) {
+                choice += 2;
+                lon=-lon;
+            }
+
+            RessourceFactory factory = RessourceFactory.getInstance();
+            String template = factory.getRessource(
+                locale,
+                COORDINATE_OUT_FORMAT[choice],
+                DEFAULT_COORDINATE_TEMPLATE
+            );
+
+            NumberFormat minFormatter = NumberFormat.getInstance(locale);
+            minFormatter.setMaximumFractionDigits(3);
+            minFormatter.setMinimumFractionDigits(3);
+
+            String minLat = minFormatter.format(60.*(lat-((int)lat)));
+            String minLon = minFormatter.format(60.*(lon-((int)lon)));
+
+            NumberFormat degFormatter = NumberFormat.getInstance(locale);
+            degFormatter.setMinimumIntegerDigits(2);
+
+            String formLat = degFormatter.format((int)lat);
+            String formLon = degFormatter.format((int)lon);
+
+            MessageFormat formatter = new MessageFormat(template);
+
+            Object[] args = {
+                formLat, minLat,
+                formLon, minLon
+            };
+
+            return formatter.format(args);
+
+        }
+        catch (ParseException e) {
+            log.warn(e,e);
+        }
+
+        return null;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/exception/ValidationException.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/exception/ValidationException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,9 +1,15 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.utils.exception;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class ValidationException extends Exception {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/exception/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Exception classes used by helper classes in the utils package.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package provides some helper classes used across the whole software.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/wms/LayerInfo.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.wms;
+
+/**
+ * This class is used to store some meta information about a layer (e.g. a WMS
+ * layers).
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class LayerInfo {
+
+    /**
+     * Constant field <code>LAYER</code>
+     */
+    public static final String LAYER        = "layer";
+
+    /**
+     * Constant field <code>LAYER_MODEL</code>
+     */
+    public static final String LAYER_MODEL  = "model";
+
+    /**
+     * Constant field <code>LAYER_NAME</code>
+     */
+    public static final String LAYER_NAME   = "name";
+
+    /**
+     * Constant field <code>LAYER_TYPE</code>
+     */
+    public static final String LAYER_TYPE   = "type";
+
+    /**
+     * Constant field <code>LAYER_DATA</code>
+     */
+    public static final String LAYER_DATA   = "data";
+
+    /**
+     * Constant field <code>LAYER_STATUS</code>
+     */
+    public static final String LAYER_STATUS = "status";
+
+    /**
+     * Constant field <code>LAYER_TITLE</code>
+     */
+    public static final String LAYER_TITLE  = "title";
+
+    /**
+     * Field storing the layer name.
+     */
+    private String name;
+
+    /**
+     * Field storing the layer title.
+     */
+    private String title;
+
+    /**
+     * Field storing the layer type.
+     */
+    private String type;
+
+    /**
+     * Field storing the layer data.
+     */
+    private String data;
+
+    /**
+     * Field storing the layer status.
+     */
+    private String status;
+
+    /**
+     * Field storing the layer model.
+     */
+    private String model;
+
+
+    /**
+     * Constructs an empty object. All parameters should be set via setter
+     * methods.
+     */
+    public LayerInfo() {
+    }
+
+
+    /**
+     * Set {@link #data} to data.
+     *
+     * @param data
+     */
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    /**
+     * Get {@link #data}
+     *
+     * @return data
+     */
+    public String getData() {
+        return data;
+    }
+
+    /**
+     * Set {@link #name} to name.
+     *
+     * @param name
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * Get {@link #name}
+     *
+     * @return name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * Set {@link #title} to title.
+     *
+     * @param title
+     */
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    /**
+     * Get {@link #title}
+     *
+     * @return title
+     */
+    public String getTitle() {
+        return title;
+    }
+
+    /**
+     * Set {@link #model} to model.
+     *
+     * @param model
+     */
+    public void setModel(String model) {
+        this.model = model;
+    }
+
+    /**
+     * Get {@link #model}
+     *
+     * @return model
+     */
+    public String getModel() {
+        return model;
+    }
+
+    /**
+     * Set {@link #type} to type.
+     *
+     * @param type
+     */
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    /**
+     * Get {@link #type}
+     *
+     * @return type
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * Set {@link #status} to status.
+     *
+     * @param status
+     */
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    /**
+     * Get {@link #status}
+     *
+     * @return status
+     */
+    public String getStatus() {
+        return status;
+    }
+
+    /**
+     * A <code>LayerInfo</code> object is emtpy if name, data, type and status
+     * are null.
+     *
+     * @return True, if this object is empty - otherwise false.
+     */
+    public boolean isEmpty() {
+        if (name == null && data == null && type == null && status == null)
+            return true;
+
+        return false;
+    }
+
+    /**
+     * A <code>LayerInfo</code> object is broken if name, data or type are null.
+     *
+     * @return True, if this object is broken - otherwise false.
+     */
+    public boolean isBroken() {
+        if (name == null || data == null || type == null)
+            return true;
+
+        return false;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/wms/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Classes used while generating mapfiles.
+</body>
+</html>
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages.properties	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/resources/lang/artifactMessages.properties	Fri Sep 28 12:15:18 2012 +0200
@@ -14,8 +14,12 @@
 fis_seacat = SeaCat
 fis_currentmeter = Current Meter
 fis_icestations = Ice Station Report
+fis_nauthis = Nauthis
+fis_contis=Contis
+fis_marinefeatures = Marine Features
 
 meshid= Mesh
+fis = Data set
 product= Product
 timeSeries= Timeseries
 verticalProfile = Verticalprofile
@@ -23,15 +27,20 @@
 horizontalProfileCross = Horizontales Schnittprofil
 horizontalCrossSection = Horizontal cross-section
 verticalcrosssection = Vertical cross-section
+verticalcrosssectionparallel = Achsenparalleler Vertikalschnitt
+layer = Layer
 featureid = Station
 mesh_coordinate = Geographic position (e.g. 56n30 6e20)
 mesh_linestring = Line (WKT)
+mesh_polygon = Area (WKT)
 mesh_point = Mesh Point
 measurementid = Measurement depth/height [m]
 depthrange = Measurementarea depth/height [m]
 mindepthid = Deepest Layer
 maxdepthid = Highest Layer
 parameterid = Parameter
+yearid = Year
+layerid = Layer
 timeinterval = Time period
 minvalue = from
 maxvalue = to
@@ -43,17 +52,36 @@
 surveyid = Survey Info
 axisid = Axis
 depthid = Layer and Depth range [m]
-iposition = I-Axis
-jposition = J-Axis
+iposition = West-East-Axis
+jposition = North-South-Axis
 instantaneouspoint_point = Momentanmesspunkt
 areaid=Area
 subareaid=Subarea
 depth=depth
 coordinate=coordinate
+coordinate.template.northeast={0}\u00b0N {1}'' {2}\u00b0E {3}''
+coordinate.template.southeast={0}\u00b0S {1}'' {2}\u00b0E {3}''
+coordinate.template.northwest={0}\u00b0N {1}'' {2}\u00b0W {3}''
+coordinate.template.southwest={0}\u00b0S {1}'' {2}\u00b0W {3}''
+vectorscalar = Vector / Scalar values
+vectorvalues = Vector values
+scalarvalues = Scalar values
 
 chart.timeseries.date.format=yyyy-MMM-dd
 chart.timeseries.title.xaxis=Time [UTC]
 chart.verticalprofile.title.xaxis=Depth [m]
-chart.verticalcrosssection.title.xaxis=Depth [m]
+chart.verticalcrosssection.title.xaxis=Distance [km]
+chart.verticalcrosssection.title.yaxis=Depth [m]
 chart.horizontalprofile.title.xaxis=Distance [km]
 chart.horizontalcrosssection.title.xaxis=Latitude [m]
+
+histogram.axis.range.title=Absolute Frequency
+
+# error messages
+no.input.data= No Entry was chosen. Please select at least one entry.
+input.is.not.valid=Invalid input. Please try again.
+input.is.not.valid.date.required=Invalid input. A date is required. Please try again.
+input.is.not.valid.minmax=Input is not valid for this state.
+start.date.after.end.date=Start date lies after end date. Please try again.
+date.out.of.range=Date is out of range.
+missing.data.field=Can't validate selected date. Missing date, lower or upper date bound.
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages_de.properties	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/resources/lang/artifactMessages_de.properties	Fri Sep 28 12:15:18 2012 +0200
@@ -14,7 +14,11 @@
 fis_seacat = SeaCat
 fis_currentmeter = Strommesser
 fis_icestations = Eismeldungen
+fis_nauthis = Nauthis
+fis_contis=Contis
+fis_marinefeatures = Marine Basisdaten
 
+fis = Fachinformationssystem
 product= Produkt
 timeSeries= Zeitserie
 verticalProfile = Vertikalprofil
@@ -22,16 +26,21 @@
 horizontalProfileCross = Horizontales Schnittprofil
 horizontalCrossSection = Horizontalschnitt
 verticalcrosssection = Profilschnitt
+verticalcrosssectionparallel = Achsenparalleler Vertikalschnitt
+layer = Layer
 featureid = Station
 meshid= Datengitter
 mesh_coordinate = Geographische Position (z.B. 56n30 6e20)
 mesh_linestring = Linienzug als WKT
+mesh_polygon = Fläche als WKT
 mesh_point = Gitterzelle/Knotenpunkt
 measurementid = Messung Tiefe/Höhe [m]
 depthrange = Messbereich Tiefe/Höhe [m]
 mindepthid = Untere Grenzschicht
 maxdepthid = Obere Grenzschicht
 parameterid = Parameter
+yearid = Jahr
+layerid = Layer
 timeinterval = Zeitfenster
 minvalue = von
 maxvalue = bis
@@ -43,17 +52,36 @@
 surveyid = Messabschnitt
 axisid = Achse
 depthid = Ebene und Tiefenbereich [m]
-iposition = I-Achse
-jposition = J-Achse
+iposition = West-Ost-Achse
+jposition = Nord-S\u00fcd-Achse
 instantaneouspoint_point = Messpunkt
 areaid=Gebiet
 subareaid=Teilgebiet
 depth=Tiefe
 coordinate=Koordinate
+coordinate.template.northeast={0}\u00b0N {1}'' {2}\u00b0O {3}''
+coordinate.template.southeast={0}\u00b0S {1}'' {2}\u00b0O {3}''
+coordinate.template.northwest={0}\u00b0N {1}'' {2}\u00b0W {3}''
+coordinate.template.southwest={0}\u00b0S {1}'' {2}\u00b0W {3}''
+vectorscalar = Vektorielle / Skalare Werte
+vectorvalues = Vektorielle Werte
+scalarvalues = Skalare Werte
 
 chart.timeseries.date.format=dd-MMM-yyyy
 chart.timeseries.title.xaxis=Zeit [UTC]
 chart.verticalprofile.title.xaxis=Tiefe [m]
-chart.verticalcrosssection.title.xaxis=Tiefe [m]
+chart.verticalcrosssection.title.xaxis=Distanz [km]
+chart.verticalcrosssection.title.yaxis=Tiefe [m]
 chart.horizontalprofile.title.xaxis=Distanz [km]
 chart.horizontalcrosssection.title.xaxis=Ausdehnung [m]
+
+histogram.axis.range.title=Absolute H\u00e4ufigkeit
+
+# error messages
+no.input.data=Es wurde kein Eintrag ausgew\u00e4hlt. Bitte w\u00e4hlen sie mindestens einen Eintrag aus.
+input.is.not.valid=Ung\u00fcltige Eingabe. Bitte versuchen Sie es erneut.
+input.is.not.valid.date.required=Ung\u00fcltige Eingabe. Ein Datum wird ben\u00f6tigt. Bitte versuchen Sie es erneut.
+input.is.not.valid.minmax=Die get\u00e4tigte Eingabe ist ung\u00fctig.
+start.date.after.end.date=Anfangsdatum liegt hinter dem Enddatum. Bitte versuchen Sie es erneut.
+date.out.of.range=Das gew\u00e4hlte Datum liegt au\u00dferhalb des gültigen Wertebereiches.
+missing.data.field=Validierung der Datumseingabe nicht m\u00f6glich. Datum, obere oder untere Grenze fehlt.
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages_de_DE.properties	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/resources/lang/artifactMessages_de_DE.properties	Fri Sep 28 12:15:18 2012 +0200
@@ -14,7 +14,11 @@
 fis_seacat = SeaCat
 fis_currentmeter = Strommesser
 fis_icestations = Eismeldungen
+fis_nauthis = Nauthis
+fis_contis=Contis
+fis_marinefeatures = Marine Basisdaten
 
+fis= Fachinformationssystem
 product= Produkt
 timeSeries= Zeitserie
 verticalProfile = Vertikalprofil
@@ -22,16 +26,21 @@
 horizontalProfileCross = Horizontales Schnittprofil
 horizontalCrossSection = Horizontalschnitt
 verticalcrosssection = Profilschnitt
+verticalcrosssectionparallel = Achsenparalleler Vertikalschnitt
+layer = Layer
 featureid = Station
 meshid= Datengitter
 mesh_coordinate = Geographische Position (z.B. 56n30 6e20)
 mesh_linestring = Linienzug als WKT
+mesh_polygon = Fläche als WKT
 mesh_point = Gitterzelle/Knotenpunkt
 measurementid = Messung Tiefe/Höhe [m]
 depthrange = Messbereich Tiefe/Höhe [m]
 mindepthid = Untere Grenzschicht
 maxdepthid = Obere Grenzschicht
 parameterid = Parameter
+yearid = Jahr
+layerid = Layer
 timeinterval = Zeitfenster
 minvalue = von
 maxvalue = bis
@@ -43,17 +52,36 @@
 surveyid = Messabschnitt
 axisid = Achse
 depthid = Ebene und Tiefenbereich [m]
-iposition = I-Achse
-jposition = J-Achse
+iposition = West-Ost-Achse
+jposition = Nord-S\u00fcd-Achse
 instantaneouspoint_point = Messpunkt
 areaid=Gebiet
 subareaid=Teilgebiet
 depth=Tiefe
 coordinate=Koordinate
+coordinate.template.northeast={0}\u00b0N {1}'' {2}\u00b0O {3}''
+coordinate.template.southeast={0}\u00b0S {1}'' {2}\u00b0O {3}''
+coordinate.template.northwest={0}\u00b0N {1}'' {2}\u00b0W {3}''
+coordinate.template.southwest={0}\u00b0S {1}'' {2}\u00b0W {3}''
+vectorscalar = Vektorielle / Skalare Werte
+vectorvalues = Vektorielle Werte
+scalarvalues = Skalare Werte
 
 chart.timeseries.date.format=dd-MMM-yyyy
 chart.timeseries.title.xaxis=Zeit [UTC]
 chart.verticalprofile.title.xaxis=Tiefe [m]
-chart.verticalcrosssection.title.xaxis=Tiefe [m]
+chart.verticalcrosssection.title.xaxis=Distanz [km]
+chart.verticalcrosssection.title.yaxis=Tiefe [m]
 chart.horizontalprofile.title.xaxis=Distanz [km]
 chart.horizontalcrosssection.title.xaxis=Ausdehnung [m]
+
+histogram.axis.range.title=Absolute H\u00e4ufigkeit
+
+# error messages
+no.input.data=Es wurde kein Eintrag ausgew\u00e4hlt. Bitte w\u00e4hlen sie mindestens einen Eintrag aus.
+input.is.not.valid=Ung\u00fcltige Eingabe. Bitte versuchen Sie es erneut.
+input.is.not.valid.date.required=Ung\u00fcltige Eingabe. Ein Datum wird ben\u00f6tigt. Bitte versuchen Sie es erneut.
+input.is.not.valid.minmax=Die get\u00e4tigte Eingabe ist ung\u00fctig.
+start.date.after.end.date=Anfangsdatum liegt nach dem Enddatum. Bitte versuchen Sie es erneut.
+date.out.of.range=Das gew\u00e4hlte Datum liegt au\u00dferhalb des gültigen Wertebereiches.
+missing.data.field=Validierung der Datumseingabe nicht m\u00f6glich. Datum, obere oder untere Grenze fehlt.
--- a/gnv-artifacts/src/main/resources/lang/artifactMessages_en.properties	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/main/resources/lang/artifactMessages_en.properties	Fri Sep 28 12:15:18 2012 +0200
@@ -14,8 +14,12 @@
 fis_seacat = SeaCat
 fis_currentmeter = Current Meter
 fis_icestations = Ice Station Report
+fis_nauthis = Nauthis
+fis_contis=Contis
+fis_marinefeatures = Marine Features
 
 meshid= Mesh
+fis = Data set
 product= Product
 timeSeries= Timeseries
 verticalProfile = Verticalprofile
@@ -23,15 +27,20 @@
 horizontalProfileCross = Horizontales Schnittprofil
 horizontalCrossSection = Horizontal cross-section
 verticalcrosssection = Vertical cross-section
+verticalcrosssectionparallel = Achsenparalleler Vertikalschnitt
+layer = Layer
 featureid = Station
 mesh_coordinate = Geographic position (e.g. 56n30 6e20)
 mesh_linestring = Line (WKT)
+mesh_polygon = Area (WKT)
 mesh_point = Mesh Point
 measurementid = Measurement depth/height [m]
 depthrange = Measurementarea depth/height [m]
 mindepthid = Deepest Layer
 maxdepthid = Highest Layer
 parameterid = Parameter
+yearid = Year
+layerid = Layer
 timeinterval = Time period
 minvalue = from
 maxvalue = to
@@ -43,18 +52,37 @@
 surveyid = Survey Info
 axisid = Axis
 depthid = Layer and Depth range [m]
-iposition = I-Axis
-jposition = J-Axis
+iposition = West-East-Axis
+jposition = North-South-Axis
 instantaneouspoint_point = Instantaneouspoint
 areaid=Area
 subareaid=Subarea
 depth=depth
 coordinate=coordinate
+coordinate.template.northeast={0}\u00b0N {1}'' {2}\u00b0E {3}''
+coordinate.template.southeast={0}\u00b0S {1}'' {2}\u00b0E {3}''
+coordinate.template.northwest={0}\u00b0N {1}'' {2}\u00b0W {3}''
+coordinate.template.southwest={0}\u00b0S {1}'' {2}\u00b0W {3}''
+vectorscalar = Vector / Scalar values
+vectorvalues = Vector values
+scalarvalues = Scalar values
 
 
 chart.timeseries.date.format=yyyy-MMM-dd
 chart.timeseries.title.xaxis=Time [UTC]
 chart.verticalprofile.title.xaxis=Depth [m]
-chart.verticalcrosssection.title.xaxis=Depth [m]
+chart.verticalcrosssection.title.xaxis=Distance [km]
+chart.verticalcrosssection.title.yaxis=Depth [m]
 chart.horizontalprofile.title.xaxis=Distance [km]
 chart.horizontalcrosssection.title.xaxis=Latitude [m]
+
+histogram.axis.range.title=Absolute Frequency
+
+# error messages
+no.input.data= No Entry was chosen. Please select at least one entry.
+input.is.not.valid=Invalid input. Please try again.
+input.is.not.valid.date.required=Invalid input. A date is required. Please try again.
+input.is.not.valid.minmax=Input is not valid for this state.
+start.date.after.end.date=Start date lies after end date. Please try again.
+date.out.of.range=Date is out of range.
+missing.data.field=Can't validate selected date. Missing date, lower or upper date bound.
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestCaseBase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,8 +1,26 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
+import de.intevation.artifacts.common.utils.Config;
+import de.intevation.artifactdatabase.DefaultCallMeta;
+import de.intevation.artifactdatabase.DefaultPreferredLocale;
+import de.intevation.artifactdatabase.FactoryBootstrap;
+
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallContext;
+import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.PreferredLocale;
+
+import de.intevation.gnv.utils.ArtifactXMLUtilities;
+
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -17,22 +35,13 @@
 
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Logger;
+
 import org.w3c.dom.Document;
+
 import org.xml.sax.SAXException;
 
-import de.intevation.artifactdatabase.Config;
-import de.intevation.artifactdatabase.DefaultCallMeta;
-import de.intevation.artifactdatabase.DefaultPreferredLocale;
-import de.intevation.artifactdatabase.FactoryBootstrap;
-import de.intevation.artifacts.Artifact;
-import de.intevation.artifacts.ArtifactFactory;
-import de.intevation.artifacts.CallContext;
-import de.intevation.artifacts.CallMeta;
-import de.intevation.artifacts.PreferredLocale;
-import de.intevation.gnv.utils.ArtifactXMLUtilities;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public abstract class GNVArtifactsTestCaseBase extends TestCase {
@@ -46,11 +55,11 @@
         BasicConfigurator.configure();
         log = Logger.getLogger(GNVArtifactsTestCaseBase.class);
     }
-    
+
     private String configurationDir = "doc/conf";
 
     protected FactoryBootstrap bootstrap = null;
-    
+
     /**
      * Constructor
      */
@@ -64,7 +73,7 @@
     public GNVArtifactsTestCaseBase(String name) {
         super(name);
     }
-    
+
     public abstract void testArtifact();
     /**
      * @see junit.framework.TestCase#setUp()
@@ -78,7 +87,7 @@
         bootstrap = new FactoryBootstrap();
         bootstrap.boot();
     }
-    
+
     protected void writeDocument2Log(Document document) {
         log.debug(new ArtifactXMLUtilities().writeDocument2String(document));
     }
@@ -88,6 +97,7 @@
         try {
             DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
                     .newInstance();
+            docBuilderFactory.setNamespaceAware(true);
             DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
             returnValue = docBuilder.parse(new File(fileName));
         } catch (ParserConfigurationException e) {
@@ -108,15 +118,15 @@
             throw new Exception(message);
         }
     }
-    
+
     /**
      * @return
      */
-    protected CallContext createCallContext() {
+    protected CallContext createCallContext(ArtifactFactory artifactFactory) {
         CallMeta callMeta = new DefaultCallMeta(
                 new PreferredLocale[] { new DefaultPreferredLocale("de_DE",
                         1.0f) });
-        CallContext cc = new TestCallContext(bootstrap.getContext(), callMeta);
+        CallContext cc = new TestCallContext(bootstrap.getContext(), callMeta,artifactFactory);
         return cc;
     }
 
@@ -130,7 +140,7 @@
                             String feedDocument, String advanceDocument, Document describeDocument)
                                                                         throws Exception {
         Document outputData = artifact.describe(describeDocument,cc);
-//        this.writeDocument2Log(outputData);
+//      this.writeDocument2Log(outputData);
         outputData = artifact.feed(this.readDocument(feedDocument), cc);
         this.check4ExceptionReport(outputData);
         outputData = artifact.advance(this.readDocument(advanceDocument), cc);
@@ -138,7 +148,7 @@
         this.check4ExceptionReport(outputData);
 
     }
-    
+
     protected void createFile(byte[] content, String fileName) {
         try {
             FileOutputStream fos = new FileOutputStream(new File(fileName));
@@ -171,6 +181,21 @@
         return null;
     }
 
+    /**
+     * @param artifactFactory
+     * @return
+     */
+    protected Artifact createArtifact(ArtifactFactory artifactFactory) {
+        Document setupData = null;
+        Artifact artifact = artifactFactory.createArtifact(
+                                            "" + System.currentTimeMillis(),
+                                            bootstrap.getContext(),
+                                            null,
+                                            setupData);
+        assertNotNull(artifact);
+        log.debug("Artifact is available");
+        return artifact;
+    }
 
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/GNVArtifactsTestSuite.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class GNVArtifactsTestSuite {
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("Test for de.intevation.gnv.artifacts");
+        suite.addTestSuite(TimeSeriesPointTimeSeriesTestCase.class);
+        suite.addTestSuite(MeshVerticalProfileTestCase.class);
+        suite.addTestSuite(MeshHorizontalProfileTestCase.class);
+        suite.addTestSuite(MeshHorizontalCrossSectionTestCase.class);
+        suite.addTestSuite(MeshTimeSeriesTestCase.class);
+        suite.addTestSuite(TimeSeriesPointVerticalProfileTestCase.class);
+        suite.addTestSuite(MeshVerticalCrossSectionTestCase.class);
+        suite.addTestSuite(InstantaneousPointHorizontalProfileTestCase.class);
+        suite.addTestSuite(InstantaneousPointVerticalProfileTestCase.class);
+        return suite;
+    }
+
+}
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointHorizontalProfileTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,26 +1,32 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
-import java.io.FileOutputStream;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 
+import java.io.FileOutputStream;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class InstantaneousPointHorizontalProfileTestCase extends
                                                         GNVArtifactsTestCaseBase {
 
     private static Logger log = Logger.getLogger(InstantaneousPointHorizontalProfileTestCase.class);
-    
+
     /**
      * Constructor
      */
@@ -48,25 +54,23 @@
                     .getArtifactFactory(artefactName);
             assertNotNull(artifactFactory);
             log.debug("VerticalProfile-ArtifactFactory is available");
-            Artifact artifact = artifactFactory.createArtifact(
-                    "" + System.currentTimeMillis(), bootstrap.getContext());
-            assertNotNull(artifact);
-            log.debug("VerticalProfile-Artifact is available");
 
-            CallContext cc = createCallContext();
+            Artifact artifact = createArtifact(artifactFactory);
+
+            CallContext cc = createCallContext(artifactFactory);
             Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_instantaneouspoint/horizontalprofile_describe.xml");
-            
+
             int steps = 9;
-            
+
             for (int i = 0; i < steps; i++){
-            
+
                 this.doNextStep(
                             artifact,
                             cc,
                             "src/test/ressources/horizontalProfile_instantaneouspoint/" +
                             "horizontalprofile_step_0"+i+"_feed.xml",
                             "src/test/ressources/horizontalProfile_instantaneouspoint/" +
-                            "horizontalprofile_step_0"+i+"_advance.xml", 
+                            "horizontalprofile_step_0"+i+"_advance.xml",
                             describeDocument);
             }
 
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/InstantaneousPointVerticalProfileTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,26 +1,32 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
-import java.io.FileOutputStream;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 
+import java.io.FileOutputStream;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class InstantaneousPointVerticalProfileTestCase extends
                                                       GNVArtifactsTestCaseBase {
 
     private static Logger log = Logger.getLogger(InstantaneousPointVerticalProfileTestCase.class);
-    
+
     /**
      * Constructor
      */
@@ -47,16 +53,14 @@
                     .getArtifactFactory(artefactName);
             assertNotNull(artifactFactory);
             log.debug("VerticalProfile-ArtifactFactory is available");
-            Artifact artifact = artifactFactory.createArtifact(
-                    "" + System.currentTimeMillis(), bootstrap.getContext());
-            assertNotNull(artifact);
-            log.debug("VerticalProfile-Artifact is available");
 
-            CallContext cc = createCallContext();
+            Artifact artifact = createArtifact(artifactFactory);
+
+            CallContext cc = createCallContext(artifactFactory);
             Document describeDocument = this.readDocument("src/test/ressources/verticalprofile_instantaneouspoint/verticalprofile_describe.xml");
-            
+
            int steps = 5;
-            
+
             for (int i = 1; i <= steps; i++){
                 this.doNextStep(
                             artifact,
@@ -64,7 +68,7 @@
                             "src/test/ressources/verticalprofile_instantaneouspoint/" +
                             "verticalprofile_step_0"+i+"_feed.xml",
                             "src/test/ressources/verticalprofile_instantaneouspoint/" +
-                            "verticalprofile_step_0"+i+"_advance.xml", 
+                            "verticalprofile_step_0"+i+"_advance.xml",
                             describeDocument);
             }
 
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalCrossSectionTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,26 +1,32 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
-import java.io.FileOutputStream;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 
+import java.io.FileOutputStream;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class MeshHorizontalCrossSectionTestCase extends
                                                GNVArtifactsTestCaseBase {
 
     private static Logger log = Logger.getLogger(MeshHorizontalCrossSectionTestCase.class);
-    
+
     /**
      * Constructor
      */
@@ -47,15 +53,13 @@
                     .getArtifactFactory(artefactName);
             assertNotNull(artifactFactory);
             log.debug("HorizontalCrossSectionMesh-ArtifactFactory is available");
-            Artifact artifact = artifactFactory.createArtifact(
-                    "" + System.currentTimeMillis(), bootstrap.getContext());
-            assertNotNull(artifact);
-            log.debug("HorizontalCrossSectionMesh-Artifact is available");
 
-            CallContext cc = createCallContext();
+            Artifact artifact = createArtifact(artifactFactory);
+
+            CallContext cc = createCallContext(artifactFactory);
             Document describeDocument = this.readDocument("src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_describe.xml");
-            int steps = 6;
-            
+            int steps = 8;
+
             for (int i = 1; i <= steps; i++){
                 this.doNextStep(
                             artifact,
@@ -63,37 +67,28 @@
                             "src/test/ressources/horizontalcrosssection_mesh/" +
                             "horizontalcrosssection_step_0"+i+"_feed.xml",
                             "src/test/ressources/horizontalcrosssection_mesh/" +
-                            "horizontalcrosssection_step_0"+i+"_advance.xml", 
+                            "horizontalcrosssection_step_0"+i+"_advance.xml",
                             describeDocument);
             }
-            
+
             Document outputData = artifact.describe(describeDocument,cc);
             FileOutputStream fos = null;
             FileOutputStream fos2 = null;
-            FileOutputStream fos3 = null;
             try {
                 fos = new FileOutputStream(
                         "src/test/results/horizontalcrosssection_mesh"
-                                + System.currentTimeMillis() + ".png");
-                
+                                + System.currentTimeMillis() + ".zip");
                 fos2 = new FileOutputStream(
                         "src/test/results/horizontalcrosssection_mesh"
-                                + System.currentTimeMillis() + ".csv");
-                fos3 = new FileOutputStream(
-                        "src/test/results/horizontalcrosssection_mesh"
-                                + System.currentTimeMillis() + ".odv");
+                                + System.currentTimeMillis() + ".txt");
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "horizontalcrosssection_mesh/" +
-                                               "horizontalcrosssection_step_06_out_chart.xml"),
+                                               "horizontalcrosssection_step_0"+steps+"_out_zip.xml"),
                               fos, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "horizontalcrosssection_mesh/" +
-                                               "horizontalcrosssection_step_06_out_csv.xml"),
+                                               "horizontalcrosssection_step_0"+steps+"_out_wms.xml"),
                              fos2,cc);
-                artifact.out(this.readDocument("src/test/ressources/" +
-                                               "horizontalcrosssection_mesh/" +
-                                               "horizontalcrosssection_step_06_out_odv.xml"),
-                              fos3,cc);
             } catch (Exception e) {
                 log.error(e, e);
                 fail();
@@ -103,8 +98,6 @@
                     fos.close();
                     fos2.flush();
                     fos2.close();
-                    fos3.flush();
-                    fos3.close();
                 } catch (Exception e) {
                     log.error(e, e);
                 }
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshHorizontalProfileTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,25 +1,31 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
-import java.io.FileOutputStream;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 
+import java.io.FileOutputStream;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class MeshHorizontalProfileTestCase extends GNVArtifactsTestCaseBase {
 
     private static Logger log = Logger.getLogger(MeshHorizontalProfileTestCase.class);
-    
+
     /**
      * Constructor
      */
@@ -47,16 +53,14 @@
                     .getArtifactFactory(artefactName);
             assertNotNull(artifactFactory);
             log.debug("VerticalProfile-ArtifactFactory is available");
-            Artifact artifact = artifactFactory.createArtifact(
-                    "" + System.currentTimeMillis(), bootstrap.getContext());
-            assertNotNull(artifact);
-            log.debug("VerticalProfile-Artifact is available");
 
-            CallContext cc = createCallContext();
+            Artifact artifact = createArtifact(artifactFactory);
+
+            CallContext cc = createCallContext(artifactFactory);
             Document describeDocument = this.readDocument("src/test/ressources/horizontalProfile_mesh/horizontalprofile_describe.xml");
-            
-            int steps = 10;
-            
+
+            int steps = 11;
+
             for (int i = 1; i <= steps; i++){
                 String number = ""+i;
                 if (i < 10){
@@ -68,10 +72,10 @@
                             "src/test/ressources/horizontalProfile_mesh/" +
                             "horizontalprofile_step_"+number+"_feed.xml",
                             "src/test/ressources/horizontalProfile_mesh/" +
-                            "horizontalprofile_step_"+number+"_advance.xml", 
+                            "horizontalprofile_step_"+number+"_advance.xml",
                             describeDocument);
             }
-            
+
             Document outputData = artifact.describe(describeDocument,cc);
             FileOutputStream fos = null;
             FileOutputStream fos2 = null;
@@ -92,19 +96,19 @@
                                 + System.currentTimeMillis() + ".odv");
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "horizontalProfile_mesh/" +
-                                               "horizontalprofile_step_10_out_statistics.xml"),
+                                               "horizontalprofile_step_"+steps+"_out_statistics.xml"),
                              fos2, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "horizontalProfile_mesh/" +
-                                               "horizontalprofile_step_10_out_chart.xml"),
+                                               "horizontalprofile_step_"+steps+"_out_chart.xml"),
                                 fos, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "horizontalProfile_mesh/" +
-                                               "horizontalprofile_step_10_out_csv.xml"),
+                                               "horizontalprofile_step_"+steps+"_out_csv.xml"),
                              fos3, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "horizontalProfile_mesh/" +
-                                               "horizontalprofile_step_10_out_odv.xml"),
+                                               "horizontalprofile_step_"+steps+"_out_odv.xml"),
                              fos4, cc);
             } catch (Exception e) {
                 log.error(e, e);
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshTimeSeriesTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,25 +1,31 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
-import java.io.FileOutputStream;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 
+import java.io.FileOutputStream;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class MeshTimeSeriesTestCase extends GNVArtifactsTestCaseBase {
 
     private static Logger log = Logger.getLogger(MeshTimeSeriesTestCase.class);
-    
+
     /**
      * Constructor
      */
@@ -46,17 +52,15 @@
                     .getArtifactFactory(artefactName);
             assertNotNull(artifactFactory);
             log.debug("TimeSeriesMesh-ArtifactFactory is available");
-            Artifact artifact = artifactFactory.createArtifact(
-                    "" + System.currentTimeMillis(), bootstrap.getContext());
-            assertNotNull(artifact);
-            log.debug("TimeSeriesMesh-Artifact is available");
 
-            CallContext cc = createCallContext();
+            Artifact artifact = createArtifact(artifactFactory);
+
+            CallContext cc = createCallContext(artifactFactory);
 
             Document describeDocument = this.readDocument("src/test/ressources/timeseries_mesh/timeseries_describe.xml");
-            
+
             int steps = 8;
-            
+
             for (int i = 1; i <= steps; i++){
                 this.doNextStep(
                             artifact,
@@ -64,7 +68,7 @@
                             "src/test/ressources/timeseries_mesh/" +
                             "timeseries_step_0"+i+"_feed.xml",
                             "src/test/ressources/timeseries_mesh/" +
-                            "timeseries_step_0"+i+"_advance.xml", 
+                            "timeseries_step_0"+i+"_advance.xml",
                             describeDocument);
             }
             // Achter Schritt
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalCrossSectionTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,25 +1,31 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
-import java.io.FileOutputStream;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 
+import java.io.FileOutputStream;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class MeshVerticalCrossSectionTestCase extends GNVArtifactsTestCaseBase {
 
     private static Logger log = Logger.getLogger(MeshVerticalCrossSectionTestCase.class);
-    
+
     /**
      * Constructor
      */
@@ -47,28 +53,26 @@
                     .getArtifactFactory(artefactName);
             assertNotNull(artifactFactory);
             log.debug("VerticalProfile-ArtifactFactory is available");
-            Artifact artifact = artifactFactory.createArtifact(
-                    "" + System.currentTimeMillis(), bootstrap.getContext());
-            assertNotNull(artifact);
-            log.debug("VerticalProfile-Artifact is available");
 
-            CallContext cc = createCallContext();
+            Artifact artifact = createArtifact(artifactFactory);
+
+            CallContext cc = createCallContext(artifactFactory);
             Document describeDocument = this.readDocument("src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_describe.xml");
-            
-            int steps = 8;
-            
+
+            int steps = 7;
+
             for (int i = 1; i <= steps; i++){
-            
+
                 this.doNextStep(
                             artifact,
                             cc,
                             "src/test/ressources/verticalcrosssection_mesh/" +
                             "verticalcrosssection_step_0"+i+"_feed.xml",
                             "src/test/ressources/verticalcrosssection_mesh/" +
-                            "verticalcrosssection_step_0"+i+"_advance.xml", 
+                            "verticalcrosssection_step_0"+i+"_advance.xml",
                             describeDocument);
             }
-            
+
             Document outputData = artifact.describe(describeDocument,cc);
             FileOutputStream fos = null;
             FileOutputStream fos2 = null;
@@ -77,7 +81,7 @@
                 fos = new FileOutputStream(
                         "src/test/results/verticalcrosssection_mesh"
                                 + System.currentTimeMillis() + ".png");
-                
+
                 fos2 = new FileOutputStream(
                         "src/test/results/verticalcrosssection_mesh"
                                 + System.currentTimeMillis() + ".csv");
@@ -86,17 +90,18 @@
                                 + System.currentTimeMillis() + ".odv");
                artifact.out(this.readDocument("src/test/ressources/" +
                                                "verticalcrosssection_mesh/" +
-                                               "verticalcrosssection_step_08_out_chart.xml"),
+                                               "verticalcrosssection_step_0"+steps+"_out_chart.xml"),
                              fos, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "verticalcrosssection_mesh/" +
-                                               "verticalcrosssection_step_08_out_csv.xml"),
+                                               "verticalcrosssection_step_0"+steps+"_out_csv.xml"),
                              fos2,cc);
-                artifact.out(this.readDocument("src/test/ressources/" +
-                                               "verticalcrosssection_mesh/" +
-                                               "verticalcrosssection_step_08_out_odv.xml"),
-                             fos3,cc);
-                
+                // TODO: FIXME: ODV-Export nach Reparatur wieder Testbar machen.
+//                artifact.out(this.readDocument("src/test/ressources/" +
+//                                               "verticalcrosssection_mesh/" +
+//                                               "verticalcrosssection_step_0"+steps+"_out_odv.xml"),
+//                             fos3,cc);
+
             } catch (Exception e) {
                 log.error(e, e);
                 fail();
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/MeshVerticalProfileTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,25 +1,31 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
-import java.io.FileOutputStream;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 
+import java.io.FileOutputStream;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class MeshVerticalProfileTestCase extends GNVArtifactsTestCaseBase {
 
     private static Logger log = Logger.getLogger(MeshVerticalProfileTestCase.class);
-    
+
     /**
      * Constructor
      */
@@ -46,18 +52,16 @@
                     .getArtifactFactory(artefactName);
             assertNotNull(artifactFactory);
             log.debug("VerticalProfile-ArtifactFactory is available");
-            Artifact artifact = artifactFactory.createArtifact(
-                    "" + System.currentTimeMillis(), bootstrap.getContext());
-            assertNotNull(artifact);
-            log.debug("VerticalProfile-Artifact is available");
 
-            CallContext cc = createCallContext();
+            Artifact artifact = createArtifact(artifactFactory);
+
+            CallContext cc = createCallContext(artifactFactory);
             Document describeDocument = this.readDocument("src/test/ressources/" +
                                                           "verticalprofile_mesh/" +
                                                           "verticalprofile_describe.xml");
-            
-            int steps = 10;
-            
+
+            int steps = 11;
+
             for (int i = 1; i <= steps; i++){
                 String number = ""+i;
                 if (i < 10){
@@ -69,7 +73,7 @@
                             "src/test/ressources/verticalprofile_mesh/" +
                             "verticalprofile_step_"+number+"_feed.xml",
                             "src/test/ressources/verticalprofile_mesh/" +
-                            "verticalprofile_step_"+number+"_advance.xml", 
+                            "verticalprofile_step_"+number+"_advance.xml",
                             describeDocument);
             }
             // 10. Schritt
@@ -93,19 +97,19 @@
                                 + System.currentTimeMillis() + ".odv");
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "verticalprofile_mesh/" +
-                                               "verticalprofile_step_10_out_statistics.xml"),
+                                               "verticalprofile_step_"+steps+"_out_statistics.xml"),
                              fos2, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "verticalprofile_mesh/" +
-                                               "verticalprofile_step_10_out_chart.xml"),
+                                               "verticalprofile_step_"+steps+"_out_chart.xml"),
                              fos, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                               "verticalprofile_mesh/" +
-                                              "verticalprofile_step_10_out_csv.xml"),
+                                              "verticalprofile_step_"+steps+"_out_csv.xml"),
                              fos3, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "verticalprofile_mesh/" +
-                                               "verticalprofile_step_10_out_odv.xml"),
+                                               "verticalprofile_step_"+steps+"_out_odv.xml"),
                              fos4, cc);
             } catch (Exception e) {
                 log.error(e, e);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TestArtifactDatabase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts;
+
+import de.intevation.artifacts.Artifact;
+import de.intevation.artifacts.ArtifactDatabase;
+import de.intevation.artifacts.ArtifactDatabaseException;
+import de.intevation.artifacts.ArtifactFactory;
+import de.intevation.artifacts.CallMeta;
+
+import org.w3c.dom.Document;
+
+/**
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class TestArtifactDatabase implements ArtifactDatabase {
+
+    private ArtifactFactory artifactFactory = null;
+    /**
+     * Constructor
+     */
+    public TestArtifactDatabase(ArtifactFactory artifactFactory) {
+        this.artifactFactory = artifactFactory;
+    }
+
+    /**
+     * @see de.intevation.artifacts.ArtifactDatabase#advance(java.lang.String, org.w3c.dom.Document, de.intevation.artifacts.CallMeta)
+     */
+    public Document advance(String artifact, Document target, CallMeta callMeta)
+                                                                                throws ArtifactDatabaseException {
+
+        return null;
+    }
+
+    /**
+     * @see de.intevation.artifacts.ArtifactDatabase#artifactFactoryNamesAndDescriptions()
+     */
+    public String[][] artifactFactoryNamesAndDescriptions() {
+
+        return null;
+    }
+
+    /**
+     * @see de.intevation.artifacts.ArtifactDatabase#createArtifactWithFactory(java.lang.String, de.intevation.artifacts.CallMeta, org.w3c.dom.Document)
+     */
+    public Document createArtifactWithFactory(String factory,
+                                              CallMeta callMeta,
+                                              Document data)
+                                                                                throws ArtifactDatabaseException {
+
+        return null;
+    }
+
+    /**
+     * @see de.intevation.artifacts.ArtifactDatabase#describe(java.lang.String, org.w3c.dom.Document, de.intevation.artifacts.CallMeta)
+     */
+    public Document describe(String artifact, Document data, CallMeta callMeta)
+                                                                               throws ArtifactDatabaseException {
+
+        return null;
+    }
+
+    /**
+     * @see de.intevation.artifacts.ArtifactDatabase#feed(java.lang.String, org.w3c.dom.Document, de.intevation.artifacts.CallMeta)
+     */
+    public Document feed(String artifact, Document data, CallMeta callMeta)
+                                                                           throws ArtifactDatabaseException {
+
+        return null;
+    }
+
+    /**
+     * @see de.intevation.artifacts.ArtifactDatabase#getInternalArtifactFactory(java.lang.String)
+     */
+    public ArtifactFactory getInternalArtifactFactory(String factoryName) {
+        return this.artifactFactory;
+    }
+
+    /**
+     * @see de.intevation.artifacts.ArtifactDatabase#out(java.lang.String, org.w3c.dom.Document, de.intevation.artifacts.CallMeta)
+     */
+    public DeferredOutput out(
+        String   artifact,
+        Document format,
+        CallMeta callMeta)
+    throws ArtifactDatabaseException {
+
+        return null;
+    }
+
+    public DeferredOutput out(
+        String   artifact,
+        String   type,
+        Document format,
+        CallMeta callMeta)
+    throws ArtifactDatabaseException
+    {
+        return null;
+
+    }
+
+    public Document process(String service, Document input, CallMeta callMeta) {
+        return null;
+    }
+
+    public String[][] serviceNamesAndDescriptions() {
+        return null;
+    }
+
+    public Document exportArtifact(String artifact, CallMeta callMeta) throws ArtifactDatabaseException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public Document importArtifact(Document data, CallMeta callMeta) throws ArtifactDatabaseException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+
+    public void loadAllArtifacts(ArtifactLoadedCallback callback)
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public Artifact getRawArtifact(String identifier)
+    throws ArtifactDatabaseException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+
+
+    // COLLECTION API
+
+    public Document setCollectionTTL(String collectionId, Document doc, CallMeta meta)
+    throws ArtifactDatabaseException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public Document setCollectionName(String collectionId, Document doc, CallMeta meta)
+    throws ArtifactDatabaseException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+
+    public DeferredOutput outCollection(String collectionId, Document format, CallMeta callMeta)
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public DeferredOutput outCollection(String collectionId, String type, Document format, CallMeta callMeta)
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param collectionId
+     * @param meta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document getCollectionsMasterArtifact(
+        String   collectionId,
+        CallMeta meta
+    )
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param userId
+     * @param callMeta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document listCollections(String userId, CallMeta callMeta)
+    throws ArtifactDatabaseException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param ownerId
+     * @param data
+     * @param callMeta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document createCollection(
+        String   ownerId,
+        Document data,
+        CallMeta callMeta
+    )
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param collectionId
+     * @param callMeta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document deleteCollection(String collectionId, CallMeta callMeta)
+    throws ArtifactDatabaseException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param collectionId
+     * @param callMeta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document describeCollection(String collectionId, CallMeta callMeta)
+    throws ArtifactDatabaseException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param collectionId
+     * @param callMeta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document getCollectionAttribute(
+        String   collectionId,
+        CallMeta callMeta
+    )
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public Document setCollectionAttribute(
+        String   collectionId,
+        CallMeta callMeta,
+        Document attribute)
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param collectionId
+     * @param artifactId
+     * @param callMeta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document getCollectionItemAttribute(
+        String   collectionId,
+        String   artifactId,
+        CallMeta callMeta
+    )
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param collectionId
+     * @param artifactId
+     * @param attribute
+     * @param callMeta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document setCollectionItemAttribute(
+        String   collectionId,
+        String   artifactId,
+        Document attribute,
+        CallMeta callMeta
+    )
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param collectionId
+     * @param artifactId
+     * @param input
+     * @param callMeta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document addCollectionArtifact(
+        String   collectionId,
+        String   artifactId,
+        Document input,
+        CallMeta callMeta
+    )
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param collectionId
+     * @param artifactId
+     * @param callMeta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document removeCollectionArtifact(
+        String   collectionId,
+        String   artifactId,
+        CallMeta callMeta
+    )
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    /**
+     * @param collectionId
+     * @param callMeta
+     *
+     * @throws ArtifactDatabaseException
+     *
+     * @return
+     */
+    public Document listCollectionArtifacts(
+        String   collectionId,
+        CallMeta callMeta
+    )
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+
+    public Document listUsers(CallMeta callMeta)
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public Document createUser(Document data, CallMeta callMeta)
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public Document deleteUser(String userId, CallMeta callMeta)
+    throws ArtifactDatabaseException
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TestCallContext.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TestCallContext.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,26 +1,44 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
+import java.util.List;
+import java.util.LinkedList;
+
+import de.intevation.artifacts.ArtifactDatabase;
+import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 import de.intevation.artifacts.CallMeta;
+import de.intevation.artifacts.DataProvider;
+import de.intevation.artifacts.Message;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class TestCallContext implements CallContext {
 
+
+
     private Object globalContext = null;
     private CallMeta callMeta = null;
-
+    private ArtifactFactory artifactFactory = null;
+    private ArtifactDatabase artifactDatabase = null;
     /**
      * Constructor
      */
-    public TestCallContext(Object globalContext, CallMeta callMeta) {
+    public TestCallContext(Object globalContext,
+                           CallMeta callMeta,
+                           ArtifactFactory artifactFactory) {
         this.globalContext = globalContext;
         this.callMeta = callMeta;
+        this.artifactDatabase  = new TestArtifactDatabase(artifactFactory);
     }
 
     /**
@@ -35,6 +53,14 @@
     public void afterCall(int action) {
     }
 
+    public boolean isInBackground() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public void addBackgroundMessage(Message msg) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
     /**
      * @see de.intevation.artifacts.CallContext#globalContext()
      */
@@ -47,13 +73,30 @@
     }
 
     public Object getContextValue(Object key) {
-        
-        		return null;
+        return null;
     }
 
     public Object putContextValue(Object key, Object value) {
-        
-        		return null;
+        return null;
     }
 
+    public ArtifactDatabase getDatabase() {
+        return this.artifactDatabase;
+    }
+
+    public Long getTimeToLive() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public Object registerDataProvider(Object key, DataProvider provider) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public List<DataProvider> getDataProvider(Object key) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    public LinkedList<Message> getBackgroundMessages() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
 }
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointTimeSeriesTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,29 +1,35 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
-import java.io.FileOutputStream;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 
+import java.io.FileOutputStream;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class TimeSeriesPointTimeSeriesTestCase extends GNVArtifactsTestCaseBase {
 
-    
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(TimeSeriesPointTimeSeriesTestCase.class);
-    
+
     /**
      * Constructor
      */
@@ -50,31 +56,29 @@
                     .getArtifactFactory(artefactName);
             assertNotNull(artifactFactory);
             log.debug("TimeSeries-ArtifactFactory is available");
-            Artifact artifact = artifactFactory.createArtifact(
-                    "" + System.currentTimeMillis(), bootstrap.getContext());
-            assertNotNull(artifact);
-            log.debug("TimeSeries-Artifact is available");
-    
-            CallContext cc = createCallContext();
-    
+
+            Artifact artifact = createArtifact(artifactFactory);
+
+            CallContext cc = createCallContext(artifactFactory);
+
             // Erster Schritt
-    
+
             Document describeDocument = this.readDocument("src/test/ressources/timeseries/timeseries_describe.xml");
-            
+
             int steps = 6;
-            
+
             for (int i = 1; i <= steps; i++){
-            
+
                 this.doNextStep(
                             artifact,
                             cc,
                             "src/test/ressources/timeseries/" +
                             "timeseries_step_0"+i+"_feed.xml",
                             "src/test/ressources/timeseries/" +
-                            "timeseries_step_0"+i+"_advance.xml", 
+                            "timeseries_step_0"+i+"_advance.xml",
                             describeDocument);
             }
-            
+
             Document outputData = artifact.describe(describeDocument,cc);
             FileOutputStream fos = null;
             FileOutputStream fos2 = null;
@@ -93,7 +97,7 @@
                 fos4 = new FileOutputStream("src/test/results/timeseries"
                         + System.currentTimeMillis()
                         + ".odv");
-            
+
                 artifact.out(this
                              .readDocument("src/test/ressources/timeseries/timeseries_step_06_out_chart.xml"),
                                            fos, cc);
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/TimeSeriesPointVerticalProfileTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,26 +1,32 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifacts;
 
-import java.io.FileOutputStream;
-
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallContext;
 
+import java.io.FileOutputStream;
+
+import org.apache.log4j.Logger;
+
+import org.w3c.dom.Document;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class TimeSeriesPointVerticalProfileTestCase extends
                                                    GNVArtifactsTestCaseBase {
 
     private static Logger log = Logger.getLogger(TimeSeriesPointVerticalProfileTestCase.class);
-    
+
     /**
      * Constructor
      */
@@ -47,16 +53,14 @@
                     .getArtifactFactory(artefactName);
             assertNotNull(artifactFactory);
             log.debug("VerticalProfile-ArtifactFactory is available");
-            Artifact artifact = artifactFactory.createArtifact(
-                    "" + System.currentTimeMillis(), bootstrap.getContext());
-            assertNotNull(artifact);
-            log.debug("VerticalProfile-Artifact is available");
 
-            CallContext cc = createCallContext();
+            Artifact artifact = createArtifact(artifactFactory);
+
+            CallContext cc = createCallContext(artifactFactory);
 
             Document describeDocument = this.readDocument("src/test/ressources/verticalprofile/verticalprofile_describe.xml");
-            int steps = 6;
-            
+            int steps = 7;
+
             for (int i = 1; i <= steps; i++){
                 this.doNextStep(
                             artifact,
@@ -64,7 +68,7 @@
                             "src/test/ressources/verticalprofile/" +
                             "verticalprofile_step_0"+i+"_feed.xml",
                             "src/test/ressources/verticalprofile/" +
-                            "verticalprofile_step_0"+i+"_advance.xml", 
+                            "verticalprofile_step_0"+i+"_advance.xml",
                             describeDocument);
             }
 
@@ -89,19 +93,19 @@
                         + ".odv");
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "verticalprofile/" +
-                                               "verticalprofile_step_06_out_statistics.xml"),
+                                               "verticalprofile_step_07_out_statistics.xml"),
                              fos2, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "verticalprofile/" +
-                                               "verticalprofile_step_06_out_chart.xml"),
+                                               "verticalprofile_step_07_out_chart.xml"),
                              fos, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "verticalprofile/" +
-                                               "verticalprofile_step_06_out_csv.xml"),
+                                               "verticalprofile_step_07_out_csv.xml"),
                              fos3, cc);
                 artifact.out(this.readDocument("src/test/ressources/" +
                                                "verticalprofile/" +
-                                               "verticalprofile_step_06_out_odv.xml"),
+                                               "verticalprofile_step_07_out_odv.xml"),
                             fos4, cc);
             } catch (Exception e) {
                 log.error(e, e);
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/ressource/RessourceFactoryTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/ressource/RessourceFactoryTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,16 +1,25 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.artifacts.ressource;
 
+import de.intevation.artifactdatabase.DefaultPreferredLocale;
+
+import de.intevation.artifacts.PreferredLocale;
+
 import junit.framework.TestCase;
 
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Logger;
 
-import de.intevation.artifactdatabase.DefaultPreferredLocale;
-import de.intevation.artifacts.PreferredLocale;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class RessourceFactoryTestCase extends TestCase {
     /**
@@ -25,7 +34,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param name
      */
     public RessourceFactoryTestCase(String name) {
--- a/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/util/DistanceCalculatorTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/util/DistanceCalculatorTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.artifacts.util;
 
 import com.vividsolutions.jts.geom.Coordinate;
@@ -13,17 +21,17 @@
     public DistanceCalculatorTestCase(String name) {
         super(name);
     }
-    
+
     public void testDistanceCalculator(){
-        
+
         GeometryFactory gf = new GeometryFactory();
-        
+
         // Distance between Berlin and Tokio
         Point p1 = gf.createPoint(new Coordinate(13.4000, 52.5167));
         Point p2 = gf.createPoint(new Coordinate(139.7667, 35.7000));
-        
+
         double s = new DistanceCalculator().calculateDistance(p1, p2);
-        
+
         assertEquals(8941.201227763724, s);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/util/ShapeFileWriterTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifacts.util;
+
+import com.vividsolutions.jts.geom.MultiLineString;
+
+import com.vividsolutions.jts.io.WKTReader;
+
+import de.intevation.gnv.utils.Pair;
+import de.intevation.gnv.utils.ShapeFileWriter;
+
+import java.io.File;
+import java.io.FileReader;
+
+import java.util.ArrayList;
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Logger;
+
+/**
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class ShapeFileWriterTestCase extends TestCase {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = null;
+
+    static {
+        BasicConfigurator.configure();
+        log = Logger.getLogger(ShapeFileWriterTestCase.class);
+    }
+
+    /**
+     * Constructor
+     * @param name
+     */
+    public ShapeFileWriterTestCase(String name) {
+        super(name);
+    }
+
+
+    public void testMultiLineStringWriter(){
+
+        try {
+            String wkt = "MULTILINESTRING ((10 10, 20 20),(15 15, 30 15))";
+            String wkt1 = "MULTILINESTRING ((10 5, 20 20),(15 15, 30 15))";
+            String wkt2 = "MULTILINESTRING ((10 10, 8 20),(15 15, 30 15))";
+            String wkt3 = "MULTILINESTRING ((8 10, 20 20),(15 15, 30 15))";
+            File isolineFile = new File("src/test/ressources/isolines.wkt");
+            MultiLineString multiLineString = (MultiLineString)new WKTReader().read(new FileReader(isolineFile));
+            MultiLineString multiLineString1 = (MultiLineString)new WKTReader().read(wkt1);
+            MultiLineString multiLineString2 = (MultiLineString)new WKTReader().read(wkt2);
+            MultiLineString multiLineString3 = (MultiLineString)new WKTReader().read(wkt3);
+            ArrayList<Pair<Object, MultiLineString>> multiLineStrings =
+                new ArrayList<Pair<Object, MultiLineString>>();
+            multiLineStrings.add(
+                    new Pair<Object, MultiLineString>(
+                            1.2,
+                            multiLineString));
+            multiLineStrings.add(
+                    new Pair<Object, MultiLineString>(
+                            1.3,
+                            multiLineString1));
+            multiLineStrings.add(
+                    new Pair<Object, MultiLineString>(
+                            1.4,
+                            multiLineString2));
+            multiLineStrings.add(
+                    new Pair<Object, MultiLineString>(
+                            1.5,
+                            multiLineString3));
+
+            java.io.File shapeFile = new java.io.File("/tmp/test"+System.currentTimeMillis()+".shp");
+
+            ShapeFileWriter.writeMultiLineStringsToFile(shapeFile, 1, 1, new Date(), multiLineStrings);
+
+        } catch (Exception e) {
+           log.error(e,e);
+           fail();
+        }
+    }
+
+}
--- a/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_09_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_09_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
 	<art:hash value="29647319" />
-	<art:target name="horizontalprofile_mesh_date" />
+	<art:target name="horizontalprofile_mesh_year" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
 	<art:hash value="29647319" />
-	<art:target name="horizontalprofile_mesh_calculate_results" />
+	<art:target name="horizontalprofile_mesh_date" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -4,7 +4,6 @@
 	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
 	<art:hash value="29647319" />
 	<art:data>
-		<art:input name="dateid" value="2009.11.29 00:00:00" />
-		<art:input name="dateid" value="2009.11.30 00:00:00" />
+		<art:input name="yearid" value="2010" />
 	</art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_out_chart.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
-	<art:hash value="29647319" />
-	<art:out name="chart">
-		<art:mime-type value="image/png" />
-		<art:params>
-			<art:input name="width" value="600" />
-			<art:input name="height" value="400" />
-		</art:params>
-	</art:out>
-</art:action>
--- a/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_out_csv.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
-	<art:hash value="29647319" />
-	<art:out name="csv">
-		<art:out value="text/plain" />
-		<art:params />
-	</art:out>
-</art:action>
--- a/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_out_odv.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
-	<art:hash value="29647319" />
-	<art:out name="odv">
-		<art:out value="text/plain" />
-		<art:params />
-	</art:out>
-</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_10_out_statistics.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
-	<art:hash value="29647319" />
-	<art:out name="statistics">
-		<art:out value="text/xml" />
-		<art:params />
-	</art:out>
-</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="advance" />
+	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
+	<art:hash value="29647319" />
+	<art:target name="horizontalprofile_mesh_calculate_results" />
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="feed" />
+	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
+	<art:hash value="29647319" />
+	<art:data>
+        <art:input name="dateid" value="2010.03.14 00:00:00" />
+        <art:input name="dateid" value="2010.03.18 00:00:00" />
+	</art:data>
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_out_chart.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
+	<art:hash value="29647319" />
+	<art:out name="chart">
+		<art:mime-type value="image/png" />
+		<art:params>
+			<art:input name="width" value="600" />
+			<art:input name="height" value="400" />
+		</art:params>
+	</art:out>
+</art:action>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_out_csv.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
+	<art:hash value="29647319" />
+	<art:out name="csv">
+		<art:out value="text/plain" />
+		<art:params />
+	</art:out>
+</art:action>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_out_odv.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
+	<art:hash value="29647319" />
+	<art:out name="odv">
+		<art:out value="text/plain" />
+		<art:params />
+	</art:out>
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalProfile_mesh/horizontalprofile_step_11_out_statistics.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="1f6a63e2-c9d6-4ab1-830e-1effbc189d68" />
+	<art:hash value="29647319" />
+	<art:out name="statistics">
+		<art:out value="text/xml" />
+		<art:params />
+	</art:out>
+</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_03_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_03_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
     <art:type name="advance" />
     <art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
     <art:hash value="6292125" />
-    <art:target name="horizontalcrosssection_meshpoint_depth"/>
+    <art:target name="verticalcrosssection_mesh_polygon"/>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_04_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_04_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="advance" />
-	<art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
-	<art:hash value="6292125" />
-	<art:target name="horizontalcrosssection_meshpoint_parameter" />
+    <art:type name="advance" />
+    <art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
+    <art:hash value="6292125" />
+    <art:target name="horizontalcrosssection_meshpoint_depth"/>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_04_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_04_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -4,6 +4,6 @@
 	<art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
 	<art:hash value="6292125" />
 	<art:data>
-		<art:input name="depthid" value="1" />
+		<art:input name="mesh_polygon" value="POLYGON (( 3.619257904890151 60.124073114994786, -0.0100024331643465 58.22749190607598, 0.0602413153141276 54.73871906497843, 1.0436537940127657 53.33384409540895, 2.2612121009729846 52.13970037127489, 3.619257904890151 52.116285788448735, 4.789987046198053 53.544575340844375, 6.358764095550643 54.15335449432448, 8.021199476207865 54.10652532867217, 7.904126562077074 55.62847321237244, 8.021199476207865 57.22066484455119, 9.496318194255823 57.478225255638925, 9.941195267952825 57.876273163683614, 10.877778580999147 57.73578566672666, 10.760705666868358 57.05676276476808, 10.526559838606776 56.75237318802803, 11.228997323391518 56.28408153150487, 10.620218169911409 55.815789874981704, 11.346070237522309 55.2070107215016, 12.235824384916315 55.97969195476481, 12.306068133394788 56.61188569107108, 11.55680148295773 57.73578566672666, 10.924607746651462 58.64895439694683, 10.47973067295446 58.906514808034565,  9.777293188169718 58.57871064846835, 8.466076549904868 57.85285858085746, 7.014372414683068 57.45481067281277, 5.937301604679798 58.04017524346672,  4.930474543155002 59.11724605346999, 4.602670383588789 59.70261062412394, 4.5324266351103155 59.91334186955937,  4.321695389674892 59.889927286733204, 4.064134978587155 59.81968353825473, 3.619257904890151 60.10065853216863,  3.619257904890151 60.124073114994786))" />
 	</art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_05_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_05_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
 	<art:hash value="6292125" />
-	<art:target name="horizontalcrosssection_mesh_date" />
+	<art:target name="horizontalcrosssection_meshpoint_parameter" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_05_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_05_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -4,6 +4,6 @@
 	<art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
 	<art:hash value="6292125" />
 	<art:data>
-		<art:input name="parameterid" value="2" />
+		<art:input name="depthid" value="1" />
 	</art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_06_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_06_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
 	<art:hash value="6292125" />
-	<art:target name="horizontalcrosssection_mesh_calculate_results" />
+	<art:target name="horizontalcrosssection_mesh_year" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_06_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_06_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -4,6 +4,6 @@
 	<art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
 	<art:hash value="6292125" />
 	<art:data>
-		<art:input name="dateid" value="2009.11.27 00:00:00" />
+		<art:input name="parameterid" value="2" />
 	</art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_06_out_chart.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-    <art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
-    <art:hash value="6292125" />
-	<art:out name="chart">
-		<art:mime-type value="image/png" />
-		<art:params>
-			<art:input name="width" value="600" />
-			<art:input name="height" value="400" />
-		</art:params>
-	</art:out>
-</art:action>
--- a/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_06_out_csv.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-    <art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
-    <art:hash value="6292125" />
-	<art:out name="csv">
-		<art:out value="text/plain" />
-		<art:params />
-	</art:out>
-</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_06_out_odv.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-    <art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
-    <art:hash value="6292125" />
-	<art:out name="odv">
-		<art:out value="text/plain" />
-		<art:params />
-	</art:out>
-</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_07_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="advance" />
+	<art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
+	<art:hash value="6292125" />
+	<art:target name="horizontalcrosssection_mesh_date" />
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_07_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="feed" />
+	<art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
+	<art:hash value="6292125" />
+	<art:data>
+		<art:input name="yearid" value="2010" />
+	</art:data>
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_08_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="advance" />
+	<art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
+	<art:hash value="6292125" />
+	<art:target name="horizontalcrosssection_mesh_calculate_results" />
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_08_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="feed" />
+	<art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
+	<art:hash value="6292125" />
+	<art:data>
+		<art:input name="dateid" value="2010.01.03 00:00:00" />
+	</art:data>
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_08_out_wms.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+    <art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
+    <art:hash value="6292125" />
+	<art:out name="wms">
+		<art:out value="text/url" />
+		<art:params />
+	</art:out>
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/horizontalcrosssection_mesh/horizontalcrosssection_step_08_out_zip.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+    <art:uuid value="74baff94-b172-4667-b6d8-db21abeb1b81" />
+    <art:hash value="6292125" />
+	<art:out name="zip">
+		<art:mime-type value="application/zip" />
+		<art:params>
+		</art:params>
+	</art:out>
+</art:action>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/isolines.wkt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,52 @@
+MULTILINESTRING ((4.355421574235005 -7.503513066218794, 3.1939758211056706 -7.503513066218794, 3.1939758211056706 -7.81615944397791, 0.5807228765646674 -7.81615944397791, 0.5807228765646674 -8.128805821737027, 0 -8.128805821737027), 
+  (297.3301128011097 -67.21897121821003, 296.4590284862627 -67.21897121821003, 296.4590284862627 -67.53161759596915, 295.29758273313337 -67.53161759596915, 295.29758273313337 -67.84426397372826, 294.42649841828637 -67.84426397372826, 294.42649841828637 -68.15691035148738, 293.5554141034394 -68.15691035148738, 293.5554141034394 -68.46955672924649, 292.39396835031005 -68.46955672924649, 292.39396835031005 -68.78220310700561, 291.522884035463 -68.78220310700561, 291.522884035463 -69.09484948476472, 290.651799720616 -69.09484948476472, 290.651799720616 -69.40749586252385, 289.49035396748667 -69.40749586252385, 289.49035396748667 -69.72014224028295, 288.6192696526397 -69.72014224028295, 288.6192696526397 -70.03278861804208, 287.7481853377927 -70.03278861804208, 287.7481853377927 -70.3454349958012, 280.198787942452 -70.3454349958012, 280.198787942452 -70.65808137356031, 276.714450683064 -70.65808137356031, 276.714450683064 -70.97072775131943, 276.13372780649934 -70.97072775131943, 276.13372780649934 -70.65808137356031, 274.97228205337 -70.65808137356031, 274.97228205337 -70.3454349958012, 273.52047486195835 -70.3454349958012, 273.52047486195835 -70.03278861804208, 272.359029108829 -70.03278861804208, 272.359029108829 -69.72014224028295, 270.9072219174173 -69.72014224028295, 270.9072219174173 -69.40749586252385, 269.45541472600564 -69.40749586252385, 269.45541472600564 -69.09484948476472, 268.003607534594 -69.09484948476472, 268.003607534594 -68.78220310700561, 266.2614389049 -68.78220310700561, 266.2614389049 -68.46955672924649, 264.519270275206 -68.46955672924649, 264.519270275206 -68.15691035148738, 262.777101645512 -68.15691035148738, 262.777101645512 -67.84426397372826, 261.03493301581796 -67.84426397372826, 261.03493301581796 -67.53161759596915, 259.29276438612396 -67.53161759596915, 259.29276438612396 -67.21897121821003, 257.55059575642997 -67.21897121821003, 257.55059575642997 -66.9063248404509, 255.80842712673598 -66.9063248404509, 255.80842712673598 -66.5936784626918, 254.06625849704199 -66.5936784626918, 254.06625849704199 -66.28103208493268, 249.1301140462423 -66.28103208493268, 249.1301140462423 -65.96838570717357, 245.35541534857197 -65.96838570717357, 245.35541534857197 -65.65573932941444, 242.45180096574862 -65.65573932941444, 242.45180096574862 -65.34309295165534, 239.25782514464296 -65.34309295165534, 239.25782514464296 -65.03044657389621, 236.64457220010195 -65.03044657389621, 236.64457220010195 -64.71780019613709, 233.74095781727863 -64.71780019613709, 233.74095781727863 -64.40515381837798, 231.1277048727376 -64.40515381837798, 231.1277048727376 -64.09250744061886, 229.96625911960828 -64.09250744061886, 229.96625911960828 -63.77986106285975, 228.51445192819662 -63.77986106285975, 228.51445192819662 -63.46721468510063, 227.35300617506726 -63.46721468510063, 227.35300617506726 -63.15456830734151, 225.9011989836556 -63.15456830734151, 225.9011989836556 -62.8419219295824, 224.44939179224394 -62.8419219295824, 224.44939179224394 -62.52927555182328, 222.99758460083228 -62.52927555182328, 222.99758460083228 -62.21662917406417, 221.5457774094206 -62.21662917406417, 221.5457774094206 -61.90398279630505, 219.8036087797266 -61.90398279630505, 219.8036087797266 -61.591336418545936, 218.0614401500326 -61.591336418545936, 218.0614401500326 -61.27869004078681, 215.73854864377392 -61.27869004078681, 215.73854864377392 -60.9660436630277, 212.8349342609506 -60.9660436630277, 212.8349342609506 -60.65339728526858, 199.47830809996324 -60.65339728526858, 199.47830809996324 -60.34075090750947, 195.7036094022929 -60.34075090750947, 195.7036094022929 -60.65339728526858, 194.54216364916357 -60.65339728526858, 194.54216364916357 -60.9660436630277, 193.0903564577519 -60.9660436630277, 193.0903564577519 -61.27869004078681, 191.92891070462255 -61.27869004078681, 191.92891070462255 -61.591336418545936, 190.4771035132109 -61.591336418545936, 190.4771035132109 -61.90398279630505, 189.31565776008156 -61.90398279630505, 189.31565776008156 -62.21662917406417, 188.15421200695224 -62.21662917406417, 188.15421200695224 -62.52927555182328, 186.99276625382288 -62.52927555182328, 186.99276625382288 -62.8419219295824, 185.83132050069355 -62.8419219295824, 185.83132050069355 -63.15456830734151, 184.96023618584655 -63.15456830734151, 184.96023618584655 -63.46721468510063, 184.08915187099956 -63.46721468510063, 184.08915187099956 -63.77986106285975, 183.21806755615256 -63.77986106285975, 183.21806755615256 -64.09250744061886, 182.05662180302323 -64.09250744061886, 182.05662180302323 -64.40515381837798, 181.1855374881762 -64.40515381837798, 181.1855374881762 -64.71780019613709, 180.3144531733292 -64.71780019613709, 180.3144531733292 -65.03044657389621, 179.15300742019988 -65.03044657389621, 179.15300742019988 -65.34309295165534, 178.2819231053529 -65.34309295165534, 178.2819231053529 -65.65573932941444, 177.12047735222356 -65.65573932941444, 177.12047735222356 -65.96838570717357, 176.24939303737654 -65.96838570717357, 176.24939303737654 -66.28103208493268, 175.0879472842472 -66.28103208493268, 175.0879472842472 -66.5936784626918, 173.92650153111788 -66.5936784626918, 173.92650153111788 -66.9063248404509, 171.02288714829453 -66.9063248404509, 171.02288714829453 -67.21897121821003, 167.82891132718888 -67.21897121821003, 167.82891132718888 -67.53161759596915, 164.34457406780086 -67.53161759596915, 164.34457406780086 -67.84426397372826, 160.2795139318482 -67.84426397372826, 160.2795139318482 -68.15691035148738, 155.3433694810485 -68.15691035148738, 155.3433694810485 -68.46955672924649, 149.2457792771195 -68.46955672924649, 149.2457792771195 -68.78220310700561, 137.0505988692615 -68.78220310700561, 137.0505988692615 -68.46955672924649, 133.85662304815583 -68.46955672924649, 133.85662304815583 -68.15691035148738, 131.24337010361484 -68.15691035148738, 131.24337010361484 -67.84426397372826, 129.50120147392082 -67.84426397372826, 129.50120147392082 -67.53161759596915, 127.75903284422682 -67.53161759596915, 127.75903284422682 -67.21897121821003, 126.30722565281515 -67.21897121821003, 126.30722565281515 -66.9063248404509, 124.85541846140349 -66.9063248404509, 124.85541846140349 -66.5936784626918, 123.40361126999181 -66.5936784626918, 123.40361126999181 -66.28103208493268, 122.24216551686249 -66.28103208493268, 122.24216551686249 -65.96838570717357, 120.79035832545081 -65.96838570717357, 120.79035832545081 -65.65573932941444, 119.62891257232148 -65.65573932941444, 119.62891257232148 -65.34309295165534, 118.46746681919214 -65.34309295165534, 118.46746681919214 -65.03044657389621, 116.14457531293347 -65.03044657389621, 116.14457531293347 -64.71780019613709, 112.9505994918278 -64.71780019613709, 112.9505994918278 -64.40515381837798, 110.62770798556913 -64.40515381837798, 110.62770798556913 -64.09250744061886, 108.30481647931046 -64.09250744061886, 108.30481647931046 -63.77986106285975, 106.56264784961647 -63.77986106285975, 106.56264784961647 -63.46721468510063, 98.14216613942878 -63.46721468510063, 98.14216613942878 -63.15456830734151, 92.91566025034678 -63.15456830734151, 92.91566025034678 -63.46721468510063, 89.14096155267644 -63.46721468510063, 89.14096155267644 -63.77986106285975, 86.52770860813544 -63.77986106285975, 86.52770860813544 -64.09250744061886, 84.20481710187677 -64.09250744061886, 84.20481710187677 -64.40515381837798, 76.36505826825376 -64.40515381837798, 76.36505826825376 -64.71780019613709, 72.59035957058342 -64.71780019613709), 
+  (72.29999813230108 -64.71780019613709, 69.68674518776008 -64.71780019613709, 69.68674518776008 -64.40515381837798, 66.78313080493675 -64.40515381837798, 66.78313080493675 -64.09250744061886, 64.16987786039574 -64.09250744061886, 64.16987786039574 -63.77986106285975, 61.55662491585474 -63.77986106285975, 61.55662491585474 -63.46721468510063, 59.81445628616074 -63.46721468510063, 59.81445628616074 -63.15456830734151, 58.653010533031406 -63.15456830734151, 58.653010533031406 -62.8419219295824, 57.49156477990207 -62.8419219295824, 57.49156477990207 -62.52927555182328, 56.330119026772735 -62.52927555182328, 56.330119026772735 -62.21662917406417, 55.45903471192573 -62.21662917406417, 55.45903471192573 -61.90398279630505, 54.297588958796396 -61.90398279630505, 54.297588958796396 -61.591336418545936, 53.4265046439494 -61.591336418545936, 53.4265046439494 -61.27869004078681, 52.5554203291024 -61.27869004078681, 52.5554203291024 -60.9660436630277, 51.68433601425539 -60.9660436630277, 51.68433601425539 -60.65339728526858, 50.8132516994084 -60.65339728526858, 50.8132516994084 -60.34075090750947, 50.232528822843726 -60.34075090750947, 50.232528822843726 -60.02810452975035, 49.36144450799673 -60.02810452975035, 49.36144450799673 -59.715458151991236, 47.909637316585055 -59.715458151991236, 47.909637316585055 -59.40281177423212, 46.74819156345572 -59.40281177423212, 46.74819156345572 -59.090165396473004, 45.29638437204405 -59.090165396473004, 45.29638437204405 -58.77751901871389, 44.13493861891472 -58.77751901871389, 44.13493861891472 -58.464872640954766, 42.97349286578539 -58.464872640954766, 42.97349286578539 -58.15222626319565, 41.81204711265605 -58.15222626319565, 41.81204711265605 -57.839579885436535, 40.65060135952672 -57.839579885436535, 40.65060135952672 -57.52693350767742, 39.48915560639738 -57.52693350767742, 39.48915560639738 -57.214287129918304, 38.32770985326805 -57.214287129918304, 38.32770985326805 -56.90164075215919, 37.16626410013871 -56.90164075215919, 37.16626410013871 -56.58899437440007, 35.714456908727044 -56.58899437440007, 35.714456908727044 -56.27634799664095, 33.972288279033044 -56.27634799664095, 33.972288279033044 -55.963701618881835, 32.23011964933904 -55.963701618881835, 32.23011964933904 -55.65105524112272, 30.48795101964504 -55.65105524112272, 30.48795101964504 -55.338408863363604, 28.165059513386367 -55.338408863363604, 28.165059513386367 -55.02576248560449, 24.971083692280697 -55.02576248560449, 24.971083692280697 -55.338408863363604, 22.93855362430436 -55.338408863363604, 22.93855362430436 -55.65105524112272, 21.777107871175026 -55.65105524112272, 21.777107871175026 -55.963701618881835, 20.61566211804569 -55.963701618881835, 20.61566211804569 -56.27634799664095, 19.74457780319869 -56.27634799664095), 
+  (4.355421574235005 -55.02576248560449, 3.774698697670338 -55.02576248560449, 3.774698697670338 -55.338408863363604, 2.6132529445410033 -55.338408863363604, 2.6132529445410033 -55.65105524112272, 1.7421686296940022 -55.65105524112272, 1.7421686296940022 -55.963701618881835, 0.5807228765646674 -55.963701618881835, 0.5807228765646674 -56.27634799664095, 0 -56.27634799664095), 
+  (25.551806568845365 0, 25.551806568845365 -0.3126463777591164, 25.842168007127697 -0.3126463777591164, 25.842168007127697 -0.6252927555182328, 26.132529445410032 -0.6252927555182328, 26.132529445410032 -0.9379391332773492, 26.422890883692364 -0.9379391332773492, 26.422890883692364 -1.2505855110364656, 26.7132523219747 -1.2505855110364656, 26.7132523219747 -1.563231888795582, 27.003613760257032 -1.563231888795582, 27.003613760257032 -2.8138173998320477, 26.7132523219747 -2.8138173998320477, 26.7132523219747 -3.126463777591164, 26.422890883692364 -3.126463777591164, 26.422890883692364 -3.4391101553502805, 26.132529445410032 -3.4391101553502805, 26.132529445410032 -3.751756533109397, 25.551806568845365 -3.751756533109397, 25.551806568845365 -4.064402910868513, 24.680722253998365 -4.064402910868513, 24.680722253998365 -4.37704928862763, 23.80963793915136 -4.37704928862763, 23.80963793915136 -4.689695666386746, 22.648192186022026 -4.689695666386746, 22.648192186022026 -5.002342044145863, 21.486746432892694 -5.002342044145863, 21.486746432892694 -5.314988421904979, 20.034939241481023 -5.314988421904979, 20.034939241481023 -5.627634799664095, 19.74457780319869 -5.627634799664095))MULTILINESTRING ((297.3301128011097 -61.27869004078681, 297.03975136282736 -61.27869004078681, 297.03975136282736 -61.591336418545936, 296.16866704798036 -61.591336418545936, 296.16866704798036 -61.90398279630505, 295.29758273313337 -61.90398279630505, 295.29758273313337 -62.21662917406417, 294.42649841828637 -62.21662917406417, 294.42649841828637 -62.52927555182328, 293.26505266515704 -62.52927555182328, 293.26505266515704 -62.8419219295824, 292.39396835031005 -62.8419219295824, 292.39396835031005 -63.15456830734151, 291.522884035463 -63.15456830734151, 291.522884035463 -63.46721468510063, 290.651799720616 -63.46721468510063, 290.651799720616 -63.77986106285975, 289.780715405769 -63.77986106285975, 289.780715405769 -64.09250744061886, 288.909631090922 -64.09250744061886, 288.909631090922 -64.40515381837798, 288.038546776075 -64.40515381837798, 288.038546776075 -64.71780019613709, 278.7469807510403 -64.71780019613709, 278.7469807510403 -65.03044657389621, 275.5530049299347 -65.03044657389621, 275.5530049299347 -64.71780019613709, 274.39155917680534 -64.71780019613709, 274.39155917680534 -64.40515381837798, 273.230113423676 -64.40515381837798, 273.230113423676 -64.09250744061886, 271.77830623226436 -64.09250744061886, 271.77830623226436 -63.77986106285975, 270.32649904085264 -63.77986106285975, 270.32649904085264 -63.46721468510063, 269.1650532877233 -63.46721468510063, 269.1650532877233 -63.15456830734151, 267.71324609631165 -63.15456830734151, 267.71324609631165 -62.8419219295824, 265.97107746661766 -62.8419219295824, 265.97107746661766 -62.52927555182328, 264.22890883692367 -62.52927555182328, 264.22890883692367 -62.21662917406417, 262.19637876894734 -62.21662917406417, 262.19637876894734 -61.90398279630505, 260.16384870097096 -61.90398279630505, 260.16384870097096 -61.591336418545936, 258.13131863299463 -61.591336418545936, 258.13131863299463 -61.27869004078681, 256.0987885650183 -61.27869004078681, 256.0987885650183 -60.9660436630277, 254.06625849704199 -60.9660436630277, 254.06625849704199 -60.65339728526858, 250.0011983610893 -60.65339728526858, 250.0011983610893 -60.34075090750947, 245.93613822513663 -60.34075090750947, 245.93613822513663 -60.02810452975035, 242.16143952746629 -60.02810452975035, 242.16143952746629 -59.715458151991236, 238.6771022680783 -59.715458151991236, 238.6771022680783 -59.40281177423212, 235.1927650086903 -59.40281177423212, 235.1927650086903 -59.090165396473004, 231.9987891875846 -59.090165396473004, 231.9987891875846 -58.77751901871389, 230.2566205578906 -58.77751901871389, 230.2566205578906 -58.464872640954766, 229.09517480476129 -58.464872640954766, 229.09517480476129 -58.15222626319565, 227.93372905163193 -58.15222626319565, 227.93372905163193 -57.839579885436535, 226.7722832985026 -57.839579885436535, 226.7722832985026 -57.52693350767742, 225.61083754537327 -57.52693350767742, 225.61083754537327 -57.214287129918304, 224.1590303539616 -57.214287129918304, 224.1590303539616 -56.90164075215919, 222.99758460083228 -56.90164075215919, 222.99758460083228 -56.58899437440007, 221.5457774094206 -56.58899437440007, 221.5457774094206 -56.27634799664095, 220.09397021800893 -56.27634799664095, 220.09397021800893 -55.963701618881835, 218.35180158831494 -55.963701618881835, 218.35180158831494 -55.65105524112272, 216.3192715203386 -55.65105524112272, 216.3192715203386 -55.338408863363604, 213.99638001407993 -55.338408863363604, 213.99638001407993 -55.02576248560449, 210.2216813164096 -55.02576248560449, 210.2216813164096 -54.71311610784537, 199.47830809996324 -54.71311610784537, 199.47830809996324 -54.40046973008626, 197.15541659370456 -54.40046973008626, 197.15541659370456 -54.08782335232714, 196.86505515542223 -54.08782335232714, 196.86505515542223 -54.40046973008626, 195.41324796401057 -54.40046973008626, 195.41324796401057 -54.71311610784537, 194.25180221088124 -54.71311610784537, 194.25180221088124 -55.02576248560449, 192.79999501946958 -55.02576248560449, 192.79999501946958 -55.338408863363604, 191.3481878280579 -55.338408863363604, 191.3481878280579 -55.65105524112272, 190.18674207492856 -55.65105524112272, 190.18674207492856 -55.963701618881835, 188.7349348835169 -55.963701618881835, 188.7349348835169 -56.27634799664095, 187.57348913038757 -56.27634799664095, 187.57348913038757 -56.58899437440007, 186.41204337725821 -56.58899437440007, 186.41204337725821 -56.90164075215919, 185.2505976241289 -56.90164075215919, 185.2505976241289 -57.214287129918304, 184.08915187099956 -57.214287129918304, 184.08915187099956 -57.52693350767742, 183.21806755615256 -57.52693350767742, 183.21806755615256 -57.839579885436535, 182.05662180302323 -57.839579885436535, 182.05662180302323 -58.15222626319565, 181.1855374881762 -58.15222626319565, 181.1855374881762 -58.464872640954766, 180.02409173504688 -58.464872640954766, 180.02409173504688 -58.77751901871389, 178.86264598191755 -58.77751901871389, 178.86264598191755 -59.090165396473004, 177.99156166707056 -59.090165396473004, 177.99156166707056 -59.40281177423212, 176.8301159139412 -59.40281177423212, 176.8301159139412 -59.715458151991236, 175.66867016081187 -59.715458151991236, 175.66867016081187 -60.02810452975035, 174.79758584596487 -60.02810452975035, 174.79758584596487 -60.34075090750947, 171.6036100248592 -60.34075090750947, 171.6036100248592 -60.65339728526858, 167.53854988890654 -60.65339728526858, 167.53854988890654 -60.9660436630277, 163.47348975295387 -60.9660436630277, 163.47348975295387 -61.27869004078681, 157.08553811074253 -61.27869004078681, 157.08553811074253 -61.591336418545936, 137.63132174582617 -61.591336418545936, 137.63132174582617 -61.27869004078681, 135.01806880128515 -61.27869004078681, 135.01806880128515 -60.9660436630277, 132.6951772950265 -60.9660436630277, 132.6951772950265 -60.65339728526858, 130.9530086653325 -60.65339728526858, 130.9530086653325 -60.34075090750947, 129.50120147392082 -60.34075090750947, 129.50120147392082 -60.02810452975035, 128.04939428250916 -60.02810452975035, 128.04939428250916 -59.715458151991236, 126.59758709109748 -59.715458151991236, 126.59758709109748 -59.40281177423212, 125.43614133796815 -59.40281177423212, 125.43614133796815 -59.090165396473004, 124.27469558483881 -59.090165396473004, 124.27469558483881 -58.77751901871389, 123.11324983170948 -58.77751901871389, 123.11324983170948 -58.464872640954766, 121.95180407858015 -58.464872640954766, 121.95180407858015 -58.15222626319565, 120.79035832545081 -58.15222626319565, 120.79035832545081 -57.839579885436535, 119.62891257232148 -57.839579885436535, 119.62891257232148 -57.52693350767742, 118.75782825747447 -57.52693350767742, 118.75782825747447 -57.214287129918304, 117.59638250434514 -57.214287129918304, 117.59638250434514 -56.90164075215919, 114.40240668323948 -56.90164075215919, 114.40240668323948 -56.58899437440007, 111.78915373869847 -56.58899437440007, 111.78915373869847 -56.27634799664095, 109.75662367072213 -56.27634799664095, 109.75662367072213 -55.963701618881835, 108.01445504102813 -55.963701618881835, 108.01445504102813 -55.65105524112272, 106.56264784961647 -55.65105524112272, 106.56264784961647 -55.338408863363604, 101.04578052225212 -55.338408863363604, 101.04578052225212 -55.02576248560449, 90.88313018237044 -55.02576248560449, 90.88313018237044 -55.338408863363604, 87.9795157995471 -55.338408863363604, 87.9795157995471 -55.65105524112272, 85.94698573157078 -55.65105524112272, 85.94698573157078 -55.963701618881835, 84.20481710187677 -55.963701618881835, 84.20481710187677 -56.27634799664095, 76.6554197065361 -56.27634799664095, 76.6554197065361 -56.58899437440007, 72.59035957058342 -56.58899437440007), 
+  (72.29999813230108 -56.58899437440007, 69.39638374947775 -56.58899437440007, 69.39638374947775 -56.27634799664095, 66.78313080493675 -56.27634799664095, 66.78313080493675 -55.963701618881835, 64.46023929867808 -55.963701618881835, 64.46023929867808 -55.65105524112272, 61.84698635413707 -55.65105524112272, 61.84698635413707 -55.338408863363604, 60.395179162725405 -55.338408863363604, 60.395179162725405 -55.02576248560449, 59.23373340959607 -55.02576248560449, 59.23373340959607 -54.71311610784537, 58.072287656466735 -54.71311610784537, 58.072287656466735 -54.40046973008626, 57.20120334161974 -54.40046973008626, 57.20120334161974 -54.08782335232714, 56.0397575884904 -54.08782335232714, 56.0397575884904 -53.775176974568026, 55.1686732736434 -53.775176974568026, 55.1686732736434 -53.462530596808904, 54.297588958796396 -53.462530596808904, 54.297588958796396 -53.14988421904979, 53.71686608223173 -53.14988421904979, 53.71686608223173 -52.83723784129067, 52.84578176738473 -52.83723784129067, 52.84578176738473 -52.52459146353156, 51.97469745253773 -52.52459146353156, 51.97469745253773 -52.21194508577244, 51.39397457597306 -52.21194508577244, 51.39397457597306 -51.899298708013326, 50.52289026112606 -51.899298708013326, 50.52289026112606 -51.58665233025421, 49.942167384561394 -51.58665233025421, 49.942167384561394 -51.27400595249509, 49.07108306971439 -51.27400595249509, 49.07108306971439 -50.96135957473597, 47.909637316585055 -50.96135957473597, 47.909637316585055 -50.64871319697686, 46.74819156345572 -50.64871319697686, 46.74819156345572 -50.33606681921774, 45.58674581032639 -50.33606681921774, 45.58674581032639 -50.023420441458626, 44.71566149547939 -50.023420441458626, 44.71566149547939 -49.71077406369951, 43.55421574235005 -49.71077406369951, 43.55421574235005 -49.398127685940395, 42.39276998922072 -49.398127685940395, 42.39276998922072 -49.08548130818128, 41.23132423609138 -49.08548130818128, 41.23132423609138 -48.772834930422164, 40.36023992124438 -48.772834930422164, 40.36023992124438 -48.46018855266304, 39.19879416811505 -48.46018855266304, 39.19879416811505 -48.147542174903926, 38.32770985326805 -48.147542174903926, 38.32770985326805 -47.83489579714481, 37.16626410013871 -47.83489579714481, 37.16626410013871 -47.522249419385695, 35.714456908727044 -47.522249419385695, 35.714456908727044 -47.20960304162658, 34.26264971731538 -47.20960304162658, 34.26264971731538 -46.89695666386746, 32.81084252590371 -46.89695666386746, 32.81084252590371 -46.58431028610835, 31.359035334492038 -46.58431028610835, 31.359035334492038 -46.271663908349225, 29.616866704798035 -46.271663908349225, 29.616866704798035 -45.95901753059011, 27.5843366368217 -45.95901753059011, 27.5843366368217 -45.646371152830994, 24.39036081571603 -45.646371152830994, 24.39036081571603 -45.95901753059011, 22.06746930945736 -45.95901753059011, 22.06746930945736 -46.271663908349225, 20.906023556328027 -46.271663908349225, 20.906023556328027 -46.58431028610835, 19.74457780319869 -46.58431028610835), 
+  (72.29999813230108 -7.81615944397791, 70.26746806432475 -7.81615944397791, 70.26746806432475 -8.128805821737027, 67.07349224321908 -8.128805821737027, 67.07349224321908 -8.441452199496144, 63.29879354554874 -8.441452199496144, 63.29879354554874 -8.75409857725526, 59.5240948478784 -8.75409857725526, 59.5240948478784 -9.066744955014375, 55.74939615020807 -9.066744955014375, 55.74939615020807 -9.379391332773492, 51.68433601425539 -9.379391332773492, 51.68433601425539 -9.69203771053261, 47.61927587830272 -9.69203771053261, 47.61927587830272 -10.004684088291725, 44.13493861891472 -10.004684088291725, 44.13493861891472 -10.31733046605084, 40.06987848296205 -10.31733046605084, 40.06987848296205 -10.629976843809958, 36.29517978529171 -10.629976843809958, 36.29517978529171 -10.942623221569075, 32.23011964933904 -10.942623221569075, 32.23011964933904 -11.25526959932819, 28.165059513386367 -11.25526959932819, 28.165059513386367 -11.567915977087306, 24.680722253998365 -11.567915977087306, 24.680722253998365 -11.880562354846424, 21.777107871175026 -11.880562354846424, 21.777107871175026 -12.193208732605541, 19.74457780319869 -12.193208732605541), 
+  (92.62529881206444 0, 92.62529881206444 -0.3126463777591164, 92.91566025034678 -0.3126463777591164, 92.91566025034678 -0.6252927555182328, 93.20602168862911 -0.6252927555182328, 93.20602168862911 -0.9379391332773492, 93.49638312691144 -0.9379391332773492, 93.49638312691144 -1.2505855110364656, 93.78674456519379 -1.2505855110364656, 93.78674456519379 -1.563231888795582, 94.07710600347612 -1.563231888795582, 94.07710600347612 -3.126463777591164, 93.78674456519379 -3.126463777591164, 93.78674456519379 -3.4391101553502805, 93.20602168862911 -3.4391101553502805, 93.20602168862911 -3.751756533109397, 92.62529881206444 -3.751756533109397, 92.62529881206444 -4.064402910868513, 92.04457593549978 -4.064402910868513, 92.04457593549978 -4.37704928862763, 91.17349162065278 -4.37704928862763, 91.17349162065278 -4.689695666386746, 90.01204586752344 -4.689695666386746, 90.01204586752344 -5.002342044145863, 88.85060011439411 -5.002342044145863, 88.85060011439411 -5.314988421904979, 87.68915436126477 -5.314988421904979, 87.68915436126477 -5.627634799664095, 86.23734716985311 -5.627634799664095, 86.23734716985311 -5.940281177423212, 84.4951785401591 -5.940281177423212, 84.4951785401591 -6.252927555182328, 82.7530099104651 -6.252927555182328, 82.7530099104651 -6.565573932941445, 80.72047984248876 -6.565573932941445, 80.72047984248876 -6.878220310700561, 78.3975883362301 -6.878220310700561, 78.3975883362301 -7.1908666884596775, 76.07469682997143 -7.1908666884596775, 76.07469682997143 -7.503513066218794, 73.46144388543043 -7.503513066218794, 73.46144388543043 -7.81615944397791, 72.59035957058342 -7.81615944397791), 
+  (4.355421574235005 -43.7704928862763, 3.4843372593880044 -43.7704928862763, 3.4843372593880044 -44.08313926403542, 1.4518071914116684 -44.08313926403542, 1.4518071914116684 -44.39578564179453, 0 -44.39578564179453), 
+  (4.355421574235005 -13.13114786588289, 0.5807228765646674 -13.13114786588289, 0.5807228765646674 -13.443794243642007, 0 -13.443794243642007))MULTILINESTRING ((4.355421574235005 -33.765808797984576, 2.9036143828233367 -33.765808797984576, 2.9036143828233367 -34.07845517574369, 0 -34.07845517574369), 
+  (72.29999813230108 -48.46018855266304, 72.00963669401875 -48.46018855266304, 72.00963669401875 -48.147542174903926, 69.39638374947775 -48.147542174903926, 69.39638374947775 -47.83489579714481, 67.07349224321908 -47.83489579714481, 67.07349224321908 -47.522249419385695, 65.04096217524274 -47.522249419385695, 65.04096217524274 -47.20960304162658, 62.718070668984076 -47.20960304162658, 62.718070668984076 -46.89695666386746, 60.97590203929008 -46.89695666386746, 60.97590203929008 -46.58431028610835, 59.81445628616074 -46.58431028610835, 59.81445628616074 -46.271663908349225, 58.94337197131374 -46.271663908349225, 58.94337197131374 -45.95901753059011, 58.072287656466735 -45.95901753059011, 58.072287656466735 -45.646371152830994, 57.20120334161974 -45.646371152830994, 57.20120334161974 -45.33372477507188, 56.330119026772735 -45.33372477507188, 56.330119026772735 -45.02107839731276, 55.74939615020807 -45.02107839731276, 55.74939615020807 -44.70843201955365, 54.87831183536107 -44.70843201955365, 54.87831183536107 -44.39578564179453, 54.297588958796396 -44.39578564179453, 54.297588958796396 -44.08313926403542, 53.4265046439494 -44.08313926403542, 53.4265046439494 -43.7704928862763, 52.84578176738473 -43.7704928862763, 52.84578176738473 -43.45784650851718, 52.265058890820065 -43.45784650851718, 52.265058890820065 -43.14520013075806, 51.68433601425539 -43.14520013075806, 51.68433601425539 -42.83255375299895, 50.8132516994084 -42.83255375299895, 50.8132516994084 -42.51990737523983, 50.232528822843726 -42.51990737523983, 50.232528822843726 -42.20726099748072, 49.65180594627906 -42.20726099748072, 49.65180594627906 -41.8946146197216, 48.78072163143206 -41.8946146197216, 48.78072163143206 -41.581968241962485, 47.61927587830272 -41.581968241962485, 47.61927587830272 -41.26932186420336, 46.74819156345572 -41.26932186420336, 46.74819156345572 -40.95667548644425, 45.58674581032639 -40.95667548644425, 45.58674581032639 -40.64402910868513, 44.71566149547939 -40.64402910868513, 44.71566149547939 -40.331382730926016, 43.55421574235005 -40.331382730926016, 43.55421574235005 -40.0187363531669, 42.68313142750305 -40.0187363531669, 42.68313142750305 -39.706089975407785, 41.81204711265605 -39.706089975407785, 41.81204711265605 -39.39344359764867, 40.65060135952672 -39.39344359764867, 40.65060135952672 -39.080797219889554, 39.779517044679714 -39.080797219889554, 39.779517044679714 -38.76815084213044, 38.61807129155038 -38.76815084213044, 38.61807129155038 -38.455504464371316, 37.746986976703376 -38.455504464371316, 37.746986976703376 -38.1428580866122, 36.29517978529171 -38.1428580866122, 36.29517978529171 -37.830211708853085, 35.13373403216237 -37.830211708853085, 35.13373403216237 -37.51756533109397, 33.681926840750705 -37.51756533109397, 33.681926840750705 -37.204918953334854, 32.23011964933904 -37.204918953334854, 32.23011964933904 -36.89227257557574, 30.48795101964504 -36.89227257557574, 30.48795101964504 -36.57962619781662, 28.745782389951035 -36.57962619781662, 28.745782389951035 -36.2669798200575, 26.132529445410032 -36.2669798200575, 26.132529445410032 -35.954333442298385, 23.51927650086903 -35.954333442298385, 23.51927650086903 -36.2669798200575, 20.61566211804569 -36.2669798200575, 20.61566211804569 -36.57962619781662, 19.74457780319869 -36.57962619781662), 
+  (170.15180283344753 0, 170.15180283344753 -0.3126463777591164, 170.44216427172987 -0.3126463777591164, 170.44216427172987 -0.9379391332773492, 170.7325257100122 -0.9379391332773492, 170.7325257100122 -1.2505855110364656, 171.02288714829453 -1.2505855110364656, 171.02288714829453 -1.8758782665546985, 171.31324858657686 -1.8758782665546985, 171.31324858657686 -2.8138173998320477, 171.02288714829453 -2.8138173998320477, 171.02288714829453 -3.126463777591164, 170.7325257100122 -3.126463777591164, 170.7325257100122 -3.4391101553502805, 170.44216427172987 -3.4391101553502805, 170.44216427172987 -3.751756533109397, 170.15180283344753 -3.751756533109397, 170.15180283344753 -4.064402910868513, 169.57107995688287 -4.064402910868513, 169.57107995688287 -4.37704928862763, 168.69999564203587 -4.37704928862763, 168.69999564203587 -4.689695666386746, 167.82891132718888 -4.689695666386746, 167.82891132718888 -5.002342044145863, 166.95782701234188 -5.002342044145863, 166.95782701234188 -5.314988421904979, 165.79638125921252 -5.314988421904979, 165.79638125921252 -5.627634799664095, 164.6349355060832 -5.627634799664095, 164.6349355060832 -5.940281177423212, 163.18312831467154 -5.940281177423212, 163.18312831467154 -6.252927555182328, 160.86023680841285 -6.252927555182328, 160.86023680841285 -6.565573932941445, 158.24698386387186 -6.565573932941445, 158.24698386387186 -6.878220310700561, 155.63373091933084 -6.878220310700561, 155.63373091933084 -7.1908666884596775, 153.02047797478986 -7.1908666884596775, 153.02047797478986 -7.503513066218794, 150.1168635919665 -7.503513066218794, 150.1168635919665 -7.81615944397791, 147.21324920914319 -7.81615944397791, 147.21324920914319 -8.128805821737027, 144.30963482631984 -8.128805821737027, 144.30963482631984 -8.441452199496144, 141.40602044349652 -8.441452199496144, 141.40602044349652 -8.75409857725526, 137.9216831841085 -8.75409857725526, 137.9216831841085 -9.066744955014375, 134.14698448643816 -9.066744955014375, 134.14698448643816 -9.379391332773492, 130.3722857887678 -9.379391332773492, 130.3722857887678 -9.69203771053261, 126.59758709109748 -9.69203771053261, 126.59758709109748 -10.004684088291725, 122.53252695514482 -10.004684088291725, 122.53252695514482 -10.31733046605084, 118.17710538090981 -10.31733046605084, 118.17710538090981 -10.629976843809958, 114.40240668323948 -10.629976843809958, 114.40240668323948 -10.942623221569075, 110.3373465472868 -10.942623221569075, 110.3373465472868 -11.25526959932819, 106.27228641133412 -11.25526959932819, 106.27228641133412 -11.567915977087306, 102.49758771366379 -11.567915977087306, 102.49758771366379 -11.880562354846424, 98.72288901599346 -11.880562354846424, 98.72288901599346 -12.193208732605541, 94.94819031832311 -12.193208732605541, 94.94819031832311 -12.505855110364656, 91.46385305893511 -12.505855110364656, 91.46385305893511 -12.818501488123772, 87.9795157995471 -12.818501488123772, 87.9795157995471 -13.13114786588289, 84.20481710187677 -13.13114786588289, 84.20481710187677 -13.443794243642007, 80.1397569659241 -13.443794243642007, 80.1397569659241 -13.756440621401122, 75.49397395340675 -13.756440621401122, 75.49397395340675 -14.069086999160238, 72.59035957058342 -14.069086999160238), 
+  (72.29999813230108 -14.069086999160238, 70.84819094088942 -14.069086999160238, 70.84819094088942 -14.381733376919355, 65.91204649008975 -14.381733376919355, 65.91204649008975 -14.694379754678472, 60.68554060100774 -14.694379754678472, 60.68554060100774 -15.007026132437588, 55.74939615020807 -15.007026132437588, 55.74939615020807 -15.319672510196703, 50.232528822843726 -15.319672510196703, 50.232528822843726 -15.63231888795582, 45.87710724860872 -15.63231888795582, 45.87710724860872 -15.944965265714938, 41.521685674373714 -15.944965265714938, 41.521685674373714 -16.257611643474053, 37.16626410013871 -16.257611643474053, 37.16626410013871 -16.57025802123317, 32.23011964933904 -16.57025802123317, 32.23011964933904 -16.882904398992288, 27.003613760257032 -16.882904398992288, 27.003613760257032 -17.195550776751404, 24.099999377433697 -17.195550776751404, 24.099999377433697 -17.50819715451052, 21.19638499461036 -17.50819715451052, 21.19638499461036 -17.820843532269635, 19.74457780319869 -17.820843532269635), 
+  (4.355421574235005 -18.13348991002875, 3.4843372593880044 -18.13348991002875, 3.4843372593880044 -18.44613628778787, 0 -18.44613628778787), 
+  (297.3301128011097 -55.65105524112272, 297.03975136282736 -55.65105524112272, 297.03975136282736 -55.963701618881835, 295.87830560969803 -55.963701618881835, 295.87830560969803 -56.27634799664095, 295.00722129485104 -56.27634799664095, 295.00722129485104 -56.58899437440007, 294.13613698000404 -56.58899437440007, 294.13613698000404 -56.90164075215919, 293.26505266515704 -56.90164075215919, 293.26505266515704 -57.214287129918304, 292.39396835031005 -57.214287129918304, 292.39396835031005 -57.52693350767742, 291.8132454737453 -57.52693350767742, 291.8132454737453 -57.839579885436535, 290.94216115889833 -57.839579885436535, 290.94216115889833 -58.15222626319565, 290.07107684405133 -58.15222626319565, 290.07107684405133 -58.464872640954766, 289.19999252920434 -58.464872640954766, 289.19999252920434 -58.77751901871389, 288.32890821435734 -58.77751901871389, 288.32890821435734 -59.090165396473004, 277.29517355962867 -59.090165396473004, 277.29517355962867 -59.40281177423212, 276.13372780649934 -59.40281177423212, 276.13372780649934 -59.090165396473004, 274.97228205337 -59.090165396473004, 274.97228205337 -58.77751901871389, 273.8108363002407 -58.77751901871389, 273.8108363002407 -58.464872640954766, 272.64939054711135 -58.464872640954766, 272.64939054711135 -58.15222626319565, 271.48794479398197 -58.15222626319565, 271.48794479398197 -57.839579885436535, 270.32649904085264 -57.839579885436535, 270.32649904085264 -57.52693350767742, 268.874691849441 -57.52693350767742, 268.874691849441 -57.214287129918304, 267.71324609631165 -57.214287129918304, 267.71324609631165 -56.90164075215919, 266.2614389049 -56.90164075215919, 266.2614389049 -56.58899437440007, 264.519270275206 -56.58899437440007, 264.519270275206 -56.27634799664095, 262.19637876894734 -56.27634799664095, 262.19637876894734 -55.963701618881835, 259.8734872626886 -55.963701618881835, 259.8734872626886 -55.65105524112272, 257.26023431814764 -55.65105524112272, 257.26023431814764 -55.338408863363604, 254.93734281188898 -55.338408863363604, 254.93734281188898 -55.02576248560449, 251.7433669907833 -55.02576248560449, 251.7433669907833 -54.71311610784537, 247.09758397826596 -54.71311610784537, 247.09758397826596 -54.40046973008626, 242.45180096574862 -54.40046973008626, 242.45180096574862 -54.08782335232714, 238.96746370636063 -54.08782335232714, 238.96746370636063 -53.775176974568026, 235.48312644697262 -53.775176974568026, 235.48312644697262 -53.462530596808904, 232.28915062586694 -53.462530596808904, 232.28915062586694 -53.14988421904979, 230.54698199617295 -53.14988421904979, 230.54698199617295 -52.83723784129067, 229.38553624304362 -52.83723784129067, 229.38553624304362 -52.52459146353156, 228.51445192819662 -52.52459146353156, 228.51445192819662 -52.21194508577244, 227.35300617506726 -52.21194508577244, 227.35300617506726 -51.899298708013326, 226.48192186022027 -51.899298708013326, 226.48192186022027 -51.58665233025421, 225.32047610709094 -51.58665233025421, 225.32047610709094 -51.27400595249509, 224.1590303539616 -51.27400595249509, 224.1590303539616 -50.96135957473597, 222.99758460083228 -50.96135957473597, 222.99758460083228 -50.64871319697686, 221.5457774094206 -50.64871319697686, 221.5457774094206 -50.33606681921774, 220.38433165629127 -50.33606681921774, 220.38433165629127 -50.023420441458626, 218.64216302659727 -50.023420441458626, 218.64216302659727 -49.71077406369951, 216.89999439690325 -49.71077406369951, 216.89999439690325 -49.398127685940395, 214.28674145236226 -49.398127685940395, 214.28674145236226 -49.08548130818128, 211.09276563125658 -49.08548130818128, 211.09276563125658 -48.772834930422164, 202.09156104450423 -48.772834930422164, 202.09156104450423 -48.46018855266304, 198.89758522339858 -48.46018855266304, 198.89758522339858 -48.147542174903926, 195.7036094022929 -48.147542174903926, 195.7036094022929 -48.46018855266304, 194.25180221088124 -48.46018855266304, 194.25180221088124 -48.772834930422164, 192.79999501946958 -48.772834930422164, 192.79999501946958 -49.08548130818128, 191.63854926634022 -49.08548130818128, 191.63854926634022 -49.398127685940395, 190.18674207492856 -49.398127685940395, 190.18674207492856 -49.71077406369951, 188.7349348835169 -49.71077406369951, 188.7349348835169 -50.023420441458626, 187.57348913038757 -50.023420441458626, 187.57348913038757 -50.33606681921774, 186.12168193897588 -50.33606681921774, 186.12168193897588 -50.64871319697686, 184.96023618584655 -50.64871319697686, 184.96023618584655 -50.96135957473597, 183.79879043271723 -50.96135957473597, 183.79879043271723 -51.27400595249509, 182.6373446795879 -51.27400595249509, 182.6373446795879 -51.58665233025421, 181.47589892645854 -51.58665233025421, 181.47589892645854 -51.899298708013326, 180.3144531733292 -51.899298708013326, 180.3144531733292 -52.21194508577244, 179.15300742019988 -52.21194508577244, 179.15300742019988 -52.52459146353156, 177.99156166707056 -52.52459146353156, 177.99156166707056 -52.83723784129067, 176.8301159139412 -52.83723784129067, 176.8301159139412 -53.14988421904979, 175.9590315990942 -53.14988421904979, 175.9590315990942 -53.462530596808904, 174.79758584596487 -53.462530596808904, 174.79758584596487 -53.775176974568026, 170.7325257100122 -53.775176974568026, 170.7325257100122 -54.08782335232714, 165.79638125921252 -54.08782335232714, 165.79638125921252 -54.40046973008626, 157.6662609873072 -54.40046973008626, 157.6662609873072 -54.71311610784537, 142.2771047583435 -54.71311610784537, 142.2771047583435 -54.40046973008626, 138.21204462239083 -54.40046973008626, 138.21204462239083 -54.08782335232714, 135.88915311613218 -54.08782335232714, 135.88915311613218 -53.775176974568026, 133.85662304815583 -53.775176974568026, 133.85662304815583 -53.462530596808904, 132.40481585674416 -53.462530596808904, 132.40481585674416 -53.14988421904979, 130.9530086653325 -53.14988421904979, 130.9530086653325 -52.83723784129067, 129.50120147392082 -52.83723784129067, 129.50120147392082 -52.52459146353156, 128.3397557207915 -52.52459146353156, 128.3397557207915 -52.21194508577244, 127.17830996766216 -52.21194508577244, 127.17830996766216 -51.899298708013326, 126.01686421453282 -51.899298708013326, 126.01686421453282 -51.58665233025421, 125.14577989968582 -51.58665233025421, 125.14577989968582 -51.27400595249509, 123.98433414655648 -51.27400595249509, 123.98433414655648 -50.96135957473597, 123.11324983170948 -50.96135957473597, 123.11324983170948 -50.64871319697686, 122.24216551686249 -50.64871319697686, 122.24216551686249 -50.33606681921774, 121.08071976373314 -50.33606681921774, 121.08071976373314 -50.023420441458626, 120.20963544888615 -50.023420441458626, 120.20963544888615 -49.71077406369951, 119.33855113403915 -49.71077406369951, 119.33855113403915 -49.398127685940395, 118.46746681919214 -49.398127685940395, 118.46746681919214 -49.08548130818128, 117.30602106606281 -49.08548130818128, 117.30602106606281 -48.772834930422164, 114.40240668323948 -48.772834930422164, 114.40240668323948 -48.46018855266304, 112.36987661526314 -48.46018855266304, 112.36987661526314 -48.147542174903926, 110.62770798556913 -48.147542174903926, 110.62770798556913 -47.83489579714481, 108.88553935587512 -47.83489579714481, 108.88553935587512 -47.522249419385695, 107.7240936027458 -47.522249419385695, 107.7240936027458 -47.20960304162658, 106.27228641133412 -47.20960304162658, 106.27228641133412 -46.89695666386746, 101.91686483709913 -46.89695666386746, 101.91686483709913 -46.58431028610835, 96.69035894801712 -46.58431028610835, 96.69035894801712 -46.271663908349225, 92.91566025034678 -46.271663908349225, 92.91566025034678 -46.58431028610835, 89.72168442924111 -46.58431028610835, 89.72168442924111 -46.89695666386746, 87.39879292298244 -46.89695666386746, 87.39879292298244 -47.20960304162658, 85.65662429328843 -47.20960304162658, 85.65662429328843 -47.522249419385695, 83.91445566359444 -47.522249419385695, 83.91445566359444 -47.83489579714481, 76.94578114481843 -47.83489579714481, 76.94578114481843 -48.147542174903926, 72.59035957058342 -48.147542174903926))MULTILINESTRING ((246.80722253998363 0, 246.80722253998363 -0.3126463777591164, 247.09758397826596 -0.3126463777591164, 247.09758397826596 -0.9379391332773492, 247.3879454165483 -0.9379391332773492, 247.3879454165483 -1.8758782665546985, 247.67830685483062 -1.8758782665546985, 247.67830685483062 -2.5011710220729313, 247.3879454165483 -2.5011710220729313, 247.3879454165483 -3.4391101553502805, 247.09758397826596 -3.4391101553502805, 247.09758397826596 -3.751756533109397, 246.80722253998363 -3.751756533109397, 246.80722253998363 -4.064402910868513, 246.5168611017013 -4.064402910868513, 246.5168611017013 -4.37704928862763, 245.93613822513663 -4.37704928862763, 245.93613822513663 -4.689695666386746, 245.6457767868543 -4.689695666386746, 245.6457767868543 -5.002342044145863, 245.06505391028963 -5.002342044145863, 245.06505391028963 -5.314988421904979, 244.48433103372497 -5.314988421904979, 244.48433103372497 -5.627634799664095, 243.61324671887797 -5.627634799664095, 243.61324671887797 -5.940281177423212, 242.74216240403095 -5.940281177423212, 242.74216240403095 -6.252927555182328, 242.16143952746629 -6.252927555182328, 242.16143952746629 -6.565573932941445, 241.2903552126193 -6.565573932941445, 241.2903552126193 -6.878220310700561, 240.4192708977723 -6.878220310700561, 240.4192708977723 -7.1908666884596775, 239.83854802120763 -7.1908666884596775, 239.83854802120763 -7.503513066218794, 238.6771022680783 -7.503513066218794, 238.6771022680783 -7.81615944397791, 237.80601795323128 -7.81615944397791, 237.80601795323128 -8.128805821737027, 236.93493363838428 -8.128805821737027, 236.93493363838428 -8.441452199496144, 235.77348788525495 -8.441452199496144, 235.77348788525495 -8.75409857725526, 234.61204213212562 -8.75409857725526, 234.61204213212562 -9.066744955014375, 233.74095781727863 -9.066744955014375, 233.74095781727863 -9.379391332773492, 232.57951206414927 -9.379391332773492, 232.57951206414927 -9.69203771053261, 231.1277048727376 -9.69203771053261, 231.1277048727376 -10.004684088291725, 229.67589768132595 -10.004684088291725, 229.67589768132595 -10.31733046605084, 228.2240904899143 -10.31733046605084, 228.2240904899143 -10.629976843809958, 226.48192186022027 -10.629976843809958, 226.48192186022027 -10.942623221569075, 224.73975323052628 -10.942623221569075, 224.73975323052628 -11.25526959932819, 222.70722316254992 -11.25526959932819, 222.70722316254992 -11.567915977087306, 220.6746930945736 -11.567915977087306, 220.6746930945736 -11.880562354846424, 218.0614401500326 -11.880562354846424, 218.0614401500326 -12.193208732605541, 214.5771028906446 -12.193208732605541, 214.5771028906446 -12.505855110364656, 210.2216813164096 -12.505855110364656, 210.2216813164096 -12.818501488123772, 200.34939241481024 -12.818501488123772, 200.34939241481024 -13.13114786588289, 192.79999501946958 -13.13114786588289, 192.79999501946958 -13.443794243642007, 187.8638505686699 -13.443794243642007, 187.8638505686699 -13.756440621401122, 183.5084289944349 -13.756440621401122, 183.5084289944349 -14.069086999160238, 180.02409173504688 -14.069086999160238, 180.02409173504688 -14.381733376919355, 176.24939303737654 -14.381733376919355, 176.24939303737654 -14.694379754678472, 171.6036100248592 -14.694379754678472, 171.6036100248592 -15.007026132437588, 166.3771041357772 -15.007026132437588, 166.3771041357772 -15.319672510196703, 157.95662242558953 -15.319672510196703, 157.95662242558953 -15.63231888795582, 148.08433352399018 -15.63231888795582, 148.08433352399018 -15.944965265714938, 139.6638518138025 -15.944965265714938, 139.6638518138025 -16.257611643474053, 132.98553873330883 -16.257611643474053, 132.98553873330883 -16.57025802123317, 127.46867140594449 -16.57025802123317, 127.46867140594449 -16.882904398992288, 123.69397270827415 -16.882904398992288, 123.69397270827415 -17.195550776751404, 119.33855113403915 -17.195550776751404, 119.33855113403915 -17.50819715451052, 115.27349099808647 -17.50819715451052, 115.27349099808647 -17.820843532269635, 111.2084308621338 -17.820843532269635, 111.2084308621338 -18.13348991002875, 107.14337072618113 -18.13348991002875, 107.14337072618113 -18.44613628778787, 102.49758771366379 -18.44613628778787, 102.49758771366379 -18.758782665546985, 98.43252757771111 -18.758782665546985, 98.43252757771111 -19.0714290433061, 94.94819031832311 -19.0714290433061, 94.94819031832311 -19.38407542106522, 90.88313018237044 -19.38407542106522, 90.88313018237044 -19.696721798824335, 86.81807004641777 -19.696721798824335, 86.81807004641777 -20.00936817658345, 82.7530099104651 -20.00936817658345, 82.7530099104651 -20.322014554342566, 78.97831121279476 -20.322014554342566, 78.97831121279476 -20.63466093210168, 74.62288963855976 -20.63466093210168, 74.62288963855976 -20.9473073098608, 72.59035957058342 -20.9473073098608), 
+  (72.29999813230108 -20.9473073098608, 70.55782950260709 -20.9473073098608, 70.55782950260709 -21.259953687619916, 67.65421511978374 -21.259953687619916, 67.65421511978374 -21.57260006537903, 64.75060073696041 -21.57260006537903, 64.75060073696041 -21.88524644313815, 62.137347792419405 -21.88524644313815, 62.137347792419405 -22.197892820897266, 60.10481772444307 -22.197892820897266, 60.10481772444307 -22.51053919865638, 58.653010533031406 -22.51053919865638, 58.653010533031406 -22.823185576415497, 57.20120334161974 -22.823185576415497, 57.20120334161974 -23.135831954174613, 55.74939615020807 -23.135831954174613, 55.74939615020807 -23.44847833193373, 54.587950397078735 -23.44847833193373, 54.587950397078735 -23.761124709692847, 53.71686608223173 -23.761124709692847, 53.71686608223173 -24.073771087451963, 52.84578176738473 -24.073771087451963, 52.84578176738473 -24.386417465211082, 51.97469745253773 -24.386417465211082, 51.97469745253773 -24.699063842970197, 51.39397457597306 -24.699063842970197, 51.39397457597306 -25.011710220729313, 51.10361313769073 -25.011710220729313, 51.10361313769073 -25.32435659848843, 50.52289026112606 -25.32435659848843, 50.52289026112606 -25.637002976247544, 50.232528822843726 -25.637002976247544, 50.232528822843726 -26.26229573176578, 49.942167384561394 -26.26229573176578, 49.942167384561394 -27.20023486504313, 50.232528822843726 -27.20023486504313, 50.232528822843726 -27.82552762056136, 50.52289026112606 -27.82552762056136, 50.52289026112606 -28.450820376079594, 50.8132516994084 -28.450820376079594, 50.8132516994084 -28.76346675383871, 51.10361313769073 -28.76346675383871, 51.10361313769073 -29.076113131597825, 51.39397457597306 -29.076113131597825, 51.39397457597306 -29.388759509356944, 51.68433601425539 -29.388759509356944, 51.68433601425539 -29.70140588711606, 51.97469745253773 -29.70140588711606, 51.97469745253773 -30.014052264875176, 52.5554203291024 -30.014052264875176, 52.5554203291024 -30.32669864263429, 52.84578176738473 -30.32669864263429, 52.84578176738473 -30.639345020393407, 53.13614320566706 -30.639345020393407, 53.13614320566706 -30.951991398152526, 53.71686608223173 -30.951991398152526, 53.71686608223173 -31.26463777591164, 54.007227520514064 -31.26463777591164, 54.007227520514064 -31.577284153670757, 54.587950397078735 -31.577284153670757, 54.587950397078735 -31.889930531429876, 54.87831183536107 -31.889930531429876, 54.87831183536107 -32.20257690918899, 55.45903471192573 -32.20257690918899, 55.45903471192573 -32.51522328694811, 56.0397575884904 -32.51522328694811, 56.0397575884904 -32.82786966470722, 56.62048046505507 -32.82786966470722, 56.62048046505507 -33.14051604246634, 57.20120334161974 -33.14051604246634, 57.20120334161974 -33.45316242022545, 57.49156477990207 -33.45316242022545, 57.49156477990207 -33.765808797984576, 58.072287656466735 -33.765808797984576, 58.072287656466735 -34.07845517574369, 58.653010533031406 -34.07845517574369, 58.653010533031406 -34.39110155350281, 59.5240948478784 -34.39110155350281, 59.5240948478784 -34.70374793126192, 60.10481772444307 -34.70374793126192, 60.10481772444307 -35.01639430902104, 60.68554060100774 -35.01639430902104, 60.68554060100774 -35.329040686780154, 61.84698635413707 -35.329040686780154, 61.84698635413707 -35.64168706453927, 63.00843210726641 -35.64168706453927, 63.00843210726641 -35.954333442298385, 64.46023929867808 -35.954333442298385, 64.46023929867808 -36.2669798200575, 65.91204649008975 -36.2669798200575, 65.91204649008975 -36.57962619781662, 67.36385368150141 -36.57962619781662, 67.36385368150141 -36.89227257557574, 68.81566087291309 -36.89227257557574, 68.81566087291309 -37.204918953334854, 70.55782950260709 -37.204918953334854, 70.55782950260709 -37.51756533109397, 72.29999813230108 -37.51756533109397), 
+  (297.3301128011097 -49.71077406369951, 296.4590284862627 -49.71077406369951, 296.4590284862627 -50.023420441458626, 295.5879441714157 -50.023420441458626, 295.5879441714157 -50.33606681921774, 294.7168598565687 -50.33606681921774, 294.7168598565687 -50.64871319697686, 293.8457755417217 -50.64871319697686, 293.8457755417217 -50.96135957473597, 292.9746912268747 -50.96135957473597, 292.9746912268747 -51.27400595249509, 292.39396835031005 -51.27400595249509, 292.39396835031005 -51.58665233025421, 291.522884035463 -51.58665233025421, 291.522884035463 -51.899298708013326, 290.651799720616 -51.899298708013326, 290.651799720616 -52.21194508577244, 290.07107684405133 -52.21194508577244, 290.07107684405133 -52.52459146353156, 289.19999252920434 -52.52459146353156, 289.19999252920434 -52.83723784129067, 288.6192696526397 -52.83723784129067, 288.6192696526397 -53.14988421904979, 287.7481853377927 -53.14988421904979, 287.7481853377927 -53.462530596808904, 286.58673958466335 -53.462530596808904, 286.58673958466335 -53.14988421904979, 275.843366368217 -53.14988421904979, 275.843366368217 -52.83723784129067, 274.97228205337 -52.83723784129067, 274.97228205337 -52.52459146353156, 274.101197738523 -52.52459146353156, 274.101197738523 -52.21194508577244, 272.9397519853937 -52.21194508577244, 272.9397519853937 -51.899298708013326, 272.0686676705467 -51.899298708013326, 272.0686676705467 -51.58665233025421, 270.9072219174173 -51.58665233025421, 270.9072219174173 -51.27400595249509, 269.745776164288 -51.27400595249509, 269.745776164288 -50.96135957473597, 268.874691849441 -50.96135957473597, 268.874691849441 -50.64871319697686, 267.71324609631165 -50.64871319697686, 267.71324609631165 -50.33606681921774, 266.5518003431823 -50.33606681921774, 266.5518003431823 -50.023420441458626, 265.390354590053 -50.023420441458626, 265.390354590053 -49.71077406369951, 262.777101645512 -49.71077406369951, 262.777101645512 -49.398127685940395, 260.16384870097096 -49.398127685940395, 260.16384870097096 -49.08548130818128, 257.55059575642997 -49.08548130818128, 257.55059575642997 -48.772834930422164, 254.93734281188898 -48.772834930422164, 254.93734281188898 -48.46018855266304, 250.0011983610893 -48.46018855266304, 250.0011983610893 -48.147542174903926, 243.9036081571603 -48.147542174903926, 243.9036081571603 -47.83489579714481, 240.4192708977723 -47.83489579714481, 240.4192708977723 -47.522249419385695, 237.51565651494894 -47.522249419385695, 237.51565651494894 -47.20960304162658, 234.90240357040796 -47.20960304162658, 234.90240357040796 -46.89695666386746, 232.28915062586694 -46.89695666386746, 232.28915062586694 -46.58431028610835, 230.54698199617295 -46.58431028610835, 230.54698199617295 -46.271663908349225, 229.96625911960828 -46.271663908349225, 229.96625911960828 -45.95901753059011, 229.09517480476129 -45.95901753059011, 229.09517480476129 -45.646371152830994, 228.2240904899143 -45.646371152830994, 228.2240904899143 -45.33372477507188, 227.35300617506726 -45.33372477507188, 227.35300617506726 -45.02107839731276, 226.48192186022027 -45.02107839731276, 226.48192186022027 -44.70843201955365, 225.61083754537327 -44.70843201955365, 225.61083754537327 -44.39578564179453, 224.73975323052628 -44.39578564179453, 224.73975323052628 -44.08313926403542, 223.86866891567928 -44.08313926403542, 223.86866891567928 -43.7704928862763, 222.70722316254992 -43.7704928862763, 222.70722316254992 -43.45784650851718, 221.83613884770293 -43.45784650851718, 221.83613884770293 -43.14520013075806, 220.6746930945736 -43.14520013075806, 220.6746930945736 -42.83255375299895, 219.51324734144427 -42.83255375299895, 219.51324734144427 -42.51990737523983, 217.19035583518558 -42.51990737523983, 217.19035583518558 -42.20726099748072, 214.5771028906446 -42.20726099748072, 214.5771028906446 -41.8946146197216, 211.09276563125658 -41.8946146197216, 211.09276563125658 -41.581968241962485, 203.83372967419825 -41.581968241962485, 203.83372967419825 -41.26932186420336, 200.0590309765279 -41.26932186420336, 200.0590309765279 -40.95667548644425, 197.44577803198692 -40.95667548644425, 197.44577803198692 -40.64402910868513, 196.5746937171399 -40.64402910868513, 196.5746937171399 -40.95667548644425, 195.41324796401057 -40.95667548644425, 195.41324796401057 -41.26932186420336, 193.9614407725989 -41.26932186420336, 193.9614407725989 -41.581968241962485, 192.50963358118724 -41.581968241962485, 192.50963358118724 -41.8946146197216, 191.05782638977556 -41.8946146197216, 191.05782638977556 -42.20726099748072, 189.89638063664623 -42.20726099748072, 189.89638063664623 -42.51990737523983, 188.44457344523457 -42.51990737523983, 188.44457344523457 -42.83255375299895, 186.99276625382288 -42.83255375299895, 186.99276625382288 -43.14520013075806, 185.83132050069355 -43.14520013075806, 185.83132050069355 -43.45784650851718, 184.3795133092819 -43.45784650851718, 184.3795133092819 -43.7704928862763, 182.92770611787023 -43.7704928862763, 182.92770611787023 -44.08313926403542, 181.76626036474087 -44.08313926403542, 181.76626036474087 -44.39578564179453, 180.60481461161154 -44.39578564179453, 180.60481461161154 -44.70843201955365, 179.15300742019988 -44.70843201955365, 179.15300742019988 -45.02107839731276, 177.99156166707056 -45.02107839731276, 177.99156166707056 -45.33372477507188, 177.12047735222356 -45.33372477507188, 177.12047735222356 -45.646371152830994, 175.9590315990942 -45.646371152830994, 175.9590315990942 -45.95901753059011, 174.79758584596487 -45.95901753059011, 174.79758584596487 -46.271663908349225, 169.28071851860054 -46.271663908349225, 169.28071851860054 -46.58431028610835, 161.73132112325987 -46.58431028610835, 161.73132112325987 -46.89695666386746, 149.82650215368417 -46.89695666386746, 149.82650215368417 -46.58431028610835, 141.69638188177885 -46.58431028610835, 141.69638188177885 -46.271663908349225, 138.7927674989555 -46.271663908349225, 138.7927674989555 -45.95901753059011, 137.0505988692615 -45.95901753059011, 137.0505988692615 -45.646371152830994, 135.30843023956749 -45.646371152830994, 135.30843023956749 -45.33372477507188, 133.85662304815583 -45.33372477507188, 133.85662304815583 -45.02107839731276, 132.6951772950265 -45.02107839731276, 132.6951772950265 -44.70843201955365, 131.53373154189717 -44.70843201955365, 131.53373154189717 -44.39578564179453, 130.3722857887678 -44.39578564179453, 130.3722857887678 -44.08313926403542, 129.50120147392082 -44.08313926403542, 129.50120147392082 -43.7704928862763, 128.3397557207915 -43.7704928862763, 128.3397557207915 -43.45784650851718, 127.46867140594449 -43.45784650851718, 127.46867140594449 -43.14520013075806, 126.59758709109748 -43.14520013075806, 126.59758709109748 -42.83255375299895, 125.72650277625048 -42.83255375299895, 125.72650277625048 -42.51990737523983, 125.14577989968582 -42.51990737523983, 125.14577989968582 -42.20726099748072, 124.27469558483881 -42.20726099748072, 124.27469558483881 -41.8946146197216, 123.40361126999181 -41.8946146197216, 123.40361126999181 -41.581968241962485, 122.82288839342715 -41.581968241962485, 122.82288839342715 -41.26932186420336, 121.95180407858015 -41.26932186420336, 121.95180407858015 -40.95667548644425, 121.08071976373314 -40.95667548644425, 121.08071976373314 -40.64402910868513, 120.49999688716848 -40.64402910868513, 120.49999688716848 -40.331382730926016, 119.62891257232148 -40.331382730926016, 119.62891257232148 -40.0187363531669, 119.0481896957568 -40.0187363531669, 119.0481896957568 -39.706089975407785, 118.17710538090981 -39.706089975407785, 118.17710538090981 -39.39344359764867, 117.01565962778048 -39.39344359764867, 117.01565962778048 -39.080797219889554, 114.98312955980414 -39.080797219889554, 114.98312955980414 -38.76815084213044, 113.24096093011013 -38.76815084213044, 113.24096093011013 -38.455504464371316, 111.78915373869847 -38.455504464371316, 111.78915373869847 -38.1428580866122, 110.3373465472868 -38.1428580866122, 110.3373465472868 -37.830211708853085, 109.17590079415747 -37.830211708853085, 109.17590079415747 -37.51756533109397, 108.01445504102813 -37.51756533109397, 108.01445504102813 -37.204918953334854, 106.8530092878988 -37.204918953334854, 106.8530092878988 -36.89227257557574, 104.82047921992246 -36.89227257557574, 104.82047921992246 -36.57962619781662, 101.33614196053446 -36.57962619781662, 101.33614196053446 -36.2669798200575, 97.85180470114645 -36.2669798200575, 97.85180470114645 -35.954333442298385, 90.01204586752344 -35.954333442298385, 90.01204586752344 -36.2669798200575, 87.68915436126477 -36.2669798200575, 87.68915436126477 -36.57962619781662, 85.65662429328843 -36.57962619781662, 85.65662429328843 -36.89227257557574, 84.20481710187677 -36.89227257557574, 84.20481710187677 -37.204918953334854, 76.07469682997143 -37.204918953334854, 76.07469682997143 -37.51756533109397, 72.59035957058342 -37.51756533109397))MULTILINESTRING ((179.15300742019988 -30.014052264875176, 179.15300742019988 -29.388759509356944, 179.44336885848222 -29.388759509356944, 179.44336885848222 -29.076113131597825, 179.15300742019988 -29.076113131597825, 179.15300742019988 -28.450820376079594, 178.86264598191755 -28.450820376079594, 178.86264598191755 -28.138173998320475, 178.57228454363522 -28.138173998320475, 178.57228454363522 -27.82552762056136, 177.99156166707056 -27.82552762056136, 177.99156166707056 -27.512881242802244, 177.12047735222356 -27.512881242802244, 177.12047735222356 -27.20023486504313, 175.9590315990942 -27.20023486504313, 175.9590315990942 -26.887588487284013, 172.1843329014239 -26.887588487284013, 172.1843329014239 -27.20023486504313, 170.15180283344753 -27.20023486504313, 170.15180283344753 -27.512881242802244, 168.1192727654712 -27.512881242802244, 168.1192727654712 -27.82552762056136, 166.08674269749486 -27.82552762056136, 166.08674269749486 -28.138173998320475, 164.34457406780086 -28.138173998320475, 164.34457406780086 -28.450820376079594, 162.31204399982454 -28.450820376079594, 162.31204399982454 -28.76346675383871, 159.98915249356585 -28.76346675383871, 159.98915249356585 -29.076113131597825, 158.24698386387186 -29.076113131597825, 158.24698386387186 -29.388759509356944, 157.08553811074253 -29.388759509356944, 157.08553811074253 -29.70140588711606, 155.92409235761318 -29.70140588711606, 155.92409235761318 -30.014052264875176, 155.3433694810485 -30.014052264875176, 155.3433694810485 -30.951991398152526, 155.92409235761318 -30.951991398152526, 155.92409235761318 -31.26463777591164, 156.7951766724602 -31.26463777591164, 156.7951766724602 -31.577284153670757, 158.24698386387186 -31.577284153670757, 158.24698386387186 -31.889930531429876, 159.98915249356585 -31.889930531429876, 159.98915249356585 -32.20257690918899, 162.0216825615422 -32.20257690918899, 162.0216825615422 -32.51522328694811, 166.08674269749486 -32.51522328694811, 166.08674269749486 -32.82786966470722, 171.02288714829453 -32.82786966470722, 171.02288714829453 -33.14051604246634, 174.79758584596487 -33.14051604246634, 174.79758584596487 -32.82786966470722, 175.37830872252954 -32.82786966470722, 175.37830872252954 -32.51522328694811, 175.9590315990942 -32.51522328694811, 175.9590315990942 -32.20257690918899, 176.24939303737654 -32.20257690918899, 176.24939303737654 -31.889930531429876, 176.8301159139412 -31.889930531429876, 176.8301159139412 -31.577284153670757, 177.4108387905059 -31.577284153670757, 177.4108387905059 -31.26463777591164, 177.70120022878822 -31.26463777591164, 177.70120022878822 -30.951991398152526, 178.2819231053529 -30.951991398152526, 178.2819231053529 -30.639345020393407, 178.57228454363522 -30.639345020393407, 178.57228454363522 -30.32669864263429, 178.86264598191755 -30.32669864263429, 178.86264598191755 -30.014052264875176, 179.15300742019988 -30.014052264875176), 
+  (297.3301128011097 -9.69203771053261, 297.03975136282736 -9.69203771053261, 297.03975136282736 -10.004684088291725, 296.749389924545 -10.004684088291725, 296.749389924545 -10.31733046605084, 296.4590284862627 -10.31733046605084, 296.4590284862627 -10.629976843809958, 296.16866704798036 -10.629976843809958, 296.16866704798036 -10.942623221569075, 295.5879441714157 -10.942623221569075, 295.5879441714157 -11.25526959932819, 295.29758273313337 -11.25526959932819, 295.29758273313337 -11.567915977087306, 294.7168598565687 -11.567915977087306, 294.7168598565687 -11.880562354846424, 294.42649841828637 -11.880562354846424, 294.42649841828637 -12.193208732605541, 293.8457755417217 -12.193208732605541, 293.8457755417217 -12.505855110364656, 293.26505266515704 -12.505855110364656, 293.26505266515704 -12.818501488123772, 292.6843297885924 -12.818501488123772, 292.6843297885924 -13.13114786588289, 292.39396835031005 -13.13114786588289, 292.39396835031005 -13.443794243642007, 291.8132454737453 -13.443794243642007, 291.8132454737453 -13.756440621401122, 291.23252259718066 -13.756440621401122, 291.23252259718066 -14.069086999160238, 290.651799720616 -14.069086999160238, 290.651799720616 -14.381733376919355, 290.07107684405133 -14.381733376919355, 290.07107684405133 -14.694379754678472, 289.49035396748667 -14.694379754678472, 289.49035396748667 -15.007026132437588, 288.909631090922 -15.007026132437588, 288.909631090922 -15.319672510196703, 288.32890821435734 -15.319672510196703, 288.32890821435734 -15.63231888795582, 287.7481853377927 -15.63231888795582, 287.7481853377927 -15.944965265714938, 286.8771010229457 -15.944965265714938, 286.8771010229457 -16.257611643474053, 286.0060167080987 -16.257611643474053, 286.0060167080987 -16.57025802123317, 285.425293831534 -16.57025802123317, 285.425293831534 -16.882904398992288, 284.554209516687 -16.882904398992288, 284.554209516687 -17.195550776751404, 283.97348664012236 -17.195550776751404, 283.97348664012236 -17.50819715451052, 283.10240232527536 -17.50819715451052, 283.10240232527536 -17.820843532269635, 282.5216794487107 -17.820843532269635, 282.5216794487107 -18.13348991002875, 281.65059513386365 -18.13348991002875, 281.65059513386365 -18.44613628778787, 281.069872257299 -18.44613628778787, 281.069872257299 -18.758782665546985, 280.4891493807343 -18.758782665546985, 280.4891493807343 -19.0714290433061, 279.6180650658873 -19.0714290433061, 279.6180650658873 -19.38407542106522, 279.03734218932266 -19.38407542106522, 279.03734218932266 -19.696721798824335, 278.456619312758 -19.696721798824335, 278.456619312758 -20.00936817658345, 277.585534997911 -20.00936817658345, 277.585534997911 -20.322014554342566, 277.00481212134633 -20.322014554342566, 277.00481212134633 -20.63466093210168, 276.42408924478167 -20.63466093210168, 276.42408924478167 -20.9473073098608, 274.97228205337 -20.9473073098608, 274.97228205337 -21.259953687619916, 273.8108363002407 -21.259953687619916, 273.8108363002407 -21.57260006537903, 272.359029108829 -21.57260006537903, 272.359029108829 -21.88524644313815, 271.19758335569963 -21.88524644313815, 271.19758335569963 -22.197892820897266, 270.0361376025703 -22.197892820897266, 270.0361376025703 -22.51053919865638, 269.1650532877233 -22.51053919865638, 269.1650532877233 -22.823185576415497, 268.003607534594 -22.823185576415497, 268.003607534594 -23.135831954174613, 267.132523219747 -23.135831954174613, 267.132523219747 -23.44847833193373, 266.2614389049 -23.44847833193373, 266.2614389049 -23.761124709692847, 265.390354590053 -23.761124709692847, 265.390354590053 -24.073771087451963, 263.06746308379434 -24.073771087451963, 263.06746308379434 -24.386417465211082, 260.7445715775356 -24.386417465211082, 260.7445715775356 -24.699063842970197, 258.42168007127697 -24.699063842970197, 258.42168007127697 -25.011710220729313, 256.679511441583 -25.011710220729313, 256.679511441583 -25.32435659848843, 255.2277042501713 -25.32435659848843, 255.2277042501713 -25.637002976247544, 253.19517418219496 -25.637002976247544, 253.19517418219496 -25.949649354006663, 245.93613822513663 -25.949649354006663, 245.93613822513663 -26.26229573176578, 242.16143952746629 -26.26229573176578, 242.16143952746629 -26.574942109524894, 241.2903552126193 -26.574942109524894, 241.2903552126193 -26.887588487284013, 240.4192708977723 -26.887588487284013, 240.4192708977723 -27.20023486504313, 239.5481865829253 -27.20023486504313, 239.5481865829253 -27.512881242802244, 238.6771022680783 -27.512881242802244, 238.6771022680783 -27.82552762056136, 237.80601795323128 -27.82552762056136, 237.80601795323128 -28.138173998320475, 237.2252950766666 -28.138173998320475, 237.2252950766666 -28.450820376079594, 236.35421076181962 -28.450820376079594, 236.35421076181962 -28.76346675383871, 235.77348788525495 -28.76346675383871, 235.77348788525495 -29.076113131597825, 235.1927650086903 -29.076113131597825, 235.1927650086903 -29.388759509356944, 234.61204213212562 -29.388759509356944, 234.61204213212562 -29.70140588711606, 234.3216806938433 -29.70140588711606, 234.3216806938433 -30.014052264875176, 233.74095781727863 -30.014052264875176, 233.74095781727863 -30.32669864263429, 233.4505963789963 -30.32669864263429, 233.4505963789963 -30.639345020393407, 233.16023494071393 -30.639345020393407, 233.16023494071393 -30.951991398152526, 232.8698735024316 -30.951991398152526, 232.8698735024316 -31.26463777591164, 232.57951206414927 -31.26463777591164, 232.57951206414927 -31.577284153670757, 232.28915062586694 -31.577284153670757, 232.28915062586694 -33.14051604246634, 232.57951206414927 -33.14051604246634, 232.57951206414927 -33.765808797984576, 232.8698735024316 -33.765808797984576, 232.8698735024316 -34.07845517574369, 233.16023494071393 -34.07845517574369, 233.16023494071393 -34.39110155350281, 233.4505963789963 -34.39110155350281, 233.4505963789963 -34.70374793126192, 234.03131925556096 -34.70374793126192, 234.03131925556096 -35.01639430902104, 234.61204213212562 -35.01639430902104, 234.61204213212562 -35.329040686780154, 234.90240357040796 -35.329040686780154, 234.90240357040796 -35.64168706453927, 235.77348788525495 -35.64168706453927, 235.77348788525495 -35.954333442298385, 236.35421076181962 -35.954333442298385, 236.35421076181962 -36.2669798200575, 236.93493363838428 -36.2669798200575, 236.93493363838428 -36.57962619781662, 237.80601795323128 -36.57962619781662, 237.80601795323128 -36.89227257557574, 238.6771022680783 -36.89227257557574, 238.6771022680783 -37.204918953334854, 239.5481865829253 -37.204918953334854, 239.5481865829253 -37.51756533109397, 240.4192708977723 -37.51756533109397, 240.4192708977723 -37.830211708853085, 241.58071665090162 -37.830211708853085, 241.58071665090162 -38.1428580866122, 243.03252384231328 -38.1428580866122, 243.03252384231328 -38.455504464371316, 254.64698137360665 -38.455504464371316, 254.64698137360665 -38.76815084213044, 256.0987885650183 -38.76815084213044, 256.0987885650183 -39.080797219889554, 258.13131863299463 -39.080797219889554, 258.13131863299463 -39.39344359764867, 260.4542101392533 -39.39344359764867, 260.4542101392533 -39.706089975407785, 262.777101645512 -39.706089975407785, 262.777101645512 -40.0187363531669, 265.09999315177066 -40.0187363531669, 265.09999315177066 -40.331382730926016, 265.6807160283353 -40.331382730926016, 265.6807160283353 -40.64402910868513, 266.5518003431823 -40.64402910868513, 266.5518003431823 -40.95667548644425, 267.132523219747 -40.95667548644425, 267.132523219747 -41.26932186420336, 267.71324609631165 -41.26932186420336, 267.71324609631165 -41.581968241962485, 268.58433041115865 -41.581968241962485, 268.58433041115865 -41.8946146197216, 269.1650532877233 -41.8946146197216, 269.1650532877233 -42.20726099748072, 269.745776164288 -42.20726099748072, 269.745776164288 -42.51990737523983, 270.61686047913497 -42.51990737523983, 270.61686047913497 -42.83255375299895, 271.19758335569963 -42.83255375299895, 271.19758335569963 -43.14520013075806, 271.77830623226436 -43.14520013075806, 271.77830623226436 -43.45784650851718, 272.64939054711135 -43.45784650851718, 272.64939054711135 -43.7704928862763, 273.230113423676 -43.7704928862763, 273.230113423676 -44.08313926403542, 274.101197738523 -44.08313926403542, 274.101197738523 -44.39578564179453, 274.6819206150877 -44.39578564179453, 274.6819206150877 -44.70843201955365, 275.26264349165234 -44.70843201955365, 275.26264349165234 -45.02107839731276, 276.13372780649934 -45.02107839731276, 276.13372780649934 -45.33372477507188, 280.4891493807343 -45.33372477507188, 280.4891493807343 -45.646371152830994, 283.10240232527536 -45.646371152830994, 283.10240232527536 -45.95901753059011, 285.71565526981635 -45.95901753059011, 285.71565526981635 -46.271663908349225, 288.32890821435734 -46.271663908349225, 288.32890821435734 -45.95901753059011, 288.909631090922 -45.95901753059011, 288.909631090922 -45.646371152830994, 289.49035396748667 -45.646371152830994, 289.49035396748667 -45.33372477507188, 290.07107684405133 -45.33372477507188, 290.07107684405133 -45.02107839731276, 290.651799720616 -45.02107839731276, 290.651799720616 -44.70843201955365, 291.23252259718066 -44.70843201955365, 291.23252259718066 -44.39578564179453, 292.10360691202766 -44.39578564179453, 292.10360691202766 -44.08313926403542, 292.6843297885924 -44.08313926403542, 292.6843297885924 -43.7704928862763, 293.5554141034394 -43.7704928862763, 293.5554141034394 -43.45784650851718, 294.13613698000404 -43.45784650851718, 294.13613698000404 -43.14520013075806, 295.00722129485104 -43.14520013075806, 295.00722129485104 -42.83255375299895, 295.5879441714157 -42.83255375299895, 295.5879441714157 -42.51990737523983, 296.4590284862627 -42.51990737523983, 296.4590284862627 -42.20726099748072, 297.3301128011097 -42.20726099748072))MULTILINESTRING ((297.3301128011097 -109.73887859344985, 296.4590284862627 -109.73887859344985, 296.4590284862627 -109.42623221569075, 295.29758273313337 -109.42623221569075, 295.29758273313337 -109.11358583793162, 294.13613698000404 -109.11358583793162, 294.13613698000404 -108.80093946017251, 292.6843297885924 -108.80093946017251, 292.6843297885924 -108.48829308241339, 291.23252259718066 -108.48829308241339, 291.23252259718066 -108.17564670465428, 289.780715405769 -108.17564670465428, 289.780715405769 -107.86300032689516, 288.038546776075 -107.86300032689516, 288.038546776075 -107.55035394913605, 287.45782389951034 -107.55035394913605, 287.45782389951034 -107.86300032689516, 286.8771010229457 -107.86300032689516, 286.8771010229457 -108.17564670465428, 286.0060167080987 -108.17564670465428, 286.0060167080987 -108.48829308241339, 285.1349323932517 -108.48829308241339, 285.1349323932517 -108.80093946017251, 284.554209516687 -108.80093946017251, 284.554209516687 -109.11358583793162, 283.97348664012236 -109.11358583793162, 283.97348664012236 -109.42623221569075, 283.10240232527536 -109.42623221569075, 283.10240232527536 -109.73887859344985, 282.5216794487107 -109.73887859344985, 282.5216794487107 -110.05152497120898, 281.940956572146 -110.05152497120898, 281.940956572146 -110.3641713489681, 281.3602336955813 -110.3641713489681, 281.3602336955813 -110.67681772672721, 280.77951081901665 -110.67681772672721, 280.77951081901665 -110.98946410448633, 279.90842650416965 -110.98946410448633, 279.90842650416965 -111.30211048224544, 279.327703627605 -111.30211048224544, 279.327703627605 -111.61475686000456, 278.7469807510403 -111.61475686000456, 278.7469807510403 -111.92740323776367, 278.16625787447566 -111.92740323776367, 278.16625787447566 -112.24004961552279, 277.585534997911 -112.24004961552279, 277.585534997911 -112.5526959932819, 276.714450683064 -112.5526959932819, 276.714450683064 -112.86534237104102, 274.97228205337 -112.86534237104102, 274.97228205337 -112.5526959932819, 272.64939054711135 -112.5526959932819, 272.64939054711135 -112.24004961552279, 270.0361376025703 -112.24004961552279, 270.0361376025703 -111.92740323776367, 265.97107746661766 -111.92740323776367, 265.97107746661766 -111.61475686000456, 263.648185960359 -111.61475686000456, 263.648185960359 -111.30211048224544, 262.19637876894734 -111.30211048224544, 262.19637876894734 -110.98946410448633, 261.03493301581796 -110.98946410448633, 261.03493301581796 -110.67681772672721, 259.8734872626886 -110.67681772672721, 259.8734872626886 -110.3641713489681, 259.00240294784163 -110.3641713489681, 259.00240294784163 -110.05152497120898, 258.13131863299463 -110.05152497120898, 258.13131863299463 -109.73887859344985, 257.26023431814764 -109.73887859344985, 257.26023431814764 -109.42623221569075, 256.38915000330064 -109.42623221569075, 256.38915000330064 -109.11358583793162, 255.51806568845365 -109.11358583793162, 255.51806568845365 -108.80093946017251, 254.93734281188898 -108.80093946017251, 254.93734281188898 -108.48829308241339, 254.06625849704199 -108.48829308241339, 254.06625849704199 -108.17564670465428, 253.77589705875965 -108.17564670465428, 253.77589705875965 -108.48829308241339, 253.4855356204773 -108.48829308241339, 253.4855356204773 -109.73887859344985, 253.19517418219496 -109.73887859344985, 253.19517418219496 -111.30211048224544, 252.90481274391263 -111.30211048224544, 252.90481274391263 -112.86534237104102, 252.6144513056303 -112.86534237104102, 252.6144513056303 -115.05386701535484, 252.32408986734796 -115.05386701535484, 252.32408986734796 -117.86768441518689, 252.03372842906563 -117.86768441518689, 252.03372842906563 -122.24473370381452, 251.7433669907833 -122.24473370381452, 251.7433669907833 -131.93677141434713), 
+  (234.61204213212562 -116.61709890415042, 234.61204213212562 -114.74122063759572, 234.3216806938433 -114.74122063759572, 234.3216806938433 -112.5526959932819, 234.03131925556096 -112.5526959932819, 234.03131925556096 -110.67681772672721, 233.74095781727863 -110.67681772672721, 233.74095781727863 -109.42623221569075, 233.4505963789963 -109.42623221569075, 233.4505963789963 -108.17564670465428, 233.16023494071393 -108.17564670465428, 233.16023494071393 -107.23770757137693, 232.8698735024316 -107.23770757137693, 232.8698735024316 -106.29976843809958, 232.57951206414927 -106.29976843809958, 232.57951206414927 -105.36182930482224, 232.28915062586694 -105.36182930482224, 232.28915062586694 -104.42389017154488, 231.9987891875846 -104.42389017154488, 231.9987891875846 -103.79859741602665, 231.70842774930227 -103.79859741602665, 231.70842774930227 -103.17330466050842, 231.41806631101994 -103.17330466050842, 231.41806631101994 -102.54801190499018, 231.1277048727376 -102.54801190499018, 231.1277048727376 -102.23536552723107, 230.54698199617295 -102.23536552723107, 230.54698199617295 -101.92271914947194, 229.96625911960828 -101.92271914947194, 229.96625911960828 -101.61007277171284, 229.09517480476129 -101.61007277171284, 229.09517480476129 -101.29742639395371, 228.51445192819662 -101.29742639395371, 228.51445192819662 -100.9847800161946, 227.93372905163193 -100.9847800161946, 227.93372905163193 -100.67213363843548, 227.06264473678493 -100.67213363843548, 227.06264473678493 -100.35948726067637, 226.48192186022027 -100.35948726067637, 226.48192186022027 -100.04684088291725, 225.61083754537327 -100.04684088291725, 225.61083754537327 -99.73419450515813, 225.0301146688086 -99.73419450515813, 225.0301146688086 -99.42154812739902, 224.1590303539616 -99.42154812739902, 224.1590303539616 -99.1089017496399, 223.28794603911462 -99.1089017496399, 223.28794603911462 -98.79625537188079, 222.4168617242676 -98.79625537188079, 222.4168617242676 -98.48360899412167, 221.83613884770293 -98.48360899412167, 221.83613884770293 -98.17096261636256, 220.96505453285593 -98.17096261636256, 220.96505453285593 -97.85831623860344, 219.8036087797266 -97.85831623860344, 219.8036087797266 -97.54566986084433, 219.51324734144427 -97.54566986084433))MULTILINESTRING ((189.6060191983639 -91.91803506118022, 185.54095906241122 -91.91803506118022, 185.54095906241122 -91.60538868342111, 183.5084289944349 -91.60538868342111, 183.5084289944349 -91.29274230566199, 182.05662180302323 -91.29274230566199, 182.05662180302323 -91.60538868342111, 180.02409173504688 -91.60538868342111, 180.02409173504688 -91.91803506118022, 178.86264598191755 -91.91803506118022, 178.86264598191755 -92.23068143893934, 177.99156166707056 -92.23068143893934, 177.99156166707056 -92.54332781669845, 177.70120022878822 -92.54332781669845, 177.70120022878822 -92.85597419445757, 177.12047735222356 -92.85597419445757, 177.12047735222356 -93.1686205722167, 176.53975447565887 -93.1686205722167, 176.53975447565887 -93.4812669499758, 175.9590315990942 -93.4812669499758, 175.9590315990942 -93.79391332773493, 175.37830872252954 -93.79391332773493, 175.37830872252954 -94.10655970549404, 175.0879472842472 -94.10655970549404, 175.0879472842472 -94.41920608325316, 174.50722440768254 -94.41920608325316, 174.50722440768254 -94.73185246101227, 173.63614009283555 -94.73185246101227, 173.63614009283555 -95.04449883877139, 172.76505577798855 -95.04449883877139, 172.76505577798855 -95.35714521653051, 171.89397146314155 -95.35714521653051, 171.89397146314155 -95.66979159428962, 171.02288714829453 -95.66979159428962, 171.02288714829453 -95.98243797204874, 169.8614413951652 -95.98243797204874, 169.8614413951652 -96.29508434980785, 168.9903570803182 -96.29508434980785, 168.9903570803182 -96.60773072756697, 168.1192727654712 -96.60773072756697, 168.1192727654712 -96.92037710532608, 167.2481884506242 -96.92037710532608, 167.2481884506242 -97.2330234830852, 166.08674269749486 -97.2330234830852, 166.08674269749486 -97.54566986084433, 165.21565838264786 -97.54566986084433, 165.21565838264786 -97.85831623860344, 164.34457406780086 -97.85831623860344, 164.34457406780086 -98.17096261636256, 163.18312831467154 -98.17096261636256, 163.18312831467154 -98.48360899412167, 162.31204399982454 -98.48360899412167, 162.31204399982454 -98.79625537188079, 161.4409596849775 -98.79625537188079, 161.4409596849775 -99.1089017496399, 160.56987537013052 -99.1089017496399, 160.56987537013052 -99.42154812739902, 159.69879105528352 -99.42154812739902, 159.69879105528352 -99.73419450515813, 158.82770674043653 -99.73419450515813, 158.82770674043653 -100.04684088291725, 157.95662242558953 -100.04684088291725, 157.95662242558953 -100.35948726067637, 157.08553811074253 -100.35948726067637, 157.08553811074253 -100.67213363843548, 156.2144537958955 -100.67213363843548, 156.2144537958955 -100.9847800161946, 155.05300804276618 -100.9847800161946, 155.05300804276618 -101.29742639395371, 154.18192372791918 -101.29742639395371, 154.18192372791918 -101.61007277171284, 153.02047797478986 -101.61007277171284, 153.02047797478986 -101.92271914947194, 152.14939365994286 -101.92271914947194, 152.14939365994286 -102.23536552723107, 151.27830934509586 -102.23536552723107, 151.27830934509586 -102.54801190499018, 150.69758646853117 -102.54801190499018, 150.69758646853117 -102.8606582827493, 150.1168635919665 -102.8606582827493, 150.1168635919665 -103.17330466050842, 149.53614071540184 -103.17330466050842, 149.53614071540184 -103.48595103826753, 148.95541783883718 -103.48595103826753, 148.95541783883718 -103.79859741602665, 148.3746949622725 -103.79859741602665, 148.3746949622725 -104.11124379378576, 147.50361064742552 -104.11124379378576, 147.50361064742552 -104.42389017154488, 146.92288777086085 -104.42389017154488, 146.92288777086085 -104.73653654930399, 146.3421648942962 -104.73653654930399, 146.3421648942962 -105.04918292706311, 145.7614420177315 -105.04918292706311, 145.7614420177315 -105.36182930482224, 145.18071914116683 -105.36182930482224, 145.18071914116683 -105.67447568258135, 144.59999626460217 -105.67447568258135, 144.59999626460217 -105.98712206034047, 144.0192733880375 -105.98712206034047, 144.0192733880375 -106.29976843809958, 143.43855051147284 -106.29976843809958, 143.43855051147284 -106.6124148158587, 142.85782763490818 -106.6124148158587, 142.85782763490818 -106.92506119361781, 142.2771047583435 -106.92506119361781, 142.2771047583435 -107.23770757137693, 141.69638188177885 -107.23770757137693, 141.69638188177885 -107.55035394913605, 141.11565900521418 -107.55035394913605, 141.11565900521418 -107.86300032689516, 140.5349361286495 -107.86300032689516, 140.5349361286495 -108.17564670465428, 139.95421325208483 -108.17564670465428, 139.95421325208483 -108.48829308241339, 139.6638518138025 -108.48829308241339, 139.6638518138025 -108.80093946017251, 139.08312893723783 -108.80093946017251, 139.08312893723783 -109.11358583793162, 138.7927674989555 -109.11358583793162, 138.7927674989555 -109.42623221569075, 138.21204462239083 -109.42623221569075, 138.21204462239083 -109.73887859344985, 137.9216831841085 -109.73887859344985, 137.9216831841085 -110.05152497120898, 137.34096030754384 -110.05152497120898, 137.34096030754384 -110.3641713489681, 137.0505988692615 -110.3641713489681, 137.0505988692615 -110.67681772672721, 136.76023743097917 -110.67681772672721, 136.76023743097917 -110.98946410448633, 136.1795145544145 -110.98946410448633, 136.1795145544145 -111.30211048224544, 135.88915311613218 -111.30211048224544, 135.88915311613218 -111.61475686000456, 135.59879167784982 -111.61475686000456, 135.59879167784982 -111.92740323776367, 135.01806880128515 -111.92740323776367, 135.01806880128515 -112.24004961552279, 134.72770736300282 -112.24004961552279, 134.72770736300282 -112.5526959932819, 134.4373459247205 -112.5526959932819, 134.4373459247205 -112.86534237104102, 134.14698448643816 -112.86534237104102, 134.14698448643816 -113.17798874880015, 133.85662304815583 -113.17798874880015, 133.85662304815583 -113.49063512655925, 133.5662616098735 -113.49063512655925, 133.5662616098735 -113.80328150431838, 133.27590017159116 -113.80328150431838, 133.27590017159116 -114.11592788207749, 132.98553873330883 -114.11592788207749, 132.98553873330883 -114.42857425983661, 132.6951772950265 -114.42857425983661, 132.6951772950265 -114.74122063759572, 132.40481585674416 -114.74122063759572, 132.40481585674416 -115.05386701535484, 132.11445441846183 -115.05386701535484, 132.11445441846183 -115.36651339311396, 131.8240929801795 -115.36651339311396, 131.8240929801795 -115.67915977087307, 131.53373154189717 -115.67915977087307, 131.53373154189717 -115.9918061486322, 131.24337010361484 -115.9918061486322, 131.24337010361484 -116.3044525263913, 130.9530086653325 -116.3044525263913, 130.9530086653325 -116.92974528190953, 130.66264722705014 -116.92974528190953, 130.66264722705014 -117.24239165966866, 130.3722857887678 -117.24239165966866, 130.3722857887678 -117.55503803742778, 130.08192435048548 -117.55503803742778, 130.08192435048548 -118.18033079294601, 129.79156291220315 -118.18033079294601, 129.79156291220315 -118.49297717070512, 129.50120147392082 -118.49297717070512, 129.50120147392082 -119.11826992622335, 129.21084003563848 -119.11826992622335, 129.21084003563848 -119.43091630398247, 128.92047859735615 -119.43091630398247, 128.92047859735615 -120.0562090595007, 128.3397557207915 -120.0562090595007, 128.3397557207915 -120.36885543725982, 128.04939428250916 -120.36885543725982, 128.04939428250916 -120.68150181501893, 127.75903284422682 -120.68150181501893, 127.75903284422682 -120.99414819277806, 127.46867140594449 -120.99414819277806, 127.46867140594449 -121.30679457053716, 127.17830996766216 -121.30679457053716, 127.17830996766216 -121.61944094829629, 126.88794852937983 -121.61944094829629, 126.88794852937983 -121.9320873260554, 126.59758709109748 -121.9320873260554, 126.59758709109748 -122.24473370381452, 126.30722565281515 -122.24473370381452, 126.30722565281515 -122.55738008157363, 126.01686421453282 -122.55738008157363, 126.01686421453282 -122.87002645933275, 125.72650277625048 -122.87002645933275, 125.72650277625048 -123.18267283709187, 125.43614133796815 -123.18267283709187, 125.43614133796815 -123.8079655926101, 125.14577989968582 -123.8079655926101, 125.14577989968582 -124.12061197036921, 124.85541846140349 -124.12061197036921, 124.85541846140349 -124.74590472588744, 124.56505702312116 -124.74590472588744, 124.56505702312116 -125.05855110364656, 124.27469558483881 -125.05855110364656, 124.27469558483881 -125.6838438591648, 123.98433414655648 -125.6838438591648, 123.98433414655648 -126.30913661468303, 123.69397270827415 -126.30913661468303, 123.69397270827415 -127.24707574796038, 123.40361126999181 -127.24707574796038, 123.40361126999181 -128.18501488123772, 123.11324983170948 -128.18501488123772, 123.11324983170948 -129.12295401451507, 122.82288839342715 -129.12295401451507, 122.82288839342715 -130.68618590331067, 122.53252695514482 -130.68618590331067, 122.53252695514482 -133.1873569253836, 122.24216551686249 -133.1873569253836, 122.24216551686249 -139.1276381028068, 122.53252695514482 -139.1276381028068, 122.53252695514482 -142.56674825815708, 122.82288839342715 -142.56674825815708, 122.82288839342715 -145.06791928023, 123.11324983170948 -145.06791928023, 123.11324983170948 -147.25644392454382, 123.40361126999181 -147.25644392454382, 123.40361126999181 -149.44496856885763, 123.69397270827415 -149.44496856885763, 123.69397270827415 -151.32084683541234, 123.98433414655648 -151.32084683541234, 123.98433414655648 -152.88407872420794, 124.27469558483881 -152.88407872420794, 124.27469558483881 -154.75995699076262, 124.56505702312116 -154.75995699076262, 124.56505702312116 -156.32318887955822, 124.85541846140349 -156.32318887955822, 124.85541846140349 -158.1990671461129, 125.14577989968582 -158.1990671461129, 125.14577989968582 -159.7622990349085, 125.43614133796815 -159.7622990349085, 125.43614133796815 -161.32553092370406, 125.72650277625048 -161.32553092370406, 125.72650277625048 -163.51405556801788, 126.01686421453282 -163.51405556801788, 126.01686421453282 -165.7025802123317, 126.30722565281515 -165.7025802123317, 126.30722565281515 -167.5784584788864, 126.59758709109748 -167.5784584788864, 126.59758709109748 -168.20375123440462), 
+  (297.3301128011097 -90.66744955014376, 297.03975136282736 -90.66744955014376, 297.03975136282736 -90.98009592790288, 295.5879441714157 -90.98009592790288, 295.5879441714157 -91.29274230566199, 293.8457755417217 -91.29274230566199, 293.8457755417217 -91.60538868342111, 292.39396835031005 -91.60538868342111, 292.39396835031005 -91.91803506118022, 290.651799720616 -91.91803506118022, 290.651799720616 -92.23068143893934, 288.6192696526397 -92.23068143893934, 288.6192696526397 -92.54332781669845, 286.8771010229457 -92.54332781669845, 286.8771010229457 -92.85597419445757, 285.425293831534 -92.85597419445757, 285.425293831534 -93.1686205722167, 284.2638480784047 -93.1686205722167, 284.2638480784047 -93.4812669499758, 282.81204088699303 -93.4812669499758, 282.81204088699303 -93.79391332773493, 281.65059513386365 -93.79391332773493, 281.65059513386365 -94.10655970549404, 280.198787942452 -94.10655970549404, 280.198787942452 -94.41920608325316, 279.327703627605 -94.41920608325316, 279.327703627605 -94.73185246101227, 278.16625787447566 -94.73185246101227, 278.16625787447566 -95.04449883877139, 277.00481212134633 -95.04449883877139, 277.00481212134633 -95.35714521653051, 275.5530049299347 -95.35714521653051, 275.5530049299347 -95.04449883877139, 274.39155917680534 -95.04449883877139, 274.39155917680534 -94.73185246101227, 273.230113423676 -94.73185246101227, 273.230113423676 -94.41920608325316, 272.0686676705467 -94.41920608325316, 272.0686676705467 -94.10655970549404, 270.61686047913497 -94.10655970549404, 270.61686047913497 -93.79391332773493, 269.45541472600564 -93.79391332773493, 269.45541472600564 -93.4812669499758, 268.003607534594 -93.4812669499758, 268.003607534594 -93.1686205722167, 266.5518003431823 -93.1686205722167, 266.5518003431823 -92.85597419445757, 264.80963171348833 -92.85597419445757, 264.80963171348833 -92.54332781669845, 263.93854739864133 -92.54332781669845, 263.93854739864133 -92.23068143893934, 263.06746308379434 -92.23068143893934, 263.06746308379434 -91.91803506118022, 261.906017330665 -91.91803506118022, 261.906017330665 -91.60538868342111, 261.03493301581796 -91.60538868342111, 261.03493301581796 -91.29274230566199, 260.16384870097096 -91.29274230566199, 260.16384870097096 -90.98009592790288, 259.29276438612396 -90.98009592790288, 259.29276438612396 -90.66744955014376, 258.42168007127697 -90.66744955014376, 258.42168007127697 -90.35480317238465, 257.26023431814764 -90.35480317238465, 257.26023431814764 -90.04215679462553, 256.38915000330064 -90.04215679462553, 256.38915000330064 -89.7295104168664, 255.51806568845365 -89.7295104168664, 255.51806568845365 -89.4168640391073, 254.64698137360665 -89.4168640391073, 254.64698137360665 -89.10421766134817, 253.19517418219496 -89.10421766134817, 253.19517418219496 -89.4168640391073, 252.90481274391263 -89.4168640391073, 252.90481274391263 -89.7295104168664, 252.6144513056303 -89.7295104168664, 252.6144513056303 -90.04215679462553, 252.32408986734796 -90.04215679462553, 252.32408986734796 -90.35480317238465, 251.7433669907833 -90.35480317238465, 251.7433669907833 -90.66744955014376, 251.45300555250097 -90.66744955014376, 251.45300555250097 -90.98009592790288, 251.16264411421864 -90.98009592790288, 251.16264411421864 -91.29274230566199, 250.8722826759363 -91.29274230566199, 250.8722826759363 -91.60538868342111, 250.29155979937164 -91.60538868342111, 250.29155979937164 -91.91803506118022, 250.0011983610893 -91.91803506118022, 250.0011983610893 -92.23068143893934, 249.71083692280698 -92.23068143893934, 249.71083692280698 -92.54332781669845, 249.1301140462423 -92.54332781669845, 249.1301140462423 -92.85597419445757, 248.83975260795998 -92.85597419445757, 248.83975260795998 -93.1686205722167, 248.2590297313953 -93.1686205722167, 248.2590297313953 -93.4812669499758, 247.67830685483062 -93.4812669499758, 247.67830685483062 -93.79391332773493, 247.3879454165483 -93.79391332773493, 247.3879454165483 -94.10655970549404, 246.80722253998363 -94.10655970549404, 246.80722253998363 -94.41920608325316, 245.93613822513663 -94.41920608325316, 245.93613822513663 -94.73185246101227, 244.7746924720073 -94.73185246101227, 244.7746924720073 -95.04449883877139, 242.74216240403095 -95.04449883877139, 242.74216240403095 -94.73185246101227, 242.16143952746629 -94.73185246101227, 242.16143952746629 -94.41920608325316, 241.87107808918395 -94.41920608325316, 241.87107808918395 -93.79391332773493, 241.58071665090162 -93.79391332773493, 241.58071665090162 -93.4812669499758, 241.2903552126193 -93.4812669499758, 241.2903552126193 -93.1686205722167, 240.99999377433696 -93.1686205722167, 240.99999377433696 -92.85597419445757, 240.70963233605463 -92.85597419445757, 240.70963233605463 -92.54332781669845, 240.4192708977723 -92.54332781669845, 240.4192708977723 -91.91803506118022, 240.12890945948996 -91.91803506118022, 240.12890945948996 -91.60538868342111, 239.83854802120763 -91.60538868342111, 239.83854802120763 -91.29274230566199, 239.5481865829253 -91.29274230566199, 239.5481865829253 -90.98009592790288, 239.25782514464296 -90.98009592790288, 239.25782514464296 -90.66744955014376, 238.96746370636063 -90.66744955014376, 238.96746370636063 -90.35480317238465, 238.6771022680783 -90.35480317238465, 238.6771022680783 -90.04215679462553, 238.0963793915136 -90.04215679462553, 238.0963793915136 -89.7295104168664, 237.80601795323128 -89.7295104168664, 237.80601795323128 -89.4168640391073, 237.51565651494894 -89.4168640391073, 237.51565651494894 -89.10421766134817, 237.2252950766666 -89.10421766134817, 237.2252950766666 -88.79157128358906, 236.93493363838428 -88.79157128358906, 236.93493363838428 -88.47892490582994, 236.35421076181962 -88.47892490582994, 236.35421076181962 -88.16627852807083, 236.06384932353728 -88.16627852807083, 236.06384932353728 -87.85363215031171, 235.77348788525495 -87.85363215031171, 235.77348788525495 -87.5409857725526, 235.1927650086903 -87.5409857725526, 235.1927650086903 -87.22833939479348, 234.90240357040796 -87.22833939479348, 234.90240357040796 -86.91569301703436, 234.3216806938433 -86.91569301703436, 234.3216806938433 -86.60304663927525, 233.74095781727863 -86.60304663927525, 233.74095781727863 -86.29040026151613, 233.4505963789963 -86.29040026151613, 233.4505963789963 -85.97775388375702, 232.8698735024316 -85.97775388375702, 232.8698735024316 -85.6651075059979, 232.28915062586694 -85.6651075059979, 232.28915062586694 -85.35246112823879, 231.70842774930227 -85.35246112823879, 231.70842774930227 -85.03981475047966, 230.83734343445528 -85.03981475047966, 230.83734343445528 -84.72716837272054, 229.67589768132595 -84.72716837272054, 229.67589768132595 -84.41452199496143, 228.51445192819662 -84.41452199496143, 228.51445192819662 -84.10187561720231, 227.35300617506726 -84.10187561720231, 227.35300617506726 -83.7892292394432, 226.19156042193794 -83.7892292394432, 226.19156042193794 -83.47658286168408, 224.73975323052628 -83.47658286168408, 224.73975323052628 -83.16393648392497, 223.57830747739695 -83.16393648392497, 223.57830747739695 -82.85129010616585, 222.12650028598526 -82.85129010616585, 222.12650028598526 -82.53864372840673, 220.6746930945736 -82.53864372840673, 220.6746930945736 -82.22599735064762, 219.51324734144427 -82.22599735064762, 219.51324734144427 -82.53864372840673, 219.22288590316194 -82.53864372840673, 219.22288590316194 -82.85129010616585, 218.9325244648796 -82.85129010616585, 218.9325244648796 -83.16393648392497, 218.64216302659727 -83.16393648392497, 218.64216302659727 -83.47658286168408, 218.35180158831494 -83.47658286168408, 218.35180158831494 -83.7892292394432, 218.0614401500326 -83.7892292394432, 218.0614401500326 -84.10187561720231, 217.77107871175025 -84.10187561720231, 217.77107871175025 -84.41452199496143, 217.48071727346792 -84.41452199496143, 217.48071727346792 -85.03981475047966, 217.19035583518558 -85.03981475047966, 217.19035583518558 -85.35246112823879))MULTILINESTRING ((106.56264784961647 -229.16979489743233, 106.56264784961647 -224.48009923104559, 106.27228641133412 -224.48009923104559, 106.27228641133412 -224.16745285328648, 105.98192497305179 -224.16745285328648, 105.98192497305179 -230.10773403070968), 
+  (72.29999813230108 -86.91569301703436, 69.68674518776008 -86.91569301703436, 69.68674518776008 -86.60304663927525, 67.07349224321908 -86.60304663927525, 67.07349224321908 -86.29040026151613, 64.46023929867808 -86.29040026151613, 64.46023929867808 -85.97775388375702, 62.137347792419405 -85.97775388375702, 62.137347792419405 -85.6651075059979, 60.395179162725405 -85.6651075059979, 60.395179162725405 -85.35246112823879, 58.653010533031406 -85.35246112823879, 58.653010533031406 -85.03981475047966, 57.49156477990207 -85.03981475047966, 57.49156477990207 -84.72716837272054, 56.0397575884904 -84.72716837272054, 56.0397575884904 -84.41452199496143, 54.87831183536107 -84.41452199496143, 54.87831183536107 -84.10187561720231, 53.71686608223173 -84.10187561720231, 53.71686608223173 -83.7892292394432, 52.84578176738473 -83.7892292394432, 52.84578176738473 -83.47658286168408, 51.68433601425539 -83.47658286168408, 51.68433601425539 -83.16393648392497, 50.8132516994084 -83.16393648392497, 50.8132516994084 -82.85129010616585, 49.942167384561394 -82.85129010616585, 49.942167384561394 -82.53864372840673, 48.78072163143206 -82.53864372840673, 48.78072163143206 -82.22599735064762, 47.61927587830272 -82.22599735064762, 47.61927587830272 -81.9133509728885, 46.45783012517339 -81.9133509728885, 46.45783012517339 -81.60070459512939, 45.29638437204405 -81.60070459512939, 45.29638437204405 -81.28805821737026, 44.13493861891472 -81.28805821737026, 44.13493861891472 -80.97541183961116, 42.97349286578539 -80.97541183961116, 42.97349286578539 -80.66276546185203, 42.102408550938385 -80.66276546185203, 42.102408550938385 -80.35011908409292, 40.94096279780905 -80.35011908409292, 40.94096279780905 -80.0374727063338, 40.06987848296205 -80.0374727063338, 40.06987848296205 -79.72482632857468, 38.90843272983271 -79.72482632857468, 38.90843272983271 -79.41217995081557, 37.746986976703376 -79.41217995081557, 37.746986976703376 -79.09953357305645, 35.714456908727044 -79.09953357305645, 35.714456908727044 -78.78688719529734, 33.39156540246837 -78.78688719529734, 33.39156540246837 -78.47424081753822, 30.77831245792737 -78.47424081753822, 30.77831245792737 -78.16159443977911, 25.551806568845365 -78.16159443977911, 25.551806568845365 -78.47424081753822, 24.39036081571603 -78.47424081753822, 24.39036081571603 -78.78688719529734, 23.228915062586694 -78.78688719529734, 23.228915062586694 -79.09953357305645, 22.357830747739694 -79.09953357305645, 22.357830747739694 -79.41217995081557, 21.486746432892694 -79.41217995081557, 21.486746432892694 -79.72482632857468, 20.61566211804569 -79.72482632857468, 20.61566211804569 -80.0374727063338, 19.74457780319869 -80.0374727063338), 
+  (297.3301128011097 -80.66276546185203, 296.4590284862627 -80.66276546185203, 296.4590284862627 -80.97541183961116, 295.5879441714157 -80.97541183961116, 295.5879441714157 -81.28805821737026, 294.42649841828637 -81.28805821737026, 294.42649841828637 -81.60070459512939, 293.26505266515704 -81.60070459512939, 293.26505266515704 -81.9133509728885, 292.10360691202766 -81.9133509728885, 292.10360691202766 -82.22599735064762, 290.94216115889833 -82.22599735064762, 290.94216115889833 -82.53864372840673, 290.07107684405133 -82.53864372840673, 290.07107684405133 -82.85129010616585, 288.909631090922 -82.85129010616585, 288.909631090922 -83.16393648392497, 287.45782389951034 -83.16393648392497, 287.45782389951034 -83.47658286168408, 284.84457095496936 -83.47658286168408, 284.84457095496936 -83.7892292394432, 282.5216794487107 -83.7892292394432, 282.5216794487107 -84.10187561720231, 280.4891493807343 -84.10187561720231, 280.4891493807343 -84.41452199496143, 278.7469807510403 -84.41452199496143, 278.7469807510403 -84.72716837272054, 277.00481212134633 -84.72716837272054, 277.00481212134633 -85.03981475047966, 275.843366368217 -85.03981475047966, 275.843366368217 -84.72716837272054, 274.6819206150877 -84.72716837272054, 274.6819206150877 -84.41452199496143, 273.52047486195835 -84.41452199496143, 273.52047486195835 -84.10187561720231, 272.359029108829 -84.10187561720231, 272.359029108829 -83.7892292394432, 270.9072219174173 -83.7892292394432, 270.9072219174173 -83.47658286168408, 269.45541472600564 -83.47658286168408, 269.45541472600564 -83.16393648392497, 268.003607534594 -83.16393648392497, 268.003607534594 -82.85129010616585, 266.5518003431823 -82.85129010616585, 266.5518003431823 -82.53864372840673, 265.09999315177066 -82.53864372840673, 265.09999315177066 -82.22599735064762, 263.93854739864133 -82.22599735064762, 263.93854739864133 -81.9133509728885, 262.777101645512 -81.9133509728885, 262.777101645512 -81.60070459512939, 261.6156558923827 -81.60070459512939, 261.6156558923827 -81.28805821737026, 260.4542101392533 -81.28805821737026, 260.4542101392533 -80.97541183961116, 259.29276438612396 -80.97541183961116, 259.29276438612396 -80.66276546185203, 258.13131863299463 -80.66276546185203, 258.13131863299463 -80.35011908409292, 256.9698728798653 -80.35011908409292, 256.9698728798653 -80.0374727063338, 255.80842712673598 -80.0374727063338, 255.80842712673598 -79.72482632857468, 254.64698137360665 -79.72482632857468, 254.64698137360665 -79.41217995081557, 252.6144513056303 -79.41217995081557, 252.6144513056303 -79.72482632857468, 251.45300555250097 -79.72482632857468, 251.45300555250097 -80.0374727063338, 250.0011983610893 -80.0374727063338, 250.0011983610893 -80.35011908409292, 247.67830685483062 -80.35011908409292, 247.67830685483062 -80.66276546185203, 244.7746924720073 -80.66276546185203, 244.7746924720073 -80.35011908409292, 242.45180096574862 -80.35011908409292, 242.45180096574862 -80.0374727063338, 241.87107808918395 -80.0374727063338, 241.87107808918395 -79.72482632857468, 241.2903552126193 -79.72482632857468, 241.2903552126193 -79.41217995081557, 240.4192708977723 -79.41217995081557, 240.4192708977723 -79.09953357305645, 239.83854802120763 -79.09953357305645, 239.83854802120763 -78.78688719529734, 238.96746370636063 -78.78688719529734, 238.96746370636063 -78.47424081753822, 238.0963793915136 -78.47424081753822, 238.0963793915136 -78.16159443977911, 237.2252950766666 -78.16159443977911, 237.2252950766666 -77.84894806201999, 236.35421076181962 -77.84894806201999, 236.35421076181962 -77.53630168426088, 235.48312644697262 -77.53630168426088, 235.48312644697262 -77.22365530650175, 234.3216806938433 -77.22365530650175, 234.3216806938433 -76.91100892874263, 233.16023494071393 -76.91100892874263, 233.16023494071393 -76.59836255098352, 231.9987891875846 -76.59836255098352, 231.9987891875846 -76.2857161732244, 230.54698199617295 -76.2857161732244, 230.54698199617295 -75.97306979546529, 229.38553624304362 -75.97306979546529, 229.38553624304362 -75.66042341770617, 227.93372905163193 -75.66042341770617, 227.93372905163193 -75.34777703994706, 226.48192186022027 -75.34777703994706, 226.48192186022027 -75.03513066218794, 225.0301146688086 -75.03513066218794, 225.0301146688086 -74.72248428442882, 223.57830747739695 -74.72248428442882, 223.57830747739695 -74.40983790666971, 221.83613884770293 -74.40983790666971, 221.83613884770293 -74.09719152891059, 220.09397021800893 -74.09719152891059, 220.09397021800893 -73.78454515115148, 217.48071727346792 -73.78454515115148, 217.48071727346792 -74.09719152891059, 211.67348850782125 -74.09719152891059, 211.67348850782125 -74.40983790666971, 204.99517542732758 -74.40983790666971, 204.99517542732758 -74.72248428442882, 198.60722378511625 -74.72248428442882, 198.60722378511625 -74.40983790666971, 196.86505515542223 -74.40983790666971, 196.86505515542223 -74.72248428442882, 195.7036094022929 -74.72248428442882, 195.7036094022929 -75.03513066218794, 194.8325250874459 -75.03513066218794, 194.8325250874459 -75.34777703994706, 193.67107933431657 -75.34777703994706, 193.67107933431657 -75.66042341770617, 192.79999501946958 -75.66042341770617, 192.79999501946958 -75.97306979546529, 191.63854926634022 -75.97306979546529, 191.63854926634022 -76.2857161732244, 190.76746495149322 -76.2857161732244, 190.76746495149322 -76.59836255098352, 189.6060191983639 -76.59836255098352, 189.6060191983639 -76.91100892874263, 188.7349348835169 -76.91100892874263, 188.7349348835169 -77.22365530650175, 187.57348913038757 -77.22365530650175, 187.57348913038757 -77.53630168426088, 186.70240481554055 -77.53630168426088, 186.70240481554055 -77.84894806201999, 185.54095906241122 -77.84894806201999, 185.54095906241122 -78.16159443977911, 184.3795133092819 -78.16159443977911, 184.3795133092819 -78.47424081753822, 183.5084289944349 -78.47424081753822, 183.5084289944349 -78.78688719529734, 182.34698324130557 -78.78688719529734, 182.34698324130557 -79.09953357305645, 181.47589892645854 -79.09953357305645, 181.47589892645854 -79.41217995081557, 180.60481461161154 -79.41217995081557, 180.60481461161154 -79.72482632857468, 179.44336885848222 -79.72482632857468, 179.44336885848222 -80.0374727063338, 178.57228454363522 -80.0374727063338, 178.57228454363522 -80.35011908409292, 177.99156166707056 -80.35011908409292, 177.99156166707056 -80.66276546185203, 177.12047735222356 -80.66276546185203, 177.12047735222356 -80.97541183961116, 176.53975447565887 -80.97541183961116, 176.53975447565887 -81.28805821737026, 175.66867016081187 -81.28805821737026, 175.66867016081187 -81.60070459512939, 175.0879472842472 -81.60070459512939, 175.0879472842472 -81.9133509728885, 174.50722440768254 -81.9133509728885, 174.50722440768254 -82.22599735064762, 173.05541721627088 -82.22599735064762, 173.05541721627088 -82.53864372840673, 171.31324858657686 -82.53864372840673, 171.31324858657686 -82.85129010616585, 169.8614413951652 -82.85129010616585, 169.8614413951652 -83.16393648392497, 168.1192727654712 -83.16393648392497, 168.1192727654712 -83.47658286168408, 166.3771041357772 -83.47658286168408, 166.3771041357772 -83.7892292394432, 164.6349355060832 -83.7892292394432, 164.6349355060832 -84.10187561720231, 162.60240543810687 -84.10187561720231, 162.60240543810687 -84.41452199496143, 160.86023680841285 -84.41452199496143, 160.86023680841285 -84.72716837272054, 159.11806817871886 -84.72716837272054, 159.11806817871886 -85.03981475047966, 157.37589954902487 -85.03981475047966, 157.37589954902487 -85.35246112823879, 155.05300804276618 -85.35246112823879, 155.05300804276618 -85.6651075059979, 153.02047797478986 -85.6651075059979, 153.02047797478986 -85.97775388375702, 150.9879479068135 -85.97775388375702, 150.9879479068135 -86.29040026151613, 148.95541783883718 -86.29040026151613, 148.95541783883718 -86.60304663927525, 147.21324920914319 -86.60304663927525, 147.21324920914319 -86.91569301703436, 145.18071914116683 -86.91569301703436, 145.18071914116683 -87.22833939479348, 142.85782763490818 -87.22833939479348, 142.85782763490818 -87.5409857725526, 140.24457469036716 -87.5409857725526, 140.24457469036716 -87.85363215031171, 136.1795145544145 -87.85363215031171, 136.1795145544145 -88.16627852807083, 128.92047859735615 -88.16627852807083, 128.92047859735615 -87.85363215031171, 126.88794852937983 -87.85363215031171, 126.88794852937983 -87.5409857725526, 125.14577989968582 -87.5409857725526, 125.14577989968582 -87.22833939479348, 123.69397270827415 -87.22833939479348, 123.69397270827415 -86.91569301703436, 121.95180407858015 -86.91569301703436, 121.95180407858015 -86.60304663927525, 120.49999688716848 -86.60304663927525, 120.49999688716848 -86.29040026151613, 119.0481896957568 -86.29040026151613, 119.0481896957568 -85.97775388375702, 117.59638250434514 -85.97775388375702, 117.59638250434514 -85.6651075059979, 112.9505994918278 -85.6651075059979, 112.9505994918278 -85.35246112823879, 109.4662622324398 -85.35246112823879, 109.4662622324398 -85.03981475047966, 106.8530092878988 -85.03981475047966, 106.8530092878988 -84.72716837272054, 103.65903346679312 -84.72716837272054, 103.65903346679312 -85.03981475047966, 97.85180470114645 -85.03981475047966, 97.85180470114645 -84.72716837272054, 94.07710600347612 -84.72716837272054, 94.07710600347612 -85.03981475047966, 90.88313018237044 -85.03981475047966, 90.88313018237044 -85.35246112823879, 88.26987723782943 -85.35246112823879, 88.26987723782943 -85.6651075059979, 85.65662429328843 -85.6651075059979, 85.65662429328843 -85.97775388375702, 82.46264847218276 -85.97775388375702, 82.46264847218276 -86.29040026151613, 77.52650402138309 -86.29040026151613, 77.52650402138309 -86.60304663927525, 74.33252820027742 -86.60304663927525, 74.33252820027742 -86.91569301703436, 72.59035957058342 -86.91569301703436), 
+  (4.355421574235005 -87.22833939479348, 4.065060135952671 -87.22833939479348, 4.065060135952671 -87.5409857725526, 3.4843372593880044 -87.5409857725526, 3.4843372593880044 -87.85363215031171, 3.1939758211056706 -87.85363215031171, 3.1939758211056706 -88.16627852807083, 2.9036143828233367 -88.16627852807083, 2.9036143828233367 -88.47892490582994, 2.6132529445410033 -88.47892490582994, 2.6132529445410033 -88.79157128358906, 2.3228915062586695 -88.79157128358906, 2.3228915062586695 -89.10421766134817, 2.0325300679763356 -89.10421766134817, 2.0325300679763356 -89.4168640391073, 1.4518071914116684 -89.4168640391073, 1.4518071914116684 -89.7295104168664, 1.1614457531293347 -89.7295104168664, 1.1614457531293347 -90.04215679462553, 0.8710843148470011 -90.04215679462553, 0.8710843148470011 -90.35480317238465, 0.5807228765646674 -90.35480317238465, 0.5807228765646674 -90.66744955014376, 0.2903614382823337 -90.66744955014376, 0.2903614382823337 -90.98009592790288, 0 -90.98009592790288))MULTILINESTRING ((297.3301128011097 -73.15925239563325, 297.03975136282736 -73.15925239563325, 297.03975136282736 -73.47189877339235, 295.87830560969803 -73.47189877339235, 295.87830560969803 -73.78454515115148, 295.00722129485104 -73.78454515115148, 295.00722129485104 -74.09719152891059, 293.8457755417217 -74.09719152891059, 293.8457755417217 -74.40983790666971, 292.9746912268747 -74.40983790666971, 292.9746912268747 -74.72248428442882, 291.8132454737453 -74.72248428442882, 291.8132454737453 -75.03513066218794, 290.94216115889833 -75.03513066218794, 290.94216115889833 -75.34777703994706, 289.780715405769 -75.34777703994706, 289.780715405769 -75.66042341770617, 288.909631090922 -75.66042341770617, 288.909631090922 -75.97306979546529, 287.7481853377927 -75.97306979546529, 287.7481853377927 -76.2857161732244, 283.97348664012236 -76.2857161732244, 283.97348664012236 -76.59836255098352, 280.198787942452 -76.59836255098352, 280.198787942452 -76.91100892874263, 277.585534997911 -76.91100892874263, 277.585534997911 -77.22365530650175, 275.5530049299347 -77.22365530650175, 275.5530049299347 -76.91100892874263, 274.39155917680534 -76.91100892874263, 274.39155917680534 -76.59836255098352, 273.230113423676 -76.59836255098352, 273.230113423676 -76.2857161732244, 271.77830623226436 -76.2857161732244, 271.77830623226436 -75.97306979546529, 270.32649904085264 -75.97306979546529, 270.32649904085264 -75.66042341770617, 268.874691849441 -75.66042341770617, 268.874691849441 -75.34777703994706, 267.4228846580293 -75.34777703994706, 267.4228846580293 -75.03513066218794, 265.6807160283353 -75.03513066218794, 265.6807160283353 -74.72248428442882, 264.22890883692367 -74.72248428442882, 264.22890883692367 -74.40983790666971, 262.777101645512 -74.40983790666971, 262.777101645512 -74.09719152891059, 261.3252944541003 -74.09719152891059, 261.3252944541003 -73.78454515115148, 259.8734872626886 -73.78454515115148, 259.8734872626886 -73.47189877339235, 258.42168007127697 -73.47189877339235, 258.42168007127697 -73.15925239563325, 256.9698728798653 -73.15925239563325, 256.9698728798653 -72.84660601787412, 255.51806568845365 -72.84660601787412, 255.51806568845365 -72.533959640115, 254.06625849704199 -72.533959640115, 254.06625849704199 -72.22131326235589, 245.35541534857197 -72.22131326235589, 245.35541534857197 -71.90866688459677, 242.74216240403095 -71.90866688459677, 242.74216240403095 -71.59602050683766, 240.99999377433696 -71.59602050683766, 240.99999377433696 -71.28337412907854, 239.25782514464296 -71.28337412907854, 239.25782514464296 -70.97072775131943, 237.2252950766666 -70.97072775131943, 237.2252950766666 -70.65808137356031, 235.1927650086903 -70.65808137356031, 235.1927650086903 -70.3454349958012, 233.4505963789963 -70.3454349958012, 233.4505963789963 -70.03278861804208, 231.41806631101994 -70.03278861804208, 231.41806631101994 -69.72014224028295, 229.96625911960828 -69.72014224028295, 229.96625911960828 -69.40749586252385, 228.51445192819662 -69.40749586252385, 228.51445192819662 -69.09484948476472, 227.06264473678493 -69.09484948476472, 227.06264473678493 -68.78220310700561, 225.61083754537327 -68.78220310700561, 225.61083754537327 -68.46955672924649, 224.1590303539616 -68.46955672924649, 224.1590303539616 -68.15691035148738, 222.70722316254992 -68.15691035148738, 222.70722316254992 -67.84426397372826, 220.96505453285593 -67.84426397372826, 220.96505453285593 -67.53161759596915, 218.9325244648796 -67.53161759596915, 218.9325244648796 -67.21897121821003, 216.02891008205626 -67.21897121821003, 216.02891008205626 -66.9063248404509, 210.2216813164096 -66.9063248404509, 210.2216813164096 -66.5936784626918, 208.18915124843326 -66.5936784626918, 208.18915124843326 -66.9063248404509, 198.89758522339858 -66.9063248404509, 198.89758522339858 -66.5936784626918, 196.28433227885756 -66.5936784626918, 196.28433227885756 -66.9063248404509, 195.12288652572823 -66.9063248404509, 195.12288652572823 -67.21897121821003, 193.67107933431657 -67.21897121821003, 193.67107933431657 -67.53161759596915, 192.50963358118724 -67.53161759596915, 192.50963358118724 -67.84426397372826, 191.3481878280579 -67.84426397372826, 191.3481878280579 -68.15691035148738, 190.18674207492856 -68.15691035148738, 190.18674207492856 -68.46955672924649, 189.31565776008156 -68.46955672924649, 189.31565776008156 -68.78220310700561, 188.15421200695224 -68.78220310700561, 188.15421200695224 -69.09484948476472, 186.99276625382288 -69.09484948476472, 186.99276625382288 -69.40749586252385, 185.83132050069355 -69.40749586252385, 185.83132050069355 -69.72014224028295, 184.96023618584655 -69.72014224028295, 184.96023618584655 -70.03278861804208, 184.08915187099956 -70.03278861804208, 184.08915187099956 -70.3454349958012, 183.21806755615256 -70.3454349958012, 183.21806755615256 -70.65808137356031, 182.34698324130557 -70.65808137356031, 182.34698324130557 -70.97072775131943, 181.47589892645854 -70.97072775131943, 181.47589892645854 -71.28337412907854, 180.60481461161154 -71.28337412907854, 180.60481461161154 -71.59602050683766, 179.44336885848222 -71.59602050683766, 179.44336885848222 -71.90866688459677, 178.57228454363522 -71.90866688459677, 178.57228454363522 -72.22131326235589, 177.70120022878822 -72.22131326235589, 177.70120022878822 -72.533959640115, 176.8301159139412 -72.533959640115, 176.8301159139412 -72.84660601787412, 175.9590315990942 -72.84660601787412, 175.9590315990942 -73.15925239563325, 175.0879472842472 -73.15925239563325, 175.0879472842472 -73.47189877339235, 174.2168629694002 -73.47189877339235, 174.2168629694002 -73.78454515115148, 171.89397146314155 -73.78454515115148, 171.89397146314155 -74.09719152891059, 169.57107995688287 -74.09719152891059, 169.57107995688287 -74.40983790666971, 166.95782701234188 -74.40983790666971, 166.95782701234188 -74.72248428442882, 164.34457406780086 -74.72248428442882, 164.34457406780086 -75.03513066218794, 161.73132112325987 -75.03513066218794, 161.73132112325987 -75.34777703994706, 158.82770674043653 -75.34777703994706, 158.82770674043653 -75.66042341770617, 155.3433694810485 -75.66042341770617, 155.3433694810485 -75.97306979546529, 151.5686707833782 -75.97306979546529, 151.5686707833782 -76.2857161732244, 147.79397208570785 -76.2857161732244, 147.79397208570785 -76.59836255098352, 142.85782763490818 -76.59836255098352, 142.85782763490818 -76.91100892874263, 135.59879167784982 -76.91100892874263, 135.59879167784982 -76.59836255098352, 131.53373154189717 -76.59836255098352, 131.53373154189717 -76.2857161732244, 129.21084003563848 -76.2857161732244, 129.21084003563848 -75.97306979546529, 127.17830996766216 -75.97306979546529, 127.17830996766216 -75.66042341770617, 125.72650277625048 -75.66042341770617, 125.72650277625048 -75.34777703994706, 124.27469558483881 -75.34777703994706, 124.27469558483881 -75.03513066218794, 122.82288839342715 -75.03513066218794, 122.82288839342715 -74.72248428442882, 121.37108120201547 -74.72248428442882, 121.37108120201547 -74.40983790666971, 119.91927401060381 -74.40983790666971, 119.91927401060381 -74.09719152891059, 118.46746681919214 -74.09719152891059, 118.46746681919214 -73.78454515115148, 116.4349367512158 -73.78454515115148, 116.4349367512158 -73.47189877339235, 112.66023805354547 -73.47189877339235, 112.66023805354547 -73.15925239563325, 110.04698510900447 -73.15925239563325, 110.04698510900447 -72.84660601787412, 107.7240936027458 -72.84660601787412, 107.7240936027458 -72.533959640115, 98.72288901599346 -72.533959640115, 98.72288901599346 -72.22131326235589, 93.20602168862911 -72.22131326235589, 93.20602168862911 -72.533959640115, 89.14096155267644 -72.533959640115, 89.14096155267644 -72.84660601787412, 86.23734716985311 -72.84660601787412, 86.23734716985311 -73.15925239563325, 83.91445566359444 -73.15925239563325, 83.91445566359444 -73.47189877339235, 74.91325107684209 -73.47189877339235, 74.91325107684209 -73.78454515115148, 72.59035957058342 -73.78454515115148), 
+  (72.29999813230108 -73.78454515115148, 70.55782950260709 -73.78454515115148, 70.55782950260709 -73.47189877339235, 67.65421511978374 -73.47189877339235, 67.65421511978374 -73.15925239563325, 64.75060073696041 -73.15925239563325, 64.75060073696041 -72.84660601787412, 62.427709230701744 -72.84660601787412, 62.427709230701744 -72.533959640115, 60.10481772444307 -72.533959640115, 60.10481772444307 -72.22131326235589, 58.94337197131374 -72.22131326235589, 58.94337197131374 -71.90866688459677, 57.49156477990207 -71.90866688459677, 57.49156477990207 -71.59602050683766, 56.330119026772735 -71.59602050683766, 56.330119026772735 -71.28337412907854, 55.1686732736434 -71.28337412907854, 55.1686732736434 -70.97072775131943, 54.007227520514064 -70.97072775131943, 54.007227520514064 -70.65808137356031, 53.13614320566706 -70.65808137356031, 53.13614320566706 -70.3454349958012, 51.97469745253773 -70.3454349958012, 51.97469745253773 -70.03278861804208, 51.10361313769073 -70.03278861804208, 51.10361313769073 -69.72014224028295, 50.232528822843726 -69.72014224028295, 50.232528822843726 -69.40749586252385, 49.07108306971439 -69.40749586252385, 49.07108306971439 -69.09484948476472, 47.61927587830272 -69.09484948476472, 47.61927587830272 -68.78220310700561, 46.45783012517339 -68.78220310700561, 46.45783012517339 -68.46955672924649, 45.00602293376172 -68.46955672924649, 45.00602293376172 -68.15691035148738, 43.55421574235005 -68.15691035148738, 43.55421574235005 -67.84426397372826, 42.39276998922072 -67.84426397372826, 42.39276998922072 -67.53161759596915, 41.23132423609138 -67.53161759596915, 41.23132423609138 -67.21897121821003, 40.06987848296205 -67.21897121821003, 40.06987848296205 -66.9063248404509, 38.61807129155038 -66.9063248404509, 38.61807129155038 -66.5936784626918, 37.16626410013871 -66.5936784626918, 37.16626410013871 -66.28103208493268, 35.42409547044471 -66.28103208493268, 35.42409547044471 -65.96838570717357, 33.39156540246837 -65.96838570717357, 33.39156540246837 -65.65573932941444, 31.359035334492038 -65.65573932941444, 31.359035334492038 -65.34309295165534, 28.745782389951035 -65.34309295165534, 28.745782389951035 -65.03044657389621, 25.551806568845365 -65.03044657389621, 25.551806568845365 -65.34309295165534, 24.099999377433697 -65.34309295165534, 24.099999377433697 -65.65573932941444, 22.648192186022026 -65.65573932941444, 22.648192186022026 -65.96838570717357, 21.486746432892694 -65.96838570717357, 21.486746432892694 -66.28103208493268, 20.61566211804569 -66.28103208493268, 20.61566211804569 -66.5936784626918, 19.74457780319869 -66.5936784626918), 
+  (4.355421574235005 -68.46955672924649, 4.065060135952671 -68.46955672924649, 4.065060135952671 -68.78220310700561, 3.4843372593880044 -68.78220310700561, 3.4843372593880044 -69.09484948476472, 2.9036143828233367 -69.09484948476472, 2.9036143828233367 -69.40749586252385, 2.3228915062586695 -69.40749586252385, 2.3228915062586695 -69.72014224028295, 1.7421686296940022 -69.72014224028295, 1.7421686296940022 -70.03278861804208, 0.8710843148470011 -70.03278861804208, 0.8710843148470011 -70.3454349958012, 0.2903614382823337 -70.3454349958012, 0.2903614382823337 -70.65808137356031, 0 -70.65808137356031))MULTILINESTRING ((297.3301128011097 -70.03278861804208, 297.03975136282736 -70.03278861804208, 297.03975136282736 -70.3454349958012, 295.87830560969803 -70.3454349958012, 295.87830560969803 -70.65808137356031, 295.00722129485104 -70.65808137356031, 295.00722129485104 -70.97072775131943, 293.8457755417217 -70.97072775131943, 293.8457755417217 -71.28337412907854, 292.9746912268747 -71.28337412907854, 292.9746912268747 -71.59602050683766, 291.8132454737453 -71.59602050683766, 291.8132454737453 -71.90866688459677, 290.94216115889833 -71.90866688459677, 290.94216115889833 -72.22131326235589, 289.780715405769 -72.22131326235589, 289.780715405769 -72.533959640115, 288.909631090922 -72.533959640115, 288.909631090922 -72.84660601787412, 288.038546776075 -72.84660601787412, 288.038546776075 -73.15925239563325, 283.3927637635577 -73.15925239563325, 283.3927637635577 -73.47189877339235, 279.03734218932266 -73.47189877339235, 279.03734218932266 -73.78454515115148, 275.26264349165234 -73.78454515115148, 275.26264349165234 -73.47189877339235, 273.8108363002407 -73.47189877339235, 273.8108363002407 -73.15925239563325, 272.64939054711135 -73.15925239563325, 272.64939054711135 -72.84660601787412, 271.19758335569963 -72.84660601787412, 271.19758335569963 -72.533959640115, 269.745776164288 -72.533959640115, 269.745776164288 -72.22131326235589, 268.2939689728763 -72.22131326235589, 268.2939689728763 -71.90866688459677, 266.5518003431823 -71.90866688459677, 266.5518003431823 -71.59602050683766, 264.80963171348833 -71.59602050683766, 264.80963171348833 -71.28337412907854, 263.35782452207667 -71.28337412907854, 263.35782452207667 -70.97072775131943, 261.6156558923827 -70.97072775131943, 261.6156558923827 -70.65808137356031, 260.16384870097096 -70.65808137356031, 260.16384870097096 -70.3454349958012, 258.42168007127697 -70.3454349958012, 258.42168007127697 -70.03278861804208, 256.9698728798653 -70.03278861804208, 256.9698728798653 -69.72014224028295, 255.2277042501713 -69.72014224028295, 255.2277042501713 -69.40749586252385, 252.6144513056303 -69.40749586252385, 252.6144513056303 -69.09484948476472, 246.80722253998363 -69.09484948476472, 246.80722253998363 -68.78220310700561, 243.61324671887797 -68.78220310700561, 243.61324671887797 -68.46955672924649, 240.99999377433696 -68.46955672924649, 240.99999377433696 -68.15691035148738, 238.6771022680783 -68.15691035148738, 238.6771022680783 -67.84426397372826, 236.35421076181962 -67.84426397372826, 236.35421076181962 -67.53161759596915, 234.03131925556096 -67.53161759596915, 234.03131925556096 -67.21897121821003, 231.70842774930227 -67.21897121821003, 231.70842774930227 -66.9063248404509, 229.96625911960828 -66.9063248404509, 229.96625911960828 -66.5936784626918, 228.80481336647895 -66.5936784626918, 228.80481336647895 -66.28103208493268, 227.35300617506726 -66.28103208493268, 227.35300617506726 -65.96838570717357, 225.9011989836556 -65.96838570717357, 225.9011989836556 -65.65573932941444, 224.44939179224394 -65.65573932941444, 224.44939179224394 -65.34309295165534, 222.99758460083228 -65.34309295165534, 222.99758460083228 -65.03044657389621, 221.25541597113826 -65.03044657389621, 221.25541597113826 -64.71780019613709, 219.8036087797266 -64.71780019613709, 219.8036087797266 -64.40515381837798, 217.48071727346792 -64.40515381837798, 217.48071727346792 -64.09250744061886, 214.86746432892693 -64.09250744061886, 214.86746432892693 -63.77986106285975, 210.51204275469192 -63.77986106285975, 210.51204275469192 -63.46721468510063, 207.60842837186857 -63.46721468510063, 207.60842837186857 -63.77986106285975, 200.34939241481024 -63.77986106285975, 200.34939241481024 -63.46721468510063, 197.15541659370456 -63.46721468510063, 197.15541659370456 -63.15456830734151, 196.86505515542223 -63.15456830734151, 196.86505515542223 -63.46721468510063, 195.7036094022929 -63.46721468510063, 195.7036094022929 -63.77986106285975, 194.25180221088124 -63.77986106285975, 194.25180221088124 -64.09250744061886, 193.0903564577519 -64.09250744061886, 193.0903564577519 -64.40515381837798, 191.92891070462255 -64.40515381837798, 191.92891070462255 -64.71780019613709, 190.76746495149322 -64.71780019613709, 190.76746495149322 -65.03044657389621, 189.6060191983639 -65.03044657389621, 189.6060191983639 -65.34309295165534, 188.44457344523457 -65.34309295165534, 188.44457344523457 -65.65573932941444, 187.28312769210524 -65.65573932941444, 187.28312769210524 -65.96838570717357, 186.12168193897588 -65.96838570717357, 186.12168193897588 -66.28103208493268, 185.2505976241289 -66.28103208493268, 185.2505976241289 -66.5936784626918, 184.3795133092819 -66.5936784626918, 184.3795133092819 -66.9063248404509, 183.5084289944349 -66.9063248404509, 183.5084289944349 -67.21897121821003, 182.34698324130557 -67.21897121821003, 182.34698324130557 -67.53161759596915, 181.47589892645854 -67.53161759596915, 181.47589892645854 -67.84426397372826, 180.60481461161154 -67.84426397372826, 180.60481461161154 -68.15691035148738, 179.73373029676455 -68.15691035148738, 179.73373029676455 -68.46955672924649, 178.57228454363522 -68.46955672924649, 178.57228454363522 -68.78220310700561, 177.70120022878822 -68.78220310700561, 177.70120022878822 -69.09484948476472, 176.8301159139412 -69.09484948476472, 176.8301159139412 -69.40749586252385, 175.66867016081187 -69.40749586252385, 175.66867016081187 -69.72014224028295, 174.79758584596487 -69.72014224028295, 174.79758584596487 -70.03278861804208, 173.05541721627088 -70.03278861804208, 173.05541721627088 -70.3454349958012, 170.44216427172987 -70.3454349958012, 170.44216427172987 -70.65808137356031, 167.53854988890654 -70.65808137356031, 167.53854988890654 -70.97072775131943, 164.6349355060832 -70.97072775131943, 164.6349355060832 -71.28337412907854, 161.4409596849775 -71.28337412907854, 161.4409596849775 -71.59602050683766, 157.6662609873072 -71.59602050683766, 157.6662609873072 -71.90866688459677, 153.02047797478986 -71.90866688459677, 153.02047797478986 -72.22131326235589, 148.08433352399018 -72.22131326235589, 148.08433352399018 -72.533959640115, 135.01806880128515 -72.533959640115, 135.01806880128515 -72.22131326235589, 131.8240929801795 -72.22131326235589, 131.8240929801795 -71.90866688459677, 129.79156291220315 -71.90866688459677, 129.79156291220315 -71.59602050683766, 127.75903284422682 -71.59602050683766, 127.75903284422682 -71.28337412907854, 126.30722565281515 -71.28337412907854, 126.30722565281515 -70.97072775131943, 124.85541846140349 -70.97072775131943, 124.85541846140349 -70.65808137356031, 123.40361126999181 -70.65808137356031, 123.40361126999181 -70.3454349958012, 121.95180407858015 -70.3454349958012, 121.95180407858015 -70.03278861804208, 120.49999688716848 -70.03278861804208, 120.49999688716848 -69.72014224028295, 119.33855113403915 -69.72014224028295, 119.33855113403915 -69.40749586252385, 117.88674394262748 -69.40749586252385, 117.88674394262748 -69.09484948476472, 114.98312955980414 -69.09484948476472, 114.98312955980414 -68.78220310700561, 111.78915373869847 -68.78220310700561, 111.78915373869847 -68.46955672924649, 109.4662622324398 -68.46955672924649, 109.4662622324398 -68.15691035148738, 107.14337072618113 -68.15691035148738, 107.14337072618113 -67.84426397372826, 99.30361189255812 -67.84426397372826, 99.30361189255812 -67.53161759596915, 92.62529881206444 -67.53161759596915, 92.62529881206444 -67.84426397372826, 88.85060011439411 -67.84426397372826, 88.85060011439411 -68.15691035148738, 85.94698573157078 -68.15691035148738, 85.94698573157078 -68.46955672924649, 83.6240942253121 -68.46955672924649, 83.6240942253121 -68.78220310700561, 74.62288963855976 -68.78220310700561, 74.62288963855976 -69.09484948476472, 72.59035957058342 -69.09484948476472), 
+  (4.355421574235005 -61.27869004078681, 4.065060135952671 -61.27869004078681, 4.065060135952671 -61.591336418545936, 3.4843372593880044 -61.591336418545936, 3.4843372593880044 -61.90398279630505, 2.6132529445410033 -61.90398279630505, 2.6132529445410033 -62.21662917406417, 1.7421686296940022 -62.21662917406417, 1.7421686296940022 -62.52927555182328, 1.1614457531293347 -62.52927555182328, 1.1614457531293347 -62.8419219295824, 0.2903614382823337 -62.8419219295824, 0.2903614382823337 -63.15456830734151, 0 -63.15456830734151), 
+  (72.29999813230108 -69.09484948476472, 70.55782950260709 -69.09484948476472, 70.55782950260709 -68.78220310700561, 67.65421511978374 -68.78220310700561, 67.65421511978374 -68.46955672924649, 65.04096217524274 -68.46955672924649, 65.04096217524274 -68.15691035148738, 62.427709230701744 -68.15691035148738, 62.427709230701744 -67.84426397372826, 60.395179162725405 -67.84426397372826, 60.395179162725405 -67.53161759596915, 58.94337197131374 -67.53161759596915, 58.94337197131374 -67.21897121821003, 57.7819262181844 -67.21897121821003, 57.7819262181844 -66.9063248404509, 56.62048046505507 -66.9063248404509, 56.62048046505507 -66.5936784626918, 55.45903471192573 -66.5936784626918, 55.45903471192573 -66.28103208493268, 54.297588958796396 -66.28103208493268, 54.297588958796396 -65.96838570717357, 53.4265046439494 -65.96838570717357, 53.4265046439494 -65.65573932941444, 52.265058890820065 -65.65573932941444, 52.265058890820065 -65.34309295165534, 51.39397457597306 -65.34309295165534, 51.39397457597306 -65.03044657389621, 50.52289026112606 -65.03044657389621, 50.52289026112606 -64.71780019613709, 49.942167384561394 -64.71780019613709, 49.942167384561394 -64.40515381837798, 48.78072163143206 -64.40515381837798, 48.78072163143206 -64.09250744061886, 47.32891444002039 -64.09250744061886, 47.32891444002039 -63.77986106285975, 45.87710724860872 -63.77986106285975, 45.87710724860872 -63.46721468510063, 44.71566149547939 -63.46721468510063, 44.71566149547939 -63.15456830734151, 43.26385430406772 -63.15456830734151, 43.26385430406772 -62.8419219295824, 42.102408550938385 -62.8419219295824, 42.102408550938385 -62.52927555182328, 40.94096279780905 -62.52927555182328, 40.94096279780905 -62.21662917406417, 39.779517044679714 -62.21662917406417, 39.779517044679714 -61.90398279630505, 38.61807129155038 -61.90398279630505, 38.61807129155038 -61.591336418545936, 37.16626410013871 -61.591336418545936, 37.16626410013871 -61.27869004078681, 35.42409547044471 -61.27869004078681, 35.42409547044471 -60.9660436630277, 33.681926840750705 -60.9660436630277, 33.681926840750705 -60.65339728526858, 31.939758211056706 -60.65339728526858, 31.939758211056706 -60.34075090750947, 29.616866704798035 -60.34075090750947, 29.616866704798035 -60.02810452975035, 27.293975198539368 -60.02810452975035, 27.293975198539368 -59.715458151991236, 26.7132523219747 -59.715458151991236, 26.7132523219747 -60.02810452975035, 24.39036081571603 -60.02810452975035, 24.39036081571603 -60.34075090750947, 22.93855362430436 -60.34075090750947, 22.93855362430436 -60.65339728526858, 21.486746432892694 -60.65339728526858, 21.486746432892694 -60.9660436630277, 20.61566211804569 -60.9660436630277, 20.61566211804569 -61.27869004078681, 19.74457780319869 -61.27869004078681))MULTILINESTRING ((4.355421574235005 -10.629976843809958, 1.1614457531293347 -10.629976843809958, 1.1614457531293347 -10.942623221569075, 0 -10.942623221569075), 
+  (4.355421574235005 -49.08548130818128, 4.065060135952671 -49.08548130818128, 4.065060135952671 -49.398127685940395, 2.9036143828233367 -49.398127685940395, 2.9036143828233367 -49.71077406369951, 1.4518071914116684 -49.71077406369951, 1.4518071914116684 -50.023420441458626, 0 -50.023420441458626), 
+  (72.29999813230108 -60.65339728526858, 69.68674518776008 -60.65339728526858, 69.68674518776008 -60.34075090750947, 67.07349224321908 -60.34075090750947, 67.07349224321908 -60.02810452975035, 64.46023929867808 -60.02810452975035, 64.46023929867808 -59.715458151991236, 61.84698635413707 -59.715458151991236, 61.84698635413707 -59.40281177423212, 60.10481772444307 -59.40281177423212, 60.10481772444307 -59.090165396473004, 58.94337197131374 -59.090165396473004, 58.94337197131374 -58.77751901871389, 57.7819262181844 -58.77751901871389, 57.7819262181844 -58.464872640954766, 56.9108419033374 -58.464872640954766, 56.9108419033374 -58.15222626319565, 55.74939615020807 -58.15222626319565, 55.74939615020807 -57.839579885436535, 54.87831183536107 -57.839579885436535, 54.87831183536107 -57.52693350767742, 54.007227520514064 -57.52693350767742, 54.007227520514064 -57.214287129918304, 53.13614320566706 -57.214287129918304, 53.13614320566706 -56.90164075215919, 52.265058890820065 -56.90164075215919, 52.265058890820065 -56.58899437440007, 51.68433601425539 -56.58899437440007, 51.68433601425539 -56.27634799664095, 50.8132516994084 -56.27634799664095, 50.8132516994084 -55.963701618881835, 49.942167384561394 -55.963701618881835, 49.942167384561394 -55.65105524112272, 49.36144450799673 -55.65105524112272, 49.36144450799673 -55.338408863363604, 47.909637316585055 -55.338408863363604, 47.909637316585055 -55.02576248560449, 46.74819156345572 -55.02576248560449, 46.74819156345572 -54.71311610784537, 45.58674581032639 -54.71311610784537, 45.58674581032639 -54.40046973008626, 44.425300057197056 -54.40046973008626, 44.425300057197056 -54.08782335232714, 43.26385430406772 -54.08782335232714, 43.26385430406772 -53.775176974568026, 42.102408550938385 -53.775176974568026, 42.102408550938385 -53.462530596808904, 40.94096279780905 -53.462530596808904, 40.94096279780905 -53.14988421904979, 40.06987848296205 -53.14988421904979, 40.06987848296205 -52.83723784129067, 38.90843272983271 -52.83723784129067, 38.90843272983271 -52.52459146353156, 37.746986976703376 -52.52459146353156, 37.746986976703376 -52.21194508577244, 36.29517978529171 -52.21194508577244, 36.29517978529171 -51.899298708013326, 35.13373403216237 -51.899298708013326, 35.13373403216237 -51.58665233025421, 33.39156540246837 -51.58665233025421, 33.39156540246837 -51.27400595249509, 31.939758211056706 -51.27400595249509, 31.939758211056706 -50.96135957473597, 30.197589581362703 -50.96135957473597, 30.197589581362703 -50.64871319697686, 28.165059513386367 -50.64871319697686, 28.165059513386367 -50.33606681921774, 24.39036081571603 -50.33606681921774, 24.39036081571603 -50.64871319697686, 22.648192186022026 -50.64871319697686, 22.648192186022026 -50.96135957473597, 21.19638499461036 -50.96135957473597, 21.19638499461036 -51.27400595249509, 20.034939241481023 -51.27400595249509, 20.034939241481023 -51.58665233025421, 19.74457780319869 -51.58665233025421), 
+  (297.3301128011097 -64.09250744061886, 297.03975136282736 -64.09250744061886, 297.03975136282736 -64.40515381837798, 296.16866704798036 -64.40515381837798, 296.16866704798036 -64.71780019613709, 295.29758273313337 -64.71780019613709, 295.29758273313337 -65.03044657389621, 294.13613698000404 -65.03044657389621, 294.13613698000404 -65.34309295165534, 293.26505266515704 -65.34309295165534, 293.26505266515704 -65.65573932941444, 292.39396835031005 -65.65573932941444, 292.39396835031005 -65.96838570717357, 291.522884035463 -65.96838570717357, 291.522884035463 -66.28103208493268, 290.651799720616 -66.28103208493268, 290.651799720616 -66.5936784626918, 289.49035396748667 -66.5936784626918, 289.49035396748667 -66.9063248404509, 288.6192696526397 -66.9063248404509, 288.6192696526397 -67.21897121821003, 287.7481853377927 -67.21897121821003, 287.7481853377927 -67.53161759596915, 279.03734218932266 -67.53161759596915, 279.03734218932266 -67.84426397372826, 275.5530049299347 -67.84426397372826, 275.5530049299347 -67.53161759596915, 274.101197738523 -67.53161759596915, 274.101197738523 -67.21897121821003, 272.9397519853937 -67.21897121821003, 272.9397519853937 -66.9063248404509, 271.48794479398197 -66.9063248404509, 271.48794479398197 -66.5936784626918, 270.0361376025703 -66.5936784626918, 270.0361376025703 -66.28103208493268, 268.58433041115865 -66.28103208493268, 268.58433041115865 -65.96838570717357, 267.132523219747 -65.96838570717357, 267.132523219747 -65.65573932941444, 265.390354590053 -65.65573932941444, 265.390354590053 -65.34309295165534, 263.648185960359 -65.34309295165534, 263.648185960359 -65.03044657389621, 261.6156558923827 -65.03044657389621, 261.6156558923827 -64.71780019613709, 259.8734872626886 -64.71780019613709, 259.8734872626886 -64.40515381837798, 257.8409571947123 -64.40515381837798, 257.8409571947123 -64.09250744061886, 256.0987885650183 -64.09250744061886, 256.0987885650183 -63.77986106285975, 254.06625849704199 -63.77986106285975, 254.06625849704199 -63.46721468510063, 250.0011983610893 -63.46721468510063, 250.0011983610893 -63.15456830734151, 245.93613822513663 -63.15456830734151, 245.93613822513663 -62.8419219295824, 242.45180096574862 -62.8419219295824, 242.45180096574862 -62.52927555182328, 239.25782514464296 -62.52927555182328, 239.25782514464296 -62.21662917406417, 236.06384932353728 -62.21662917406417, 236.06384932353728 -61.90398279630505, 232.8698735024316 -61.90398279630505, 232.8698735024316 -61.591336418545936, 230.54698199617295 -61.591336418545936, 230.54698199617295 -61.27869004078681, 229.38553624304362 -61.27869004078681, 229.38553624304362 -60.9660436630277, 228.2240904899143 -60.9660436630277, 228.2240904899143 -60.65339728526858, 227.06264473678493 -60.65339728526858, 227.06264473678493 -60.34075090750947, 225.61083754537327 -60.34075090750947, 225.61083754537327 -60.02810452975035, 224.44939179224394 -60.02810452975035, 224.44939179224394 -59.715458151991236, 222.99758460083228 -59.715458151991236, 222.99758460083228 -59.40281177423212, 221.5457774094206 -59.40281177423212, 221.5457774094206 -59.090165396473004, 219.8036087797266 -59.090165396473004, 219.8036087797266 -58.77751901871389, 218.0614401500326 -58.77751901871389, 218.0614401500326 -58.464872640954766, 216.02891008205626 -58.464872640954766, 216.02891008205626 -58.15222626319565, 213.41565713751527 -58.15222626319565, 213.41565713751527 -57.839579885436535, 201.8011996062219 -57.839579885436535, 201.8011996062219 -57.52693350767742, 198.31686234683391 -57.52693350767742, 198.31686234683391 -57.214287129918304, 196.28433227885756 -57.214287129918304, 196.28433227885756 -57.52693350767742, 194.8325250874459 -57.52693350767742, 194.8325250874459 -57.839579885436535, 193.67107933431657 -57.839579885436535, 193.67107933431657 -58.15222626319565, 192.21927214290488 -58.15222626319565, 192.21927214290488 -58.464872640954766, 191.05782638977556 -58.464872640954766, 191.05782638977556 -58.77751901871389, 189.6060191983639 -58.77751901871389, 189.6060191983639 -59.090165396473004, 188.44457344523457 -59.090165396473004, 188.44457344523457 -59.40281177423212, 187.28312769210524 -59.40281177423212, 187.28312769210524 -59.715458151991236, 186.12168193897588 -59.715458151991236, 186.12168193897588 -60.02810452975035, 184.96023618584655 -60.02810452975035, 184.96023618584655 -60.34075090750947, 184.08915187099956 -60.34075090750947, 184.08915187099956 -60.65339728526858, 183.21806755615256 -60.65339728526858, 183.21806755615256 -60.9660436630277, 182.05662180302323 -60.9660436630277, 182.05662180302323 -61.27869004078681, 181.1855374881762 -61.27869004078681, 181.1855374881762 -61.591336418545936, 180.02409173504688 -61.591336418545936, 180.02409173504688 -61.90398279630505, 179.15300742019988 -61.90398279630505, 179.15300742019988 -62.21662917406417, 177.99156166707056 -62.21662917406417, 177.99156166707056 -62.52927555182328, 176.8301159139412 -62.52927555182328, 176.8301159139412 -62.8419219295824, 175.9590315990942 -62.8419219295824, 175.9590315990942 -63.15456830734151, 174.79758584596487 -63.15456830734151, 174.79758584596487 -63.46721468510063, 172.76505577798855 -63.46721468510063, 172.76505577798855 -63.77986106285975, 169.28071851860054 -63.77986106285975, 169.28071851860054 -64.09250744061886, 165.5060198209302 -64.09250744061886, 165.5060198209302 -64.40515381837798, 161.15059824669518 -64.40515381837798, 161.15059824669518 -64.71780019613709, 155.3433694810485 -64.71780019613709, 155.3433694810485 -65.03044657389621, 146.05180345601383 -65.03044657389621, 146.05180345601383 -65.34309295165534, 141.11565900521418 -65.34309295165534, 141.11565900521418 -65.03044657389621, 136.1795145544145 -65.03044657389621, 136.1795145544145 -64.71780019613709, 133.5662616098735 -64.71780019613709, 133.5662616098735 -64.40515381837798, 131.53373154189717 -64.40515381837798, 131.53373154189717 -64.09250744061886, 129.50120147392082 -64.09250744061886, 129.50120147392082 -63.77986106285975, 128.04939428250916 -63.77986106285975, 128.04939428250916 -63.46721468510063, 126.59758709109748 -63.46721468510063, 126.59758709109748 -63.15456830734151, 125.14577989968582 -63.15456830734151, 125.14577989968582 -62.8419219295824, 123.98433414655648 -62.8419219295824, 123.98433414655648 -62.52927555182328, 122.82288839342715 -62.52927555182328, 122.82288839342715 -62.21662917406417, 121.6614426402978 -62.21662917406417, 121.6614426402978 -61.90398279630505, 120.49999688716848 -61.90398279630505, 120.49999688716848 -61.591336418545936, 119.33855113403915 -61.591336418545936, 119.33855113403915 -61.27869004078681, 118.17710538090981 -61.27869004078681, 118.17710538090981 -60.9660436630277, 115.5638524363688 -60.9660436630277, 115.5638524363688 -60.65339728526858, 112.66023805354547 -60.65339728526858, 112.66023805354547 -60.34075090750947, 110.3373465472868 -60.34075090750947, 110.3373465472868 -60.02810452975035, 108.30481647931046 -60.02810452975035, 108.30481647931046 -59.715458151991236, 106.8530092878988 -59.715458151991236, 106.8530092878988 -59.40281177423212, 100.46505764568745 -59.40281177423212, 100.46505764568745 -59.090165396473004, 91.46385305893511 -59.090165396473004, 91.46385305893511 -59.40281177423212, 88.26987723782943 -59.40281177423212, 88.26987723782943 -59.715458151991236, 85.94698573157078 -59.715458151991236, 85.94698573157078 -60.02810452975035, 84.20481710187677 -60.02810452975035, 84.20481710187677 -60.34075090750947, 76.07469682997143 -60.34075090750947, 76.07469682997143 -60.65339728526858, 72.59035957058342 -60.65339728526858), 
+  (58.362649094749074 0, 58.362649094749074 -0.3126463777591164, 58.653010533031406 -0.3126463777591164, 58.653010533031406 -0.6252927555182328, 59.23373340959607 -0.6252927555182328, 59.23373340959607 -0.9379391332773492, 59.5240948478784 -0.9379391332773492, 59.5240948478784 -1.2505855110364656, 59.81445628616074 -1.2505855110364656, 59.81445628616074 -1.563231888795582, 60.10481772444307 -1.563231888795582, 60.10481772444307 -2.8138173998320477, 59.81445628616074 -2.8138173998320477, 59.81445628616074 -3.126463777591164, 59.5240948478784 -3.126463777591164, 59.5240948478784 -3.4391101553502805, 58.94337197131374 -3.4391101553502805, 58.94337197131374 -3.751756533109397, 58.362649094749074 -3.751756533109397, 58.362649094749074 -4.064402910868513, 57.49156477990207 -4.064402910868513, 57.49156477990207 -4.37704928862763, 56.330119026772735 -4.37704928862763, 56.330119026772735 -4.689695666386746, 54.87831183536107 -4.689695666386746, 54.87831183536107 -5.002342044145863, 53.13614320566706 -5.002342044145863, 53.13614320566706 -5.314988421904979, 51.39397457597306 -5.314988421904979, 51.39397457597306 -5.627634799664095, 49.36144450799673 -5.627634799664095, 49.36144450799673 -5.940281177423212, 47.32891444002039 -5.940281177423212, 47.32891444002039 -6.252927555182328, 45.29638437204405 -6.252927555182328, 45.29638437204405 -6.565573932941445, 42.97349286578539 -6.565573932941445, 42.97349286578539 -6.878220310700561, 40.65060135952672 -6.878220310700561, 40.65060135952672 -7.1908666884596775, 38.037348414985715 -7.1908666884596775, 38.037348414985715 -7.503513066218794, 35.42409547044471 -7.503513066218794, 35.42409547044471 -7.81615944397791, 32.52048108762137 -7.81615944397791, 32.52048108762137 -8.128805821737027, 29.616866704798035 -8.128805821737027, 29.616866704798035 -8.441452199496144, 26.422890883692364 -8.441452199496144, 26.422890883692364 -8.75409857725526, 23.80963793915136 -8.75409857725526, 23.80963793915136 -9.066744955014375, 21.486746432892694 -9.066744955014375, 21.486746432892694 -9.379391332773492, 19.74457780319869 -9.379391332773492))MULTILINESTRING ((297.3301128011097 -52.83723784129067, 296.4590284862627 -52.83723784129067, 296.4590284862627 -53.14988421904979, 295.5879441714157 -53.14988421904979, 295.5879441714157 -53.462530596808904, 294.7168598565687 -53.462530596808904, 294.7168598565687 -53.775176974568026, 293.8457755417217 -53.775176974568026, 293.8457755417217 -54.08782335232714, 292.9746912268747 -54.08782335232714, 292.9746912268747 -54.40046973008626, 292.10360691202766 -54.40046973008626, 292.10360691202766 -54.71311610784537, 291.522884035463 -54.71311610784537, 291.522884035463 -55.02576248560449, 290.651799720616 -55.02576248560449, 290.651799720616 -55.338408863363604, 289.780715405769 -55.338408863363604, 289.780715405769 -55.65105524112272, 289.19999252920434 -55.65105524112272, 289.19999252920434 -55.963701618881835, 288.32890821435734 -55.963701618881835, 288.32890821435734 -56.27634799664095, 275.843366368217 -56.27634799664095, 275.843366368217 -55.963701618881835, 274.6819206150877 -55.963701618881835, 274.6819206150877 -55.65105524112272, 273.52047486195835 -55.65105524112272, 273.52047486195835 -55.338408863363604, 272.359029108829 -55.338408863363604, 272.359029108829 -55.02576248560449, 271.19758335569963 -55.02576248560449, 271.19758335569963 -54.71311610784537, 270.0361376025703 -54.71311610784537, 270.0361376025703 -54.40046973008626, 268.874691849441 -54.40046973008626, 268.874691849441 -54.08782335232714, 267.71324609631165 -54.08782335232714, 267.71324609631165 -53.775176974568026, 266.5518003431823 -53.775176974568026, 266.5518003431823 -53.462530596808904, 265.09999315177066 -53.462530596808904, 265.09999315177066 -53.14988421904979, 262.4867402072297 -53.14988421904979, 262.4867402072297 -52.83723784129067, 259.8734872626886 -52.83723784129067, 259.8734872626886 -52.52459146353156, 257.55059575642997 -52.52459146353156, 257.55059575642997 -52.21194508577244, 254.93734281188898 -52.21194508577244, 254.93734281188898 -51.899298708013326, 250.8722826759363 -51.899298708013326, 250.8722826759363 -51.58665233025421, 245.93613822513663 -51.58665233025421, 245.93613822513663 -51.27400595249509, 241.2903552126193 -51.27400595249509, 241.2903552126193 -50.96135957473597, 238.0963793915136 -50.96135957473597, 238.0963793915136 -50.64871319697686, 234.90240357040796 -50.64871319697686, 234.90240357040796 -50.33606681921774, 231.9987891875846 -50.33606681921774, 231.9987891875846 -50.023420441458626, 230.54698199617295 -50.023420441458626, 230.54698199617295 -49.71077406369951, 229.67589768132595 -49.71077406369951, 229.67589768132595 -49.398127685940395, 228.51445192819662 -49.398127685940395, 228.51445192819662 -49.08548130818128, 227.6433676133496 -49.08548130818128, 227.6433676133496 -48.772834930422164, 226.7722832985026 -48.772834930422164, 226.7722832985026 -48.46018855266304, 225.61083754537327 -48.46018855266304, 225.61083754537327 -48.147542174903926, 224.73975323052628 -48.147542174903926, 224.73975323052628 -47.83489579714481, 223.57830747739695 -47.83489579714481, 223.57830747739695 -47.522249419385695, 222.4168617242676 -47.522249419385695, 222.4168617242676 -47.20960304162658, 221.25541597113826 -47.20960304162658, 221.25541597113826 -46.89695666386746, 220.09397021800893 -46.89695666386746, 220.09397021800893 -46.58431028610835, 218.35180158831494 -46.58431028610835, 218.35180158831494 -46.271663908349225, 216.02891008205626 -46.271663908349225, 216.02891008205626 -45.95901753059011, 213.41565713751527 -45.95901753059011, 213.41565713751527 -45.646371152830994, 209.64095843984492 -45.646371152830994, 209.64095843984492 -45.33372477507188, 201.51083816793957 -45.33372477507188, 201.51083816793957 -45.02107839731276, 198.60722378511625 -45.02107839731276, 198.60722378511625 -44.70843201955365, 195.99397084057523 -44.70843201955365, 195.99397084057523 -45.02107839731276, 194.54216364916357 -45.02107839731276, 194.54216364916357 -45.33372477507188, 193.0903564577519 -45.33372477507188, 193.0903564577519 -45.646371152830994, 191.63854926634022 -45.646371152830994, 191.63854926634022 -45.95901753059011, 190.18674207492856 -45.95901753059011, 190.18674207492856 -46.271663908349225, 189.02529632179923 -46.271663908349225, 189.02529632179923 -46.58431028610835, 187.57348913038757 -46.58431028610835, 187.57348913038757 -46.89695666386746, 186.12168193897588 -46.89695666386746, 186.12168193897588 -47.20960304162658, 184.96023618584655 -47.20960304162658, 184.96023618584655 -47.522249419385695, 183.79879043271723 -47.522249419385695, 183.79879043271723 -47.83489579714481, 182.34698324130557 -47.83489579714481, 182.34698324130557 -48.147542174903926, 181.1855374881762 -48.147542174903926, 181.1855374881762 -48.46018855266304, 180.02409173504688 -48.46018855266304, 180.02409173504688 -48.772834930422164, 178.86264598191755 -48.772834930422164, 178.86264598191755 -49.08548130818128, 177.70120022878822 -49.08548130818128, 177.70120022878822 -49.398127685940395, 176.53975447565887 -49.398127685940395, 176.53975447565887 -49.71077406369951, 175.37830872252954 -49.71077406369951, 175.37830872252954 -50.023420441458626, 174.2168629694002 -50.023420441458626, 174.2168629694002 -50.33606681921774, 168.1192727654712 -50.33606681921774, 168.1192727654712 -50.64871319697686, 161.4409596849775 -50.64871319697686, 161.4409596849775 -50.96135957473597, 144.0192733880375 -50.96135957473597, 144.0192733880375 -50.64871319697686, 139.37349037552016 -50.64871319697686, 139.37349037552016 -50.33606681921774, 137.0505988692615 -50.33606681921774, 137.0505988692615 -50.023420441458626, 135.30843023956749 -50.023420441458626, 135.30843023956749 -49.71077406369951, 133.5662616098735 -49.71077406369951, 133.5662616098735 -49.398127685940395, 132.11445441846183 -49.398127685940395, 132.11445441846183 -49.08548130818128, 130.9530086653325 -49.08548130818128, 130.9530086653325 -48.772834930422164, 129.79156291220315 -48.772834930422164, 129.79156291220315 -48.46018855266304, 128.63011715907382 -48.46018855266304, 128.63011715907382 -48.147542174903926, 127.46867140594449 -48.147542174903926, 127.46867140594449 -47.83489579714481, 126.59758709109748 -47.83489579714481, 126.59758709109748 -47.522249419385695, 125.72650277625048 -47.522249419385695, 125.72650277625048 -47.20960304162658, 124.56505702312116 -47.20960304162658, 124.56505702312116 -46.89695666386746, 123.69397270827415 -46.89695666386746, 123.69397270827415 -46.58431028610835, 122.82288839342715 -46.58431028610835, 122.82288839342715 -46.271663908349225, 121.95180407858015 -46.271663908349225, 121.95180407858015 -45.95901753059011, 121.08071976373314 -45.95901753059011, 121.08071976373314 -45.646371152830994, 120.20963544888615 -45.646371152830994, 120.20963544888615 -45.33372477507188, 119.33855113403915 -45.33372477507188, 119.33855113403915 -45.02107839731276, 118.75782825747447 -45.02107839731276, 118.75782825747447 -44.70843201955365, 117.88674394262748 -44.70843201955365, 117.88674394262748 -44.39578564179453, 115.5638524363688 -44.39578564179453, 115.5638524363688 -44.08313926403542, 113.24096093011013 -44.08313926403542, 113.24096093011013 -43.7704928862763, 111.49879230041614 -43.7704928862763, 111.49879230041614 -43.45784650851718, 110.04698510900447 -43.45784650851718, 110.04698510900447 -43.14520013075806, 108.59517791759279 -43.14520013075806, 108.59517791759279 -42.83255375299895, 107.43373216446346 -42.83255375299895, 107.43373216446346 -42.51990737523983, 106.27228641133412 -42.51990737523983, 106.27228641133412 -42.20726099748072, 102.20722627538146 -42.20726099748072, 102.20722627538146 -41.8946146197216, 97.85180470114645 -41.8946146197216, 97.85180470114645 -41.581968241962485, 91.46385305893511 -41.581968241962485, 91.46385305893511 -41.8946146197216, 88.56023867611178 -41.8946146197216, 88.56023867611178 -42.20726099748072, 86.52770860813544 -42.20726099748072, 86.52770860813544 -42.51990737523983, 85.07590141672377 -42.51990737523983, 85.07590141672377 -42.83255375299895, 83.6240942253121 -42.83255375299895, 83.6240942253121 -43.14520013075806, 75.20361251512442 -43.14520013075806, 75.20361251512442 -43.45784650851718, 72.59035957058342 -43.45784650851718), 
+  (204.99517542732758 0, 204.99517542732758 -0.6252927555182328, 205.2855368656099 -0.6252927555182328, 205.2855368656099 -0.9379391332773492, 205.57589830389225 -0.9379391332773492, 205.57589830389225 -1.2505855110364656, 205.86625974217458 -1.2505855110364656, 205.86625974217458 -2.188524644313815, 206.1566211804569 -2.188524644313815, 206.1566211804569 -2.5011710220729313, 205.86625974217458 -2.5011710220729313, 205.86625974217458 -3.126463777591164, 205.57589830389225 -3.126463777591164, 205.57589830389225 -3.4391101553502805, 205.2855368656099 -3.4391101553502805, 205.2855368656099 -3.751756533109397, 204.99517542732758 -3.751756533109397, 204.99517542732758 -4.064402910868513, 204.41445255076292 -4.064402910868513, 204.41445255076292 -4.37704928862763, 203.54336823591592 -4.37704928862763, 203.54336823591592 -4.689695666386746, 202.67228392106892 -4.689695666386746, 202.67228392106892 -5.002342044145863, 201.8011996062219 -5.002342044145863, 201.8011996062219 -5.314988421904979, 200.63975385309257 -5.314988421904979, 200.63975385309257 -5.627634799664095, 199.47830809996324 -5.627634799664095, 199.47830809996324 -5.940281177423212, 197.73613947026925 -5.940281177423212, 197.73613947026925 -6.252927555182328, 196.5746937171399 -6.252927555182328, 196.5746937171399 -6.565573932941445, 195.12288652572823 -6.565573932941445, 195.12288652572823 -6.878220310700561, 193.9614407725989 -6.878220310700561, 193.9614407725989 -7.1908666884596775, 192.21927214290488 -7.1908666884596775, 192.21927214290488 -7.503513066218794, 190.76746495149322 -7.503513066218794, 190.76746495149322 -7.81615944397791, 189.02529632179923 -7.81615944397791, 189.02529632179923 -8.128805821737027, 186.99276625382288 -8.128805821737027, 186.99276625382288 -8.441452199496144, 185.2505976241289 -8.441452199496144, 185.2505976241289 -8.75409857725526, 183.5084289944349 -8.75409857725526, 183.5084289944349 -9.066744955014375, 181.76626036474087 -9.066744955014375, 181.76626036474087 -9.379391332773492, 180.02409173504688 -9.379391332773492, 180.02409173504688 -9.69203771053261, 177.99156166707056 -9.69203771053261, 177.99156166707056 -10.004684088291725, 175.66867016081187 -10.004684088291725, 175.66867016081187 -10.31733046605084, 172.76505577798855 -10.31733046605084, 172.76505577798855 -10.629976843809958, 169.28071851860054 -10.629976843809958, 169.28071851860054 -10.942623221569075, 165.5060198209302 -10.942623221569075, 165.5060198209302 -11.25526959932819, 160.2795139318482 -11.25526959932819, 160.2795139318482 -11.567915977087306, 153.60120085135452 -11.567915977087306, 153.60120085135452 -11.880562354846424, 148.08433352399018 -11.880562354846424, 148.08433352399018 -12.193208732605541, 142.85782763490818 -12.193208732605541, 142.85782763490818 -12.505855110364656, 137.63132174582617 -12.505855110364656, 137.63132174582617 -12.818501488123772, 132.11445441846183 -12.818501488123772, 132.11445441846183 -13.13114786588289, 127.17830996766216 -13.13114786588289, 127.17830996766216 -13.443794243642007, 122.24216551686249 -13.443794243642007, 122.24216551686249 -13.756440621401122, 117.30602106606281 -13.756440621401122, 117.30602106606281 -14.069086999160238, 113.24096093011013 -14.069086999160238, 113.24096093011013 -14.381733376919355, 108.59517791759279 -14.381733376919355, 108.59517791759279 -14.694379754678472, 104.2397563433578 -14.694379754678472, 104.2397563433578 -15.007026132437588, 99.88433476912279 -15.007026132437588, 99.88433476912279 -15.319672510196703, 95.81927463317011 -15.319672510196703, 95.81927463317011 -15.63231888795582, 91.75421449721745 -15.63231888795582, 91.75421449721745 -15.944965265714938, 87.68915436126477 -15.944965265714938, 87.68915436126477 -16.257611643474053, 83.6240942253121 -16.257611643474053, 83.6240942253121 -16.57025802123317, 78.97831121279476 -16.57025802123317, 78.97831121279476 -16.882904398992288, 74.04216676199509 -16.882904398992288, 74.04216676199509 -17.195550776751404, 72.59035957058342 -17.195550776751404), 
+  (4.355421574235005 -23.44847833193373, 3.774698697670338 -23.44847833193373, 3.774698697670338 -23.761124709692847, 2.9036143828233367 -23.761124709692847, 2.9036143828233367 -24.073771087451963, 2.0325300679763356 -24.073771087451963, 2.0325300679763356 -24.386417465211082, 1.4518071914116684 -24.386417465211082, 1.4518071914116684 -24.699063842970197, 1.1614457531293347 -24.699063842970197, 1.1614457531293347 -25.011710220729313, 0.8710843148470011 -25.011710220729313, 0.8710843148470011 -25.637002976247544, 1.1614457531293347 -25.637002976247544, 1.1614457531293347 -25.949649354006663, 1.7421686296940022 -25.949649354006663, 1.7421686296940022 -26.26229573176578, 2.3228915062586695 -26.26229573176578, 2.3228915062586695 -26.574942109524894, 3.774698697670338 -26.574942109524894, 3.774698697670338 -26.887588487284013, 4.355421574235005 -26.887588487284013), 
+  (72.29999813230108 -17.195550776751404, 69.10602231119542 -17.195550776751404, 69.10602231119542 -17.50819715451052, 64.46023929867808 -17.50819715451052, 64.46023929867808 -17.820843532269635, 60.10481772444307 -17.820843532269635, 60.10481772444307 -18.13348991002875, 56.330119026772735 -18.13348991002875, 56.330119026772735 -18.44613628778787, 52.265058890820065 -18.44613628778787, 52.265058890820065 -18.758782665546985, 48.199998754867394 -18.758782665546985, 48.199998754867394 -19.0714290433061, 45.29638437204405 -19.0714290433061, 45.29638437204405 -19.38407542106522, 42.102408550938385 -19.38407542106522, 42.102408550938385 -19.696721798824335, 39.19879416811505 -19.696721798824335, 39.19879416811505 -20.00936817658345, 36.004818347009376 -20.00936817658345, 36.004818347009376 -20.322014554342566, 32.81084252590371 -20.322014554342566, 32.81084252590371 -20.63466093210168, 29.616866704798035 -20.63466093210168, 29.616866704798035 -20.9473073098608, 26.7132523219747 -20.9473073098608, 26.7132523219747 -21.259953687619916, 24.680722253998365 -21.259953687619916, 24.680722253998365 -21.57260006537903, 22.93855362430436 -21.57260006537903, 22.93855362430436 -21.88524644313815, 21.486746432892694 -21.88524644313815, 21.486746432892694 -22.197892820897266, 19.74457780319869 -22.197892820897266), 
+  (72.29999813230108 -43.45784650851718, 70.26746806432475 -43.45784650851718, 70.26746806432475 -43.14520013075806, 68.23493799634842 -43.14520013075806, 68.23493799634842 -42.83255375299895, 66.20240792837208 -42.83255375299895, 66.20240792837208 -42.51990737523983, 64.46023929867808 -42.51990737523983, 64.46023929867808 -42.20726099748072, 62.718070668984076 -42.20726099748072, 62.718070668984076 -41.8946146197216, 60.97590203929008 -41.8946146197216, 60.97590203929008 -41.581968241962485, 60.10481772444307 -41.581968241962485, 60.10481772444307 -41.26932186420336, 59.23373340959607 -41.26932186420336, 59.23373340959607 -40.95667548644425, 58.362649094749074 -40.95667548644425, 58.362649094749074 -40.64402910868513, 57.7819262181844 -40.64402910868513, 57.7819262181844 -40.331382730926016, 56.9108419033374 -40.331382730926016, 56.9108419033374 -40.0187363531669, 56.330119026772735 -40.0187363531669, 56.330119026772735 -39.706089975407785, 55.45903471192573 -39.706089975407785, 55.45903471192573 -39.39344359764867, 54.87831183536107 -39.39344359764867, 54.87831183536107 -39.080797219889554, 54.297588958796396 -39.080797219889554, 54.297588958796396 -38.76815084213044, 53.4265046439494 -38.76815084213044, 53.4265046439494 -38.455504464371316, 52.84578176738473 -38.455504464371316, 52.84578176738473 -38.1428580866122, 52.265058890820065 -38.1428580866122, 52.265058890820065 -37.830211708853085, 51.68433601425539 -37.830211708853085, 51.68433601425539 -37.51756533109397, 51.10361313769073 -37.51756533109397, 51.10361313769073 -37.204918953334854, 50.52289026112606 -37.204918953334854, 50.52289026112606 -36.89227257557574, 49.942167384561394 -36.89227257557574, 49.942167384561394 -36.57962619781662, 49.07108306971439 -36.57962619781662, 49.07108306971439 -36.2669798200575, 48.199998754867394 -36.2669798200575, 48.199998754867394 -35.954333442298385, 47.32891444002039 -35.954333442298385, 47.32891444002039 -35.64168706453927, 46.167468686891056 -35.64168706453927, 46.167468686891056 -35.329040686780154, 45.29638437204405 -35.329040686780154, 45.29638437204405 -35.01639430902104, 44.425300057197056 -35.01639430902104, 44.425300057197056 -34.70374793126192, 43.26385430406772 -34.70374793126192, 43.26385430406772 -34.39110155350281, 42.39276998922072 -34.39110155350281, 42.39276998922072 -34.07845517574369, 41.521685674373714 -34.07845517574369, 41.521685674373714 -33.765808797984576, 40.65060135952672 -33.765808797984576, 40.65060135952672 -33.45316242022545, 39.48915560639738 -33.45316242022545, 39.48915560639738 -33.14051604246634, 38.61807129155038 -33.14051604246634, 38.61807129155038 -32.82786966470722, 37.746986976703376 -32.82786966470722, 37.746986976703376 -32.51522328694811, 36.58554122357405 -32.51522328694811, 36.58554122357405 -32.20257690918899, 35.13373403216237 -32.20257690918899, 35.13373403216237 -31.889930531429876, 33.972288279033044 -31.889930531429876, 33.972288279033044 -31.577284153670757, 32.52048108762137 -31.577284153670757, 32.52048108762137 -31.26463777591164, 31.068673896209702 -31.26463777591164, 31.068673896209702 -30.951991398152526, 29.616866704798035 -30.951991398152526, 29.616866704798035 -30.639345020393407, 27.874698075104035 -30.639345020393407, 27.874698075104035 -30.32669864263429, 25.842168007127697 -30.32669864263429, 25.842168007127697 -30.014052264875176, 19.74457780319869 -30.014052264875176))MULTILINESTRING ((297.3301128011097 -18.758782665546985, 296.749389924545 -18.758782665546985, 296.749389924545 -19.0714290433061, 296.16866704798036 -19.0714290433061, 296.16866704798036 -19.38407542106522, 295.5879441714157 -19.38407542106522, 295.5879441714157 -19.696721798824335, 295.00722129485104 -19.696721798824335, 295.00722129485104 -20.00936817658345, 294.42649841828637 -20.00936817658345, 294.42649841828637 -20.322014554342566, 293.8457755417217 -20.322014554342566, 293.8457755417217 -20.63466093210168, 293.26505266515704 -20.63466093210168, 293.26505266515704 -20.9473073098608, 292.6843297885924 -20.9473073098608, 292.6843297885924 -21.259953687619916, 292.10360691202766 -21.259953687619916, 292.10360691202766 -21.57260006537903, 291.522884035463 -21.57260006537903, 291.522884035463 -21.88524644313815, 290.94216115889833 -21.88524644313815, 290.94216115889833 -22.197892820897266, 290.07107684405133 -22.197892820897266, 290.07107684405133 -22.51053919865638, 289.49035396748667 -22.51053919865638, 289.49035396748667 -22.823185576415497, 288.6192696526397 -22.823185576415497, 288.6192696526397 -23.135831954174613, 287.7481853377927 -23.135831954174613, 287.7481853377927 -23.44847833193373, 287.167462461228 -23.44847833193373, 287.167462461228 -23.761124709692847, 286.58673958466335 -23.761124709692847, 286.58673958466335 -24.073771087451963, 286.0060167080987 -24.073771087451963, 286.0060167080987 -24.386417465211082, 285.425293831534 -24.386417465211082, 285.425293831534 -24.699063842970197, 284.84457095496936 -24.699063842970197, 284.84457095496936 -25.011710220729313, 284.2638480784047 -25.011710220729313, 284.2638480784047 -25.32435659848843, 283.68312520184 -25.32435659848843, 283.68312520184 -25.637002976247544, 283.3927637635577 -25.637002976247544, 283.3927637635577 -25.949649354006663, 282.81204088699303 -25.949649354006663, 282.81204088699303 -26.26229573176578, 282.23131801042837 -26.26229573176578, 282.23131801042837 -26.574942109524894, 281.65059513386365 -26.574942109524894, 281.65059513386365 -26.887588487284013, 281.3602336955813 -26.887588487284013, 281.3602336955813 -27.20023486504313, 280.77951081901665 -27.20023486504313, 280.77951081901665 -27.512881242802244, 280.198787942452 -27.512881242802244, 280.198787942452 -27.82552762056136, 279.90842650416965 -27.82552762056136, 279.90842650416965 -28.138173998320475, 279.327703627605 -28.138173998320475, 279.327703627605 -28.450820376079594, 278.7469807510403 -28.450820376079594, 278.7469807510403 -28.76346675383871, 278.456619312758 -28.76346675383871, 278.456619312758 -29.076113131597825, 277.87589643619333 -29.076113131597825, 277.87589643619333 -29.388759509356944, 277.29517355962867 -29.388759509356944, 277.29517355962867 -29.70140588711606, 277.00481212134633 -29.70140588711606, 277.00481212134633 -30.014052264875176, 276.42408924478167 -30.014052264875176, 276.42408924478167 -30.32669864263429, 276.13372780649934 -30.32669864263429, 276.13372780649934 -30.639345020393407, 275.843366368217 -30.639345020393407, 275.843366368217 -30.951991398152526, 275.5530049299347 -30.951991398152526, 275.5530049299347 -31.26463777591164, 275.26264349165234 -31.26463777591164, 275.26264349165234 -31.577284153670757, 274.97228205337 -31.577284153670757, 274.97228205337 -31.889930531429876, 274.6819206150877 -31.889930531429876, 274.6819206150877 -32.20257690918899, 274.39155917680534 -32.20257690918899, 274.39155917680534 -32.82786966470722, 274.101197738523 -32.82786966470722, 274.101197738523 -35.329040686780154, 274.39155917680534 -35.329040686780154, 274.39155917680534 -36.2669798200575, 274.6819206150877 -36.2669798200575, 274.6819206150877 -36.57962619781662, 274.97228205337 -36.57962619781662, 274.97228205337 -37.204918953334854, 275.26264349165234 -37.204918953334854, 275.26264349165234 -37.51756533109397, 275.5530049299347 -37.51756533109397, 275.5530049299347 -37.830211708853085, 275.843366368217 -37.830211708853085, 275.843366368217 -38.1428580866122, 276.13372780649934 -38.1428580866122, 276.13372780649934 -38.455504464371316, 277.00481212134633 -38.455504464371316, 277.00481212134633 -38.76815084213044, 278.16625787447566 -38.76815084213044, 278.16625787447566 -39.080797219889554, 279.6180650658873 -39.080797219889554, 279.6180650658873 -39.39344359764867, 280.4891493807343 -39.39344359764867, 280.4891493807343 -39.706089975407785, 281.65059513386365 -39.706089975407785, 281.65059513386365 -40.0187363531669, 282.81204088699303 -40.0187363531669, 282.81204088699303 -40.331382730926016, 283.68312520184 -40.331382730926016, 283.68312520184 -40.64402910868513, 284.84457095496936 -40.64402910868513, 284.84457095496936 -40.95667548644425, 286.296378146381 -40.95667548644425, 286.296378146381 -41.26932186420336, 287.45782389951034 -41.26932186420336, 287.45782389951034 -41.581968241962485, 287.7481853377927 -41.581968241962485, 287.7481853377927 -41.26932186420336, 288.32890821435734 -41.26932186420336, 288.32890821435734 -40.95667548644425, 288.909631090922 -40.95667548644425, 288.909631090922 -40.64402910868513, 289.19999252920434 -40.64402910868513, 289.19999252920434 -40.331382730926016, 289.780715405769 -40.331382730926016, 289.780715405769 -40.0187363531669, 290.36143828233367 -40.0187363531669, 290.36143828233367 -39.706089975407785, 290.94216115889833 -39.706089975407785, 290.94216115889833 -39.39344359764867, 291.522884035463 -39.39344359764867, 291.522884035463 -39.080797219889554, 292.10360691202766 -39.080797219889554, 292.10360691202766 -38.76815084213044, 292.6843297885924 -38.76815084213044, 292.6843297885924 -38.455504464371316, 293.26505266515704 -38.455504464371316, 293.26505266515704 -38.1428580866122, 293.8457755417217 -38.1428580866122, 293.8457755417217 -37.830211708853085, 294.42649841828637 -37.830211708853085, 294.42649841828637 -37.51756533109397, 295.29758273313337 -37.51756533109397, 295.29758273313337 -37.204918953334854, 295.87830560969803 -37.204918953334854, 295.87830560969803 -36.89227257557574, 296.749389924545 -36.89227257557574, 296.749389924545 -36.57962619781662, 297.3301128011097 -36.57962619781662))MULTILINESTRING ((72.29999813230108 -100.67213363843548, 68.81566087291309 -100.67213363843548, 68.81566087291309 -100.35948726067637, 64.16987786039574 -100.35948726067637, 64.16987786039574 -100.04684088291725, 60.97590203929008 -100.04684088291725, 60.97590203929008 -99.73419450515813, 58.653010533031406 -99.73419450515813, 58.653010533031406 -99.42154812739902, 56.9108419033374 -99.42154812739902, 56.9108419033374 -99.1089017496399, 55.45903471192573 -99.1089017496399, 55.45903471192573 -98.79625537188079, 54.007227520514064 -98.79625537188079, 54.007227520514064 -98.48360899412167, 52.84578176738473 -98.48360899412167, 52.84578176738473 -98.17096261636256, 51.68433601425539 -98.17096261636256, 51.68433601425539 -97.85831623860344, 50.52289026112606 -97.85831623860344, 50.52289026112606 -97.54566986084433, 49.65180594627906 -97.54566986084433, 49.65180594627906 -97.2330234830852, 49.07108306971439 -97.2330234830852, 49.07108306971439 -96.92037710532608, 48.490360193149726 -96.92037710532608, 48.490360193149726 -96.60773072756697, 47.61927587830272 -96.60773072756697, 47.61927587830272 -96.29508434980785, 47.03855300173806 -96.29508434980785, 47.03855300173806 -95.98243797204874, 46.45783012517339 -95.98243797204874, 46.45783012517339 -95.66979159428962, 45.87710724860872 -95.66979159428962, 45.87710724860872 -95.35714521653051, 45.29638437204405 -95.35714521653051, 45.29638437204405 -95.04449883877139, 45.00602293376172 -95.04449883877139, 45.00602293376172 -94.73185246101227, 44.425300057197056 -94.73185246101227, 44.425300057197056 -94.41920608325316, 43.844577180632385 -94.41920608325316, 43.844577180632385 -94.10655970549404, 43.26385430406772 -94.10655970549404, 43.26385430406772 -93.79391332773493, 42.68313142750305 -93.79391332773493, 42.68313142750305 -93.4812669499758, 42.102408550938385 -93.4812669499758, 42.102408550938385 -93.1686205722167, 41.521685674373714 -93.1686205722167, 41.521685674373714 -92.85597419445757, 40.94096279780905 -92.85597419445757, 40.94096279780905 -92.54332781669845, 40.36023992124438 -92.54332781669845, 40.36023992124438 -92.23068143893934, 40.06987848296205 -92.23068143893934, 40.06987848296205 -91.91803506118022, 39.48915560639738 -91.91803506118022, 39.48915560639738 -91.60538868342111, 38.90843272983271 -91.60538868342111, 38.90843272983271 -91.29274230566199, 38.32770985326805 -91.29274230566199, 38.32770985326805 -90.98009592790288, 37.16626410013871 -90.98009592790288, 37.16626410013871 -90.66744955014376, 35.714456908727044 -90.66744955014376, 35.714456908727044 -90.35480317238465, 34.26264971731538 -90.35480317238465, 34.26264971731538 -90.04215679462553, 32.52048108762137 -90.04215679462553, 32.52048108762137 -89.7295104168664, 30.48795101964504 -89.7295104168664, 30.48795101964504 -89.4168640391073, 28.165059513386367 -89.4168640391073, 28.165059513386367 -89.10421766134817, 26.422890883692364 -89.10421766134817, 26.422890883692364 -89.4168640391073, 25.26144513056303 -89.4168640391073, 25.26144513056303 -89.7295104168664, 24.39036081571603 -89.7295104168664, 24.39036081571603 -90.04215679462553, 23.228915062586694 -90.04215679462553, 23.228915062586694 -90.35480317238465, 22.357830747739694 -90.35480317238465, 22.357830747739694 -90.66744955014376, 21.19638499461036 -90.66744955014376, 21.19638499461036 -90.98009592790288, 20.32530067976336 -90.98009592790288, 20.32530067976336 -91.29274230566199, 19.74457780319869 -91.29274230566199), 
+  (47.61927587830272 -150.69555407989412, 47.61927587830272 -150.382907702135, 47.32891444002039 -150.382907702135, 47.32891444002039 -149.75761494661677, 47.03855300173806 -149.75761494661677, 47.03855300173806 -149.13232219109852, 46.74819156345572 -149.13232219109852, 46.74819156345572 -148.5070294355803, 46.45783012517339 -148.5070294355803, 46.45783012517339 -147.88173668006206, 46.167468686891056 -147.88173668006206, 46.167468686891056 -147.56909030230295, 45.87710724860872 -147.56909030230295, 45.87710724860872 -146.9437975467847, 45.58674581032639 -146.9437975467847, 45.58674581032639 -146.6311511690256, 45.29638437204405 -146.6311511690256, 45.29638437204405 -146.3185047912665, 45.00602293376172 -146.3185047912665, 45.00602293376172 -145.69321203574825, 44.71566149547939 -145.69321203574825, 44.71566149547939 -145.38056565798914, 44.425300057197056 -145.38056565798914, 44.425300057197056 -145.06791928023, 44.13493861891472 -145.06791928023, 44.13493861891472 -144.7552729024709, 43.844577180632385 -144.7552729024709, 43.844577180632385 -144.44262652471178, 43.55421574235005 -144.44262652471178, 43.55421574235005 -144.12998014695268, 43.26385430406772 -144.12998014695268, 43.26385430406772 -143.81733376919354, 42.68313142750305 -143.81733376919354, 42.68313142750305 -143.50468739143443, 42.39276998922072 -143.50468739143443, 42.39276998922072 -143.19204101367532, 41.81204711265605 -143.19204101367532, 41.81204711265605 -142.8793946359162, 41.521685674373714 -142.8793946359162, 41.521685674373714 -142.56674825815708, 40.94096279780905 -142.56674825815708, 40.94096279780905 -142.25410188039797, 40.06987848296205 -142.25410188039797, 40.06987848296205 -141.94145550263886, 39.48915560639738 -141.94145550263886, 39.48915560639738 -141.62880912487972, 38.61807129155038 -141.62880912487972, 38.61807129155038 -141.31616274712061, 38.32770985326805 -141.31616274712061, 38.32770985326805 -141.62880912487972, 38.037348414985715 -141.62880912487972, 38.037348414985715 -142.56674825815708, 37.746986976703376 -142.56674825815708, 37.746986976703376 -143.81733376919354, 37.456625538421044 -143.81733376919354, 37.456625538421044 -145.06791928023, 37.16626410013871 -145.06791928023, 37.16626410013871 -146.6311511690256, 36.87590266185638 -146.6311511690256, 36.87590266185638 -147.88173668006206, 36.58554122357405 -147.88173668006206, 36.58554122357405 -149.75761494661677, 36.29517978529171 -149.75761494661677, 36.29517978529171 -151.32084683541234, 36.004818347009376 -151.32084683541234, 36.004818347009376 -152.88407872420794), 
+  (297.3301128011097 -85.35246112823879, 296.16866704798036 -85.35246112823879, 296.16866704798036 -85.6651075059979, 295.00722129485104 -85.6651075059979, 295.00722129485104 -85.97775388375702, 293.5554141034394 -85.97775388375702, 293.5554141034394 -86.29040026151613, 292.39396835031005 -86.29040026151613, 292.39396835031005 -86.60304663927525, 291.23252259718066 -86.60304663927525, 291.23252259718066 -86.91569301703436, 289.780715405769 -86.91569301703436, 289.780715405769 -87.22833939479348, 288.32890821435734 -87.22833939479348, 288.32890821435734 -87.5409857725526, 286.8771010229457 -87.5409857725526, 286.8771010229457 -87.85363215031171, 284.84457095496936 -87.85363215031171, 284.84457095496936 -88.16627852807083, 283.10240232527536 -88.16627852807083, 283.10240232527536 -88.47892490582994, 281.3602336955813 -88.47892490582994, 281.3602336955813 -88.79157128358906, 279.90842650416965 -88.79157128358906, 279.90842650416965 -89.10421766134817, 278.456619312758 -89.10421766134817, 278.456619312758 -89.4168640391073, 277.29517355962867 -89.4168640391073, 277.29517355962867 -89.7295104168664, 275.5530049299347 -89.7295104168664, 275.5530049299347 -89.4168640391073, 274.39155917680534 -89.4168640391073, 274.39155917680534 -89.10421766134817, 273.230113423676 -89.10421766134817, 273.230113423676 -88.79157128358906, 272.0686676705467 -88.79157128358906, 272.0686676705467 -88.47892490582994, 270.9072219174173 -88.47892490582994, 270.9072219174173 -88.16627852807083, 269.45541472600564 -88.16627852807083, 269.45541472600564 -87.85363215031171, 268.003607534594 -87.85363215031171, 268.003607534594 -87.5409857725526, 266.5518003431823 -87.5409857725526, 266.5518003431823 -87.22833939479348, 265.09999315177066 -87.22833939479348, 265.09999315177066 -86.91569301703436, 263.93854739864133 -86.91569301703436, 263.93854739864133 -86.60304663927525, 262.777101645512 -86.60304663927525, 262.777101645512 -86.29040026151613, 261.906017330665 -86.29040026151613, 261.906017330665 -85.97775388375702, 260.7445715775356 -85.97775388375702, 260.7445715775356 -85.6651075059979, 259.8734872626886 -85.6651075059979, 259.8734872626886 -85.35246112823879, 258.7120415095593 -85.35246112823879, 258.7120415095593 -85.03981475047966, 257.8409571947123 -85.03981475047966, 257.8409571947123 -84.72716837272054, 256.679511441583 -84.72716837272054, 256.679511441583 -84.41452199496143, 255.80842712673598 -84.41452199496143, 255.80842712673598 -84.10187561720231, 254.64698137360665 -84.10187561720231, 254.64698137360665 -83.7892292394432, 253.19517418219496 -83.7892292394432, 253.19517418219496 -84.10187561720231, 252.32408986734796 -84.10187561720231, 252.32408986734796 -84.41452199496143, 251.7433669907833 -84.41452199496143, 251.7433669907833 -84.72716837272054, 251.16264411421864 -84.72716837272054, 251.16264411421864 -85.03981475047966, 250.29155979937164 -85.03981475047966, 250.29155979937164 -85.35246112823879, 249.71083692280698 -85.35246112823879, 249.71083692280698 -85.6651075059979, 248.83975260795998 -85.6651075059979, 248.83975260795998 -85.97775388375702, 247.67830685483062 -85.97775388375702, 247.67830685483062 -86.29040026151613, 246.22649966341896 -86.29040026151613, 246.22649966341896 -86.60304663927525, 243.3228852805956 -86.60304663927525, 243.3228852805956 -86.29040026151613, 242.16143952746629 -86.29040026151613, 242.16143952746629 -85.97775388375702, 241.87107808918395 -85.97775388375702, 241.87107808918395 -85.6651075059979, 241.58071665090162 -85.6651075059979, 241.58071665090162 -85.35246112823879, 240.99999377433696 -85.35246112823879, 240.99999377433696 -85.03981475047966, 240.70963233605463 -85.03981475047966, 240.70963233605463 -84.72716837272054, 240.12890945948996 -84.72716837272054, 240.12890945948996 -84.41452199496143, 239.83854802120763 -84.41452199496143, 239.83854802120763 -84.10187561720231, 239.25782514464296 -84.10187561720231, 239.25782514464296 -83.7892292394432, 238.6771022680783 -83.7892292394432, 238.6771022680783 -83.47658286168408, 238.38674082979597 -83.47658286168408, 238.38674082979597 -83.16393648392497, 237.80601795323128 -83.16393648392497, 237.80601795323128 -82.85129010616585, 237.2252950766666 -82.85129010616585, 237.2252950766666 -82.53864372840673, 236.64457220010195 -82.53864372840673, 236.64457220010195 -82.22599735064762, 236.06384932353728 -82.22599735064762, 236.06384932353728 -81.9133509728885, 235.1927650086903 -81.9133509728885, 235.1927650086903 -81.60070459512939, 234.61204213212562 -81.60070459512939, 234.61204213212562 -81.28805821737026, 233.74095781727863 -81.28805821737026, 233.74095781727863 -80.97541183961116, 232.8698735024316 -80.97541183961116, 232.8698735024316 -80.66276546185203, 231.9987891875846 -80.66276546185203, 231.9987891875846 -80.35011908409292, 231.1277048727376 -80.35011908409292, 231.1277048727376 -80.0374727063338, 229.96625911960828 -80.0374727063338, 229.96625911960828 -79.72482632857468, 228.80481336647895 -79.72482632857468, 228.80481336647895 -79.41217995081557, 227.35300617506726 -79.41217995081557, 227.35300617506726 -79.09953357305645, 226.19156042193794 -79.09953357305645, 226.19156042193794 -78.78688719529734, 224.73975323052628 -78.78688719529734, 224.73975323052628 -78.47424081753822, 223.28794603911462 -78.47424081753822, 223.28794603911462 -78.16159443977911, 221.5457774094206 -78.16159443977911, 221.5457774094206 -77.84894806201999, 220.09397021800893 -77.84894806201999, 220.09397021800893 -77.53630168426088, 219.51324734144427 -77.53630168426088, 219.51324734144427 -77.84894806201999, 218.64216302659727 -77.84894806201999, 218.64216302659727 -78.16159443977911, 217.77107871175025 -78.16159443977911, 217.77107871175025 -78.47424081753822, 217.19035583518558 -78.47424081753822, 217.19035583518558 -78.78688719529734, 216.89999439690325 -78.78688719529734, 216.89999439690325 -79.09953357305645, 216.3192715203386 -79.09953357305645, 216.3192715203386 -79.41217995081557, 216.02891008205626 -79.41217995081557, 216.02891008205626 -79.72482632857468, 215.4481872054916 -79.72482632857468, 215.4481872054916 -80.0374727063338, 215.15782576720926 -80.0374727063338), 
+  (4.355421574235005 -101.92271914947194, 4.065060135952671 -101.92271914947194, 4.065060135952671 -102.23536552723107, 3.774698697670338 -102.23536552723107, 3.774698697670338 -102.8606582827493, 3.4843372593880044 -102.8606582827493, 3.4843372593880044 -103.17330466050842, 3.1939758211056706 -103.17330466050842, 3.1939758211056706 -103.48595103826753, 2.9036143828233367 -103.48595103826753, 2.9036143828233367 -104.11124379378576, 2.6132529445410033 -104.11124379378576, 2.6132529445410033 -104.42389017154488, 2.3228915062586695 -104.42389017154488, 2.3228915062586695 -104.73653654930399, 2.0325300679763356 -104.73653654930399, 2.0325300679763356 -105.36182930482224, 1.7421686296940022 -105.36182930482224, 1.7421686296940022 -105.67447568258135, 1.4518071914116684 -105.67447568258135, 1.4518071914116684 -105.98712206034047, 1.1614457531293347 -105.98712206034047, 1.1614457531293347 -106.6124148158587, 0.8710843148470011 -106.6124148158587, 0.8710843148470011 -106.92506119361781, 0.5807228765646674 -106.92506119361781, 0.5807228765646674 -107.55035394913605, 0.2903614382823337 -107.55035394913605, 0.2903614382823337 -107.86300032689516, 0 -107.86300032689516), 
+  (193.38071789603424 -82.22599735064762, 192.21927214290488 -82.22599735064762, 192.21927214290488 -82.53864372840673, 191.05782638977556 -82.53864372840673, 191.05782638977556 -82.85129010616585, 189.6060191983639 -82.85129010616585, 189.6060191983639 -83.16393648392497, 188.15421200695224 -83.16393648392497, 188.15421200695224 -83.47658286168408, 186.70240481554055 -83.47658286168408, 186.70240481554055 -83.7892292394432, 184.96023618584655 -83.7892292394432, 184.96023618584655 -84.10187561720231, 182.92770611787023 -84.10187561720231, 182.92770611787023 -84.41452199496143, 181.47589892645854 -84.41452199496143, 181.47589892645854 -84.72716837272054, 180.3144531733292 -84.72716837272054, 180.3144531733292 -85.03981475047966, 179.15300742019988 -85.03981475047966, 179.15300742019988 -85.35246112823879, 178.2819231053529 -85.35246112823879, 178.2819231053529 -85.6651075059979, 177.70120022878822 -85.6651075059979, 177.70120022878822 -85.97775388375702, 177.12047735222356 -85.97775388375702, 177.12047735222356 -86.29040026151613, 176.53975447565887 -86.29040026151613, 176.53975447565887 -86.60304663927525, 175.9590315990942 -86.60304663927525, 175.9590315990942 -86.91569301703436, 175.37830872252954 -86.91569301703436, 175.37830872252954 -87.22833939479348, 174.79758584596487 -87.22833939479348, 174.79758584596487 -87.5409857725526, 173.92650153111788 -87.5409857725526, 173.92650153111788 -87.85363215031171, 172.47469433970622 -87.85363215031171, 172.47469433970622 -88.16627852807083, 171.31324858657686 -88.16627852807083, 171.31324858657686 -88.47892490582994, 170.15180283344753 -88.47892490582994, 170.15180283344753 -88.79157128358906, 168.69999564203587 -88.79157128358906, 168.69999564203587 -89.10421766134817, 167.53854988890654 -89.10421766134817, 167.53854988890654 -89.4168640391073, 166.08674269749486 -89.4168640391073, 166.08674269749486 -89.7295104168664, 164.6349355060832 -89.7295104168664, 164.6349355060832 -90.04215679462553, 163.18312831467154 -90.04215679462553, 163.18312831467154 -90.35480317238465, 162.0216825615422 -90.35480317238465, 162.0216825615422 -90.66744955014376, 160.56987537013052 -90.66744955014376, 160.56987537013052 -90.98009592790288, 159.4084296170012 -90.98009592790288, 159.4084296170012 -91.29274230566199, 157.95662242558953 -91.29274230566199, 157.95662242558953 -91.60538868342111, 156.50481523417787 -91.60538868342111, 156.50481523417787 -91.91803506118022, 155.05300804276618 -91.91803506118022, 155.05300804276618 -92.23068143893934, 153.3108394130722 -92.23068143893934, 153.3108394130722 -92.54332781669845, 151.5686707833782 -92.54332781669845, 151.5686707833782 -92.85597419445757, 150.40722503024884 -92.85597419445757, 150.40722503024884 -93.1686205722167, 149.2457792771195 -93.1686205722167, 149.2457792771195 -93.4812669499758, 148.08433352399018 -93.4812669499758, 148.08433352399018 -93.79391332773493, 146.92288777086085 -93.79391332773493, 146.92288777086085 -94.10655970549404, 145.7614420177315 -94.10655970549404, 145.7614420177315 -94.41920608325316, 144.30963482631984 -94.41920608325316, 144.30963482631984 -94.73185246101227, 143.1481890731905 -94.73185246101227, 143.1481890731905 -95.04449883877139, 141.69638188177885 -95.04449883877139, 141.69638188177885 -95.35714521653051, 140.24457469036716 -95.35714521653051, 140.24457469036716 -95.66979159428962, 138.7927674989555 -95.66979159428962, 138.7927674989555 -95.98243797204874, 137.34096030754384 -95.98243797204874, 137.34096030754384 -96.29508434980785, 135.59879167784982 -96.29508434980785, 135.59879167784982 -96.60773072756697, 133.85662304815583 -96.60773072756697, 133.85662304815583 -96.92037710532608, 132.11445441846183 -96.92037710532608, 132.11445441846183 -97.2330234830852, 129.50120147392082 -97.2330234830852, 129.50120147392082 -97.54566986084433, 128.04939428250916 -97.54566986084433, 128.04939428250916 -97.2330234830852, 125.72650277625048 -97.2330234830852, 125.72650277625048 -96.92037710532608, 123.69397270827415 -96.92037710532608, 123.69397270827415 -96.60773072756697, 121.95180407858015 -96.60773072756697, 121.95180407858015 -96.29508434980785, 120.20963544888615 -96.29508434980785, 120.20963544888615 -95.98243797204874, 118.46746681919214 -95.98243797204874, 118.46746681919214 -95.66979159428962, 110.62770798556913 -95.66979159428962, 110.62770798556913 -95.35714521653051, 106.56264784961647 -95.35714521653051, 106.56264784961647 -95.04449883877139, 105.98192497305179 -95.04449883877139, 105.98192497305179 -95.35714521653051, 101.6265033988168 -95.35714521653051, 101.6265033988168 -95.66979159428962, 95.81927463317011 -95.66979159428962, 95.81927463317011 -95.35714521653051, 94.65782888004078 -95.35714521653051, 94.65782888004078 -95.66979159428962, 93.20602168862911 -95.66979159428962, 93.20602168862911 -95.98243797204874, 91.46385305893511 -95.98243797204874, 91.46385305893511 -96.29508434980785, 90.01204586752344 -96.29508434980785, 90.01204586752344 -96.60773072756697, 88.26987723782943 -96.60773072756697, 88.26987723782943 -96.92037710532608, 86.52770860813544 -96.92037710532608, 86.52770860813544 -97.2330234830852, 85.07590141672377 -97.2330234830852, 85.07590141672377 -97.54566986084433, 83.33373278702977 -97.54566986084433, 83.33373278702977 -97.85831623860344, 81.59156415733577 -97.85831623860344, 81.59156415733577 -98.17096261636256, 79.84939552764176 -98.17096261636256, 79.84939552764176 -98.48360899412167, 78.68794977451243 -98.48360899412167, 78.68794977451243 -98.79625537188079, 77.23614258310076 -98.79625537188079, 77.23614258310076 -99.1089017496399, 76.07469682997143 -99.1089017496399, 76.07469682997143 -99.42154812739902, 75.20361251512442 -99.42154812739902, 75.20361251512442 -99.73419450515813, 74.33252820027742 -99.73419450515813, 74.33252820027742 -100.04684088291725, 73.46144388543043 -100.04684088291725, 73.46144388543043 -100.35948726067637, 72.59035957058342 -100.35948726067637), 
+  (112.0795151769808 -211.3489513651627, 112.0795151769808 -209.16042672084887, 111.78915373869847 -209.16042672084887, 111.78915373869847 -206.34660932101684, 111.49879230041614 -206.34660932101684, 111.49879230041614 -203.8454382989439, 111.2084308621338 -203.8454382989439, 111.2084308621338 -201.65691365463007, 110.91806942385146 -201.65691365463007, 110.91806942385146 -199.7810353880754, 110.62770798556913 -199.7810353880754, 110.62770798556913 -197.9051571215207, 110.3373465472868 -197.9051571215207, 110.3373465472868 -196.34192523272512, 110.04698510900447 -196.34192523272512, 110.04698510900447 -194.77869334392952, 109.75662367072213 -194.77869334392952, 109.75662367072213 -193.21546145513395, 109.4662622324398 -193.21546145513395, 109.4662622324398 -191.96487594409749, 109.17590079415747 -191.96487594409749, 109.17590079415747 -190.71429043306102, 108.88553935587512 -190.71429043306102, 108.88553935587512 -189.46370492202453, 108.59517791759279 -189.46370492202453, 108.59517791759279 -188.5257657887472, 108.30481647931046 -188.5257657887472, 108.30481647931046 -187.27518027771072, 108.01445504102813 -187.27518027771072, 108.01445504102813 -186.3372411444334, 107.7240936027458 -186.3372411444334, 107.7240936027458 -185.39930201115604, 107.43373216446346 -185.39930201115604, 107.43373216446346 -184.46136287787868, 107.14337072618113 -184.46136287787868, 107.14337072618113 -183.52342374460133, 106.8530092878988 -183.52342374460133, 106.8530092878988 -182.8981309890831, 106.56264784961647 -182.8981309890831, 106.56264784961647 -181.96019185580576, 106.27228641133412 -181.96019185580576, 106.27228641133412 -181.64754547804662, 101.33614196053446 -181.64754547804662, 101.33614196053446 -181.33489910028752, 99.59397333084046 -181.33489910028752, 99.59397333084046 -181.0222527225284, 98.72288901599346 -181.0222527225284, 98.72288901599346 -180.7096063447693, 98.14216613942878 -180.7096063447693, 98.14216613942878 -180.39695996701016, 97.56144326286412 -180.39695996701016, 97.56144326286412 -180.08431358925105, 97.27108182458178 -180.08431358925105, 97.27108182458178 -179.77166721149194, 96.69035894801712 -179.77166721149194, 96.69035894801712 -179.4590208337328, 96.39999750973479 -179.4590208337328, 96.39999750973479 -179.1463744559737, 96.10963607145244 -179.1463744559737, 96.10963607145244 -178.8337280782146, 95.81927463317011 -178.8337280782146, 95.81927463317011 -178.20843532269635, 95.52891319488778 -178.20843532269635, 95.52891319488778 -177.89578894493724, 95.23855175660545 -177.89578894493724, 95.23855175660545 -177.58314256717813, 94.94819031832311 -177.58314256717813, 94.94819031832311 -176.95784981165988, 94.65782888004078 -176.95784981165988, 94.65782888004078 -176.33255705614167, 94.36746744175845 -176.33255705614167, 94.36746744175845 -175.70726430062342, 94.07710600347612 -175.70726430062342, 94.07710600347612 -175.0819715451052, 93.78674456519379 -175.0819715451052, 93.78674456519379 -174.76932516734607, 93.49638312691144 -174.76932516734607, 93.49638312691144 -174.14403241182785, 93.20602168862911 -174.14403241182785, 93.20602168862911 -173.5187396563096, 92.91566025034678 -173.5187396563096, 92.91566025034678 -172.8934469007914, 92.62529881206444 -172.8934469007914, 92.62529881206444 -172.26815414527314, 92.33493737378211 -172.26815414527314, 92.33493737378211 -171.6428613897549, 92.04457593549978 -171.6428613897549, 92.04457593549978 -171.3302150119958, 91.75421449721745 -171.3302150119958, 91.75421449721745 -170.70492225647757, 91.46385305893511 -170.70492225647757, 91.46385305893511 -170.07962950095933, 91.17349162065278 -170.07962950095933, 91.17349162065278 -169.45433674544108, 90.88313018237044 -169.45433674544108, 90.88313018237044 -169.14169036768197, 90.5927687440881 -169.14169036768197, 90.5927687440881 -168.51639761216376, 90.30240730580577 -168.51639761216376, 90.30240730580577 -167.8911048566455, 90.01204586752344 -167.8911048566455, 90.01204586752344 -167.26581210112727, 89.72168442924111 -167.26581210112727, 89.72168442924111 -166.95316572336816, 89.43132299095878 -166.95316572336816, 89.43132299095878 -166.32787296784994, 89.14096155267644 -166.32787296784994, 89.14096155267644 -165.7025802123317, 88.85060011439411 -165.7025802123317, 88.85060011439411 -165.07728745681345, 88.56023867611178 -165.07728745681345, 88.56023867611178 -164.76464107905434, 88.26987723782943 -164.76464107905434, 88.26987723782943 -164.13934832353613, 87.9795157995471 -164.13934832353613, 87.9795157995471 -163.51405556801788, 87.68915436126477 -163.51405556801788, 87.68915436126477 -163.20140919025877, 87.39879292298244 -163.20140919025877, 87.39879292298244 -162.57611643474053, 87.1084314847001 -162.57611643474053, 87.1084314847001 -161.9508236792223, 86.81807004641777 -161.9508236792223, 86.81807004641777 -161.63817730146317, 86.52770860813544 -161.63817730146317, 86.52770860813544 -161.01288454594496, 86.23734716985311 -161.01288454594496, 86.23734716985311 -160.70023816818585, 85.94698573157078 -160.70023816818585, 85.94698573157078 -160.0749454126676, 85.65662429328843 -160.0749454126676, 85.65662429328843 -159.44965265714936, 85.3662628550061 -159.44965265714936, 85.3662628550061 -159.13700627939025, 85.07590141672377 -159.13700627939025, 85.07590141672377 -158.51171352387203, 84.78553997844143 -158.51171352387203, 84.78553997844143 -158.1990671461129, 84.4951785401591 -158.1990671461129, 84.4951785401591 -157.57377439059468, 84.20481710187677 -157.57377439059468, 84.20481710187677 -157.26112801283554, 83.91445566359444 -157.26112801283554, 83.91445566359444 -156.63583525731732, 83.6240942253121 -156.63583525731732, 83.6240942253121 -156.32318887955822, 83.33373278702977 -156.32318887955822, 83.33373278702977 -156.01054250179908, 83.04337134874743 -156.01054250179908, 83.04337134874743 -155.69789612403997, 82.46264847218276 -155.69789612403997, 82.46264847218276 -155.38524974628086, 82.17228703390043 -155.38524974628086, 82.17228703390043 -155.07260336852175, 81.59156415733577 -155.07260336852175, 81.59156415733577 -154.75995699076262, 81.30120271905344 -154.75995699076262, 81.30120271905344 -154.4473106130035, 81.0108412807711 -154.4473106130035, 81.0108412807711 -154.1346642352444, 80.43011840420642 -154.1346642352444, 80.43011840420642 -153.82201785748526, 80.1397569659241 -153.82201785748526, 80.1397569659241 -153.50937147972616, 79.55903408935943 -153.50937147972616, 79.55903408935943 -153.19672510196705, 79.2686726510771 -153.19672510196705, 79.2686726510771 -152.88407872420794, 78.68794977451243 -152.88407872420794, 78.68794977451243 -152.5714323464488, 78.10722689794775 -152.5714323464488, 78.10722689794775 -152.2587859686897, 77.81686545966542 -152.2587859686897, 77.81686545966542 -151.94613959093058, 77.23614258310076 -151.94613959093058, 77.23614258310076 -151.63349321317145, 76.94578114481843 -151.63349321317145, 76.94578114481843 -151.32084683541234, 76.36505826825376 -151.32084683541234, 76.36505826825376 -151.00820045765323, 75.7843353916891 -151.00820045765323, 75.7843353916891 -150.69555407989412, 75.49397395340675 -150.69555407989412, 75.49397395340675 -150.382907702135, 74.91325107684209 -150.382907702135, 74.91325107684209 -150.07026132437588, 74.62288963855976 -150.07026132437588, 74.62288963855976 -149.75761494661677, 74.04216676199509 -149.75761494661677, 74.04216676199509 -149.44496856885763, 73.46144388543043 -149.44496856885763, 73.46144388543043 -149.13232219109852, 73.1710824471481 -149.13232219109852, 73.1710824471481 -148.81967581333942, 72.59035957058342 -148.81967581333942), 
+  (198.02650090855158 -81.9133509728885, 197.73613947026925 -81.9133509728885, 197.73613947026925 -81.60070459512939, 197.44577803198692 -81.60070459512939, 197.44577803198692 -81.28805821737026, 197.15541659370456 -81.28805821737026, 197.15541659370456 -80.97541183961116, 196.28433227885756 -80.97541183961116, 196.28433227885756 -81.28805821737026, 195.41324796401057 -81.28805821737026, 195.41324796401057 -81.60070459512939), 
+  (72.29999813230108 -148.19438305782117, 72.00963669401875 -148.19438305782117, 72.00963669401875 -147.88173668006206, 71.71927525573642 -147.88173668006206, 71.71927525573642 -147.56909030230295, 71.42891381745409 -147.56909030230295, 71.42891381745409 -147.25644392454382, 71.13855237917176 -147.25644392454382, 71.13855237917176 -146.9437975467847, 70.84819094088942 -146.9437975467847, 70.84819094088942 -146.6311511690256, 70.55782950260709 -146.6311511690256, 70.55782950260709 -146.3185047912665, 70.26746806432475 -146.3185047912665, 70.26746806432475 -146.00585841350735, 69.97710662604241 -146.00585841350735, 69.97710662604241 -145.69321203574825, 69.68674518776008 -145.69321203574825, 69.68674518776008 -145.38056565798914, 69.39638374947775 -145.38056565798914, 69.39638374947775 -145.06791928023, 69.10602231119542 -145.06791928023, 69.10602231119542 -144.7552729024709, 68.81566087291309 -144.7552729024709, 68.81566087291309 -144.12998014695268, 68.52529943463075 -144.12998014695268, 68.52529943463075 -143.81733376919354, 68.23493799634842 -143.81733376919354, 68.23493799634842 -143.50468739143443, 67.94457655806609 -143.50468739143443, 67.94457655806609 -143.19204101367532, 67.65421511978374 -143.19204101367532, 67.65421511978374 -142.8793946359162, 67.36385368150141 -142.8793946359162, 67.36385368150141 -142.56674825815708, 67.07349224321908 -142.56674825815708, 67.07349224321908 -142.25410188039797, 66.78313080493675 -142.25410188039797, 66.78313080493675 -141.94145550263886, 66.49276936665441 -141.94145550263886, 66.49276936665441 -141.31616274712061, 66.20240792837208 -141.31616274712061, 66.20240792837208 -141.0035163693615, 65.91204649008975 -141.0035163693615, 65.91204649008975 -140.6908699916024, 65.62168505180742 -140.6908699916024, 65.62168505180742 -140.37822361384326, 65.33132361352507 -140.37822361384326, 65.33132361352507 -140.06557723608415, 65.04096217524274 -140.06557723608415, 65.04096217524274 -139.75293085832504, 64.75060073696041 -139.75293085832504, 64.75060073696041 -139.4402844805659, 64.46023929867808 -139.4402844805659, 64.46023929867808 -138.8149917250477, 64.16987786039574 -138.8149917250477, 64.16987786039574 -138.50234534728858, 63.87951642211341 -138.50234534728858, 63.87951642211341 -138.18969896952945, 63.58915498383108 -138.18969896952945, 63.58915498383108 -137.87705259177034, 63.29879354554874 -137.87705259177034, 63.29879354554874 -137.56440621401123, 63.00843210726641 -137.56440621401123, 63.00843210726641 -137.2517598362521, 62.718070668984076 -137.2517598362521, 62.718070668984076 -136.93911345849298, 62.427709230701744 -136.93911345849298, 62.427709230701744 -136.62646708073387, 62.137347792419405 -136.62646708073387, 62.137347792419405 -136.00117432521563, 61.84698635413707 -136.00117432521563, 61.84698635413707 -135.68852794745652, 61.55662491585474 -135.68852794745652, 61.55662491585474 -135.3758815696974, 61.26626347757241 -135.3758815696974, 61.26626347757241 -135.0632351919383, 60.97590203929008 -135.0632351919383, 60.97590203929008 -134.75058881417917, 60.10481772444307 -134.75058881417917, 60.10481772444307 -134.43794243642006, 58.653010533031406 -134.43794243642006, 58.653010533031406 -134.12529605866095, 57.20120334161974 -134.12529605866095, 57.20120334161974 -134.43794243642006, 55.74939615020807 -134.43794243642006, 55.74939615020807 -134.75058881417917, 55.1686732736434 -134.75058881417917, 55.1686732736434 -135.0632351919383, 54.587950397078735 -135.0632351919383, 54.587950397078735 -135.3758815696974, 54.297588958796396 -135.3758815696974, 54.297588958796396 -135.68852794745652, 54.007227520514064 -135.68852794745652, 54.007227520514064 -136.00117432521563, 53.71686608223173 -136.00117432521563, 53.71686608223173 -136.31382070297477, 53.4265046439494 -136.31382070297477, 53.4265046439494 -136.62646708073387, 53.13614320566706 -136.62646708073387, 53.13614320566706 -136.93911345849298, 52.84578176738473 -136.93911345849298, 52.84578176738473 -137.56440621401123, 52.5554203291024 -137.56440621401123, 52.5554203291024 -138.18969896952945, 52.265058890820065 -138.18969896952945, 52.265058890820065 -138.8149917250477, 51.97469745253773 -138.8149917250477, 51.97469745253773 -139.4402844805659, 51.68433601425539 -139.4402844805659, 51.68433601425539 -140.37822361384326, 51.39397457597306 -140.37822361384326, 51.39397457597306 -141.31616274712061, 51.10361313769073 -141.31616274712061, 51.10361313769073 -142.56674825815708, 50.8132516994084 -142.56674825815708, 50.8132516994084 -144.12998014695268, 50.52289026112606 -144.12998014695268, 50.52289026112606 -146.3185047912665, 50.232528822843726 -146.3185047912665, 50.232528822843726 -148.81967581333942, 49.942167384561394 -148.81967581333942, 49.942167384561394 -151.00820045765323), 
+  (95.23855175660545 -236.04801520813288, 95.23855175660545 -227.29391663087762, 94.94819031832311 -227.29391663087762, 94.94819031832311 -215.1007078982721, 94.65782888004078 -215.1007078982721, 94.65782888004078 -220.10304994241795, 94.36746744175845 -220.10304994241795, 94.36746744175845 -225.1053919865638, 94.07710600347612 -225.1053919865638, 94.07710600347612 -229.79508765295057, 93.78674456519379 -229.79508765295057, 93.78674456519379 -231.67096591950525))MULTILINESTRING ((4.355421574235005 -38.76815084213044, 2.3228915062586695 -38.76815084213044, 2.3228915062586695 -39.080797219889554, 0 -39.080797219889554), 
+  (130.08192435048548 0, 130.08192435048548 -0.3126463777591164, 130.66264722705014 -0.3126463777591164, 130.66264722705014 -0.6252927555182328, 130.9530086653325 -0.6252927555182328, 130.9530086653325 -0.9379391332773492, 131.24337010361484 -0.9379391332773492, 131.24337010361484 -1.2505855110364656, 131.53373154189717 -1.2505855110364656, 131.53373154189717 -1.563231888795582, 131.8240929801795 -1.563231888795582, 131.8240929801795 -2.8138173998320477, 131.53373154189717 -2.8138173998320477, 131.53373154189717 -3.126463777591164, 131.24337010361484 -3.126463777591164, 131.24337010361484 -3.4391101553502805, 130.9530086653325 -3.4391101553502805, 130.9530086653325 -3.751756533109397, 130.08192435048548 -3.751756533109397, 130.08192435048548 -4.064402910868513, 129.21084003563848 -4.064402910868513, 129.21084003563848 -4.37704928862763, 128.3397557207915 -4.37704928862763, 128.3397557207915 -4.689695666386746, 127.17830996766216 -4.689695666386746, 127.17830996766216 -5.002342044145863, 125.72650277625048 -5.002342044145863, 125.72650277625048 -5.314988421904979, 123.98433414655648 -5.314988421904979, 123.98433414655648 -5.627634799664095, 121.95180407858015 -5.627634799664095, 121.95180407858015 -5.940281177423212, 119.62891257232148 -5.940281177423212, 119.62891257232148 -6.252927555182328, 117.30602106606281 -6.252927555182328, 117.30602106606281 -6.565573932941445, 114.98312955980414 -6.565573932941445, 114.98312955980414 -6.878220310700561, 112.66023805354547 -6.878220310700561, 112.66023805354547 -7.1908666884596775, 109.75662367072213 -7.1908666884596775, 109.75662367072213 -7.503513066218794, 106.8530092878988 -7.503513066218794, 106.8530092878988 -7.81615944397791, 104.2397563433578 -7.81615944397791, 104.2397563433578 -8.128805821737027, 101.6265033988168 -8.128805821737027, 101.6265033988168 -8.441452199496144, 98.72288901599346 -8.441452199496144, 98.72288901599346 -8.75409857725526, 95.81927463317011 -8.75409857725526, 95.81927463317011 -9.066744955014375, 93.20602168862911 -9.066744955014375, 93.20602168862911 -9.379391332773492, 90.30240730580577 -9.379391332773492, 90.30240730580577 -9.69203771053261, 87.39879292298244 -9.69203771053261, 87.39879292298244 -10.004684088291725, 84.4951785401591 -10.004684088291725, 84.4951785401591 -10.31733046605084, 81.0108412807711 -10.31733046605084, 81.0108412807711 -10.629976843809958, 77.23614258310076 -10.629976843809958, 77.23614258310076 -10.942623221569075, 73.46144388543043 -10.942623221569075, 73.46144388543043 -11.25526959932819, 72.59035957058342 -11.25526959932819), 
+  (72.29999813230108 -11.25526959932819, 69.10602231119542 -11.25526959932819, 69.10602231119542 -11.567915977087306, 64.46023929867808 -11.567915977087306, 64.46023929867808 -11.880562354846424, 59.5240948478784 -11.880562354846424, 59.5240948478784 -12.193208732605541, 54.87831183536107 -12.193208732605541, 54.87831183536107 -12.505855110364656, 49.36144450799673 -12.505855110364656, 49.36144450799673 -12.818501488123772, 45.00602293376172 -12.818501488123772, 45.00602293376172 -13.13114786588289, 40.65060135952672 -13.13114786588289, 40.65060135952672 -13.443794243642007, 36.004818347009376 -13.443794243642007, 36.004818347009376 -13.756440621401122, 31.359035334492038 -13.756440621401122, 31.359035334492038 -14.069086999160238, 26.422890883692364 -14.069086999160238, 26.422890883692364 -14.381733376919355, 23.228915062586694 -14.381733376919355, 23.228915062586694 -14.694379754678472, 20.32530067976336 -14.694379754678472, 20.32530067976336 -15.007026132437588, 19.74457780319869 -15.007026132437588), 
+  (4.355421574235005 -15.319672510196703, 4.065060135952671 -15.319672510196703, 4.065060135952671 -15.63231888795582, 0 -15.63231888795582), 
+  (297.3301128011097 -58.464872640954766, 297.03975136282736 -58.464872640954766, 297.03975136282736 -58.77751901871389, 296.16866704798036 -58.77751901871389, 296.16866704798036 -59.090165396473004, 295.29758273313337 -59.090165396473004, 295.29758273313337 -59.40281177423212, 294.42649841828637 -59.40281177423212, 294.42649841828637 -59.715458151991236, 293.5554141034394 -59.715458151991236, 293.5554141034394 -60.02810452975035, 292.6843297885924 -60.02810452975035, 292.6843297885924 -60.34075090750947, 291.8132454737453 -60.34075090750947, 291.8132454737453 -60.65339728526858, 290.94216115889833 -60.65339728526858, 290.94216115889833 -60.9660436630277, 290.07107684405133 -60.9660436630277, 290.07107684405133 -61.27869004078681, 289.19999252920434 -61.27869004078681, 289.19999252920434 -61.591336418545936, 288.32890821435734 -61.591336418545936, 288.32890821435734 -61.90398279630505, 278.456619312758 -61.90398279630505, 278.456619312758 -62.21662917406417, 275.843366368217 -62.21662917406417, 275.843366368217 -61.90398279630505, 274.6819206150877 -61.90398279630505, 274.6819206150877 -61.591336418545936, 273.52047486195835 -61.591336418545936, 273.52047486195835 -61.27869004078681, 272.0686676705467 -61.27869004078681, 272.0686676705467 -60.9660436630277, 270.9072219174173 -60.9660436630277, 270.9072219174173 -60.65339728526858, 269.45541472600564 -60.65339728526858, 269.45541472600564 -60.34075090750947, 268.003607534594 -60.34075090750947, 268.003607534594 -60.02810452975035, 266.5518003431823 -60.02810452975035, 266.5518003431823 -59.715458151991236, 265.09999315177066 -59.715458151991236, 265.09999315177066 -59.40281177423212, 263.06746308379434 -59.40281177423212, 263.06746308379434 -59.090165396473004, 260.7445715775356 -59.090165396473004, 260.7445715775356 -58.77751901871389, 258.42168007127697 -58.77751901871389, 258.42168007127697 -58.464872640954766, 256.38915000330064 -58.464872640954766, 256.38915000330064 -58.15222626319565, 254.06625849704199 -58.15222626319565, 254.06625849704199 -57.839579885436535, 250.29155979937164 -57.839579885436535, 250.29155979937164 -57.52693350767742, 245.93613822513663 -57.52693350767742, 245.93613822513663 -57.214287129918304, 241.87107808918395 -57.214287129918304, 241.87107808918395 -56.90164075215919, 238.0963793915136 -56.90164075215919, 238.0963793915136 -56.58899437440007, 234.90240357040796 -56.58899437440007, 234.90240357040796 -56.27634799664095, 231.70842774930227 -56.27634799664095, 231.70842774930227 -55.963701618881835, 230.2566205578906 -55.963701618881835, 230.2566205578906 -55.65105524112272, 229.09517480476129 -55.65105524112272, 229.09517480476129 -55.338408863363604, 227.93372905163193 -55.338408863363604, 227.93372905163193 -55.02576248560449, 226.7722832985026 -55.02576248560449, 226.7722832985026 -54.71311610784537, 225.61083754537327 -54.71311610784537, 225.61083754537327 -54.40046973008626, 224.44939179224394 -54.40046973008626, 224.44939179224394 -54.08782335232714, 223.28794603911462 -54.08782335232714, 223.28794603911462 -53.775176974568026, 221.83613884770293 -53.775176974568026, 221.83613884770293 -53.462530596808904, 220.38433165629127 -53.462530596808904, 220.38433165629127 -53.14988421904979, 218.9325244648796 -53.14988421904979, 218.9325244648796 -52.83723784129067, 217.19035583518558 -52.83723784129067, 217.19035583518558 -52.52459146353156, 214.86746432892693 -52.52459146353156, 214.86746432892693 -52.21194508577244, 211.67348850782125 -52.21194508577244, 211.67348850782125 -51.899298708013326, 201.8011996062219 -51.899298708013326, 201.8011996062219 -51.58665233025421, 198.60722378511625 -51.58665233025421, 198.60722378511625 -51.27400595249509, 195.99397084057523 -51.27400595249509, 195.99397084057523 -51.58665233025421, 194.54216364916357 -51.58665233025421, 194.54216364916357 -51.899298708013326, 193.0903564577519 -51.899298708013326, 193.0903564577519 -52.21194508577244, 191.63854926634022 -52.21194508577244, 191.63854926634022 -52.52459146353156, 190.4771035132109 -52.52459146353156, 190.4771035132109 -52.83723784129067, 189.02529632179923 -52.83723784129067, 189.02529632179923 -53.14988421904979, 187.8638505686699 -53.14988421904979, 187.8638505686699 -53.462530596808904, 186.41204337725821 -53.462530596808904, 186.41204337725821 -53.775176974568026, 185.2505976241289 -53.775176974568026, 185.2505976241289 -54.08782335232714, 184.3795133092819 -54.08782335232714, 184.3795133092819 -54.40046973008626, 183.21806755615256 -54.40046973008626, 183.21806755615256 -54.71311610784537, 182.05662180302323 -54.71311610784537, 182.05662180302323 -55.02576248560449, 180.89517604989388 -55.02576248560449, 180.89517604989388 -55.338408863363604, 179.73373029676455 -55.338408863363604, 179.73373029676455 -55.65105524112272, 178.86264598191755 -55.65105524112272, 178.86264598191755 -55.963701618881835, 177.70120022878822 -55.963701618881835, 177.70120022878822 -56.27634799664095, 176.53975447565887 -56.27634799664095, 176.53975447565887 -56.58899437440007, 175.37830872252954 -56.58899437440007, 175.37830872252954 -56.90164075215919, 174.2168629694002 -56.90164075215919, 174.2168629694002 -57.214287129918304, 169.8614413951652 -57.214287129918304, 169.8614413951652 -57.52693350767742, 165.21565838264786 -57.52693350767742, 165.21565838264786 -57.839579885436535, 158.82770674043653 -57.839579885436535, 158.82770674043653 -58.15222626319565, 139.08312893723783 -58.15222626319565, 139.08312893723783 -57.839579885436535, 136.1795145544145 -57.839579885436535, 136.1795145544145 -57.52693350767742, 134.14698448643816 -57.52693350767742, 134.14698448643816 -57.214287129918304, 132.11445441846183 -57.214287129918304, 132.11445441846183 -56.90164075215919, 130.66264722705014 -56.90164075215919, 130.66264722705014 -56.58899437440007, 129.21084003563848 -56.58899437440007, 129.21084003563848 -56.27634799664095, 128.04939428250916 -56.27634799664095, 128.04939428250916 -55.963701618881835, 126.59758709109748 -55.963701618881835, 126.59758709109748 -55.65105524112272, 125.43614133796815 -55.65105524112272, 125.43614133796815 -55.338408863363604, 124.56505702312116 -55.338408863363604, 124.56505702312116 -55.02576248560449, 123.40361126999181 -55.02576248560449, 123.40361126999181 -54.71311610784537, 122.24216551686249 -54.71311610784537, 122.24216551686249 -54.40046973008626, 121.37108120201547 -54.40046973008626, 121.37108120201547 -54.08782335232714, 120.20963544888615 -54.08782335232714, 120.20963544888615 -53.775176974568026, 119.33855113403915 -53.775176974568026, 119.33855113403915 -53.462530596808904, 118.17710538090981 -53.462530596808904, 118.17710538090981 -53.14988421904979, 116.4349367512158 -53.14988421904979, 116.4349367512158 -52.83723784129067, 113.8216838066748 -52.83723784129067, 113.8216838066748 -52.52459146353156, 111.49879230041614 -52.52459146353156, 111.49879230041614 -52.21194508577244, 109.75662367072213 -52.21194508577244, 109.75662367072213 -51.899298708013326, 108.01445504102813 -51.899298708013326, 108.01445504102813 -51.58665233025421, 106.8530092878988 -51.58665233025421, 106.8530092878988 -51.27400595249509, 102.78794915194612 -51.27400595249509, 102.78794915194612 -50.96135957473597, 96.69035894801712 -50.96135957473597, 96.69035894801712 -50.64871319697686, 93.20602168862911 -50.64871319697686, 93.20602168862911 -50.96135957473597, 89.72168442924111 -50.96135957473597, 89.72168442924111 -51.27400595249509, 87.39879292298244 -51.27400595249509, 87.39879292298244 -51.58665233025421, 85.3662628550061 -51.58665233025421, 85.3662628550061 -51.899298708013326, 83.91445566359444 -51.899298708013326, 83.91445566359444 -52.21194508577244, 76.07469682997143 -52.21194508577244, 76.07469682997143 -52.52459146353156, 72.59035957058342 -52.52459146353156), 
+  (72.29999813230108 -52.52459146353156, 69.68674518776008 -52.52459146353156, 69.68674518776008 -52.21194508577244, 67.36385368150141 -52.21194508577244, 67.36385368150141 -51.899298708013326, 65.04096217524274 -51.899298708013326, 65.04096217524274 -51.58665233025421, 62.718070668984076 -51.58665233025421, 62.718070668984076 -51.27400595249509, 60.68554060100774 -51.27400595249509, 60.68554060100774 -50.96135957473597, 59.5240948478784 -50.96135957473597, 59.5240948478784 -50.64871319697686, 58.653010533031406 -50.64871319697686, 58.653010533031406 -50.33606681921774, 57.7819262181844 -50.33606681921774, 57.7819262181844 -50.023420441458626, 56.9108419033374 -50.023420441458626, 56.9108419033374 -49.71077406369951, 56.0397575884904 -49.71077406369951, 56.0397575884904 -49.398127685940395, 55.1686732736434 -49.398127685940395, 55.1686732736434 -49.08548130818128, 54.297588958796396 -49.08548130818128, 54.297588958796396 -48.772834930422164, 53.71686608223173 -48.772834930422164, 53.71686608223173 -48.46018855266304, 52.84578176738473 -48.46018855266304, 52.84578176738473 -48.147542174903926, 52.265058890820065 -48.147542174903926, 52.265058890820065 -47.83489579714481, 51.39397457597306 -47.83489579714481, 51.39397457597306 -47.522249419385695, 50.8132516994084 -47.522249419385695, 50.8132516994084 -47.20960304162658, 50.232528822843726 -47.20960304162658, 50.232528822843726 -46.89695666386746, 49.36144450799673 -46.89695666386746, 49.36144450799673 -46.58431028610835, 48.490360193149726 -46.58431028610835, 48.490360193149726 -46.271663908349225, 47.32891444002039 -46.271663908349225, 47.32891444002039 -45.95901753059011, 46.167468686891056 -45.95901753059011, 46.167468686891056 -45.646371152830994, 45.00602293376172 -45.646371152830994, 45.00602293376172 -45.33372477507188, 44.13493861891472 -45.33372477507188, 44.13493861891472 -45.02107839731276, 42.97349286578539 -45.02107839731276, 42.97349286578539 -44.70843201955365, 42.102408550938385 -44.70843201955365, 42.102408550938385 -44.39578564179453, 40.94096279780905 -44.39578564179453, 40.94096279780905 -44.08313926403542, 40.06987848296205 -44.08313926403542, 40.06987848296205 -43.7704928862763, 38.90843272983271 -43.7704928862763, 38.90843272983271 -43.45784650851718, 38.037348414985715 -43.45784650851718, 38.037348414985715 -43.14520013075806, 36.87590266185638 -43.14520013075806, 36.87590266185638 -42.83255375299895, 35.42409547044471 -42.83255375299895, 35.42409547044471 -42.51990737523983, 34.26264971731538 -42.51990737523983, 34.26264971731538 -42.20726099748072, 32.81084252590371 -42.20726099748072, 32.81084252590371 -41.8946146197216, 31.068673896209702 -41.8946146197216, 31.068673896209702 -41.581968241962485, 29.616866704798035 -41.581968241962485, 29.616866704798035 -41.26932186420336, 27.5843366368217 -41.26932186420336, 27.5843366368217 -40.95667548644425, 23.51927650086903 -40.95667548644425, 23.51927650086903 -41.26932186420336, 21.19638499461036 -41.26932186420336, 21.19638499461036 -41.581968241962485, 20.034939241481023 -41.581968241962485, 20.034939241481023 -41.8946146197216, 19.74457780319869 -41.8946146197216))MULTILINESTRING ((297.3301128011097 -76.59836255098352, 297.03975136282736 -76.59836255098352, 297.03975136282736 -76.91100892874263, 295.87830560969803 -76.91100892874263, 295.87830560969803 -77.22365530650175, 295.00722129485104 -77.22365530650175, 295.00722129485104 -77.53630168426088, 293.8457755417217 -77.53630168426088, 293.8457755417217 -77.84894806201999, 292.9746912268747 -77.84894806201999, 292.9746912268747 -78.16159443977911, 291.8132454737453 -78.16159443977911, 291.8132454737453 -78.47424081753822, 290.94216115889833 -78.47424081753822, 290.94216115889833 -78.78688719529734, 289.780715405769 -78.78688719529734, 289.780715405769 -79.09953357305645, 288.6192696526397 -79.09953357305645, 288.6192696526397 -79.41217995081557, 287.45782389951034 -79.41217995081557, 287.45782389951034 -79.72482632857468, 284.2638480784047 -79.72482632857468, 284.2638480784047 -80.0374727063338, 281.069872257299 -80.0374727063338, 281.069872257299 -80.35011908409292, 278.7469807510403 -80.35011908409292, 278.7469807510403 -80.66276546185203, 277.00481212134633 -80.66276546185203, 277.00481212134633 -80.97541183961116, 276.13372780649934 -80.97541183961116, 276.13372780649934 -80.66276546185203, 274.6819206150877 -80.66276546185203, 274.6819206150877 -80.35011908409292, 273.52047486195835 -80.35011908409292, 273.52047486195835 -80.0374727063338, 272.359029108829 -80.0374727063338, 272.359029108829 -79.72482632857468, 270.9072219174173 -79.72482632857468, 270.9072219174173 -79.41217995081557, 269.45541472600564 -79.41217995081557, 269.45541472600564 -79.09953357305645, 268.003607534594 -79.09953357305645, 268.003607534594 -78.78688719529734, 266.5518003431823 -78.78688719529734, 266.5518003431823 -78.47424081753822, 264.80963171348833 -78.47424081753822, 264.80963171348833 -78.16159443977911, 263.648185960359 -78.16159443977911, 263.648185960359 -77.84894806201999, 262.4867402072297 -77.84894806201999, 262.4867402072297 -77.53630168426088, 261.03493301581796 -77.53630168426088, 261.03493301581796 -77.22365530650175, 259.8734872626886 -77.22365530650175, 259.8734872626886 -76.91100892874263, 258.7120415095593 -76.91100892874263, 258.7120415095593 -76.59836255098352, 257.26023431814764 -76.59836255098352, 257.26023431814764 -76.2857161732244, 256.0987885650183 -76.2857161732244, 256.0987885650183 -75.97306979546529, 254.64698137360665 -75.97306979546529, 254.64698137360665 -75.66042341770617, 251.45300555250097 -75.66042341770617, 251.45300555250097 -75.97306979546529, 245.35541534857197 -75.97306979546529, 245.35541534857197 -75.66042341770617, 242.74216240403095 -75.66042341770617, 242.74216240403095 -75.34777703994706, 241.58071665090162 -75.34777703994706, 241.58071665090162 -75.03513066218794, 240.4192708977723 -75.03513066218794, 240.4192708977723 -74.72248428442882, 239.25782514464296 -74.72248428442882, 239.25782514464296 -74.40983790666971, 237.80601795323128 -74.40983790666971, 237.80601795323128 -74.09719152891059, 236.35421076181962 -74.09719152891059, 236.35421076181962 -73.78454515115148, 234.90240357040796 -73.78454515115148, 234.90240357040796 -73.47189877339235, 233.4505963789963 -73.47189877339235, 233.4505963789963 -73.15925239563325, 231.70842774930227 -73.15925239563325, 231.70842774930227 -72.84660601787412, 230.2566205578906 -72.84660601787412, 230.2566205578906 -72.533959640115, 228.80481336647895 -72.533959640115, 228.80481336647895 -72.22131326235589, 227.6433676133496 -72.22131326235589, 227.6433676133496 -71.90866688459677, 226.19156042193794 -71.90866688459677, 226.19156042193794 -71.59602050683766, 224.44939179224394 -71.59602050683766, 224.44939179224394 -71.28337412907854, 222.99758460083228 -71.28337412907854, 222.99758460083228 -70.97072775131943, 221.25541597113826 -70.97072775131943, 221.25541597113826 -70.65808137356031, 219.22288590316194 -70.65808137356031, 219.22288590316194 -70.3454349958012, 197.15541659370456 -70.3454349958012, 197.15541659370456 -70.03278861804208, 196.86505515542223 -70.03278861804208, 196.86505515542223 -70.3454349958012, 195.7036094022929 -70.3454349958012, 195.7036094022929 -70.65808137356031, 194.54216364916357 -70.65808137356031, 194.54216364916357 -70.97072775131943, 193.38071789603424 -70.97072775131943, 193.38071789603424 -71.28337412907854, 192.21927214290488 -71.28337412907854, 192.21927214290488 -71.59602050683766, 191.3481878280579 -71.59602050683766, 191.3481878280579 -71.90866688459677, 190.18674207492856 -71.90866688459677, 190.18674207492856 -72.22131326235589, 189.02529632179923 -72.22131326235589, 189.02529632179923 -72.533959640115, 188.15421200695224 -72.533959640115, 188.15421200695224 -72.84660601787412, 186.99276625382288 -72.84660601787412, 186.99276625382288 -73.15925239563325, 186.12168193897588 -73.15925239563325, 186.12168193897588 -73.47189877339235, 184.96023618584655 -73.47189877339235, 184.96023618584655 -73.78454515115148, 184.08915187099956 -73.78454515115148, 184.08915187099956 -74.09719152891059, 183.21806755615256 -74.09719152891059, 183.21806755615256 -74.40983790666971, 182.34698324130557 -74.40983790666971, 182.34698324130557 -74.72248428442882, 181.47589892645854 -74.72248428442882, 181.47589892645854 -75.03513066218794, 180.60481461161154 -75.03513066218794, 180.60481461161154 -75.34777703994706, 179.73373029676455 -75.34777703994706, 179.73373029676455 -75.66042341770617, 178.86264598191755 -75.66042341770617, 178.86264598191755 -75.97306979546529, 177.99156166707056 -75.97306979546529, 177.99156166707056 -76.2857161732244, 177.12047735222356 -76.2857161732244, 177.12047735222356 -76.59836255098352, 176.24939303737654 -76.59836255098352, 176.24939303737654 -76.91100892874263, 175.66867016081187 -76.91100892874263, 175.66867016081187 -77.22365530650175, 174.79758584596487 -77.22365530650175, 174.79758584596487 -77.53630168426088, 173.34577865455321 -77.53630168426088, 173.34577865455321 -77.84894806201999, 171.6036100248592 -77.84894806201999, 171.6036100248592 -78.16159443977911, 169.57107995688287 -78.16159443977911, 169.57107995688287 -78.47424081753822, 167.53854988890654 -78.47424081753822, 167.53854988890654 -78.78688719529734, 165.5060198209302 -78.78688719529734, 165.5060198209302 -79.09953357305645, 163.18312831467154 -79.09953357305645, 163.18312831467154 -79.41217995081557, 160.86023680841285 -79.41217995081557, 160.86023680841285 -79.72482632857468, 158.5373453021542 -79.72482632857468, 158.5373453021542 -80.0374727063338, 155.92409235761318 -80.0374727063338, 155.92409235761318 -80.35011908409292, 153.02047797478986 -80.35011908409292, 153.02047797478986 -80.66276546185203, 150.1168635919665 -80.66276546185203, 150.1168635919665 -80.97541183961116, 147.50361064742552 -80.97541183961116, 147.50361064742552 -81.28805821737026, 144.30963482631984 -81.28805821737026, 144.30963482631984 -81.60070459512939, 140.24457469036716 -81.60070459512939, 140.24457469036716 -81.9133509728885, 133.5662616098735 -81.9133509728885, 133.5662616098735 -81.60070459512939, 129.50120147392082 -81.60070459512939, 129.50120147392082 -81.28805821737026, 127.46867140594449 -81.28805821737026, 127.46867140594449 -80.97541183961116, 125.72650277625048 -80.97541183961116, 125.72650277625048 -80.66276546185203, 124.27469558483881 -80.66276546185203, 124.27469558483881 -80.35011908409292, 122.82288839342715 -80.35011908409292, 122.82288839342715 -80.0374727063338, 121.37108120201547 -80.0374727063338, 121.37108120201547 -79.72482632857468, 119.91927401060381 -79.72482632857468, 119.91927401060381 -79.41217995081557, 118.46746681919214 -79.41217995081557, 118.46746681919214 -79.09953357305645, 116.14457531293347 -79.09953357305645, 116.14457531293347 -78.78688719529734, 112.36987661526314 -78.78688719529734, 112.36987661526314 -78.47424081753822, 109.4662622324398 -78.47424081753822, 109.4662622324398 -78.16159443977911, 107.14337072618113 -78.16159443977911, 107.14337072618113 -77.84894806201999, 91.75421449721745 -77.84894806201999, 91.75421449721745 -78.16159443977911, 88.26987723782943 -78.16159443977911, 88.26987723782943 -78.47424081753822, 85.65662429328843 -78.47424081753822, 85.65662429328843 -78.78688719529734, 80.43011840420642 -78.78688719529734, 80.43011840420642 -79.09953357305645, 74.62288963855976 -79.09953357305645, 74.62288963855976 -79.41217995081557, 72.59035957058342 -79.41217995081557), 
+  (4.355421574235005 -76.91100892874263, 3.774698697670338 -76.91100892874263, 3.774698697670338 -77.22365530650175, 3.4843372593880044 -77.22365530650175, 3.4843372593880044 -77.53630168426088, 2.9036143828233367 -77.53630168426088, 2.9036143828233367 -77.84894806201999, 2.3228915062586695 -77.84894806201999, 2.3228915062586695 -78.16159443977911, 2.0325300679763356 -78.16159443977911, 2.0325300679763356 -78.47424081753822, 1.4518071914116684 -78.47424081753822, 1.4518071914116684 -78.78688719529734, 1.1614457531293347 -78.78688719529734, 1.1614457531293347 -79.09953357305645, 0.5807228765646674 -79.09953357305645, 0.5807228765646674 -79.41217995081557, 0.2903614382823337 -79.41217995081557, 0.2903614382823337 -79.72482632857468, 0 -79.72482632857468), 
+  (72.29999813230108 -79.41217995081557, 70.26746806432475 -79.41217995081557, 70.26746806432475 -79.09953357305645, 67.65421511978374 -79.09953357305645, 67.65421511978374 -78.78688719529734, 65.04096217524274 -78.78688719529734, 65.04096217524274 -78.47424081753822, 62.427709230701744 -78.47424081753822, 62.427709230701744 -78.16159443977911, 60.395179162725405 -78.16159443977911, 60.395179162725405 -77.84894806201999, 58.94337197131374 -77.84894806201999, 58.94337197131374 -77.53630168426088, 57.7819262181844 -77.53630168426088, 57.7819262181844 -77.22365530650175, 56.330119026772735 -77.22365530650175, 56.330119026772735 -76.91100892874263, 55.1686732736434 -76.91100892874263, 55.1686732736434 -76.59836255098352, 54.007227520514064 -76.59836255098352, 54.007227520514064 -76.2857161732244, 53.13614320566706 -76.2857161732244, 53.13614320566706 -75.97306979546529, 51.97469745253773 -75.97306979546529, 51.97469745253773 -75.66042341770617, 51.10361313769073 -75.66042341770617, 51.10361313769073 -75.34777703994706, 50.232528822843726 -75.34777703994706, 50.232528822843726 -75.03513066218794, 49.07108306971439 -75.03513066218794, 49.07108306971439 -74.72248428442882, 47.61927587830272 -74.72248428442882, 47.61927587830272 -74.40983790666971, 46.45783012517339 -74.40983790666971, 46.45783012517339 -74.09719152891059, 45.00602293376172 -74.09719152891059, 45.00602293376172 -73.78454515115148, 43.55421574235005 -73.78454515115148, 43.55421574235005 -73.47189877339235, 42.39276998922072 -73.47189877339235, 42.39276998922072 -73.15925239563325, 41.23132423609138 -73.15925239563325, 41.23132423609138 -72.84660601787412, 40.06987848296205 -72.84660601787412, 40.06987848296205 -72.533959640115, 38.90843272983271 -72.533959640115, 38.90843272983271 -72.22131326235589, 37.16626410013871 -72.22131326235589, 37.16626410013871 -71.90866688459677, 35.13373403216237 -71.90866688459677, 35.13373403216237 -71.59602050683766, 33.10120396418604 -71.59602050683766, 33.10120396418604 -71.28337412907854, 30.48795101964504 -71.28337412907854, 30.48795101964504 -70.97072775131943, 25.26144513056303 -70.97072775131943, 25.26144513056303 -71.28337412907854, 23.80963793915136 -71.28337412907854, 23.80963793915136 -71.59602050683766, 22.648192186022026 -71.59602050683766, 22.648192186022026 -71.90866688459677, 21.777107871175026 -71.90866688459677, 21.777107871175026 -72.22131326235589, 20.61566211804569 -72.22131326235589, 20.61566211804569 -72.533959640115, 19.74457780319869 -72.533959640115))MULTILINESTRING ((297.3301128011097 -98.17096261636256, 295.00722129485104 -98.17096261636256, 295.00722129485104 -98.48360899412167, 290.07107684405133 -98.48360899412167, 290.07107684405133 -98.79625537188079, 287.167462461228 -98.79625537188079, 287.167462461228 -99.1089017496399, 286.0060167080987 -99.1089017496399, 286.0060167080987 -99.42154812739902, 284.84457095496936 -99.42154812739902, 284.84457095496936 -99.73419450515813, 283.97348664012236 -99.73419450515813, 283.97348664012236 -100.04684088291725, 282.81204088699303 -100.04684088291725, 282.81204088699303 -100.35948726067637, 281.940956572146 -100.35948726067637, 281.940956572146 -100.67213363843548, 281.069872257299 -100.67213363843548, 281.069872257299 -100.9847800161946, 280.198787942452 -100.9847800161946, 280.198787942452 -101.29742639395371, 279.327703627605 -101.29742639395371, 279.327703627605 -101.61007277171284, 278.456619312758 -101.61007277171284, 278.456619312758 -101.92271914947194, 277.87589643619333 -101.92271914947194, 277.87589643619333 -102.23536552723107, 277.00481212134633 -102.23536552723107, 277.00481212134633 -102.54801190499018, 275.5530049299347 -102.54801190499018, 275.5530049299347 -102.23536552723107, 274.39155917680534 -102.23536552723107, 274.39155917680534 -101.92271914947194, 272.9397519853937 -101.92271914947194, 272.9397519853937 -101.61007277171284, 271.77830623226436 -101.61007277171284, 271.77830623226436 -101.29742639395371, 270.32649904085264 -101.29742639395371, 270.32649904085264 -100.9847800161946, 268.874691849441 -100.9847800161946, 268.874691849441 -100.67213363843548, 267.4228846580293 -100.67213363843548, 267.4228846580293 -100.35948726067637, 265.6807160283353 -100.35948726067637, 265.6807160283353 -100.04684088291725, 264.22890883692367 -100.04684088291725, 264.22890883692367 -99.73419450515813, 263.35782452207667 -99.73419450515813, 263.35782452207667 -99.42154812739902, 262.4867402072297 -99.42154812739902, 262.4867402072297 -99.1089017496399, 261.6156558923827 -99.1089017496399, 261.6156558923827 -98.79625537188079, 260.7445715775356 -98.79625537188079, 260.7445715775356 -98.48360899412167, 259.8734872626886 -98.48360899412167, 259.8734872626886 -98.17096261636256, 259.00240294784163 -98.17096261636256, 259.00240294784163 -97.85831623860344, 258.13131863299463 -97.85831623860344, 258.13131863299463 -97.54566986084433, 257.26023431814764 -97.54566986084433, 257.26023431814764 -97.2330234830852, 256.38915000330064 -97.2330234830852, 256.38915000330064 -96.92037710532608, 255.80842712673598 -96.92037710532608, 255.80842712673598 -96.60773072756697, 254.93734281188898 -96.60773072756697, 254.93734281188898 -96.29508434980785, 254.06625849704199 -96.29508434980785, 254.06625849704199 -95.98243797204874, 253.4855356204773 -95.98243797204874, 253.4855356204773 -96.60773072756697, 253.19517418219496 -96.60773072756697, 253.19517418219496 -96.92037710532608, 252.90481274391263 -96.92037710532608, 252.90481274391263 -97.54566986084433, 252.6144513056303 -97.54566986084433, 252.6144513056303 -97.85831623860344, 252.32408986734796 -97.85831623860344, 252.32408986734796 -98.48360899412167, 252.03372842906563 -98.48360899412167, 252.03372842906563 -98.79625537188079, 251.7433669907833 -98.79625537188079, 251.7433669907833 -99.42154812739902, 251.45300555250097 -99.42154812739902, 251.45300555250097 -100.04684088291725, 251.16264411421864 -100.04684088291725, 251.16264411421864 -100.35948726067637, 250.8722826759363 -100.35948726067637, 250.8722826759363 -100.9847800161946, 250.58192123765397 -100.9847800161946, 250.58192123765397 -101.61007277171284, 250.29155979937164 -101.61007277171284, 250.29155979937164 -102.23536552723107, 250.0011983610893 -102.23536552723107, 250.0011983610893 -102.54801190499018, 249.71083692280698 -102.54801190499018, 249.71083692280698 -103.17330466050842, 249.42047548452464 -103.17330466050842, 249.42047548452464 -103.79859741602665, 249.1301140462423 -103.79859741602665, 249.1301140462423 -104.42389017154488, 248.83975260795998 -104.42389017154488, 248.83975260795998 -105.04918292706311, 248.54939116967762 -105.04918292706311, 248.54939116967762 -105.67447568258135, 248.2590297313953 -105.67447568258135, 248.2590297313953 -105.98712206034047, 247.96866829311296 -105.98712206034047, 247.96866829311296 -106.6124148158587, 247.67830685483062 -106.6124148158587, 247.67830685483062 -107.23770757137693, 247.3879454165483 -107.23770757137693, 247.3879454165483 -107.86300032689516, 247.09758397826596 -107.86300032689516, 247.09758397826596 -108.48829308241339, 246.80722253998363 -108.48829308241339, 246.80722253998363 -109.11358583793162, 246.5168611017013 -109.11358583793162, 246.5168611017013 -109.73887859344985, 246.22649966341896 -109.73887859344985, 246.22649966341896 -110.3641713489681, 245.93613822513663 -110.3641713489681, 245.93613822513663 -110.98946410448633, 245.6457767868543 -110.98946410448633), 
+  (186.12168193897588 -106.92506119361781, 185.83132050069355 -106.92506119361781, 185.83132050069355 -106.6124148158587, 185.54095906241122 -106.6124148158587, 185.54095906241122 -105.98712206034047, 185.2505976241289 -105.98712206034047, 185.2505976241289 -105.67447568258135, 184.96023618584655 -105.67447568258135, 184.96023618584655 -105.04918292706311, 184.66987474756422 -105.04918292706311, 184.66987474756422 -104.73653654930399, 184.3795133092819 -104.73653654930399, 184.3795133092819 -104.42389017154488, 184.08915187099956 -104.42389017154488, 184.08915187099956 -104.11124379378576, 183.79879043271723 -104.11124379378576, 183.79879043271723 -103.79859741602665, 183.5084289944349 -103.79859741602665, 183.5084289944349 -103.48595103826753, 183.21806755615256 -103.48595103826753, 183.21806755615256 -103.17330466050842, 182.92770611787023 -103.17330466050842, 182.92770611787023 -102.8606582827493, 182.34698324130557 -102.8606582827493, 182.34698324130557 -102.54801190499018, 181.47589892645854 -102.54801190499018, 181.47589892645854 -102.23536552723107, 178.2819231053529 -102.23536552723107, 178.2819231053529 -102.54801190499018, 177.99156166707056 -102.54801190499018, 177.99156166707056 -102.8606582827493, 177.70120022878822 -102.8606582827493, 177.70120022878822 -103.17330466050842, 177.12047735222356 -103.17330466050842, 177.12047735222356 -103.48595103826753, 176.8301159139412 -103.48595103826753, 176.8301159139412 -103.79859741602665, 176.53975447565887 -103.79859741602665, 176.53975447565887 -104.11124379378576, 175.9590315990942 -104.11124379378576, 175.9590315990942 -104.42389017154488, 175.66867016081187 -104.42389017154488, 175.66867016081187 -104.73653654930399, 175.37830872252954 -104.73653654930399, 175.37830872252954 -105.04918292706311, 174.79758584596487 -105.04918292706311, 174.79758584596487 -105.36182930482224, 174.50722440768254 -105.36182930482224, 174.50722440768254 -105.67447568258135, 174.2168629694002 -105.67447568258135, 174.2168629694002 -105.98712206034047, 173.63614009283555 -105.98712206034047, 173.63614009283555 -106.29976843809958, 173.05541721627088 -106.29976843809958, 173.05541721627088 -106.6124148158587, 172.47469433970622 -106.6124148158587, 172.47469433970622 -106.92506119361781, 171.89397146314155 -106.92506119361781, 171.89397146314155 -107.23770757137693, 171.6036100248592 -107.23770757137693, 171.6036100248592 -107.55035394913605, 171.02288714829453 -107.55035394913605, 171.02288714829453 -107.86300032689516, 170.44216427172987 -107.86300032689516, 170.44216427172987 -108.17564670465428, 170.15180283344753 -108.17564670465428, 170.15180283344753 -108.48829308241339, 169.57107995688287 -108.48829308241339, 169.57107995688287 -108.80093946017251, 168.9903570803182 -108.80093946017251, 168.9903570803182 -109.11358583793162, 168.69999564203587 -109.11358583793162, 168.69999564203587 -109.42623221569075, 168.1192727654712 -109.42623221569075, 168.1192727654712 -109.73887859344985, 167.53854988890654 -109.73887859344985, 167.53854988890654 -110.05152497120898, 167.2481884506242 -110.05152497120898, 167.2481884506242 -110.3641713489681, 166.66746557405955 -110.3641713489681, 166.66746557405955 -110.67681772672721, 166.3771041357772 -110.67681772672721, 166.3771041357772 -110.98946410448633, 165.79638125921252 -110.98946410448633, 165.79638125921252 -111.30211048224544, 165.5060198209302 -111.30211048224544, 165.5060198209302 -111.61475686000456, 164.92529694436553 -111.61475686000456, 164.92529694436553 -111.92740323776367, 164.6349355060832 -111.92740323776367, 164.6349355060832 -112.24004961552279, 164.05421262951853 -112.24004961552279, 164.05421262951853 -112.5526959932819, 163.7638511912362 -112.5526959932819, 163.7638511912362 -112.86534237104102, 163.18312831467154 -112.86534237104102, 163.18312831467154 -113.17798874880015, 162.8927668763892 -113.17798874880015, 162.8927668763892 -113.49063512655925, 162.60240543810687 -113.49063512655925, 162.60240543810687 -113.80328150431838, 162.31204399982454 -113.80328150431838, 162.31204399982454 -114.11592788207749, 162.0216825615422 -114.11592788207749, 162.0216825615422 -114.42857425983661, 161.4409596849775 -114.42857425983661, 161.4409596849775 -114.74122063759572, 161.15059824669518 -114.74122063759572, 161.15059824669518 -115.05386701535484, 160.86023680841285 -115.05386701535484, 160.86023680841285 -115.36651339311396, 160.56987537013052 -115.36651339311396, 160.56987537013052 -115.67915977087307, 160.2795139318482 -115.67915977087307, 160.2795139318482 -115.9918061486322, 159.98915249356585 -115.9918061486322, 159.98915249356585 -116.3044525263913, 159.69879105528352 -116.3044525263913, 159.69879105528352 -116.61709890415042, 159.4084296170012 -116.61709890415042, 159.4084296170012 -116.92974528190953, 159.11806817871886 -116.92974528190953, 159.11806817871886 -117.24239165966866, 158.82770674043653 -117.24239165966866, 158.82770674043653 -117.55503803742778, 158.5373453021542 -117.55503803742778, 158.5373453021542 -118.18033079294601, 158.24698386387186 -118.18033079294601, 158.24698386387186 -118.49297717070512, 157.95662242558953 -118.49297717070512, 157.95662242558953 -118.80562354846424, 157.6662609873072 -118.80562354846424, 157.6662609873072 -119.11826992622335, 157.37589954902487 -119.11826992622335, 157.37589954902487 -119.43091630398247, 157.08553811074253 -119.43091630398247, 157.08553811074253 -120.0562090595007, 156.7951766724602 -120.0562090595007, 156.7951766724602 -120.36885543725982, 156.50481523417787 -120.36885543725982, 156.50481523417787 -120.99414819277806, 156.2144537958955 -120.99414819277806, 156.2144537958955 -121.30679457053716, 155.92409235761318 -121.30679457053716, 155.92409235761318 -121.9320873260554, 155.63373091933084 -121.9320873260554, 155.63373091933084 -122.55738008157363, 155.3433694810485 -122.55738008157363, 155.3433694810485 -123.18267283709187, 155.05300804276618 -123.18267283709187, 155.05300804276618 -123.8079655926101, 154.76264660448385 -123.8079655926101, 154.76264660448385 -124.74590472588744, 154.47228516620152 -124.74590472588744, 154.47228516620152 -125.6838438591648, 154.18192372791918 -125.6838438591648, 154.18192372791918 -126.93442937020126, 153.89156228963685 -126.93442937020126, 153.89156228963685 -129.43560039227418, 153.60120085135452 -129.43560039227418, 153.60120085135452 -134.12529605866095, 153.89156228963685 -134.12529605866095, 153.89156228963685 -139.4402844805659, 154.18192372791918 -139.4402844805659, 154.18192372791918 -141.0035163693615), 
+  (239.5481865829253 -103.48595103826753, 239.5481865829253 -103.17330466050842, 239.25782514464296 -103.17330466050842, 239.25782514464296 -102.54801190499018, 238.96746370636063 -102.54801190499018, 238.96746370636063 -101.92271914947194, 238.6771022680783 -101.92271914947194, 238.6771022680783 -101.29742639395371, 238.38674082979597 -101.29742639395371, 238.38674082979597 -100.67213363843548, 238.0963793915136 -100.67213363843548, 238.0963793915136 -100.04684088291725, 237.80601795323128 -100.04684088291725, 237.80601795323128 -99.42154812739902, 237.51565651494894 -99.42154812739902, 237.51565651494894 -98.79625537188079, 237.2252950766666 -98.79625537188079, 237.2252950766666 -98.48360899412167, 236.93493363838428 -98.48360899412167, 236.93493363838428 -97.85831623860344, 236.64457220010195 -97.85831623860344, 236.64457220010195 -97.54566986084433, 236.35421076181962 -97.54566986084433, 236.35421076181962 -96.92037710532608, 236.06384932353728 -96.92037710532608, 236.06384932353728 -96.60773072756697, 235.77348788525495 -96.60773072756697, 235.77348788525495 -96.29508434980785, 235.48312644697262 -96.29508434980785, 235.48312644697262 -95.66979159428962, 235.1927650086903 -95.66979159428962, 235.1927650086903 -95.35714521653051, 234.90240357040796 -95.35714521653051, 234.90240357040796 -95.04449883877139, 234.61204213212562 -95.04449883877139, 234.61204213212562 -94.73185246101227, 234.3216806938433 -94.73185246101227, 234.3216806938433 -94.41920608325316, 234.03131925556096 -94.41920608325316, 234.03131925556096 -94.10655970549404, 233.74095781727863 -94.10655970549404, 233.74095781727863 -93.79391332773493, 233.4505963789963 -93.79391332773493, 233.4505963789963 -93.4812669499758, 233.16023494071393 -93.4812669499758, 233.16023494071393 -93.1686205722167, 232.8698735024316 -93.1686205722167, 232.8698735024316 -92.85597419445757, 232.57951206414927 -92.85597419445757, 232.57951206414927 -92.54332781669845, 232.28915062586694 -92.54332781669845, 232.28915062586694 -92.23068143893934, 231.9987891875846 -92.23068143893934, 231.9987891875846 -91.91803506118022, 231.70842774930227 -91.91803506118022, 231.70842774930227 -91.60538868342111, 231.41806631101994 -91.60538868342111, 231.41806631101994 -91.29274230566199, 230.54698199617295 -91.29274230566199, 230.54698199617295 -90.98009592790288, 229.38553624304362 -90.98009592790288, 229.38553624304362 -90.66744955014376, 228.51445192819662 -90.66744955014376, 228.51445192819662 -90.35480317238465, 227.35300617506726 -90.35480317238465, 227.35300617506726 -90.04215679462553, 226.48192186022027 -90.04215679462553, 226.48192186022027 -89.7295104168664, 225.32047610709094 -89.7295104168664, 225.32047610709094 -89.4168640391073, 224.1590303539616 -89.4168640391073, 224.1590303539616 -89.10421766134817, 222.99758460083228 -89.10421766134817, 222.99758460083228 -88.79157128358906, 221.83613884770293 -88.79157128358906, 221.83613884770293 -88.47892490582994, 220.6746930945736 -88.47892490582994, 220.6746930945736 -88.16627852807083, 219.51324734144427 -88.16627852807083, 219.51324734144427 -88.79157128358906, 219.22288590316194 -88.79157128358906, 219.22288590316194 -89.4168640391073, 218.9325244648796 -89.4168640391073, 218.9325244648796 -90.04215679462553, 218.64216302659727 -90.04215679462553, 218.64216302659727 -90.66744955014376, 218.35180158831494 -90.66744955014376, 218.35180158831494 -91.29274230566199))MULTILINESTRING ((280.4891493807343 -146.6311511690256, 280.4891493807343 -144.12998014695268, 280.198787942452 -144.12998014695268, 280.198787942452 -142.56674825815708, 279.90842650416965 -142.56674825815708, 279.90842650416965 -141.31616274712061, 279.6180650658873 -141.31616274712061, 279.6180650658873 -140.37822361384326, 279.327703627605 -140.37822361384326, 279.327703627605 -139.4402844805659, 279.03734218932266 -139.4402844805659, 279.03734218932266 -138.50234534728858, 278.7469807510403 -138.50234534728858, 278.7469807510403 -137.87705259177034, 278.456619312758 -137.87705259177034, 278.456619312758 -137.56440621401123, 278.16625787447566 -137.56440621401123, 278.16625787447566 -136.93911345849298, 277.87589643619333 -136.93911345849298, 277.87589643619333 -136.62646708073387, 277.585534997911 -136.62646708073387, 277.585534997911 -136.00117432521563, 277.29517355962867 -136.00117432521563, 277.29517355962867 -135.68852794745652, 277.00481212134633 -135.68852794745652, 277.00481212134633 -135.3758815696974, 276.714450683064 -135.3758815696974, 276.714450683064 -135.0632351919383, 276.13372780649934 -135.0632351919383, 276.13372780649934 -135.3758815696974, 275.843366368217 -135.3758815696974, 275.843366368217 -136.00117432521563, 275.5530049299347 -136.00117432521563, 275.5530049299347 -136.62646708073387, 275.26264349165234 -136.62646708073387, 275.26264349165234 -137.2517598362521, 274.97228205337 -137.2517598362521, 274.97228205337 -137.87705259177034, 274.6819206150877 -137.87705259177034, 274.6819206150877 -138.8149917250477, 274.39155917680534 -138.8149917250477, 274.39155917680534 -139.4402844805659, 274.101197738523 -139.4402844805659, 274.101197738523 -140.37822361384326, 273.8108363002407 -140.37822361384326, 273.8108363002407 -141.31616274712061, 273.52047486195835 -141.31616274712061, 273.52047486195835 -142.56674825815708, 273.230113423676 -142.56674825815708, 273.230113423676 -144.12998014695268, 272.9397519853937 -144.12998014695268, 272.9397519853937 -145.69321203574825, 272.64939054711135 -145.69321203574825, 272.64939054711135 -147.88173668006206, 272.359029108829 -147.88173668006206, 272.359029108829 -156.32318887955822))MULTILINESTRING ((286.296378146381 0, 286.296378146381 -1.563231888795582, 286.58673958466335 -1.563231888795582, 286.58673958466335 -2.8138173998320477, 286.296378146381 -2.8138173998320477, 286.296378146381 -4.064402910868513, 286.0060167080987 -4.064402910868513, 286.0060167080987 -4.689695666386746, 285.71565526981635 -4.689695666386746, 285.71565526981635 -5.314988421904979, 285.425293831534 -5.314988421904979, 285.425293831534 -5.627634799664095, 285.1349323932517 -5.627634799664095, 285.1349323932517 -5.940281177423212, 284.84457095496936 -5.940281177423212, 284.84457095496936 -6.252927555182328, 284.554209516687 -6.252927555182328, 284.554209516687 -6.565573932941445, 284.2638480784047 -6.565573932941445, 284.2638480784047 -6.878220310700561, 283.97348664012236 -6.878220310700561, 283.97348664012236 -7.1908666884596775, 283.68312520184 -7.1908666884596775, 283.68312520184 -7.503513066218794, 283.3927637635577 -7.503513066218794, 283.3927637635577 -7.81615944397791, 282.81204088699303 -7.81615944397791, 282.81204088699303 -8.128805821737027, 282.5216794487107 -8.128805821737027, 282.5216794487107 -8.441452199496144, 281.940956572146 -8.441452199496144, 281.940956572146 -8.75409857725526, 281.65059513386365 -8.75409857725526, 281.65059513386365 -9.066744955014375, 281.069872257299 -9.066744955014375, 281.069872257299 -9.379391332773492, 280.4891493807343 -9.379391332773492, 280.4891493807343 -9.69203771053261, 279.90842650416965 -9.69203771053261, 279.90842650416965 -10.004684088291725, 279.6180650658873 -10.004684088291725, 279.6180650658873 -10.31733046605084, 279.03734218932266 -10.31733046605084, 279.03734218932266 -10.629976843809958, 278.456619312758 -10.629976843809958, 278.456619312758 -10.942623221569075, 277.87589643619333 -10.942623221569075, 277.87589643619333 -11.25526959932819, 277.29517355962867 -11.25526959932819, 277.29517355962867 -11.567915977087306, 276.714450683064 -11.567915977087306, 276.714450683064 -11.880562354846424, 275.5530049299347 -11.880562354846424, 275.5530049299347 -12.193208732605541, 274.101197738523 -12.193208732605541, 274.101197738523 -12.505855110364656, 272.64939054711135 -12.505855110364656, 272.64939054711135 -12.818501488123772, 271.19758335569963 -12.818501488123772, 271.19758335569963 -13.13114786588289, 269.745776164288 -13.13114786588289, 269.745776164288 -13.443794243642007, 268.2939689728763 -13.443794243642007, 268.2939689728763 -13.756440621401122, 266.84216178146465 -13.756440621401122, 266.84216178146465 -14.069086999160238, 265.6807160283353 -14.069086999160238, 265.6807160283353 -14.381733376919355, 262.777101645512 -14.381733376919355, 262.777101645512 -14.694379754678472, 259.00240294784163 -14.694379754678472, 259.00240294784163 -15.007026132437588, 256.0987885650183 -15.007026132437588, 256.0987885650183 -15.319672510196703, 253.4855356204773 -15.319672510196703, 253.4855356204773 -15.63231888795582, 250.8722826759363 -15.63231888795582, 250.8722826759363 -15.944965265714938, 248.54939116967762 -15.944965265714938, 248.54939116967762 -16.257611643474053, 245.93613822513663 -16.257611643474053, 245.93613822513663 -16.57025802123317, 243.3228852805956 -16.57025802123317, 243.3228852805956 -16.882904398992288, 241.58071665090162 -16.882904398992288, 241.58071665090162 -17.195550776751404, 239.83854802120763 -17.195550776751404, 239.83854802120763 -17.50819715451052, 238.38674082979597 -17.50819715451052, 238.38674082979597 -17.820843532269635, 236.93493363838428 -17.820843532269635, 236.93493363838428 -18.13348991002875, 235.48312644697262 -18.13348991002875, 235.48312644697262 -18.44613628778787, 233.74095781727863 -18.44613628778787, 233.74095781727863 -18.758782665546985, 232.28915062586694 -18.758782665546985, 232.28915062586694 -19.0714290433061, 230.2566205578906 -19.0714290433061, 230.2566205578906 -19.38407542106522, 223.86866891567928 -19.38407542106522, 223.86866891567928 -19.696721798824335, 213.99638001407993 -19.696721798824335, 213.99638001407993 -19.38407542106522, 207.0277054953039 -19.38407542106522, 207.0277054953039 -19.0714290433061, 203.54336823591592 -19.0714290433061, 203.54336823591592 -18.758782665546985, 199.47830809996324 -18.758782665546985, 199.47830809996324 -18.44613628778787, 184.08915187099956 -18.44613628778787, 184.08915187099956 -18.758782665546985, 177.4108387905059 -18.758782665546985, 177.4108387905059 -19.0714290433061, 171.6036100248592 -19.0714290433061, 171.6036100248592 -19.38407542106522, 166.3771041357772 -19.38407542106522, 166.3771041357772 -19.696721798824335, 158.5373453021542 -19.696721798824335, 158.5373453021542 -20.00936817658345, 140.24457469036716 -20.00936817658345, 140.24457469036716 -20.322014554342566, 135.01806880128515 -20.322014554342566, 135.01806880128515 -20.63466093210168, 130.3722857887678 -20.63466093210168, 130.3722857887678 -20.9473073098608, 127.75903284422682 -20.9473073098608, 127.75903284422682 -21.259953687619916, 126.01686421453282 -21.259953687619916, 126.01686421453282 -21.57260006537903, 123.98433414655648 -21.57260006537903, 123.98433414655648 -21.88524644313815, 122.24216551686249 -21.88524644313815, 122.24216551686249 -22.197892820897266, 120.49999688716848 -22.197892820897266, 120.49999688716848 -22.51053919865638, 119.0481896957568 -22.51053919865638, 119.0481896957568 -22.823185576415497, 117.59638250434514 -22.823185576415497, 117.59638250434514 -23.135831954174613, 115.85421387465114 -23.135831954174613, 115.85421387465114 -23.44847833193373, 114.40240668323948 -23.44847833193373, 114.40240668323948 -23.761124709692847, 112.9505994918278 -23.761124709692847, 112.9505994918278 -24.073771087451963, 112.0795151769808 -24.073771087451963, 112.0795151769808 -24.386417465211082, 110.91806942385146 -24.386417465211082, 110.91806942385146 -24.699063842970197, 110.3373465472868 -24.699063842970197, 110.3373465472868 -25.011710220729313, 109.4662622324398 -25.011710220729313, 109.4662622324398 -25.32435659848843, 109.17590079415747 -25.32435659848843, 109.17590079415747 -25.637002976247544, 108.59517791759279 -25.637002976247544, 108.59517791759279 -25.949649354006663, 108.30481647931046 -25.949649354006663, 108.30481647931046 -26.574942109524894, 108.01445504102813 -26.574942109524894, 108.01445504102813 -27.20023486504313, 108.30481647931046 -27.20023486504313, 108.30481647931046 -27.82552762056136, 108.59517791759279 -27.82552762056136, 108.59517791759279 -28.138173998320475, 108.88553935587512 -28.138173998320475, 108.88553935587512 -28.450820376079594, 109.17590079415747 -28.450820376079594, 109.17590079415747 -28.76346675383871, 109.75662367072213 -28.76346675383871, 109.75662367072213 -29.076113131597825, 110.3373465472868 -29.076113131597825, 110.3373465472868 -29.388759509356944, 110.62770798556913 -29.388759509356944, 110.62770798556913 -29.70140588711606, 111.49879230041614 -29.70140588711606, 111.49879230041614 -30.014052264875176, 112.0795151769808 -30.014052264875176, 112.0795151769808 -30.32669864263429, 112.9505994918278 -30.32669864263429, 112.9505994918278 -30.639345020393407, 113.53132236839247 -30.639345020393407, 113.53132236839247 -30.951991398152526, 114.69276812152181 -30.951991398152526, 114.69276812152181 -31.26463777591164, 115.5638524363688 -31.26463777591164, 115.5638524363688 -31.577284153670757, 117.01565962778048 -31.577284153670757, 117.01565962778048 -31.889930531429876, 117.88674394262748 -31.889930531429876, 117.88674394262748 -32.20257690918899, 118.46746681919214 -32.20257690918899, 118.46746681919214 -32.51522328694811, 119.0481896957568 -32.51522328694811, 119.0481896957568 -32.82786966470722, 119.62891257232148 -32.82786966470722, 119.62891257232148 -33.14051604246634, 119.91927401060381 -33.14051604246634, 119.91927401060381 -33.45316242022545, 120.49999688716848 -33.45316242022545, 120.49999688716848 -33.765808797984576, 121.08071976373314 -33.765808797984576, 121.08071976373314 -34.07845517574369, 121.6614426402978 -34.07845517574369, 121.6614426402978 -34.39110155350281, 122.24216551686249 -34.39110155350281, 122.24216551686249 -34.70374793126192, 122.82288839342715 -34.70374793126192, 122.82288839342715 -35.01639430902104, 123.40361126999181 -35.01639430902104, 123.40361126999181 -35.329040686780154, 123.98433414655648 -35.329040686780154, 123.98433414655648 -35.64168706453927, 124.56505702312116 -35.64168706453927, 124.56505702312116 -35.954333442298385, 125.14577989968582 -35.954333442298385, 125.14577989968582 -36.2669798200575, 126.01686421453282 -36.2669798200575, 126.01686421453282 -36.57962619781662, 126.59758709109748 -36.57962619781662, 126.59758709109748 -36.89227257557574, 127.17830996766216 -36.89227257557574, 127.17830996766216 -37.204918953334854, 127.75903284422682 -37.204918953334854, 127.75903284422682 -37.51756533109397, 128.3397557207915 -37.51756533109397, 128.3397557207915 -37.830211708853085, 129.21084003563848 -37.830211708853085, 129.21084003563848 -38.1428580866122, 130.08192435048548 -38.1428580866122, 130.08192435048548 -38.455504464371316, 130.9530086653325 -38.455504464371316, 130.9530086653325 -38.76815084213044, 131.8240929801795 -38.76815084213044, 131.8240929801795 -39.080797219889554, 132.6951772950265 -39.080797219889554, 132.6951772950265 -39.39344359764867, 133.5662616098735 -39.39344359764867, 133.5662616098735 -39.706089975407785, 134.72770736300282 -39.706089975407785, 134.72770736300282 -40.0187363531669, 135.88915311613218 -40.0187363531669, 135.88915311613218 -40.331382730926016, 137.34096030754384 -40.331382730926016, 137.34096030754384 -40.64402910868513, 138.50240606067317 -40.64402910868513, 138.50240606067317 -40.95667548644425, 140.24457469036716 -40.95667548644425, 140.24457469036716 -41.26932186420336, 144.59999626460217 -41.26932186420336, 144.59999626460217 -41.581968241962485, 156.50481523417787 -41.581968241962485, 156.50481523417787 -41.8946146197216, 164.6349355060832 -41.8946146197216, 164.6349355060832 -41.581968241962485, 174.50722440768254 -41.581968241962485, 174.50722440768254 -41.26932186420336, 175.37830872252954 -41.26932186420336, 175.37830872252954 -40.95667548644425, 176.53975447565887 -40.95667548644425, 176.53975447565887 -40.64402910868513, 177.70120022878822 -40.64402910868513, 177.70120022878822 -40.331382730926016, 178.57228454363522 -40.331382730926016, 178.57228454363522 -40.0187363531669, 180.02409173504688 -40.0187363531669, 180.02409173504688 -39.706089975407785, 181.1855374881762 -39.706089975407785, 181.1855374881762 -39.39344359764867, 182.34698324130557 -39.39344359764867, 182.34698324130557 -39.080797219889554, 183.79879043271723 -39.080797219889554, 183.79879043271723 -38.76815084213044, 185.2505976241289 -38.76815084213044, 185.2505976241289 -38.455504464371316, 186.70240481554055 -38.455504464371316, 186.70240481554055 -38.1428580866122, 187.8638505686699 -38.1428580866122, 187.8638505686699 -37.830211708853085, 189.02529632179923 -37.830211708853085, 189.02529632179923 -37.51756533109397, 190.18674207492856 -37.51756533109397, 190.18674207492856 -37.204918953334854, 191.63854926634022 -37.204918953334854, 191.63854926634022 -36.89227257557574, 192.79999501946958 -36.89227257557574, 192.79999501946958 -36.57962619781662, 193.9614407725989 -36.57962619781662, 193.9614407725989 -36.2669798200575, 195.12288652572823 -36.2669798200575, 195.12288652572823 -35.954333442298385, 196.28433227885756 -35.954333442298385, 196.28433227885756 -35.64168706453927, 198.60722378511625 -35.64168706453927, 198.60722378511625 -35.954333442298385, 201.8011996062219 -35.954333442298385, 201.8011996062219 -36.2669798200575, 210.2216813164096 -36.2669798200575, 210.2216813164096 -36.57962619781662, 213.99638001407993 -36.57962619781662, 213.99638001407993 -36.89227257557574, 217.48071727346792 -36.89227257557574, 217.48071727346792 -37.204918953334854, 219.8036087797266 -37.204918953334854, 219.8036087797266 -37.51756533109397, 220.6746930945736 -37.51756533109397, 220.6746930945736 -37.830211708853085, 221.5457774094206 -37.830211708853085, 221.5457774094206 -38.1428580866122, 222.4168617242676 -38.1428580866122, 222.4168617242676 -38.455504464371316, 222.99758460083228 -38.455504464371316, 222.99758460083228 -38.76815084213044, 223.86866891567928 -38.76815084213044, 223.86866891567928 -39.080797219889554, 224.73975323052628 -39.080797219889554, 224.73975323052628 -39.39344359764867, 225.32047610709094 -39.39344359764867, 225.32047610709094 -39.706089975407785, 225.9011989836556 -39.706089975407785, 225.9011989836556 -40.0187363531669, 226.7722832985026 -40.0187363531669, 226.7722832985026 -40.331382730926016, 227.35300617506726 -40.331382730926016, 227.35300617506726 -40.64402910868513, 227.93372905163193 -40.64402910868513, 227.93372905163193 -40.95667548644425, 228.80481336647895 -40.95667548644425, 228.80481336647895 -41.26932186420336, 229.38553624304362 -41.26932186420336, 229.38553624304362 -41.581968241962485, 229.96625911960828 -41.581968241962485, 229.96625911960828 -41.8946146197216, 230.54698199617295 -41.8946146197216, 230.54698199617295 -42.20726099748072, 231.41806631101994 -42.20726099748072, 231.41806631101994 -42.51990737523983, 233.4505963789963 -42.51990737523983, 233.4505963789963 -42.83255375299895, 235.48312644697262 -42.83255375299895, 235.48312644697262 -43.14520013075806, 237.51565651494894 -43.14520013075806, 237.51565651494894 -43.45784650851718, 239.5481865829253 -43.45784650851718, 239.5481865829253 -43.7704928862763, 241.87107808918395 -43.7704928862763, 241.87107808918395 -44.08313926403542, 247.3879454165483 -44.08313926403542, 247.3879454165483 -44.39578564179453, 254.64698137360665 -44.39578564179453, 254.64698137360665 -44.70843201955365, 257.26023431814764 -44.70843201955365, 257.26023431814764 -45.02107839731276, 259.8734872626886 -45.02107839731276, 259.8734872626886 -45.33372477507188, 262.777101645512 -45.33372477507188, 262.777101645512 -45.646371152830994, 265.390354590053 -45.646371152830994, 265.390354590053 -45.95901753059011, 266.2614389049 -45.95901753059011, 266.2614389049 -46.271663908349225, 267.132523219747 -46.271663908349225, 267.132523219747 -46.58431028610835, 268.2939689728763 -46.58431028610835, 268.2939689728763 -46.89695666386746, 269.1650532877233 -46.89695666386746, 269.1650532877233 -47.20960304162658, 270.0361376025703 -47.20960304162658, 270.0361376025703 -47.522249419385695, 270.9072219174173 -47.522249419385695, 270.9072219174173 -47.83489579714481, 271.77830623226436 -47.83489579714481, 271.77830623226436 -48.147542174903926, 272.9397519853937 -48.147542174903926, 272.9397519853937 -48.46018855266304, 273.8108363002407 -48.46018855266304, 273.8108363002407 -48.772834930422164, 274.6819206150877 -48.772834930422164, 274.6819206150877 -49.08548130818128, 275.5530049299347 -49.08548130818128, 275.5530049299347 -49.398127685940395, 276.42408924478167 -49.398127685940395, 276.42408924478167 -49.71077406369951, 277.00481212134633 -49.71077406369951, 277.00481212134633 -49.398127685940395, 279.6180650658873 -49.398127685940395, 279.6180650658873 -49.71077406369951, 284.2638480784047 -49.71077406369951, 284.2638480784047 -50.023420441458626, 288.32890821435734 -50.023420441458626, 288.32890821435734 -49.71077406369951, 288.909631090922 -49.71077406369951, 288.909631090922 -49.398127685940395, 289.49035396748667 -49.398127685940395, 289.49035396748667 -49.08548130818128, 290.36143828233367 -49.08548130818128, 290.36143828233367 -48.772834930422164, 290.94216115889833 -48.772834930422164, 290.94216115889833 -48.46018855266304, 291.8132454737453 -48.46018855266304, 291.8132454737453 -48.147542174903926, 292.39396835031005 -48.147542174903926, 292.39396835031005 -47.83489579714481, 293.26505266515704 -47.83489579714481, 293.26505266515704 -47.522249419385695, 293.8457755417217 -47.522249419385695, 293.8457755417217 -47.20960304162658, 294.7168598565687 -47.20960304162658, 294.7168598565687 -46.89695666386746, 295.5879441714157 -46.89695666386746, 295.5879441714157 -46.58431028610835, 296.4590284862627 -46.58431028610835, 296.4590284862627 -46.271663908349225, 297.3301128011097 -46.271663908349225))
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/timeseries_mesh/timeseries_step_08_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/timeseries_mesh/timeseries_step_08_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -4,7 +4,7 @@
 	<art:uuid value="1e9f6583-9073-4409-aac1-432ad06d7ce1" />
 	<art:hash value="29913235" />
 	<art:data>
-		<art:input name="maxvalue" value="2009.12.10 00:00:00" />
-		<art:input name="minvalue" value="2009.11.29 01:00:00" />
+		<art:input name="maxvalue" value="2010.03.26 00:00:00" />
+		<art:input name="minvalue" value="2010.03.13 01:00:00" />
 	</art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_03_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_03_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
 	<art:hash value="2969645" />
-	<art:target name="verticalcrosssection_mesh_coordinate" />
+	<art:target name="verticalcrosssection_mesh_linestring" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_04_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_04_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
 	<art:hash value="2969645" />
-	<art:target name="verticalcrosssection_mesh_point" />
+	<art:target name="verticalcrosssection_mesh_parameter" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_04_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_04_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -4,6 +4,6 @@
 	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
 	<art:hash value="2969645" />
 	<art:data>
-		<art:input name="mesh_coordinate" value="56n30 6e20" />
+		<art:input name="mesh_linestring" value="LINESTRING (0.4911 56.2489, 10.4464 58.1608, 12.2321 56.4127, 13.1250 54.8832, 15.4018 54.5008, 19.6875 56.4127, 20.6250 59.0349, 28.1250 60.2640)" />
 	</art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_05_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_05_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
 	<art:hash value="2969645" />
-	<art:target name="verticalcrosssection_mesh_axis" />
+	<art:target name="verticalcrosssection_mesh_year" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_05_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_05_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="feed" />
-	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
-	<art:hash value="2969645" />
-	<art:data>
-		<art:input name="mesh_point" value="2003771" />
-	</art:data>
+    <art:type name="feed" />
+    <art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
+    <art:hash value="2969645" />
+    <art:data>
+        <art:input name="parameterid" value="1" />
+    </art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_06_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_06_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
 	<art:hash value="2969645" />
-	<art:target name="verticalcrosssection_mesh_parameter" />
+	<art:target name="verticalcrosssection_mesh_date" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_06_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_06_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="feed" />
-	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
-	<art:hash value="2969645" />
-	<art:data>
-		<art:input name="axisid" value="IPOSITION" />
-	</art:data>
+    <art:type name="feed" />
+    <art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
+    <art:hash value="2969645" />
+    <art:data>
+        <art:input name="yearid" value="2010" />
+    </art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="advance" />
-	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
-	<art:hash value="2969645" />
-	<art:target name="verticalcrosssection_mesh_date" />
+    <art:type name="advance" />
+    <art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
+    <art:hash value="2969645" />
+    <art:target name="verticalcrosssection_mesh_calculate_results" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-    <art:type name="feed" />
-    <art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
-    <art:hash value="2969645" />
-    <art:data>
-        <art:input name="parameterid" value="1" />
-    </art:data>
+	<art:type name="feed" />
+	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
+	<art:hash value="2969645" />
+	<art:data>
+		<art:input name="dateid" value="2010.03.14 00:00:00" />
+	</art:data>
 </art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_out_chart.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
+	<art:hash value="2969645" />
+	<art:out name="chart">
+		<art:mime-type value="image/png" />
+		<art:params>
+			<art:input name="width" value="600" />
+			<art:input name="height" value="400" />
+		</art:params>
+	</art:out>
+</art:action>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_out_csv.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
+	<art:hash value="2969645" />
+	<art:out name="csv">
+		<art:out value="text/plain" />
+		<art:params />
+	</art:out>
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_07_out_odv.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
+	<art:hash value="2969645" />
+	<art:out name="odv">
+		<art:out value="text/plain" />
+		<art:params />
+	</art:out>
+</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_08_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-    <art:type name="advance" />
-    <art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
-    <art:hash value="2969645" />
-    <art:target name="verticalcrosssection_mesh_calculate_results" />
-</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_08_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="feed" />
-	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
-	<art:hash value="2969645" />
-	<art:data>
-		<art:input name="dateid" value="2009.12.10 00:00:00" />
-	</art:data>
-</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_08_out_chart.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
-	<art:hash value="2969645" />
-	<art:out name="chart">
-		<art:mime-type value="image/png" />
-		<art:params>
-			<art:input name="width" value="600" />
-			<art:input name="height" value="400" />
-		</art:params>
-	</art:out>
-</art:action>
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_08_out_csv.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
-	<art:hash value="2969645" />
-	<art:out name="csv">
-		<art:out value="text/plain" />
-		<art:params />
-	</art:out>
-</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalcrosssection_mesh/verticalcrosssection_step_08_out_odv.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="07807bb4-572b-4a46-a71d-7c1c8c9ab50c" />
-	<art:hash value="2969645" />
-	<art:out name="odv">
-		<art:out value="text/plain" />
-		<art:params />
-	</art:out>
-</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_04_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_04_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
 	<art:hash value="18171662" />
-	<art:target name="verticalprofile_date" />
+	<art:target name="verticalprofile_year" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_05_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_05_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
 	<art:hash value="11096221" />
-	<art:target name="verticalprofile_minmaxdepth" />
+	<art:target name="verticalprofile_date" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_05_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_05_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -4,6 +4,6 @@
 	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
 	<art:hash value="11096221" />
 	<art:data>
-		<art:input name="dateid" value="2008.12.09 00:00:00" />
+		<art:input name="yearid" value="2008" />
 	</art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_06_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_06_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
 	<art:hash value="11096221" />
-	<art:target name="verticalprofile_calculate_results" />
+	<art:target name="verticalprofile_minmaxdepth" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_06_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_06_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -4,7 +4,6 @@
 	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
 	<art:hash value="11096221" />
 	<art:data>
-		<art:input name="maxvalue" value="-7.0" />
-		<art:input name="minvalue" value="-40.0" />
+		<art:input name="dateid" value="2008.12.09 00:00:00" />
 	</art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_06_out_chart.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
-	<art:hash value="11096221" />
-	<art:out name="chart">
-		<art:mime-type value="image/png" />
-		<art:params>
-			<art:input name="width" value="600" />
-			<art:input name="height" value="400" />
-		</art:params>
-	</art:out>
-</art:action>
--- a/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_06_out_csv.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-    <art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
-    <art:hash value="11096221" />
-	<art:out name="csv">
-		<art:out value="text/plain" />
-		<art:params />
-	</art:out>
-</art:action>
--- a/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_06_out_odv.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
-	<art:hash value="11096221" />
-	<art:out name="odv">
-		<art:out value="text/plain" />
-		<art:params />
-	</art:out>
-</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_06_out_statistics.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
-	<art:hash value="11096221" />
-	<art:out name="statistics">
-		<art:out value="text/xml" />
-		<art:params />
-	</art:out>
-</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_07_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="advance" />
+	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
+	<art:hash value="11096221" />
+	<art:target name="verticalprofile_calculate_results" />
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_07_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="feed" />
+	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
+	<art:hash value="11096221" />
+	<art:data>
+		<art:input name="maxvalue" value="-7.0" />
+		<art:input name="minvalue" value="-40.0" />
+	</art:data>
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_07_out_chart.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
+	<art:hash value="11096221" />
+	<art:out name="chart">
+		<art:mime-type value="image/png" />
+		<art:params>
+			<art:input name="width" value="600" />
+			<art:input name="height" value="400" />
+		</art:params>
+	</art:out>
+</art:action>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_07_out_csv.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+    <art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
+    <art:hash value="11096221" />
+	<art:out name="csv">
+		<art:out value="text/plain" />
+		<art:params />
+	</art:out>
+</art:action>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_07_out_odv.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
+	<art:hash value="11096221" />
+	<art:out name="odv">
+		<art:out value="text/plain" />
+		<art:params />
+	</art:out>
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile/verticalprofile_step_07_out_statistics.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="4319eb60-5419-4ce9-80b2-3ffac5b50146" />
+	<art:hash value="11096221" />
+	<art:out name="statistics">
+		<art:out value="text/xml" />
+		<art:params />
+	</art:out>
+</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_09_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_09_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" />
 	<art:hash value="3061481" />
-	<art:target name="verticalprofile_mesh_date" />
+	<art:target name="verticalprofile_mesh_year" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_advance.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -3,5 +3,5 @@
 	<art:type name="advance" />
 	<art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" />
 	<art:hash value="3061481" />
-	<art:target name="verticalprofile_mesh_calculate_results" />
+	<art:target name="verticalprofile_mesh_date" />
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_feed.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -1,10 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <art:action xmlns:art="http://www.intevation.de/2009/artifacts">
 	<art:type name="feed" />
-    <art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" />
-    <art:hash value="3061481" />
+	<art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" />
+	<art:hash value="3061481" />
 	<art:data>
-		<art:input name="dateid" value="2009.11.29 00:00:00" />
-        <art:input name="dateid" value="2009.11.30 00:00:00" />
+		<art:input name="yearid" value="2010" />
 	</art:data>
 </art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_out_chart.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-    <art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" />
-    <art:hash value="3061481" />/>
-	<art:out name="chart">
-		<art:mime-type value="image/png" />
-		<art:params>
-			<art:input name="width" value="600" />
-			<art:input name="height" value="400" />
-		</art:params>
-	</art:out>
-</art:action>
--- a/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_out_csv.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-    <art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" />
-    <art:hash value="3061481" />
-	<art:out name="csv">
-		<art:out value="text/plain" />
-		<art:params />
-	</art:out>
-</art:action>
--- a/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_out_odv.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="041fd0b2-5d77-49a8-b19f-5f3f553bda5d" />
-	<art:hash value="31343478" />
-	<art:out name="odv">
-		<art:out value="text/plain" />
-		<art:params />
-	</art:out>
-</art:action>
\ No newline at end of file
--- a/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_10_out_statistics.xml	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
-	<art:type name="out" />
-	<art:uuid value="041fd0b2-5d77-49a8-b19f-5f3f553bda5d" />
-	<art:hash value="31343478" />
-	<art:out name="statistics">
-		<art:out value="text/xml" />
-		<art:params />
-	</art:out>
-</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_advance.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="advance" />
+	<art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" />
+	<art:hash value="3061481" />
+	<art:target name="verticalprofile_mesh_calculate_results" />
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_feed.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="feed" />
+    <art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" />
+    <art:hash value="3061481" />
+	<art:data>
+		<art:input name="dateid" value="2010.03.14 00:00:00" />
+        <art:input name="dateid" value="2010.03.18 00:00:00" />
+	</art:data>
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_out_chart.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+    <art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" />
+    <art:hash value="3061481" />/>
+	<art:out name="chart">
+		<art:mime-type value="image/png" />
+		<art:params>
+			<art:input name="width" value="600" />
+			<art:input name="height" value="400" />
+		</art:params>
+	</art:out>
+</art:action>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_out_csv.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+    <art:uuid value="73da18e1-16ef-4ef8-9388-df07a22d9099" />
+    <art:hash value="3061481" />
+	<art:out name="csv">
+		<art:out value="text/plain" />
+		<art:params />
+	</art:out>
+</art:action>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_out_odv.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="041fd0b2-5d77-49a8-b19f-5f3f553bda5d" />
+	<art:hash value="31343478" />
+	<art:out name="odv">
+		<art:out value="text/plain" />
+		<art:params />
+	</art:out>
+</art:action>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv-artifacts/src/test/ressources/verticalprofile_mesh/verticalprofile_step_11_out_statistics.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<art:action xmlns:art="http://www.intevation.de/2009/artifacts">
+	<art:type name="out" />
+	<art:uuid value="041fd0b2-5d77-49a8-b19f-5f3f553bda5d" />
+	<art:hash value="31343478" />
+	<art:out name="statistics">
+		<art:out value="text/xml" />
+		<art:params />
+	</art:out>
+</art:action>
\ No newline at end of file
--- a/gnv/ChangeLog	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/ChangeLog	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,2567 @@
+2011-02-01  Ingo Weinzierl <ingo@intevation.de>
+
+	* pom.xml: Upgraded the Restlet version from 2.0-SNAPSHOT to 2.0.4 which is
+	  the current stable release.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  Renamed the packages of Request and Response that have been changed from
+	  Restlet 2.0-SNAPSHOT to 2.0.4.
+
+2010-11-30  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java:
+	  Bugfix: if debug logging was disabled for this class, a Nullpointer
+	  exception would have been thrown.
+
+2010-11-29  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/gnv/util/CaptureInputStream.java: New. This
+	  class makes it possible to capture incoming data (InputStream) in a proper
+	  way.
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java:
+	  Improved the mechanism to print the incoming data to log by using the
+	  CaptureInputStream class.
+
+2010-11-26  Ingo Weinzierl <ingo@intevation.de>
+
+	  ISSUE #323
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java:
+	  In addition to the last revision: XML documents of HTTP Post request are
+	  also logged to the logfile.
+
+2010-11-26  Ingo Weinzierl <ingo@intevation.de>
+
+	  ISSUE #323
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java:
+	  Log the xml document of the MapViewer call (DEBUG).
+
+	* src/main/webapp/WEB-INF/classes/log4j.properties: Enabled the DEBUG
+	  output of the MapViewerCallAction logging, so that the MapViewer call xml
+	  document can be found in the log file.
+
+2010-11-02  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java,
+	  src/test/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserTestCase.java,
+	  src/test/java/de/intevation/gnv/util/XSLTransformerTestCase.java,
+	  src/main/java/de/intevation/gnv/propertiesreader/PropertiesReader.java,
+	  src/main/java/de/intevation/gnv/propertiesreader/ServletPropertiesReader.java,
+	  src/main/java/de/intevation/gnv/propertiesreader/PropertiesReaderFactory.java,
+	  src/main/java/de/intevation/gnv/propertiesreader/MapPropertiesReader.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/InputParameter.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputParameter.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactDescription.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputMode.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultInputParameter.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputParameter.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticValue.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticsSet.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactObject.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ExportMode.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticValue.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticsSet.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultExportMode.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactObject.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultLayer.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/Layer.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/Artifact.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientFactory.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseClientException.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseInputException.java,
+	  src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java,
+	  src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java,
+	  src/main/java/de/intevation/gnv/action/CommunicationKeys.java,
+	  src/main/java/de/intevation/gnv/action/DoExportAction.java,
+	  src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java,
+	  src/main/java/de/intevation/gnv/action/WMSAction.java,
+	  src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java,
+	  src/main/java/de/intevation/gnv/action/ShowStatisticAction.java,
+	  src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java,
+	  src/main/java/de/intevation/gnv/action/DescribeUIAction.java,
+	  src/main/java/de/intevation/gnv/action/LoadAction.java,
+	  src/main/java/de/intevation/gnv/action/SelectFisAction.java,
+	  src/main/java/de/intevation/gnv/action/CreateHistogramAction.java,
+	  src/main/java/de/intevation/gnv/action/mapviewer/ShowMapViewerCallBodyAction.java,
+	  src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java,
+	  src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java,
+	  src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java,
+	  src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java,
+	  src/main/java/de/intevation/gnv/action/DoOutputAction.java,
+	  src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java,
+	  src/main/java/de/intevation/gnv/action/MapClientStandaloneAction.java,
+	  src/main/java/de/intevation/gnv/action/CreateChartAction.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java,
+	  src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/action/StoreAction.java,
+	  src/main/java/de/intevation/gnv/util/ArtifactNamespaceContext.java,
+	  src/main/java/de/intevation/gnv/util/XMLUtils.java,
+	  src/main/java/de/intevation/gnv/util/XSLTransformer.java,
+	  src/main/webapp/images/bfg-logo.gif,
+	  src/main/webapp/WEB-INF/jsp/wmslayout.jsp,
+	  src/main/webapp/WEB-INF/jsp/version.jsp,
+	  src/main/webapp/WEB-INF/jsp/index.jsp,
+	  src/main/webapp/WEB-INF/jsp/header.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_wms_basic_informations.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/info_german.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_wms_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/info_english.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_mapviewercall_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/info.jsp,
+	  src/main/webapp/WEB-INF/jsp/footer.jsp,
+	  src/main/webapp/WEB-INF/jsp/wmsstandalone.jsp,
+	  src/main/webapp/WEB-INF/jsp/imprint.jsp,
+	  src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Added a license header to each
+	  of these files.
+
+	* LGPL.txt: Added the license text of the GNU LGPL.
+
+2010-07-05  Hans Plum  <hans.plum@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/includes/info_german.jsp:
+	Made name more precise.
+
+2010-07-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+	
+	RELEASE 1.1
+
+	* src/main/webapp/styles/gnv.css: Some style adjustments for the info pages.
+
+	* src/main/webapp/WEB-INF/jsp/info.jsp: The outer info page. It handles the
+	  different languages (german, english) and includes the localized info page
+	  corresponding the current locale.
+
+	* src/main/webapp/WEB-INF/jsp/includes/info_german.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/info_english.jsp: German and english
+	  info pages. Currently, just the german page is filled with content.
+
+	* pom.xml: Do not check if there are local changes before writing
+	 buildnumber into MANIFEST. Local changes would stop the build process.
+
+2010-06-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* Changes, NEWS, ChangeLog: Summarized changes
+
+2010-06-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue311
+
+	* src/main/webapp/scripts/viewport.jsp: Changed OpenLayers MouseDefault
+	  control with a Navigation control which is initially disabled. Users need
+	  to activate the navigation control for panning expicitly before panning.
+
+2010-06-30  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue307
+
+	* src/main/webapp/scripts/viewport.jsp: Added a 'resize' listener for the
+	  browser window. If the browser window is resized, the size of the map
+	  panel is adapted. For example, you have a small browser window at the
+	  beginning and resize it later to its maximal size, the map panel takes all
+	  the place it can get. Currently, just the width is adapted, because outer
+	  div container has a fix height that doesn't change.
+
+2010-06-29  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSU317
+
+	* src/main/resources/applicationMessages*.properties: 
+	  Added i18n support for the Name of the GNV Web Map Service.
+
+	* src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp: 
+	  Added variable capfile to be able to reference the combobox directly.
+
+	* src/main/webapp/WEB-INF/config/reachable-servers.conf: 
+	  Added configurationfile to fill the combobox with WMS.
+
+	* src/main/webapp/scripts/olutils.jsp: 
+	  Read URL to Capabilities-Document from selected Item in Combobox.
+	  Also switched to singleTile mode for inserted Layers.
+
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Switched Inputfile for GetCapabilities URl to an Combobox.
+
+2010-06-29  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/images/ol/cloud-popup-relative.png:
+	  Added missing Image for the PopupWindow of GetFeatureInforRequests.
+
+2010-06-28  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE308
+
+	* src/main/webapp/styles/ol_style.css: 
+	  Removed unused CSS .title
+
+	* src/main/webapp/images/ol/wvHeaderBG.gif:
+	  Removed unused Image.
+
+2010-06-28  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE311
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp: 
+	  Syncronized size of the headline of fullscreen-mode of the map-client 
+	  to the size of the headline of the  web-client.
+
+2010-06-28  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE311
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp: 
+	  Syncronized size of the headline of fullscreen-mode of the map-client 
+	  to the size of the headline of the  web-client.
+
+2010-06-28  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE311
+
+	* src/main/webapp/images/ol/slider.png:
+	  Added missing Image slider.png using the colors of the BSH.
+
+	* src/main/webapp/styles/ol_style.css: 
+	  Added CSS for Zoombox. Modified CSS for Mouseposition. The background now 
+	  is gray with opacity 0.75 
+
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Switched order of Controls to tree, legend, add layers.
+
+2010-06-28  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE 306
+
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Removed ScaleLine from Viewport
+
+2010-06-28  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE 305
+
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Removed store.load() because calling this function without a given 
+	  url to a capabilities-file will cause that the complete page, where the 
+	  Web-Client is placed in, will be loaded using the proxy without the post-
+	  Parameter.
+
+2010-06-28  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE 305
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties,
+	  src/main/webapp/WEB-INF/jsp/includes/display_wms_basic_informations.jsp: 
+	  Removed duplicate Information about Layernames / Layertitle from GUI.
+	  Also removed unused resources.
+
+2010-06-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/action/DescribeUIAction.java,
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/util/XSLTransformer.java,
+	  src/main/webapp/styles/gnv.css,
+	  src/main/webapp/WEB-INF/config/struts-config.xml,
+	  src/main/webapp/WEB-INF/config/templates/describe-ui.xsl,
+	  src/main/webapp/WEB-INF/jsp/index.jsp: Removed the changes of rev1214 and
+	  rev1206.
+
+2010-06-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/wmsstandalone.jsp,
+	  src/main/webapp/WEB-INF/jsp/version.jsp,
+	  src/main/webapp/WEB-INF/jsp/info.jsp,
+	  src/main/webapp/WEB-INF/jsp/imprint.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp: 
+	  Fixed some more XHTML-Mistakes.
+
+2010-06-15  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/scripts/olutils.js: 
+	  Removed file which was commited in r1202 by mistake
+
+2010-06-15  Tim Englich  <tim.englich@intevation.de>
+
+	  ISSUE 278: Again: Because something was wrong with r1202.
+	  
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: 
+	  Prevent NPE if the Mapviewer has delivered no Geometry.
+
+2010-06-15	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl:
+	  Render direct links as list.
+
+2010-06-14  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* pom.xml: The svn revision number is written to MANIFEST.MF while creating
+	  war archive.
+
+2010-06-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	Issue 219
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java:
+	  Broke over long line.
+
+	* src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Fed
+	  more parameters into XSL transformation to allow better form rendering.
+
+	* src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java:
+	  use explicit boolean to indicate that we are still able to advance.
+
+	* src/main/java/de/intevation/gnv/util/XSLTransformer.java: Removed
+	  stupid initial size of hash map.
+
+	* src/main/webapp/styles/gnv.css: Added style to render direct
+	  links to look like buttons.
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added a few
+	  forwards. The log is full of unresolvable forwards. TODO: This
+	  needs to be checked and is not a problem introduced by direct
+	  link feature.
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Render
+	  the direct links if there are less than six item in a single
+	  select list.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Cleanup a bit. Removed
+	  form rendering here and moved it into the dynamic XSL transformation.
+
+2010-06-11  Tim Englich  <tim.englich@intevation.de>
+
+	Issue278
+	
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: 
+	  Prevent NPE if the Mapviewer has delivered no Geometry.
+	
+
+2010-06-11  Tim Englich  <tim.englich@intevation.de>
+
+	  Customize Look and Feel to styleguide of the bsh.
+
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Link OpenLayers image-folder to images/ol to get the navigation-bar in
+	  a customize look and feel.
+
+	* src/main/webapp/styles/ol_style.css: 
+	  Added missing styles of Openlayer that must be overriden.
+	
+	* src/main/webapp/images/ol/east-mini.png,
+	  src/main/webapp/images/ol/feature_info_off.png,
+	  src/main/webapp/images/ol/feature_info_on.png,
+	  src/main/webapp/images/ol/folder-open.gif,
+	  src/main/webapp/images/ol/folder.gif,
+	  src/main/webapp/images/ol/leaf.gif,
+	  src/main/webapp/images/ol/navigation_history.png,
+	  src/main/webapp/images/ol/north-mini.png,
+	  src/main/webapp/images/ol/pan_off.png,
+	  src/main/webapp/images/ol/pan_on.png,
+	  src/main/webapp/images/ol/south-mini.png,
+	  src/main/webapp/images/ol/tool-sprites.gif,
+	  src/main/webapp/images/ol/west-mini.png,
+	  src/main/webapp/images/ol/wvHeaderBG.gif,
+	  src/main/webapp/images/ol/zoom_box_off.png,
+	  src/main/webapp/images/ol/zoom_box_on.png,
+	  src/main/webapp/images/ol/zoom-minus-mini.png,
+	  src/main/webapp/images/ol/zoom-plus-mini.png,
+	  src/main/webapp/images/ol/zoom-world-mini.png,
+	  src/main/webapp/images/ol/zoombar.png:
+	  Added missing icons and put an blue-filter to all icons.
+
+2010-06-11  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/images/ol/measure_line_off.png,
+	  src/main/webapp/images/ol/measure_line_on.png,
+	  src/main/webapp/images/ol/measure_polygon_off.png,
+	  src/main/webapp/images/ol/measure_polygon_on.png:
+	  Removed unused Icons.
+
+2010-06-11  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/action/DescribeUIAction.java,
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/util/XSLTransformer.java,
+	  src/main/webapp/styles/gnv.css,
+	  src/main/webapp/WEB-INF/config/struts-config.xml,
+	  src/main/webapp/WEB-INF/config/templates/describe-ui.xsl,
+	  src/main/webapp/WEB-INF/jsp/index.jsp: Reverted the changes of rev1194 -
+	  the feature implemented in rev1194 has not been finished so far.
+
+2010-06-11  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/scripts/viewport.jsp,
+	  src/main/webapp/scripts/olutils.jsp: 
+	  Modified output of the GetfeatureInfo-request.
+	  All attributes of each feature which was returned by the request will be 
+	  put in one separte Table.
+
+2010-06-11  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/resources/applicationMessages*.properties:
+	  Added localized message if no layer were created.
+
+2010-06-11  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/scripts/layers.jsp:
+	  Bugfix: All Layer will only use one single Tile for displaying it. 
+
+2010-06-11  Tim Englich  <tim.englich@intevation.de>
+
+	  Added the informations about how the WMS which was published during the 
+	  Workflow to the GUI. The URL to the capablities-documenet, the names of 
+	  the layer and the ttl will be listed.
+
+	* src/main/java/de/intevation/gnv/action/WMSAction.java (execute): 
+	  Write the TTL to the Mapservice which is published.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java, 
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java: 
+	  Added Getter for the Attribute TTL. Which shows how long the Layer of this
+	  Service will be available.
+	  
+	* src/main/webapp/WEB-INF/jsp/includes/display_wms_basic_informations.jsp: 
+	  Added new JSP-File for publishing the Basic-Informations of the WMS.
+	  The URL which will deliver the Capablities is shown.
+	  Also the Names of the Layers are listed.
+	  At least the Time untiöl teh Layers are available is displayed.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp: 
+	  Included Informationblock for the WMS which was produced in the workflow
+	  before and now is published in the map.
+
+2010-06-10	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	Issue 219
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java:
+	  Broke over long line.
+
+	* src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Fed
+	  more parameters into XSL transformation to allow better form rendering.
+
+	* src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java:
+	  use explicit boolean to indicate that we are still able to advance.
+
+	* src/main/java/de/intevation/gnv/util/XSLTransformer.java: Removed
+	  stupid initial size of hash map.
+
+	* src/main/webapp/styles/gnv.css: Added style to render direct
+	  links to look like buttons.
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added a few
+	  forwards. The log is full of unresolvable forwards. TODO: This
+	  needs to be checked and is not a problem introduced by direct
+	  link feature.
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Render
+	  the direct links if there are less than six item in a single
+	  select list.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Cleanup a bit. Removed
+	  form rendering here and moved it into the dynamic XSL transformation.
+
+2010-06-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Removed some
+	  code for testing that have been commited by mistaken.
+
+2010-06-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java:
+	  New methods for session validation. Method isSessionExhausted(.) returns
+	  true, if the session of the user is new. Another medhod returns the
+	  ActionForward for selecting a fis - which is the start point of our
+	  application.
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java,
+	  src/main/java/de/intevation/gnv/action/DoExportAction.java,
+	  src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java,
+	  src/main/java/de/intevation/gnv/action/WMSAction.java,
+	  src/main/java/de/intevation/gnv/action/ShowStatisticAction.java,
+	  src/main/java/de/intevation/gnv/action/DescribeUIAction.java,
+	  src/main/java/de/intevation/gnv/action/LoadAction.java,
+	  src/main/java/de/intevation/gnv/action/CreateHistogramAction.java,
+	  src/main/java/de/intevation/gnv/action/DoOutputAction.java,
+	  src/main/java/de/intevation/gnv/action/CreateChartAction.java,
+	  src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/action/StoreAction.java: Validate the
+	  session before doing some other stuff. If the session is exhausted, we
+	  will return to the start point - the fis selection.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Renders an error message if the
+	  session of the user is exhausted. There will be no link to return to the
+	  last point in the parameterization.
+
+	* src/main/java/de/intevation/gnv/action/CommunicationKeys.java: A new key
+	  for session errors.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: An error message for
+	  a session that timed out.
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added a new forward to
+	  the export action that makes it possible  to step back to the fis
+	  selection.
+
+2010-06-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue177 - Messages for Java heap size errors.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added an error
+	  message for Java heap size errors.
+
+2010-06-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties:
+	  Added localization for the message that will be displayed if no 
+	  layer where found.
+ 
+	* src/main/webapp/scripts/olutils.jsp: 
+	  Improved the workflow for inserting new layer into the client.
+	  If no layer are found using the given url an exceptionmessage will be
+	  displayed using an ext-window.
+	  Now it is also possible to add more than one layer at once.
+
+2010-06-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/scripts/layers.jsp: 
+	  Switched from Untiled Layer to standard layer objects to fix a bug 
+	  in the drag and drop function of the layertree and to enable the output 
+	  of the LegendGraphicPanel.
+
+2010-06-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/scripts/olutils.jsp: 
+	  Rename olutils.js to olutils.jsp to enable possibility of i18n in this file.
+	  Added references to resources in in Method addLayer.
+
+	* src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp: 
+	  Replace linkt to olutils.js to olutils.jsp.
+
+
+2010-06-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp: 
+	  Added reference to the new css-file extjs-override.css
+
+	* src/main/webapp/images/folder-open.gif,
+	  src/main/webapp/images/folder.gif,
+	  src/main/webapp/images/leaf.gif,
+	  src/main/webapp/images/tool-sprites.gif,
+	  src/main/webapp/styles/extjs-override.css: 
+	  Customize Look and Feel to the css of this project.
+
+2010-06-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/styles/ol_style.css: 
+	  Switch color of coordinate display of mousposition and scalebar from 
+	  black to white.
+
+2010-06-07  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Put the bboxx from the mapservice-object and write it to an 
+	  javascript-variable. This variable will be used to center the map to
+	  the extend of the data which should be visualized.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java (getBBoxValue),
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java (getBBoxValue):
+	  Added a method for getting the bbox as a string from the mapservice-object.
+
+	* src/main/java/de/intevation/gnv/action/WMSAction.java (execute):
+	  Read the bbox from the retrieved meta-document and out it into the 
+	  mapservice-object which is used to represent the WMS in the client.
+
+2010-06-07  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Switch the URl for the GetFeatureInfor Control to the URL of the WMS which
+	  provide the generated Data of the GNV.
+	  Also switch the Format of the Responsdata of the GetFeatureInfor-request to
+	  GML.
+
+2010-06-07  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: 
+	  Added the Action "mapclient" for switching to the FullScreen-Mode of the 
+	  MapClient.
+
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Integrated the Viewport to render tne Mapclient in FullScreen-Mode.
+
+	* src/main/java/de/intevation/gnv/action/MapClientStandaloneAction.java : 
+	  Added Action for handling the businesslogic to switch the Mapclient to the 
+	  FullScreen-Mode.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties:
+	  Added i18n for the Link-labeling for switching to the FullScreen-Mode.
+	
+	* src/main/webapp/WEB-INF/jsp/wmsstandalone.jsp: 
+	  Added JSP-Page wich will be used to render the gui for the 
+	  FullScreen-Mode of the Mapclient.
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp: 
+	  Extracted header for the html-page whcih will contain the mapclient so
+	  that it could be used in several pages.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp: 
+	  Added JSP-Fragment which contains the gui for the FullScreen-Mode of the
+	  Mapclient.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp: 
+	  Added link for switching to the fullscreenmode 
+
+2010-06-04  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/resources/applicationMessages.properties: 
+	  Replaced incompatible Umlauts
+
+2010-06-04  Tim Englich  <tim.englich@intevation.de>
+
+
+	* src/main/webapp/scripts/viewport.jsp,
+	  src/main/resources/applicationMessages.properties, 
+	  src/main/resources/applicationMessages_en.properties:
+	  Added i18n support to the mapclient.
+
+2010-06-04  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp,
+	  /src/main/webapp/scripts/olutils.js:
+	  Fixed bug that the "Add Layer"-Button was not correctly displayed if a
+	  new WMS-Capabilities-Document was loaded.
+	  Also improved the GUI that it is now Possible to load a WMS with a lot of 
+	  layer which could not be displayed in the GUI without uisng a scrollbar. 
+
+2010-06-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue275
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp,
+	  src/main/webapp/WEB-INF/jsp/header.jsp,
+	  src/main/webapp/WEB-INF/jsp/footer.jsp,
+	  src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Removed (X)HTML
+	  errors/warnings.
+
+2010-06-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue293
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added strings for
+	  refresh-button tooltip and png export-button.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp:
+	  Changed and added some tooltips.
+
+2010-06-01  Tim Englich  <tim.englich@intevation.de>
+
+
+	Checkin of changes which are necessary for the checkin of Revision 1139.
+	
+	* src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java (selectArtifactFactory),
+	  src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java (selectedArtifactFactory): 
+	  Added functions for getting and setting a Mapservice to the SessionModel.
+	  
+	* src/main/java/de/intevation/gnv/action/WMSAction.java : 
+	  Integrated the possibility to read all Layes from Metafile.
+	
+2010-06-01  Tim Englich  <tim.englich@intevation.de>
+
+	Providing functionality to read an WMS-Capabilities-Documnet and list all
+	layers which are include. This is the first step to provide the requested
+	function to integrate external WMS-Layers.
+
+	To read the XML-Documents it is required to integrate the proxy.cgi script
+	into the Apache Webserver. for this you have to copy the  proxy.cgi script
+	to /usr/lib/cgi-bin. 
+
+	You might have to change the allowedHosts in this script.
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp: 
+	  Integrated link to JavaScript-file olutils.js
+
+	* /src/main/webapp/scripts/olutils.js:
+	  Integrate Utilities-javaScript-fiel from Demonstrator to provide
+	  JavaScript-Functions for handling WMS-Capabilities-Requests.
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Integrated JavaScript-Elements for WMS-Capabilities Request.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp: 
+	  Integrated HTML-Elements for the WMS-Capabilities Request.
+
+2010-06-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl:
+	  Implemented a N-step back history. There is a back-button besides every
+	  parameter in the static ui part now.
+
+2010-06-01  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Removed som obsolet Code.
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp: 
+	  Added reference to the new css-file.
+
+	* src/main/webapp/images/ol/*.png: 
+	  Added Icons for an customized Toolbar.
+
+	* src/main/webapp/styles/ol_style.css: 
+	  Added separat CSS-File for create own Style of the Buttons of the 
+	  OL-Buttonbar.
+	
+2010-06-01  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/scripts/openlayers,
+	  src/main/webapp/scripts/geoext/,
+	  src/main/webapp/scripts/ext/:
+	  Added subfolders of third party libraries to svn-ignore.
+
+2010-06-01  Tim Englich  <tim.englich@intevation.de>
+
+	  Integrated the Openlayers-libraray according to the Intevation-Demonstrator
+	  into the GUI. Now it is also possible to see all layers which are put into
+	  the WMS by the user.
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp: 
+	  Removed the old JavaScript-references to the OpenLayers-Library and 
+	  put the references to the JavaScript-Files and CSS-files for 
+	  OpenLayers, ext and geoext into it.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: 
+	  Removed the html-elements which are required to render the MapClient and 
+	  put them into the file includes/display_map_inc.jsp.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp: 
+	  Added own include-file for all html-elements which are required to render
+	  the Mapclient.
+
+	* src/main/webapp/scripts/viewport.jsp: 
+	  Added a JSP-file which creats an JavaScript-file which includes the 
+	  informations how to create the GUI of the WMS-Client.A JSP-file is required 
+	  because we have to insert dynamic usespecific Data into the file.
+
+	* src/main/webapp/scripts/layers.jsp: 
+	  Added a JSP-file which creats an JavaScript-file which includes all 
+	  layers which should be displayed by OpenLayers. A JSP-file is required 
+	  because we have to insert dynamic usespecific Data into the file.
+
+	* src/main/webapp/scripts/openlayers:
+	  Folder for storing the JavaScript-Library Openlayers.
+	* src/main/webapp/scripts/openlayers/readme: 
+	  Readme-File which explains which steps must be done to provide the 
+	  required Version of the Openlayers-Library.
+
+	* src/main/webapp/scripts/geoext/:
+	  Folder for storing the JavaScript-Library geoext.
+	* src/main/webapp/scripts/geoext/readme: 
+	  Readme-File which explains which steps must be done to provide the 
+	  required Version of the GeoExt-Library.
+
+	* src/main/webapp/scripts/ext/:
+	  Folder for storing the JavaScript-Library Ext.
+	* src/main/webapp/scripts/ext/readme: 
+	  Readme-File which explains which steps must be done to provide the 
+	  required Version of the Ext-Library.
+	
+
+2010-05-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue198
+
+	* src/main/java/de/intevation/gnv/action/WMSAction.java: Changed the XPath
+	  of the layer name and the time to live. Rev1134 introduced a title for wms
+	  layers - the title has been used before to specify a wms layer. The time
+	  to live moved from layer node to abstract meta information.
+
+	  NOTE: Just the first layer of a wms request is visible in the OL
+	  application currently, because there is no group-layer anymore.
+
+2010-05-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_wms_options_inc.jsp: Make use
+	  of the new method of DiagrammOptions to retrieve the value of an option as
+	  string that have been introduced in rev1129.
+
+2010-05-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/header.jsp: Don't use the old session id when
+	  restarting the application - start the application without old id.
+
+2010-05-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue289
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Store
+	  chart/histogram options inserted by the user in the SessionModel. In the
+	  case of a wrong input we are able to reuse the previous value. Options
+	  inserted by the user are stored as native objects - no longer as string.
+
+	* src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java:
+	  Store options as Object instead of String to keep the information about
+	  the type of the option (string, integer, double, etc). Furthermore there
+	  is a new method getValue(String key, Locale locale) that returns the value
+	  as string. Double values are formatted using the locale object. This
+	  method is used in the gui to display a well formatted i18n string.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp:
+	  Make use of the new method in DiagrammOptions to retrieve the value as
+	  formatted string.
+
+2010-05-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue272
+
+	* src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Read strings
+	  for example linestring/polygon from resource bundle and put them into the
+	  XSL-transformator.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added labels for
+	  links to insert example linestring/polygon.
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Don't use static
+	  strings for example linestring/polygon links but use the parameter that
+	  have been added in DescribeUIAction - which are i18n.
+
+2010-05-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue266
+
+	* src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java:
+	  Switching the language in the initial state will not throw an exception
+	  anymore, but the language is toggled.
+
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java (getValue), 
+	  src/main/java/de/intevation/gnv/util/XMLUtils.java (getXPath): 
+	  Fixed some warnings which are displaied during the javadoc-generation.
+
+namespaceContext
+
+	* src/main/java/de/intevation/gnv/action/StoreAction.java, 
+	  src/main/java/de/intevation/gnv/action/ShowStatisticAction.java, 
+	  src/main/java/de/intevation/gnv/action/SelectFisAction.java, 
+	  src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java,
+	  src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java, 
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java, 
+	  src/main/java/de/intevation/gnv/action/LoadAction.java, 
+	  src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java, 
+	  src/main/java/de/intevation/gnv/action/DescribeUIAction.java, 
+	  src/main/java/de/intevation/gnv/action/CreateHistogramAction.java, 
+	  src/main/java/de/intevation/gnv/action/CreateChartAction.java, 
+	  src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java:
+	  Added more Javadocs. Did some Codeformatting.
+
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/util/XSLTransformer.java: 
+	* src/main/java/de/intevation/gnv/util/XMLUtils.java: 
+	* src/main/java/de/intevation/gnv/util/ArtifactNamespaceContext.java: 
+	  Added more Javadocs. Did some Codeformatting.
+
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java, 
+	  src/main/java/de/intevation/gnv/servlet/package.html: 
+	  Added more Javadocs. Did some Codeformatting.
+	
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/propertiesreader/package.html, 
+	  src/main/java/de/intevation/gnv/propertiesreader/ServletPropertiesReader.java, 
+	  src/main/java/de/intevation/gnv/propertiesreader/MapPropertiesReader.java: 
+	  Added more Javadocs.
+	
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java, 
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultLayer.java: 
+	  Added more Javadocs.
+
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputParameter.java, 
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java, 
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultInputParameter.java, 
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultExportMode.java, 
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticValue.java, 
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticsSet.java, 
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java, 
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/Artifact.java: 
+	  Added more Javadocs.
+	
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java (doAdvance): 
+	  Added more Javadoc.
+
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/package.html:
+	  Added more Javadoc.
+
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/sessionmodel/package.html:
+	  Removed duplicate documentation from file.
+
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/sessionmodel/package.html,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java: 
+	  Added more Javadocs.
+
+2010-05-18  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/parser/package.html,
+	  src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java,
+	  src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java,
+	  src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java:
+	  Added more Javadocs. Format some Linees of code which are longer than 80 Chars.
+
+2010-05-17  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/package.html,
+	  src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java, 
+	  src/main/java/de/intevation/gnv/action/mapviewer/ShowMapViewerCallBodyAction.java: 
+	  Added more Javadocs. 
+
+2010-05-09	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/webapp/styles/calendar-blue.css: Deleted. Not needed any more.
+
+2010-05-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/web.xml: Removed useless log4j configuration
+	  section.
+
+	* src/main/webapp/WEB-INF/classes/log4j.properties: Adapted logging
+	  configuration for a productive system.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	RELEASE 1.0
+
+	* Changes, NEWS, ChangeLog: Summarized changes.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java: Removed
+	  trailing whitespace.
+
+2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Removed
+	  duplicated and unused imports.
+
+2010-04-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue225
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added global forwards
+	  for imprint and info.
+
+	* src/main/webapp/WEB-INF/jsp/header.jsp,
+	  src/main/webapp/WEB-INF/jsp/footer.jsp: Adapted links for imprint and info
+	  pages.
+
+	* src/main/webapp/WEB-INF/jsp/imprint.jsp,
+	  src/main/webapp/WEB-INF/jsp/info.jsp: New pages for imprint and an info
+	  page.
+
+	* src/main/resources/applicationMessages_en.properties: Renamed 'about' ->
+	  'imprint'.
+
+2010-04-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue225
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Render a
+	  parameter matrix if there is just a single parameter as well. This allows
+	  us to render a legend for multi select boxes at another place - this fixes
+	  the missing legend for parameter select boxes.
+
+2010-04-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/images/img.gif,
+	  src/main/webapp/images/stock_data-save.png,
+	  src/main/webapp/images/bg_fieldset.gif,
+	  src/main/webapp/images/list-item.gif,
+	  src/main/webapp/images/bg_fieldset_ie6.gif,
+	  src/main/webapp/scripts/calendar-setup.js,
+	  src/main/webapp/scripts/calendar-en.js,
+	  src/main/webapp/scripts/calendar.js,
+	  src/main/webapp/scripts/calendar-de.js,
+	  src/main/webapp/scripts/calendar-setup_stripped.js,
+	  src/main/webapp/scripts/jquery-1.4.2.min.js,
+	  src/main/webapp/scripts/calendar_stripped.js: Removed JavaScript files and
+	  images that are not used anymore.
+
+2010-04-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added an error
+	  message if that should be displayed if an artifact is out of date.
+
+2010-04-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue236 & Issue242
+
+	* src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java,
+	  src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Display
+	  error messages if the artifact server is down - this have been broken.
+
+2010-04-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue258
+
+	* src/main/java/de/intevation/gnv/action/LoadAction.java: An error message
+	  is displayed if the user tried to load an existing project and the
+	  artifact server is down.
+
+2010-04-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue259
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp:
+	  Added target 'chart' as url request parameter when performing the html 
+	  form to change the chart output. The reason for doing this is, that the
+	  InternetExplorer seems no to add the value of <input type="image"...>
+	  elements to the request object which is sent to the server.
+
+2010-04-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue225
+
+	* src/main/webapp/styles/gnv.css: Reduced the size of links in header and
+	  footer.
+
+2010-04-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue225
+
+	* src/main/webapp/styles/gnv.css: Adjusted the style of fieldsets - there is
+	  a gap between the fieldset border and input elements in IE now as well.
+	  The size of select boxes and textareas is fixed now.
+
+2010-04-25  Ingo Weinzierl <ingo_weinzierl@web.de>
+
+	  Issue225
+
+	* src/main/webapp/styles/gnv.css: A new style class. Most of this is copied
+	  from default.css but a lot of content which is not used anymore has been
+	  removed.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Restructuring. The parameter panel
+	  and the content div container are placed in a table row now. Very wide 
+	  html elements in the content div container don't break the layout anymore.
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp: Moved html elements to render
+	  OpenLayers into index.jsp. Removed JavaScript code to adjust layout.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp:
+	  Added style class to the table that contains the chart options.
+
+	* src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Removed JavaScript code to
+	  adjust layout.
+
+	* src/main/webapp/scripts/jquery-1.4.2.min.js: Removed. Not used anymore.
+
+2010-04-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue225
+
+	* src/main/webapp/styles/default.css: Adapted some font size in the
+	  parameter panel.
+
+2010-04-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue225
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Replaced the standard html input
+	  button with an image as the choose button.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added specific 
+	  strings that represent pathes to german and english load button images.
+
+	* src/main/webapp/styles/default.css: New styles to adjust the upload box
+	  and the load button.
+
+
+	* src/main/webapp/images/load.png,
+	  src/main/webapp/images/laden.png: Images for project load button.
+
+2010-04-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue237
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp: Added http request parameter to
+	  the mapserver path to simplify the GetCapabilities call for the user.
+
+2010-04-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue254
+
+	* src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java: New
+	  controller to toggle between german and english language.
+
+	* src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Use the
+	  locale stored in the artifact to create the user interface. At the
+	  beginning, this will be the locale of the request object. If the user
+	  chooses another language by calling the SwitchLanguageAction controller,
+	  this locale becomes the prefered locale, and the browser settings are no
+	  more relevant.
+
+	* src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java:
+	  Now, the SessionModel has two methods to set and retrieve the current
+	  locale which is used to create a language specific user interface.
+
+	* src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java:
+	  Initial creation of the SessionModel gets the locale of the request
+	  object. If this locale is changed by the user via SwitchLanguageAction
+	  controller, changes in the browser settings won't have an effect anymore.
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Add the controller to
+	  switch between languages.
+
+	* src/main/webapp/WEB-INF/jsp/header.jsp: The header contains a link to
+	  toggle between german and english language - a click on it will trigger
+	  the SwitchLanguageAction.
+
+2010-04-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue221
+
+	* src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java:
+	  Added methods to quote html characters in strings.
+
+	* src/main/java/de/intevation/gnv/action/WMSAction.java: Call methods to
+	  quote html characters in strings inserted by the user. Used to be safe 
+	  from html injections.
+
+2010-04-19  Hans Plum <hans@intevation.de>
+
+	Issue 241: Set Path to Tomcat Standard Logging
+
+	* src/main/webapp/WEB-INF/classes/log4j.properties:
+	Adapted logging path for webclient gnv to the central tomcat mechamism
+	in order to resolve the dependency to the artefact-server directory
+	layout.
+
+2010-04-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue227
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  Added a new method to retrieve the current locale.
+
+	* src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Feed the xsl
+	  transformer with a tooltip text for the back-button.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added a tooltip text
+	  for the back-button.
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Use the
+	  tooltip text that is fed in DescribeUIAction.
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Removed a
+	  PropertiesReader which isn't used there.
+
+2010-04-19	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/resources/applicationMessages.properties: Forgot a dot. ;-)
+
+2010-04-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue224
+
+	* src/main/resources/applicationMessages.properties: Fixed a typo in the
+	  german text of the overlay display.
+
+2010-04-18	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/*.java:
+	  Using unix line endings only.
+
+2010-04-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/*.java:
+	  Removed trailing whitespace.
+
+2010-04-14  Hans Plum <hans@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp:
+	Adapted background layers to a global and local visibale layer (World
+	Relief (2 Minute Raster)
+
+2010-04-14  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Changed language
+	  strings.
+
+	* src/main/webapp/styles/default.css: Adapted css classes.
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp,
+	  src/main/webapp/WEB-INF/jsp/header.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Adapeted design.
+
+	* src/main/webapp/scripts/gnviewer.js: Added javascript methods to adapt the
+	  size of the content panel.
+
+	* src/main/webapp/scripts/jquery-1.4.2.min.js: JavaScript library doing
+	  general javascript stuff.
+
+2010-04-13  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added resource
+	  pointing to the image of the 'choose'-button.
+
+	* src/main/webapp/images/auswaehlen.png,
+	  src/main/webapp/images/choose.png: Selfmade 'choose'-buttons for english
+	  and german language.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp: Removed standard
+	  html input buttons with selfmade ones.
+
+2010-04-13  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+	
+	* src/main/webapp/styles/default.css: Adapted style of links.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Replaced input buttons for
+	  loading/saving projects with links.
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp,
+	  src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Added javascript function to
+	  toggle the visibility of the file upload button/chooser.
+
+2010-04-13  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Fixed a display 
+	  bug in the measurement panel for one parameter.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: New strings for
+	  header and footer links.
+
+	* src/main/webapp/styles/default.css: Added and adapted style classes.
+	
+	* src/main/webapp/WEB-INF/jsp/header.jsp: Added links for restarting the app,
+	  retrieving information about it and switching the current language.
+
+	* src/main/webapp/WEB-INF/jsp/footer.jsp: Added navigation links to 'home',
+	  a contact page and an about page.
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp,
+	  src/main/webapp/WEB-INF/jsp/mainlayout.jsp,
+	  src/main/webapp/WEB-INF/jsp/index.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_wms_options_inc.jsp: Changed
+	  the design of the whole application regarding the bsh styleguide.
+
+2010-04-13  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticValue.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticValue.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java, 
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactObject.java :
+	  Added more Javadocs. 
+
+2010-04-13  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/package.html,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/package.html,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/exception/package.html,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/package.html,
+	  src/main/java/de/intevation/gnv/action/package.html,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/package.html,
+	  src/main/java/de/intevation/gnv/util/package.html: Added first part of
+	  package descriptions.
+
+2010-04-13  Hans Plum <hans@intevation.de>
+
+	* src/main/webapp/images/svg.png,
+	  src/main/webapp/images/delete.png,
+	  src/main/webapp/images/map_go.png,
+	  src/main/webapp/images/diagram_export.png,
+	  src/main/webapp/images/chart_curve.png,
+	  src/main/webapp/images/arrow_refresh.png,
+	  src/main/webapp/images/pdf.png,
+	  src/main/webapp/images/data_export.png,
+	  src/main/webapp/images/chart_bar.png,
+	  src/main/webapp/images/statistics.png,
+	  src/main/webapp/images/disk.png,
+	  src/main/webapp/images/tick.png,
+	  src/main/webapp/images/back_button.png:
+	  Converted relevant icons to the requirements of BSH Corporate Design,
+	  19.06.2009, S. 172: Hue: 172; Saturation: 34; Brightness: 28.
+
+2010-04-12  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/propertiesreader/PropertiesReader.java,
+	  src/main/java/de/intevation/gnv/propertiesreader/ServletPropertiesReader.java,
+	  src/main/java/de/intevation/gnv/propertiesreader/PropertiesReaderFactory.java,
+	  src/main/java/de/intevation/gnv/propertiesreader/MapPropertiesReader.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/InputParameter.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactDescription.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputParameter.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultInputParameter.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputMode.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputParameter.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticValue.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactObject.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticsSet.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ExportMode.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticsSet.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultExportMode.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactObject.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultLayer.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/Layer.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/Artifact.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientFactory.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseClientException.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseInputException.java,
+	  src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java,
+	  src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java,
+	  src/main/java/de/intevation/gnv/action/CommunicationKeys.java,
+	  src/main/java/de/intevation/gnv/action/DoExportAction.java,
+	  src/main/java/de/intevation/gnv/action/WMSAction.java,
+	  src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java,
+	  src/main/java/de/intevation/gnv/action/ShowStatisticAction.java,
+	  src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java,
+	  src/main/java/de/intevation/gnv/action/DescribeUIAction.java,
+	  src/main/java/de/intevation/gnv/action/LoadAction.java,
+	  src/main/java/de/intevation/gnv/action/CreateHistogramAction.java,
+	  src/main/java/de/intevation/gnv/action/SelectFisAction.java,
+	  src/main/java/de/intevation/gnv/action/DoOutputAction.java,
+	  src/main/java/de/intevation/gnv/action/CreateChartAction.java,
+	  src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java,
+	  src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java,
+	  src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java,
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/action/StoreAction.java,
+	  src/main/java/de/intevation/gnv/util/ArtifactNamespaceContext.java,
+	  src/main/java/de/intevation/gnv/util/XSLTransformer.java: Added JavaDoc
+	  comments.
+
+2010-04-12  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added label for
+	  chart button in actions panel.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Changed the
+	  label of the chart button in the actions panel ('Diagramm speichern' ->
+	  'Diagramm').
+
+2010-04-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue210
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Changed the
+	  parameter-measurement matrix rendering. Its content is no more selectable
+	  - it is just to inform the user about the existence of a measurement for a
+	  given parameter. Instead, there is a new row with a checkbox for each 
+	  measurement in the header of the matrix. So, the user is able to select a
+	  measurement without a relation to a specific parameter - all parameters
+	  which are available for this measurement are effected by this choice in
+	  future outputs.
+
+	* src/main/webapp/styles/default.css: New classes for styling the
+	  parameter-measurement matrix.
+
+	* src/main/webapp/images/delete.png,
+	  src/main/webapp/images/tick.png: New icons to inform the user about the 
+	  existence of a measurement for a given parameter.
+
+2010-04-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue216
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp:
+	  Added a missing character to the url of the image export.
+
+2010-03-29  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue13 & Issue18
+
+	* src/main/webapp/WEB-INF/jsp/mainlayout.jsp,
+	  src/main/webapp/WEB-INF/jsp/header.jsp: Added a reload link. A click on
+	  this link rebuilds the ui with the description of the current artifact.
+
+	  Note: If the artifact server ist down, nothing happens when using this
+	  link. A click on this link triggers a controller which sends a
+	  describe-request to the artifact server.
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added a new controller
+	  to build the current user interface. This could be used if the artifact
+	  server is down and the ui brakes after an user interaction. After the 
+	  artifact server being restarted, this controller can be called to rebuild
+	  the ui with the current artifact description.
+
+	* src/main/webapp/styles/default.css: Moved exception message and reload
+	  link a bit to avoid overlapping elements. Added a new class to adjust the
+	  style of the reload link.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added strings for
+	  reload-link.
+
+2010-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/package.html: New.
+	  Added package description with text 'DOCUMENT ME!'.
+
+2010-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/*.java:
+	  Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
+
+	  find -name \*.java | \
+	  xargs sed -i \
+	  -e 's/@author[ ]\+\([^(<]\+\)[<(]\([^>)]\+\)[>)]/@author <a href="mailto:\2">\1<\/a>/g' \
+	  -e 's@[ ]\+</a>@</a>@g'
+
+2010-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* rc/main/java/de/intevation/gnv/**/*.java:
+	  Ordered imports. Removed needless imports. Removed empty headers.
+
+2010-03-29  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue30
+
+	* src/main/java/de/intevation/gnv/action/DescribeUIAction.java: Use the
+	  correct locale for i18n supported by HttpServletRequest object. The
+	  application language is switched after the next server round-trip if the 
+	  user changes the preferred browser language.
+	  Hint: Struts' Action class has a method getLocale(HttpServletRequest)
+	  which should return the currently selected locale. This method seems to be
+	  buggy - returns session's initial locale.
+	
+	* src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java:
+	  Inherit from DescribeUIAction. The rendering stuff is now done by  
+	  DescribeUIAction.
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added missing forward
+	  used for stepping back to a previous state in SelectArtifactFactory
+	  action.
+
+2010-03-29	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/**/*.java:
+	  Removed trailing whitespace.
+	  find -name \*.java | xargs sed -i 's/[ \t]\+$//'
+
+2010-03-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue197
+
+	* src/main/java/de/intevation/gnv/action/WMSAction.java: Parse the time to
+	  live of an artifact from meta document and set an attribute 'ttl' of the
+	  request object.
+	  
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp: Added a new row showing
+	  the time to live beneath the layer name and wms url.
+
+	* src/main/resources/applicationMessages_en.properties,
+	  src/main/resources/applicationMessages.properties: Added new label for
+	  availability of an artifact/wms-layer.
+
+	* src/main/webapp/styles/default.css: Moved OpenLayers map a bit south.
+
+2010-03-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  Improved the copying of input stream to output stream a bit.
+
+2010-03-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/LoadAction.java: Just copy the
+	  input stream to the output stream without parsing it and without creating 
+	  a temporary xml document.
+
+2010-03-22  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp,
+	  src/main/java/de/intevation/gnv/action/WMSAction.java (execute): 
+	  Improved ExceptionHandling during WMS-Publishing.
+	  Now the OL-GUI will only be shown if the WMS was published succsessfull.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java (publishWMS),
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java (publishWMS),
+	  src/main/java/de/intevation/gnv/action/WMSAction.java (execute): 
+	  Improved ExceptionHandling during WMS-Publishing.
+	  The responsedocument will be scanned for Exceptionreports.
+	  Also if no URL, Mapfile or Layer was retrieved from the Responsedocument 
+	  the Exceptionpage will be visualized instead an corrupt Openlayersclient.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/resources/applicationMessages.properties: 
+	  Added new German resource for fis_marinefeatures according to msg1067
+	  of Issue2005.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/resources/applicationMessages*.properties: 
+	  Added Ressources for new FIS Marine Features.
+
+2010-03-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/LoadAction.java: Use the uploaded
+	  file to start an artifact import. Create a new Artifact object if the
+	  import was successful and fetch the current artifact description with user
+	  interface part to restore the gui. Display an error message if something 
+	  failed while importing.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java:
+	  Added a new method doImport to import artifacts from xml documents. A
+	  describe document without ui part is returned if an import was successful.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added error messages
+	  for the case that something failed while importing artifacts from xml
+	  documents.
+
+	* src/main/webapp/WEB-INF/jsp/header.jsp: Replace whitespaces from exception
+	  request parameter with dots. Exceptions thrown by the artifact server
+	  corresponds to a specific resource key. Failures coming from the artifact
+	  server are displayed language specific on this way.
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added missing forwards
+	  to import action.
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java (addParameters):
+	  Some Codecleanup done. 
+
+2010-03-19  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_mapviewercall_inc.jsp: 
+	  Integrated a Switch will be load different Geometries into the 
+	  Requestbody of an Mapviewercall.
+	  You cann add gt=POINT , gt=LINESTRING or gt=POLYGON to the URL to switch 
+	  between the different Geometries.
+	  The Values of the Geometries are the same as used in the GUI of the GNV.
+
+2010-03-17  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue208 First steps for exporting artifacts.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java:
+	  New method to export an artifact.
+
+	* pom.xml: Added Apache common-fileupload 1.2.1 lib.
+
+	* src/main/java/de/intevation/gnv/action/CommunicationKeys.java: Further
+	  error message key added which is displayed beneath project load/store
+	  buttons if an error occured while these operations.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added error messages
+	  for errors which occure while loading/storing projects.
+
+	* src/main/webapp/styles/default.css: Added a new style class to adjust
+	  error messages which may occur while loading/storing projects.
+	
+	* src/main/java/de/intevation/gnv/action/StoreAction.java: New controller 
+	  which triggers an artifact export. After pushing the corresponding button,
+	  the artifact is returned as xml document and a file dialog is displayed.
+
+	* src/main/java/de/intevation/gnv/action/LoadAction.java: New controller to
+	  import artifacts which have former been exported. XML documents are
+	  successfully read from fileupload.
+	  TODO: Use these documents to create artifacts. No artifacts are loaded
+	  yet!
+
+	* src/main/java/de/intevation/gnv/util/XMLUtils.java: Added a method to
+	  write documents to a stream.
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added LoadAction and
+	  StoreAction. The controller are available under /gnv/load and /gnv/store.
+
+	* src/main/webapp/WEB-INF/jsp/header.jsp: Removed placeholder string for 
+	  storing/loading the current project state and added buttons to start
+	  an export of the current project's state (the current artifact) or reload 
+	  an artifact from a xml document.
+
+2010-03-16  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Changed the
+	  rendering of measurement/parameter matrix. The matrix will now look like 
+	  this:
+
+		              | measurement label | measurement label
+	  -------------------------------------------------------
+	  parameter label | measurement value | measurement value
+	  parameter label | measurement value | measurement value
+
+2010-03-15  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue198
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  Added the method signature for publishing wms layers. 'publishWMS'
+	  requires a collection of InputParameters which are used to create the
+	  request xml document. These input parameters can be used to adjust some
+	  wms settings. At the moment, the only parameter which written to the
+	  request xml document is the title for a wms layer.
+
+	* src/main/java/de/intevation/gnv/action/WMSAction.java: Search for user
+	  input and append given input values to request xml document. Put the layer
+	  title into request object to be accessible in jsp files.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Render wms option panel if wms is
+	  requested.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_wms_options_inc.jsp: New.
+	  Option panel for wms customization. At the moment, the user has the
+	  possibility to adjust wms layers' title.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added some labels
+	  for wms options.
+
+2010-03-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java (testArtifactDatabaseClient):
+	  Fixed Compilation-Error because of InterfaceChanges of the 
+	  ArtifactDatabaseClient-Interface.
+
+2010-03-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/resources/applicationMessages*.properties: 
+	  Integrated Resource for FIS Contis and Nauthis.
+
+2010-03-10  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  Throw different exceptions if an error occured in the artifact server.
+	  On this way, we are able to distinguish between general server errors or
+	  errors caused by an invalid user input.
+
+	* src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java,
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java:
+	  Catch the exceptions thrown by DefaultArtifactDatabaseClient and set an 
+	  attribute at the request object for each exception type. The attributes 
+	  will take effect on different places in the user interface.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseInputException.java:
+	  Exception used to be thrown if an invalid user input error occured.
+
+	* src/main/java/de/intevation/gnv/action/CommunicationKeys.java: Added some
+	  keys to store different error messages in the Http session.
+
+	* src/main/webapp/styles/default.css: Added new style class to adjust the
+	  style of error messages caused by invalid user input.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Display invalid input errors at
+	  the top of the input area.
+
+2010-03-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/log4j.properties,
+	  src/main/webapp/WEB-INF/classes/log4j.properties: Moved logging
+	  configuration. The config file did not have any effect in config
+	  directory. In classes directory, it has.
+
+	* src/main/webapp/WEB-INF/web.xml: Removed logging section which is no more
+	  necessary anymore.
+
+2010-03-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Parse
+	  user input from chart/histogram options panel and check if integer and 
+	  doubles are valid - if we find a value which is not valid for the 
+	  configured type, we set an exception message which is displayed in the 
+	  chart/histogram options panel and sets the corresponding parameter to its
+	  default value.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp:
+	  Display error message in options panel if there is one.
+
+	* src/main/resources/applicationMessages_en.properties,
+	  src/main/resources/applicationMessages.properties:
+	  Added strings to display error messages when the user entered a bad
+	  formatted number in chart/histogram options panel.
+
+	* src/main/java/de/intevation/gnv/action/CommunicationKeys.java: Added two
+	  further error message keys used to store error messages for
+	  chart/histogram options.
+
+	* src/main/webapp/styles/default.css: Added a new class 'chartException' to
+	  adjust the style of an error message in chart/histogram options panel.
+
+2010-03-08  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  Adjusted xpath expression to find exception nodes in xml documents again.
+	  The prefix 'art:' has been missing.
+
+2010-03-08  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue187
+
+	* src/main/java/de/intevation/gnv/action/DoExportAction.java: Exports with
+	  target 'img' will get a file extension that corresponds to their
+	  mime-type. There was no code path for 'img' before, which caused the
+	  problem, that 'img'-exports had a '.txt'-file extension.
+
+2010-03-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/DoExportAction.java:
+	  Removed duplicated imports.
+
+2010-03-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue190
+
+	* src/main/java/de/intevation/gnv/action/CreateHistogramAction.java,
+	  src/main/java/de/intevation/gnv/action/CreateChartAction.java: Reset
+	  diagram options. Switching between chart and histogram caused some 'null'
+	  values in text fields. After resetting these options, we don't have these
+	  problems anymore - text fields will be filled with default values in this
+	  case.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_diagramm_adons_inc.jsp:
+	  Removed useless file.
+
+2010-03-05  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: 
+	  ISSUE 181: Removed duplicate Drawaing of the Lengendvalue of Groupelements
+	  for choosing different heights for several Parameters
+	
+2010-03-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  'publishWMS' returns a whole document which contains meta information used
+	  for mapfile generation - not just a string. These information contain
+	  MapServer URL and the path to its mapfile.
+
+	* src/main/java/de/intevation/gnv/action/WMSAction.java: Fetch MapServer
+	  settings from resulting document after wms-publishing to display these
+	  values in gui.
+
+	* src/main/java/de/intevation/gnv/util/XMLUtils.java: Converted class
+	  methods into static methods to use them without initializing an object of
+	  XMLUtils.
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp: Show MapServer and layer
+	  information in gui and use MapServer settings to feed OpenLayers client.
+
+	* src/main/webapp/styles/default.css: Added some classes to adjust style of
+	  information table (wms service, layer name) and map area.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added column labels 
+	  for displaying MapServer information.
+
+2010-03-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp,
+	  src/main/webapp/WEB-INF/jsp/wmslayout.jsp: Removed map-div from index.jsp 
+	  and moved it to wmslayout. So, we don't have an empty div with grey border
+	  in our application if there is no map currently existing. Load images from
+	  MapServer as 'image/png'.
+
+	* src/main/webapp/styles/default.css: Adjusted style for customizing
+	  map-div.
+
+2010-03-02  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  Added export mode to 'out'-xml document.
+
+	* src/main/java/de/intevation/gnv/action/DoOutputAction.java,
+	  src/main/java/de/intevation/gnv/action/DoExportAction.java: Call
+	  'doOutput' for triggering an output like chart, histogram, csv or odv with
+	  a new parameter export mode which contains the export format (img, pdf,
+	  svg).
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Added export
+	  mode to HTTP-Get requests.
+
+2010-03-02  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl:
+	  Implemented a One-Step-Back-History. The user is able to step back to
+	  the last state and to the state for choosing the fis.
+
+2010-03-02  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue184
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Display chart per default, when
+	  reaching a final state, which doesn't need any further user input.
+
+2010-03-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue183
+
+	* src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java:
+	  Take care on exceptions and render an error message if an exception
+	  occured.
+
+2010-03-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/DoExportAction.java: Removed little
+	  copy-paste mistake while setting file-extension for exports.
+
+2010-03-01  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/DoExportAction.java: Set
+	  file-extension according to mime type for histogram exports.
+
+2010-02-26  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Render a matrix
+	  for measurement selection.
+
+	* src/main/webapp/styles/default.css: Added new css class to adjust the
+	  matrix' column headers.
+
+2010-02-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue178
+
+	* src/main/java/de/intevation/gnv/action/DoExportAction.java: Added a code
+	  path for export actions, where no export mode is given.
+
+2010-02-24  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Added
+	  user selected type of bin setting (number of bins, bin width) to diagram
+	  options and request object which are used to create links for chart
+	  images.
+
+	* src/main/java/de/intevation/gnv/action/DoOutputAction.java: Added user
+	  selected type of bin setting to InputParameters which are used to create
+	  xml documents for 'out' target.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp: Added
+	  checkboxes to select the field to adjust bins in histogram charts (bin
+	  width or number of bins). When selecting a checkbox, the other box becomes
+	  disabled.
+
+	* src/main/webapp/WEB-INF/jsp/mainlayout.jsp: JavaScript function to toggle
+	  checkboxes.
+
+2010-02-24  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp: Append
+	  user inserted parameter from histogram options (width, height,  bin width,
+	  number of bins) to http request when fetching the histogram image.
+
+2010-02-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputMode.java:
+	  New method returning export modes.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultExportMode.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/objects/ExportMode.java:
+	  Object storing information about mime-type, description and name of an
+	  export mode.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  Parse export modes from describe document and put them into OutputMode
+	  objects.
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Now, this
+	  action is able to adjust histogram parameter as well.
+
+	* src/main/java/de/intevation/gnv/action/DoExportAction.java: An export is
+	  triggered regarding a new parameter 'mode' which value can be 'pdf', 
+	  'svg' or 'img'. Before, we just took care on 'target' parameter.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Transformed draw
+	  button into an update button.
+
+	* src/main/webapp/images/arrow_refresh.png: Icon for update button. (source:
+	  famfamfam)
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Moved
+	  exports from action panel into options panel. Actions (chart, histogram,
+	  etc) are devided from exports (png, pdf, svg).
+
+2010-02-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Foward to wmslayout.jsp
+	  instead of mainlayout.jsp if the user selected wms target.
+
+	* src/main/webapp/WEB-INF/jsp/wmslayout.jsp: New page for rendering a wms
+	  client (OpenLayers). JavaScript loading take place in this page. If the
+	  user select the wms target, a forward to this page will be done.
+
+	  TODO: Include OpenLayers library from local filesystem instead of loading
+	  it from openlayers.org!
+
+	* src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Removed OpenLayers JavaScript
+	  library and function to initialize OpenLayers. This reduces traffic while
+	  parameterization.
+
+2010-02-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/CreateChartAction.java: Class to
+	  trigger chart rendering.
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Changed
+	  request parameter from 'diagram' (deprecated) to 'chart'.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added title and
+	  labels for histogram options.
+
+	* src/main/webapp/images/chart_curve.png: Chart icon (source: famfamfam)
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added new action to
+	  trigger chart rendering analog to histogram action.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Render chart option panel only if
+	  the user already selected charts.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp: Show
+	  diagram/chart options panel only if the user chose one of them. Placed
+	  these option panels beneath the action panel.
+	  
+	* src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Added new
+	  icon for chart rendering.
+
+	* src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Removed js debug output.
+
+2010-02-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: New action 'WMSAction'.
+	  It triggers the generation of shapefiles and mapfile and sets an internal
+	  flag to intialize an OpenLayers map.
+
+	* src/main/java/de/intevation/gnv/action/WMSAction.java: Action which
+	  triggers the creation of shapefiles and mapfile. An internal flag is set
+	  to initialize an OpenLayers map with the layer even published.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java:
+	  Added a new method to send a request to the artifact server and start
+	  shapefile and mapfile creation.
+
+	* src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Added javascript functions to
+	  read url parameters and initialize OpenLayers.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Call 'wms.do'
+	  after clicking WMS button which triggers WMSAction.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Added a div-container for rendering
+	  an OpenLayers map.
+
+	* src/main/webapp/styles/default.css: New class for styling map
+	  div-container.
+
+	* src/main/java/de/intevation/gnv/util/XMLUtils.java: Made method static to
+	  be able to use it without creating an object of this class.
+
+
+2010-02-15  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added an action
+	  'histogram' to render histograms.
+
+	* src/main/java/de/intevation/gnv/action/CreateHistogramAction.java: Added a
+	  new action for rendering histograms.
+	
+	* src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Display an
+	  icon for histograms if this output mode is present for this artifact.
+
+	* src/main/webapp/images/chart_bar.png: Icon for histograms from famfamfam
+	  iconset.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp: JSP for
+	  rendering histograms.
+
+	* src/main/webapp/styles/default.css: Added a style class for adapting
+	  histogram div.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Include display_histogram_inc if
+	  histogram action have been chosen by user.
+	
+	* src/main/resources/applicationMessages_en.properties,
+	  src/main/resources/applicationMessages.properties: Button label and
+	  alternative image text for histograms.
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Removed
+	  comment lines at the beginning of the file. These empty comment lines 
+	  would cause trouble later, when inserting GPL text automatically with a
+	  script.
+
+2010-02-12  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Render an
+	  icon to trigger a step-back in history for each state.
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added missing forwards
+	  used for stepping back to former states.
+
+2010-02-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_mapviewercall_inc.jsp:
+	  Added further XML-Nodes for simulating the MapViewer-Call more detailed.
+
+2010-02-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: 
+	  Added new Action for Calling the Page with the Form for simmulating 
+	  the MapViewer-Interface-request.
+	  Using the URL
+	  http://localhost:8080/gnv/mvcall.do
+	  you will retrieve the Formular with the MapViewer-Interface-Request-body
+
+	* src/main/webapp/WEB-INF/jsp/header.jsp: 
+	  Added an Switch that will manage that the GUI with the Form of the
+	  MapViewer-Interface-Document only will be displaied if it is requested.
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/ShowMapViewerCallBodyAction.java (execute):
+	  Added new Action for handling the Request that should show the Form 
+	  for insterting the MapViewer-Interface-Document.
+
+2010-02-12  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java: 
+	  Modified the Create-Artifact-Request-Body that a Geometry will be put into 
+	  the Parameter if one is given e.g. using the MapViewer-Interface request.
+
+2010-02-09  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/ressources/externalinterfacecall_curl.xml,
+	  src/test/ressources/samplecall.txt: 
+	  Added Sampledata and a sample how to call the MapViewer-Interface using CURL.
+
+2010-02-09  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/styles/default.css: 
+	  Added some stylinginformation for the Textarea for the XML-Document.
+	* src/main/webapp/WEB-INF/jsp/includes/display_mapviewercall_inc.jsp: 
+	  Integrated an Textarea so that is possible to manipulate the XML-Document 
+	  which simulates the MapViewer-Interface-Body.
+
+2010-02-09  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java (execute): 
+	  Removed trailing and leading Whitespaces from the Parametervalue which 
+	  contains the XML-Document to avoid XML-Parsingerrors.
+
+2010-02-09  Tim Englich  <tim.englich@intevation.de>
+	
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java (createMetaDataRequestBody): 
+	  Fixed a NPE. Now it is possible to  put an Mapservice without an Layer into
+	  the Request-Document of am Mapviewer-Interface-Call.
+
+2010-02-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue170
+	
+	* pom.xml: Changed log4j version to 1.2.14 (later version causes errors and 
+	  breaks maven build process).
+
+2010-02-02  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/header.jsp: 
+	  Added temporally Include of includes/display_mapviewercall_inc.jsp for the
+	  Simulation of the MapViewer-Interface-Request.
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_mapviewercall_inc.jsp: 
+	  Added new Includefile with the Formular which includes the Data for the
+	  Simulation of the MapViewer-Interface-Request.
+
+2010-02-01  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: 
+	  Added am Action for handling the MapViewer-Interface.
+	  if /gnv/extcall.do is called the processing of the defined 
+	  Information will be done and the GUI will be displayed.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java: 
+	  Implementation of the interface ParametrizedArtifactObject fro the 
+	  representation of ArtifactFactories which has further Information.
+	  
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactObject.java (addParameters): 
+	  Added new Interfacedefinition ParametrizedArtifactObjects for representing those
+	  ArtifactObjects which includes further Informations. E.g. for creating an 
+	  new Artifact.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java (equals): 
+	  Override  equals-method to get ap proper comparisons of the kinds of objects.
+	  
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java (getArtifactFactoryMetaInformation): 
+	  Added Method to retrieve Metainformations form the ArtifactDatabases.
+	  Also added the possibility to send further  Informations (e.g: Parameters)
+	  in the Request-body of an Create-Artifact-Call.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java (getArtifactFactoryMetaInformation): 
+	  Added Method to retrieve Metainformations form the ArtifactDatabases.
+
+	* src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java (execute): 
+	  Added further Businesslogic to the Action which will handle the MapViewer-
+	  InterfaceCall. Now the retrieved Informations will be sent to the 
+	  ArtifactDatabase an the retrieved Informations will be used to reduce 
+	  the displayed "Fachinformationssysteme". And also will be used to
+	  send these Informations (e.g: Parameters) during the creation of an 
+	  new Artifact.
+
+2010-01-27  Hans Plum <hans@intevation.de>
+
+	RELEASE 0.3
+
+	* Changes, NEWS, ChangeLog: Summerized activities
+
+2010-01-27  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Added a
+	  workarround to avoid input failures caused by multi select boxes with only
+	  one entry. They look like text input fields and don't force the user to 
+	  select a row. In this case, the single entry is selected automatically.
+
+2010-01-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/styles/default.css: Added a class for dynamic tables 
+	  - enabled input fields - to adjust font size of input fields.
+	  
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl: Removed
+	  local-name() method, inserted a table for 'group' items (like input fields
+	  of dates) and resized the height of multi select boxes - max 5 items or
+	  less.
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Removed a typo which made the html
+	  output invalid.
+
+2010-01-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Add width,
+	  height and the boolean value to adjust the visibility of points in charts 
+	  to the pdf and svg export links.
+
+2010-01-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added legend for
+	  summary box.
+
+	* src/main/webapp/styles/default.css: Adapted some css classes regarding the
+	  position of boxes and removed background image in fieldsets.
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Removed
+	  useless div container (div container is now outside the xsl sheet).
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp: Moved former parameter into a
+	  fieldset and added a label to this fieldset.
+
+2010-01-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/ShowStatisticAction.java: This
+	  action 'calculates' the statistic and shows the result in the gui.
+	
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added controller and
+	  forwards.
+
+	* src/main/webapp/images/statistics.png: Statistic icon. FIXME: Give a Source here!
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp: Added symbol
+	  in action box to show the statistic.
+
+	* src/main/webapp/styles/default.css: Adjusted some parameter for a proper
+	  placement of the statistic box.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added label for
+	  statistic icon. 
+
+2010-01-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/DescribeUIAction.java: New action.
+	  The only task of this action is to parse the describe document and create 
+	  static and dynamic user interface out of it.
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java,
+	  src/main/java/de/intevation/gnv/action/DoOutputAction.java,
+	  src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java,
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java:
+	  Removed xsl transformation. Classes which needs xsl transformation inherit
+	  from DescribeUIAction which does the transformation. Now, it is much
+	  easier to write new actions, because they do not need to parse the
+	  describe document and create static and dynamic user interfaces.
+
+	  Removed some useless imports.
+
+2010-01-22  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/index.jsp,
+	  src/main/webapp/WEB-INF/jsp/header.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/includes/display_diagramm_adons_inc.jsp,
+	  src/main/webapp/WEB-INF/jsp/mainlayout.jsp:
+	  - Improved the design and the usibility concept ("Bedienkonzept").
+	    Removed the useless "draw" button after reaching the last state which 
+		has some output modes.
+	  - Render chart options - if chart creation is possible for this state - and show
+	    export actions.
+	  - Moved chart options and export actions to the left side beneath the 
+	    static and dynamic panals for parameterization.
+	  - Removed some warnings and errors regaring html conformance.
+
+	* src/main/webapp/styles/default.css: Made some necessary adjustments
+	  regarding the movement of chart option and action boxes.
+	
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added label for
+	  action box.
+
+	* src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java:
+	  Removed pathes of xsl sheets from code and put them to a central place.
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Added
+	  urls to xsl transformer for step-back links and create a dynamic ui only
+	  if there is content for it - avoid creation of empty boxes.
+
+	* src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java: Write
+	  dynamic ui only if there is content. Some code formatting done.
+
+	* src/main/webapp/images/back_button.png: Button to step back to a previous
+	  state.
+	  
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added forwards to fis
+	  selection and previous states.
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Enabled
+	  link to step back to fis selection.
+
+2010-01-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue149
+
+	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Show
+	  chart if there are output modes existing for this state. Set internal 
+	  value of checkboxes to 'true' if they are selected.
+	  
+	  TODO: We should check if there is an output mode named 'chart' before 
+	  rendering a chart.
+
+2010-01-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties: Added label for
+	  char option 'draw data points'.
+
+2010-01-20  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/styles/default.css,
+	  src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Adapted
+	  style of static ui to bsh style. Improved indentation.
+
+2010-01-19  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl,
+	  src/main/webapp/WEB-INF/jsp/index.jsp: Commented links to step back in
+	  history out and always render a fis select box (reason for this is the
+	  next release and a too buggy 'step-back-history').
+
+2010-01-19  Tim Englich  <tim.englich@intevation.de>
+
+	* src/test/ressources/externalinterfacecall.xml:
+	  Added an Request-Document which contains an Call which might be
+	  send from the MapViewer to the GNV. 
+	
+	* src/test/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserTestCase.java:
+	  Added TestCase for testing the functionality of the XMLExternalCallParser-Implementation.
+	
+2010-01-19  Tim Englich  <tim.englich@intevation.de>
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java: 
+	  DefaultImplementation of the Interface MapService.
+	
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java : 
+	  Added a new Interfacespecification for representing an MapService retrieved
+	  by an MapViewer-Call
+	
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultLayer.java: 
+	  DefaultImplementation of the Interface Layer.
+	
+	* src/main/java/de/intevation/gnv/artifactdatabase/objects/map/Layer.java: 
+	  Added a new Interfacespecification for representing an Layer retrieved
+	  by an MapViewer-Call
+	
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java 
+	(getArtifactFactoryMetaInformation), src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java 
+	(getArtifactFactoryMetaInformation): 
+	  Added new Method for retrieving Metainformation for the ArtifactFactories using
+	  the Data which is parsed using the ExternalCallParser.
+	
+	* src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java (ExternalCallParserException): 
+	  New ExceptionClass which is used to specify Exception which occurs during parsing
+	  an ExternalCallParser.
+	
+	* src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java : 
+	  Added an Implementation of the Inteface ExternalCallParser which is able to parse
+	  an XML-Document.
+	
+	* src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java : 
+	  Added a new Interface which provides the required Methods for parsing an 
+	  Request from the MapViewer an provide the parsed Data.
+	
+	* src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java: 
+	  Added new Action which provied the reauired logic for Implementing the 
+	  Interface to the MapViewer.
+
+2010-01-18  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added a new controller
+	  which causes a return to the point, where the user can choose a fis.
+
+	* src/main/java/de/intevation/gnv/action/SelectFisAction.java: Controller to
+	  reset the SessionModel and to jump back to fis selection.
+
+	* src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java,
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java: Made
+	  the link to return to the fis select box available in XSL.
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Check the
+	  'fis' attribute is contained in select1 nodes and create a link in this
+	  case.
+
+2010-01-18  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java:
+	  Render the static part of the gui as well - not just the dynamic part.
+
+	* src/main/webapp/WEB-INF/jsp/index.js: Do not include the fis combo box if
+	  the describe document contains a static part, which means that the user
+	  already selected a fis.
+
+	* src/main/webapp/styles/default.css: Added 20px space at the top of the
+	  static table. Otherwise the table hides the links to load and save
+	  projects.
+
+2010-01-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Simpler
+	  demo WKT polygon.
+
+2010-01-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp:
+	  Only render chart addons when we have a chart.
+
+	* src/main/java/de/intevation/gnv/action/DoExportAction.java:
+	  Set right file extensions if we have WMS or ZIP export.
+
+2010-01-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp:
+	  Add links to download zip files and WMS layers if they are
+	  available.
+
+	* src/main/resources/applicationMessages.properties,
+	  src/main/resources/applicationMessages_en.properties:
+	  Added i10n for new download link types.
+
+	* src/main/webapp/images/svg.png: New. Gimp rendered PNG
+	  of official SVG logo. Creative Commons license.
+
+	* src/main/webapp/images/pdf.png: New. Crystal pdf icon.
+	  LGPLv2 license.
+
+	* src/main/webapp/images/disk.png, src/main/webapp/images/map_go.png:
+	  famfamfam icons for disk and map. Creative Commons license.
+
+2010-01-15	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java,
+	  src/main/java/de/intevation/gnv/util/XSLTransformer.java:
+	  Cleanup imports.
+
+2010-01-14  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java:
+	  Fixed a bug which caused that the user was not able to draw charts
+	  anymore. Query the 'output' node of the describe document and render a
+	  'draw'-button if existing. If 'output' is not existing, render a 'select'
+	  button to step forward to the next step.
+
+2010-01-13  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  Added 'doAdvance' method to be able to advance only - without feed or
+	  describe. We need this method to step back to previous states. Advance was 
+	  bundled with feed and describe, before.
+
+	* src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java:
+	  Some code refactoring.
+
+	* src/main/java/de/intevation/gnv/util/XSLTransformer.java,
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java: Set
+	  parameter of xsl transformer which contains the url to step back to a 
+	  previous state. This parameter is used in xsl sheet to render a
+	  link into the user interface.
+
+	* src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java:
+	  New controller to step back to a previous state.
+
+	* src/main/webapp/WEB-INF/config/struts-config.xml: Added a new action which
+	  calls PreviousArtifactStepAction to step back to previous states.
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl:
+	  Refactored gui rendering. The static part of the parameter list is
+	  rendered in a table with three columns (icon to step back, parameter name,
+	  selected value). The target state to step back to is contained as
+	  attribute 'art:state' in 'xform:select', 'xfom:select1' and 'xform:group'
+	  nodes.
+
+	* src/main/webapp/styles/default.css: Added a style class to adapt the first 
+	  column of the static part's table.
+
+2009-01-13	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/mainlayout.jsp: Shortened
+	  fractions digits to four places to be displayable in static
+	  ui description.
+	
+	* src/main/webapp/WEB-INF/config/templates/describe-ui.xsl:
+	  Fixed target id of text input field.
+
+2009-01-13	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/webapp/WEB-INF/jsp/mainlayout.jsp,
+	  src/main/webapp/WEB-INF/config/templates/describe-ui.xsl:
+	  Added demo wkt polygon to test the "Horizontalschitt".
+	  Remove this when we have the GIS interface.
+
+2010-01-09  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java:
+	  Use XMLUtils.ElementCreator to create new elements for xml documents.
+
+2010-01-08  Tim Englich  <tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java (execute),
+	  src/main/java/de/intevation/gnv/action/DoOutputAction.java (execute): 
+	  Removed Encodingerrors from listed Files. All Files are now UTF-8 compliant.
+
+2010-01-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/util/ArtifactNamespaceContext.java:
+	  NamespaceContext class used by gnv artifacts.
+
+	* src/main/java/de/intevation/gnv/util/XMLUtils.java: Added
+	  ArtifactNamespaceContext as default namespace context while creating
+	  XPath objects.
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Removed
+	  local-name() methods.
+
+	* src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java,
+	  src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java,
+	  src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java: Adjust
+	  xpathes regarding namespace changes.
+
+2010-01-05  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Removed
+	  for-each statements and replaced them with templates.
+
+2010-01-04  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/webapp/styles/default.css: Added new classes for displaying
+	  parameters and values in left panel.
+
+	* src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl: Static
+	  nodes will be rendered as text instead of disabled xforms.
+
 2009-12-17	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	RELEASE 0.3
@@ -17,7 +2581,7 @@
 
 2009-12-17  Hans Plum <hans@intevation.de>
 
-	Issue 129: Release 0.2: Verbesserung der Übersetzungen
+	Issue 129: Release 0.2: Verbesserung der �bersetzungen
 	
 	* src/main/resources/applicationMessages.properties:
 	Fixed i18n strings reported by experts
@@ -32,7 +2596,7 @@
 
 2009-12-14  Hans Plum <hans@intevation.de>
 
-	Issue109: Tomcat: Konfiguration des Kontexts enthält Redundanz
+	Issue109: Tomcat: Konfiguration des Kontexts enth�lt Redundanz
 
 	* src/main/webapp/META-INF/context.xml:
 	Removed obsolete configuration attributes.
--- a/gnv/Changes	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/Changes	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,91 @@
+2010-06-30  RELEASE 1.1
+
+    NEW:
+
+        * Integrated an enhanced map client for working with gnv internal and
+          external wms layers
+        * N-Step back history for parameterization
+        * Added JavaDoc
+
+    FIXES:
+
+        * Input validation corresponding the current locale (#289)
+        * Fixed broken XPathes while wms publishing
+        * Removed duplicated layernames from gui (#305)
+        * Missing i18n for gui elements (#227, #272, #297, #177)
+        * Typos (#293)
+
+
+
+2010-04-28  RELEASE 1.0
+
+    NEW:
+
+        * Support for renaming wms layers (#198)
+
+        * Added control elements for saving and loading artifacts (#208).
+          Apache's commons.file-updload library is used for file upload.
+
+        * Support for changing the language between german and english via
+          button in the gui. The intial language is determined by browser
+          settings. After the user changes this settings by clicking the button
+          in the gui, the browser locale is ignored in future (#30, #254)
+
+        * Improved error handling. The user is able to reload the current
+          parameterization with the help of a link shown in the gui if an error
+          occured (#13). After clicking that link, the describe document of the
+          current artifact is requested and the gui is created again (#13, #18,
+          #236).
+
+        * Improve input validation in chart/histogram panels.
+
+        * Improve the design of the gui according to BSH style guides.
+
+    FIXES:
+
+        * Adjusted file extension of image exports (#187)
+        * Display time to live of an artifact (#197)
+        * Added missing character in the link to trigger an image export of
+          charts (#216)
+        * Restructuring of parameter-measurement matrix. Just the selection of
+          different depths is possible (#210)
+        * Added tooltip text for the step-back button (#227)
+        * Replace html characters to avoid html injections (#221)
+        * Adapted the MapServer path shown in the gui (#237)
+        * Fixed a bug in IE that avoided exporting charts as image (#259).
+        * Loading an artifact without running artifact server ends with a
+          warning and a message to try it later again (#258)
+        * Display an error message if the user tries to work with an outdated
+          artifact (#242)
+        * Repaired logging with log4j
+
+
+2010-03-08  RELEASE 0.5
+
+
+
+2010-01-27  RELEASE 0.4
+
+    New:
+
+    * Improved internal handling of each selection state and 
+    moved calculation step before rendering (instead of one step)
+    
+    * Internal Preparation of 1-step-back history: Split up in 
+    static (Summary of parameters ) and dynamic section 
+    (Selectable parameters)
+
+    * Added support for Shapefile and WMS Handling if they are available
+    
+    * First implementation of MapViewer Interface
+
+    * Improved structure of div-containers
+
+    Fixed:
+
+    * Width and height of diagramm made changeable for user (#149)
+
+
 2009-12-17      RELEASE 0.3
 
     New:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/LGPL.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,502 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
--- a/gnv/NEWS	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/NEWS	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,58 @@
+2010-06-30  RELEASE 1.1
+
+    * Integrated an enhanced map client for working with gnv internal and
+      external wms layers
+
+    * N-Step back history for parameterization
+
+
+
+2010-04-28  RELEASE 1.0
+
+    NEW:
+
+        * Support for renaming wms layers
+
+        * Added control elements in the gui for saving and loading projects
+
+        * Support for changing the language between german and english via
+          button in the gui.
+
+        * Improved error handling. The user is able to reload the current
+          parameterization with the help of a link shown in the gui if an error
+          occured.
+
+        * Improve the design of the gui according to BSH style guides.
+
+
+2010-03-08  RELEASE 0.5
+
+
+2010-01-27  RELEASE 0.4
+
+    * Adapted GUI to new concept 
+      * handling selected parameters in a central summary to make GUI
+      more compact
+      * Splitting date selections into 2 steps: yearly and 
+      exact point of time
+      * Enabling Point-Rendering for rendering in diagrams
+      * arranging productspecific actions (Exports, Statistics) 
+      in a central field in order to have direct access to end products
+      at one place
+
+    * Added support for Shapefile Download
+
+    * Added first mechanism for publishing as Cross-sections as WMS
+    
+    * Reworked HTML to be HTML standard compatible
+
+    * Added some new icons
+
+    * Integrated basic styling of BSH
+
+    * Added WKT-Line and Polygon Input for (temporary testing only)
+
+
 2009-12-17  RELEASE 0.3
 
     * PDF and SVG export of diagrams.
--- a/gnv/pom.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/pom.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -7,6 +7,11 @@
   <version>1.0-SNAPSHOT</version>
   <name>gnv</name>
   <url>http://maven.apache.org</url>
+  <scm>
+    <connection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv</connection>
+    <developerConnection>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv</developerConnection>
+    <url>scm:svn:svn+ssh://${user}@thoe.intevation.de/home/projects/Geospatial/bsh-generischer-viewer/Material/SVN/gnv</url>
+  </scm>
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
   </properties>
@@ -18,6 +23,11 @@
     </repository>
   </repositories>
   <dependencies>
+  <dependency>
+      <groupId>commons-fileupload</groupId>
+      <artifactId>commons-fileupload</artifactId>
+      <version>1.2.1</version>
+    </dependency>
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
@@ -25,14 +35,14 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.restlet</groupId>
+      <groupId>org.restlet.jse</groupId>
       <artifactId>org.restlet</artifactId>
-      <version>2.0-SNAPSHOT</version>
+      <version>2.0.4</version>
     </dependency>
     <dependency>
-      <groupId>org.restlet</groupId>
+      <groupId>org.restlet.jse</groupId>
       <artifactId>org.restlet.ext.xml</artifactId>
-      <version>2.0-SNAPSHOT</version>
+      <version>2.0.4</version>
     </dependency>
     <dependency>
       <groupId>tomcat</groupId>
@@ -55,7 +65,7 @@
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
-      <version>[1.2,)</version>
+      <version>1.2.14</version>
     </dependency>
   </dependencies>
   <build>
@@ -80,6 +90,14 @@
               </excludes>
             </resource>
           </webResources>
+          <archive>
+            <manifest>
+              <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+            </manifest>
+            <manifestEntries>
+              <SCM-Revision>${buildNumber}</SCM-Revision>
+            </manifestEntries> 
+          </archive>
         </configuration>
       </plugin>
       <plugin>
@@ -121,32 +139,21 @@
              </configuration>
       </plugin>
       <plugin>
-      <groupId>org.codehaus.mojo</groupId>
-      <artifactId>buildnumber-maven-plugin</artifactId>
-      <version>1.0-beta-2</version>
-      <executions>
-        <execution>
-          <phase>initialize</phase>
-          <goals>
-            <goal>create</goal>
-          </goals>
-        </execution>
-      </executions>
-      <configuration>
-        <doCheck>false</doCheck>
-        <doUpdate>false</doUpdate>
-        <timestampFormat>{0, date, yyyy-MM-dd HH:mm:ss}</timestampFormat>
-         <format>{0,date,yyyy-MM-dd HH:mm:ss}</format>
-          <items>
-            <item>timestamp</item>
-          </items>
-        
-        <revisionOnScmFailure>no_revision</revisionOnScmFailure>
-      </configuration>
-    </plugin>
-      
-     
-
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>buildnumber-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>validate</phase>
+            <goals>
+              <goal>create</goal>
+            </goals>
+          </execution>
+        </executions>
+        <configuration>
+          <doCheck>false</doCheck>
+          <doUpdate>false</doUpdate>
+        </configuration>
+      </plugin> 
     </plugins>
     <resources>
       <resource>
--- a/gnv/src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/ArtifactDatabaseActionBase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,10 +1,16 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
 
 import org.apache.log4j.Logger;
 import org.apache.struts.action.Action;
@@ -13,12 +19,23 @@
 import org.apache.struts.action.ActionMapping;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * Basicimplemantation for all Actions which should serv request for
+ * the GNV.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class ArtifactDatabaseActionBase extends Action {
 
+    /**
+     * The id of the action which should used if the execution
+     * of the action was successful.
+     */
     protected final static String SUCCSESS_FORWARD_ID = "success";
+    
+    /**
+     * The id of the action which should be used if an exception has occurred
+     * during the execution. 
+     */
     protected final static String EXCEPTION_FORWARD_ID = "success";
 
     /**
@@ -34,12 +51,6 @@
         super();
     }
 
-    /**
-     * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping,
-     *      org.apache.struts.action.ActionForm,
-     *      javax.servlet.http.HttpServletRequest,
-     *      javax.servlet.http.HttpServletResponse)
-     */
     @Override
     public ActionForward execute(ActionMapping mapping, ActionForm form,
                                  HttpServletRequest request,
@@ -50,14 +61,69 @@
     }
 
     /**
-     * Returns the ExceptionForward for the ArtifactDatabaseActions
-     * 
-     * @param mapping
-     * @return
+     * Returns the Action that should be used if an exception has occurred.
+     * @param mapping the mapping which holds all available Actions
+     * @return the Action that should be used.
      */
     protected ActionForward getExceptionForward(ActionMapping mapping) {
         log.debug("ArtifactDatabaseActionBase.getExceptionForward");
         ActionForward lForward = mapping.findForward(EXCEPTION_FORWARD_ID);
         return lForward;
     }
+
+    /**
+     * Encodes the <code>String</code> to prevent cross-site-scripting
+     * @param s the string that should be encoded
+     * @return the encoded string
+     */
+    protected String encode(String s) {
+        log.debug("String to encode: " + s);
+        s = s.replaceAll("<", "&lt;");
+        s = s.replaceAll(">", "&gt;");
+        s = s.replaceAll("\"", "&quot;");
+        s = s.replaceAll("&", "&amp;");
+
+        log.debug("Encoded string: " + s);
+        return s;
+    }
+
+    /**
+     * Encodes the <code>StringArray</code> to prevent cross-site-scripting
+     * @param s the stringarray that should be encoded
+     * @return the encoded stringarray
+     */
+    protected String[] encode(String[] s) {
+        if (s == null)
+            return null;
+
+        String[] good = new String[s.length];
+        for (int i = 0; i < good.length; i++) {
+            good[i] = encode(s[i]);
+        }
+
+        return good;
+    }
+
+
+    protected boolean isSessionExhausted(HttpServletRequest request) {
+        HttpSession session = request.getSession();
+        return session.isNew();
+    }
+
+
+    protected ActionForward sessionExhaustedForward(
+        ActionMapping mapping, ActionForm form,
+        HttpServletRequest request, HttpServletResponse response)
+    throws Exception
+    {
+        request.setAttribute(
+            CommunicationKeys.REQUEST_EXCEPTION_SESSION_ID,
+            "SessionTimeout has occured");
+
+        log.warn("Session timed out.");
+
+        return new FetchArtifactFactoriesAction().execute(
+            mapping, form, request, response);
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,36 +1,45 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action;
 
+import de.intevation.gnv.action.sessionmodel.DiagrammOptions;
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+
+import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
+import de.intevation.gnv.artifactdatabase.objects.OutputMode;
+import de.intevation.gnv.artifactdatabase.objects.OutputParameter;
+
+import java.text.NumberFormat;
+import java.text.ParseException;
+
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.log4j.Logger;
+
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
-import org.w3c.dom.Node;
-
-import de.intevation.gnv.action.sessionmodel.DiagrammOptions;
-import de.intevation.gnv.action.sessionmodel.SessionModel;
-import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
-import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
-import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
-import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
-import de.intevation.gnv.artifactdatabase.objects.OutputMode;
-import de.intevation.gnv.artifactdatabase.objects.OutputParameter;
-import de.intevation.gnv.util.XMLUtils;
-import de.intevation.gnv.util.XSLTransformer;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This controller is called to change options used in charts and histograms
+ * (e.g. width, height, etc).
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
-public class ChangeOptionsAction extends ArtifactDatabaseActionBase {
+public class ChangeOptionsAction extends DescribeUIAction {
     /**
      * the logger, used to log exceptions and additonaly information
      */
@@ -47,69 +56,118 @@
     public ActionForward execute(ActionMapping mapping, ActionForm form,
                                  HttpServletRequest request,
                                  HttpServletResponse response) throws Exception {
+        if (isSessionExhausted(request)) {
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
         log.debug("NextArtifactStepAction.execute");
         try {
             SessionModel sm = SessionModelFactory.getInstance()
                     .getSessionModel(request);
 
-            String target = request.getParameter("target");
+            ArtifactDescription ad = sm.getArtifactDescription();
+
+            String target         = request.getParameter("target");
             OutputMode outputMode = sm.getOutputMode(target);
+            Locale locale         = sm.getCurrentLocale();
+
             if (outputMode != null) {
-
                 Collection<OutputParameter> op = outputMode
                         .getOutputParameters();
                 if (op != null) {
                     Iterator<OutputParameter> it = op.iterator();
+                    DiagrammOptions oldOptions      = sm.getDiagrammOptions();
                     DiagrammOptions diagrammOptions = new DiagrammOptions();
                     while (it.hasNext()) {
                         OutputParameter parameter = it.next();
-                        String value = request.getParameter(parameter.getName());
-                        if (parameter.getType().equalsIgnoreCase("boolean")){
+                        String name  = parameter.getName();
+                        Object old   = oldOptions != null
+                            ? oldOptions.getValue(name)
+                            : parameter.getValue();
+                        String value = request.getParameter(name);
+                        String type  = parameter.getType();
+
+                        if (log.isDebugEnabled()) {
+                            log.debug("Change chart options now...");
+                            log.debug("Parameter name: " + name);
+                            log.debug("Parameter type: " + type);
+                            log.debug("Parameter value: " + value);
+                        }
+
+                        if (type.equalsIgnoreCase("boolean")){
                             if (value == null){
                                 value = "false";
                             }
+                            else {
+                                value = "true";
+                            }
+
+                            diagrammOptions.setValue(name,value);
                         }
-                        diagrammOptions.setValue(parameter.getName(),value);
+                        else if (type.equalsIgnoreCase("integer")) {
+                            if (validInteger(request.getLocale(), value)) {
+                                diagrammOptions.setValue(name, value);
+                            }
+                            else {
+                                log.warn("Text is not a valid integer: "+value);
+                                diagrammOptions.setValue(name, old);
 
+                                request.setAttribute(
+                                    CommunicationKeys.REQUEST_EXCEPTION_MESSAGE,
+                                    "input.not.a.integer"
+                                );
+
+                                request.setAttribute(
+                                    CommunicationKeys.REQUEST_EXCEPTION_VALUE,
+                                    value
+                                );
+                            }
+                        }
+                        else if (type.equalsIgnoreCase("double")) {
+                            try {
+                                double val    = parseDoubleValue(locale, value);
+                                String valStr = Double.toString(val);
+                                log.debug("Change diagram options ["
+                                    + name +"] to " + val);
+                                diagrammOptions.setValue(name, val);
+                            }
+                            catch (ParseException pe) {
+                                log.warn("Text is not a valid double: "+value);
+                                diagrammOptions.setValue(name, old);
+
+                                request.setAttribute(
+                                    CommunicationKeys.REQUEST_EXCEPTION_MESSAGE,
+                                    "input.not.a.double"
+                                );
+
+                                request.setAttribute(
+                                    CommunicationKeys.REQUEST_EXCEPTION_VALUE,
+                                    value
+                                );
+                            }
+                        }
                     }
                     sm.setDiagrammOptions(diagrammOptions);
+
+                    // XXX Little workarround. We should implement a 'choice' type,
+                    // if we need further choice elements! (iw)
+                    String bintype = request.getParameter("bintype");
+                    if (bintype != null) {
+                        diagrammOptions.setValue("bintype", bintype);
+                        sm.setDiagrammOptions(diagrammOptions);
+                        request.setAttribute("bintype", bintype);
+                    }
                 }
             }
 
-            ArtifactDescription ad = sm.getArtifactDescription();
-            ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
-                                                .getInstance()
-                                                .getArtifactDatabaseClient(getLocale(request));
-
-            ArtifactDescription artifactDescription = adc
-                    .getCurrentStepDescription(sm.getSelectedArtifactFactory(),
-                                               sm.getCurrentArtifact(),
-                                               true);
-
-            Node currentUI = artifactDescription.getCurrentUI();
-            XSLTransformer transformer = new XSLTransformer();
-            String ui = transformer.transform(new XMLUtils().getNodeXPath(
-                    currentUI, "dynamic"), "UTF-8", request
-                    .getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
+            Map tmpOuts = ad.getOutputModes();
+            if (tmpOuts == null || tmpOuts.isEmpty()) {
+                request.setAttribute("furthertargets", true);
+            }
+            else {
+                request.setAttribute(target, true);
+            }
 
-            request.setAttribute("ui", ui);
-
-            String staticUI = transformer
-                    .transform(
-                            new XMLUtils().getNodeXPath(currentUI, "static"),
-                            "UTF-8",
-                            request
-                                    .getRealPath("WEB-INF/config/templates/describe-ui-static.xsl"));
-            request.setAttribute("staticui", staticUI);
-            request.setAttribute("furthertargets",
-                    (ad.getReachableStates() != null && !ad
-                            .getReachableStates().isEmpty()));
-
-            if (ad.getReachableStates() != null
-                && !ad.getReachableStates().isEmpty()) {
-            } else {
-                request.setAttribute("diagramm", true);
-            }
             return super.execute(mapping, form, request, response);
         } catch (Exception e) {
             log.error(e, e);
@@ -120,4 +178,34 @@
         }
     }
 
+    protected boolean validInteger(Locale locale, String value) {
+        try {
+            if (value.split("\\.").length > 1 || value.split("\\,").length > 1){
+                return false;
+            }
+
+            NumberFormat format = NumberFormat.getIntegerInstance(locale);
+            format.setParseIntegerOnly(true);
+            Number       number = format.parse(value);
+
+            if (number.longValue() < 0)
+                return false;
+
+            return (number instanceof Integer) || (number instanceof Long);
+        }
+        catch (ParseException pe) {
+            return false;
+        }
+    }
+
+    protected double parseDoubleValue(Locale locale, String value)
+    throws ParseException
+    {
+        log.error("LOCALE FOR DOUBLE PARSING: " + locale.toString());
+        NumberFormat format = NumberFormat.getNumberInstance(locale);
+        Number       number = format.parse(value);
+
+        return number.doubleValue();
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/CommunicationKeys.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/CommunicationKeys.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,13 +1,47 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.action;
 
 /**
- * 
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This class defines some keys used to store different exception types in the
+ * session.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class CommunicationKeys {
     /**
      * The Key which should be used for accessing ExceptionMessages
      */
-    public final static String REQUEST_EXCEPTION_MESSAGE_ID = "request_exception_message";
+    public final static String REQUEST_EXCEPTION_MESSAGE_ID = "request_exception_message_id";
+
+
+    public final static String REQUEST_EXCEPTION_SESSION_ID = "request_exception_session_id";
+
+    /**
+     * Key used to store exceptions relating to wrong user input.
+     */
+    public final static String REQUEST_EXCEPTION_INPUT_ID   = "request_exception_input_id";
+
+    /**
+     * Key used to store exceptions relating to more general errors occured in
+     * the server.
+     */
+    public final static String REQUEST_EXCEPTION_MESSAGE    = "request_exception_message";
+
+    /**
+     * Key used to store exceptions relating to an invalid input format.
+     */
+    public final static String REQUEST_EXCEPTION_VALUE      = "request_exception_value";
+
+    /**
+     * Key used to store exceptions relating to a load/save project error.
+     */
+    public final static String REQUEST_EXCEPTION_PROJECT    = "request_exception_project";
 }
+// 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/gnv/src/main/java/de/intevation/gnv/action/CreateChartAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+
+/**
+ * This controller is called to display charts.<br>
+ * An attribute 'chart' on the request object is activated which inserts an
+ * image calling a chart output of the server.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class CreateChartAction extends DescribeUIAction {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger logger = Logger.getLogger(CreateChartAction.class);
+
+
+    /**
+     * Constructor
+     */
+    public CreateChartAction() {
+        super();
+    }
+
+
+    @Override
+    public ActionForward execute(
+        ActionMapping       mapping,
+        ActionForm          form,
+        HttpServletRequest  request,
+        HttpServletResponse response)
+    throws Exception {
+        if (isSessionExhausted(request)) {
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
+        logger.debug("Create chart.");
+
+        SessionModel sm = SessionModelFactory.getInstance().getSessionModel(
+            request);
+        sm.setDiagrammOptions(null);
+        request.setAttribute("chart", true);
+
+        return super.execute(mapping, form, request, response);
+    }
+}
+// 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/gnv/src/main/java/de/intevation/gnv/action/CreateHistogramAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+
+/**
+ * This controller is called to display histograms.<br>
+ * An attribute 'histogram' on the request object is activated which inserts an
+ * image calling a histogram output of the server.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class CreateHistogramAction extends DescribeUIAction {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger logger = Logger.getLogger(CreateHistogramAction.class);
+
+
+    /**
+     * Constructor
+     */
+    public CreateHistogramAction() {
+        super();
+    }
+
+
+    @Override
+    public ActionForward execute(
+        ActionMapping       mapping,
+        ActionForm          form,
+        HttpServletRequest  request,
+        HttpServletResponse response)
+    throws Exception {
+        if (isSessionExhausted(request)) {
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
+        logger.debug("Create histogram.");
+
+        SessionModel sm = SessionModelFactory.getInstance().getSessionModel(
+            request);
+        sm.setDiagrammOptions(null);
+        request.setAttribute("histogram", true);
+
+        return super.execute(mapping, form, request, response);
+    }
+}
+// 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/gnv/src/main/java/de/intevation/gnv/action/DescribeUIAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.xml.xpath.XPathConstants;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.Globals;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.w3c.dom.Node;
+
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
+import de.intevation.gnv.util.ArtifactNamespaceContext;
+import de.intevation.gnv.util.XMLUtils;
+import de.intevation.gnv.util.XSLTransformer;
+
+/**
+ * This controller is called to fetch the current artifact description using the
+ * describe operation. The describe document is used to feed an XSL transformer
+ * that parses the xml and creats html output representing the parameter panel.
+ * The html code is stored as attribute on the request object which is queried
+ * in a jsp page later.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class DescribeUIAction extends ArtifactDatabaseActionBase {
+
+    public static final String XPATH_DYNAMIC_UI = "art:dynamic";
+    public static final String XPATH_STATIC_UI  = "art:static";
+
+    public static final String XSL_SHEET_DYNAMIC =
+        "WEB-INF/config/templates/describe-ui.xsl";
+
+    public static final String XSL_SHEET_STATIC =
+        "WEB-INF/config/templates/describe-ui-static.xsl";
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger logger = Logger.getLogger(DescribeUIAction.class);
+
+
+    /**
+     * Constructor
+     */
+    public DescribeUIAction() {
+        super();
+    }
+
+
+    @Override
+    public ActionForward execute(
+        ActionMapping       mapping,
+        ActionForm          form,
+        HttpServletRequest  request,
+        HttpServletResponse response
+    ) throws Exception
+    {
+        if (isSessionExhausted(request)) {
+            // session timed out before
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
+        logger.info("describe user interface");
+        try {
+            // render describe document and create user interface
+            SessionModel sm = SessionModelFactory.getInstance().getSessionModel(
+                request);
+            Locale tmp             = sm.getCurrentLocale();
+            Locale locale          = tmp != null ? tmp : request.getLocale();
+
+            ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
+                .getInstance().getArtifactDatabaseClient(locale);
+            request.getSession().setAttribute(Globals.LOCALE_KEY, locale);
+            ArtifactObject artifactFactory = sm.getSelectedArtifactFactory();
+
+            if (artifactFactory == null) {
+                logger.error("No connection to artifact server.");
+                request.setAttribute(
+                    CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                    "java.io.ioexception..connection.refused");
+
+                return super.getExceptionForward(mapping);
+            }
+
+            ArtifactDescription artifactDescription =
+                adc.getCurrentStepDescription(
+                    artifactFactory,
+                    sm.getCurrentArtifact(),
+                    true);
+
+            Node currentUI = artifactDescription.getCurrentUI();
+            if (currentUI != null) {
+                ResourceBundle res = ResourceBundle.getBundle(
+                    "applicationMessages", locale);
+                String editText           = res.getString(
+                    "gnviewer.history.back.button");
+                String exampleLinestring = res.getString(
+                    "gnviewer.example.linestring");
+                String examplePolygon = res.getString(
+                    "gnviewer.example.polygon");
+
+                XSLTransformer transformer = new XSLTransformer();
+
+                String url = response.encodeURL(
+                    mapping.findForward("back").getPath());
+                transformer.addParameter("back-url", url);
+                transformer.addParameter("edit", editText);
+                transformer.addParameter("example-polygon", examplePolygon);
+                transformer.addParameter(
+                    "example-linestring",
+                    exampleLinestring);
+
+                String fisUrl = response.encodeURL(
+                    mapping.findForward("selectfis").getPath());
+                transformer.addParameter("selectfis", fisUrl);
+
+                // fetch dynamic part from describe document and transform it
+                Node dynamicNode = (Node) XMLUtils.xpath(
+                    currentUI,
+                    XPATH_DYNAMIC_UI,
+                    XPathConstants.NODE,
+                    ArtifactNamespaceContext.INSTANCE
+                );
+
+                String ui = transformer.transform(
+                    dynamicNode,
+                    "UTF-8",
+                    request.getRealPath(XSL_SHEET_DYNAMIC
+                ));
+
+                if (ui != null && ui.length() > 1)
+                    request.setAttribute("ui", ui);
+
+                // fetch static part from describe document and transform it
+                Node staticNode = (Node) XMLUtils.xpath(
+                    currentUI,
+                    XPATH_STATIC_UI,
+                    XPathConstants.NODE,
+                    ArtifactNamespaceContext.INSTANCE
+                );
+
+                String staticUI = transformer.transform(
+                    staticNode,
+                    "UTF-8",
+                    request.getRealPath(XSL_SHEET_STATIC));
+
+                if (staticUI != null && staticUI.length() > 1)
+                    request.setAttribute("staticui", staticUI);
+            }
+
+            return super.execute(mapping, form, request, response);
+        }
+        catch (Exception e) {
+            logger.error(e, e);
+            request.setAttribute(
+                CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                e.getMessage());
+
+            return super.getExceptionForward(mapping);
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,47 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action;
 
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+
+import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter;
+import de.intevation.gnv.artifactdatabase.objects.ExportMode;
+import de.intevation.gnv.artifactdatabase.objects.InputParameter;
+import de.intevation.gnv.artifactdatabase.objects.OutputMode;
+import de.intevation.gnv.artifactdatabase.objects.OutputParameter;
+
+import java.io.OutputStream;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.log4j.Logger;
 
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This controller is called to trigger an export (e.g. pdf, svg, image). A
+ * 'save-file' dialog is opened to save the export.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
-public class DoExportAction extends DoOutputAction {
+public class DoExportAction extends ArtifactDatabaseActionBase {
 
     /**
      * the logger, used to log exceptions and additonaly information
@@ -26,26 +55,161 @@
         super();
     }
 
+
     @Override
+    public ActionForward execute(
+        ActionMapping       mapping,
+        ActionForm          form,
+        HttpServletRequest  request,
+        HttpServletResponse response)
+    throws Exception
+    {
+        if (isSessionExhausted(request)) {
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
+        try {
+            String target   = request.getParameter("target");
+            String mimeType = request.getParameter("mimetype");
+            String mode     = request.getParameter("mode");
+
+            log.debug("Target: " + target);
+            log.debug("MimeType: " + mimeType);
+            log.debug("ExportMode: " + mode);
+
+            SessionModel sm = SessionModelFactory.getInstance()
+                    .getSessionModel(request);
+            OutputMode outputMode = sm.getOutputMode(target);
+            if (outputMode != null) {
+                ExportMode exportMode = outputMode.getExportMode(mode);
+
+                if (target.equals(mode) || (exportMode != null
+                &&  exportMode.getMimeType().equals(mimeType)))
+                {
+                    Collection<OutputParameter> inputParameter = outputMode
+                            .getOutputParameters();
+                    Collection<InputParameter> ips = null;
+                    if (inputParameter != null) {
+                        ips = new ArrayList<InputParameter>(inputParameter.size());
+                        Iterator<OutputParameter> it = inputParameter.iterator();
+                        while (it.hasNext()) {
+                            String name = it.next().getName();
+                            String[] values = request.getParameterValues(name);
+                            InputParameter ip = new DefaultInputParameter(name,
+                                    values);
+                            ips.add(ip);
+                        }
+                    }
+
+                    ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
+                            .getInstance()
+                            .getArtifactDatabaseClient(getLocale(request));
+
+                    this.setHeaders(mode, mimeType, response, request);
+
+                    OutputStream outputStream = response.getOutputStream();
+                    adc.doOutput(
+                        sm.getSelectedArtifactFactory(),
+                        sm.getCurrentArtifact(),
+                        outputStream,
+                        target,
+                        mode,
+                        mimeType,
+                        ips);
+
+                    outputStream.flush();
+                    outputStream.close();
+                }
+                else if (exportMode == null) {
+                    Collection<OutputParameter> inputParameter = outputMode
+                            .getOutputParameters();
+                    Collection<InputParameter> ips = null;
+                    if (inputParameter != null) {
+                        ips = new ArrayList<InputParameter>(inputParameter.size());
+                        Iterator<OutputParameter> it = inputParameter.iterator();
+                        while (it.hasNext()) {
+                            String name = it.next().getName();
+                            String[] values = request.getParameterValues(name);
+                            InputParameter ip = new DefaultInputParameter(name,
+                                    values);
+                            ips.add(ip);
+                        }
+                    }
+
+                    ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
+                            .getInstance()
+                            .getArtifactDatabaseClient(getLocale(request));
+
+                    this.setHeaders(target, mimeType, response, request);
+
+                    OutputStream outputStream = response.getOutputStream();
+                    adc.doOutput(
+                        sm.getSelectedArtifactFactory(),
+                        sm.getCurrentArtifact(),
+                        outputStream,
+                        target,
+                        mode,
+                        mimeType,
+                        ips);
+
+                    outputStream.flush();
+                    outputStream.close();
+                }
+                else {
+                    if (outputMode == null) {
+                        log.error("Outputmode is not supported.");
+                    }
+                    else if (!exportMode.getMimeType().equals(mimeType)) {
+                        log.error("MimeType "+mimeType+" wis not supported.");
+                    }
+                    // TODO FIXME: Fehlerbehandlung
+                }
+            }
+            return super.execute(mapping, form, request, response);
+        } catch (Exception e) {
+            log.error(e, e);
+            request.setAttribute(
+                    CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
+                            .getMessage());
+            return super.getExceptionForward(mapping);
+        }
+    }
+
     protected void setHeaders(String target, String mimeType,
                               HttpServletResponse response,
                               HttpServletRequest request) {
         log.debug("DoExportAction.setHeaders");
         try {
-            super.setHeaders(target, mimeType, response, request);
+            response.setHeader("Content-Type", mimeType);
             String fileName = "GNVEXPORT_" + System.currentTimeMillis() + ".";
 
-            if (target.equalsIgnoreCase("chart")) {
+            target = target.toLowerCase();
+            log.debug("******************************************************");
+            log.debug("TARGET: " + target);
+            log.debug("MIMETYPE: " + mimeType);
+
+            if (target.equals("chart")) {
                 fileName = fileName
                            + mimeType.substring(mimeType.indexOf("/") + 1);
-            } 
-            else if (target.equalsIgnoreCase("pdf")) {
-                fileName = fileName + "pdf";
             }
-            else if (target.equalsIgnoreCase("svg")) {
+            else if (target.equals("histogram")) {
+                fileName = fileName
+                           + mimeType.substring(mimeType.indexOf("/") + 1);
+            }
+            else if (target.equals("img")) {
+                fileName = fileName
+                           + mimeType.substring(mimeType.indexOf("/") + 1);
+            }
+            else if (target.equals("pdf")) {
+                fileName = fileName + "pdf";
+            } else if (target.equals("svg")) {
                 fileName = fileName + "svg";
-            } else if (target.equalsIgnoreCase("CSV")) {
+            } else if (target.equals("csv")) {
                 fileName = fileName + "csv";
+            } else if (target.equals("zip")) {
+                fileName = fileName + "zip";
+            } else if (target.equals("wms")) {
+                fileName = fileName + "xml";
             } else {
                 fileName = fileName + "txt";
             }
@@ -56,5 +220,5 @@
             log.error(e, e);
         }
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/DoOutputAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,9 +1,26 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action;
 
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+
+import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter;
+import de.intevation.gnv.artifactdatabase.objects.InputParameter;
+import de.intevation.gnv.artifactdatabase.objects.OutputMode;
+import de.intevation.gnv.artifactdatabase.objects.OutputParameter;
+
 import java.io.OutputStream;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -12,22 +29,17 @@
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.log4j.Logger;
+
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
 
-import de.intevation.gnv.action.sessionmodel.SessionModel;
-import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
-import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
-import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
-import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter;
-import de.intevation.gnv.artifactdatabase.objects.InputParameter;
-import de.intevation.gnv.artifactdatabase.objects.OutputMode;
-import de.intevation.gnv.artifactdatabase.objects.OutputParameter;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This controller calls the out operation of the server directly. Html img-tags
+ * in jsp pages use this action to fetch charts and histograms.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class DoOutputAction extends ArtifactDatabaseActionBase {
 
@@ -43,23 +55,24 @@
         super();
     }
 
-    /**
-     * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping,
-     *      org.apache.struts.action.ActionForm,
-     *      javax.servlet.http.HttpServletRequest,
-     *      javax.servlet.http.HttpServletResponse)
-     */
+
     @Override
     public ActionForward execute(ActionMapping mapping, ActionForm form,
                                  HttpServletRequest request,
                                  HttpServletResponse response) throws Exception {
+        if (isSessionExhausted(request)) {
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
         log.debug("DoOutputAction.execute");
         try {
-            String target = request.getParameter("target");
+            String target   = request.getParameter("target");
             String mimeType = request.getParameter("mimetype");
+            String mode     = request.getParameter("mode");
 
             log.debug("Target: " + target);
             log.debug("MimeType: " + mimeType);
+            log.debug("ExportMode: " + mode);
 
             // TODO Check if is propper;
 
@@ -71,7 +84,7 @@
                         .getOutputParameters();
                 Collection<InputParameter> ips = null;
                 if (inputParameter != null) {
-                    ips = new ArrayList<InputParameter>(inputParameter.size());
+                    ips = new ArrayList<InputParameter>(inputParameter.size()+1);
                     Iterator<OutputParameter> it = inputParameter.iterator();
                     while (it.hasNext()) {
                         String name = it.next().getName();
@@ -80,6 +93,12 @@
                                 values);
                         ips.add(ip);
                     }
+
+                    if (request.getParameter("bintype") != null) {
+                        InputParameter ip = new DefaultInputParameter(
+                            "bintype", request.getParameterValues("bintype"));
+                        ips.add(ip);
+                    }
                 }
 
                 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
@@ -89,18 +108,23 @@
                 this.setHeaders(target, mimeType, response, request);
 
                 OutputStream outputStream = response.getOutputStream();
-                adc.doOutput(sm.getSelectedArtifactFactory(), sm
-                        .getCurrentArtifact(), outputStream, target, mimeType,
-                        ips);
+                adc.doOutput(
+                    sm.getSelectedArtifactFactory(),
+                    sm.getCurrentArtifact(),
+                    outputStream,
+                    target,
+                    mode,
+                    mimeType,
+                    ips);
 
                 outputStream.flush();
                 outputStream.close();
             } else {
                 if (outputMode == null) {
-                    log.error("Outputmode wird nicht unterstützt.");
+                    log.error("Outputmode is not supported.");
                 } else if (!outputMode.getMimeType().equals(mimeType)) {
                     log.error("MimeType " + mimeType
-                              + " wird nicht unterstützt.");
+                              + " wis not supported.");
                 }
                 // TODO FIXME: Fehlerbehandlung
             }
@@ -121,3 +145,4 @@
     }
 
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/FetchArtifactFactoriesAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action;
 
 import java.util.Collection;
@@ -16,48 +21,66 @@
 import de.intevation.gnv.action.sessionmodel.SessionModel;
 import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This controller fetches artifact factories from artifact server and stores
+ * them on a <code>SessionModel</code> object.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class FetchArtifactFactoriesAction extends ArtifactDatabaseActionBase {
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger
             .getLogger(FetchArtifactFactoriesAction.class);
 
+    /**
+     * Constructor
+     */
     public FetchArtifactFactoriesAction() {
         super();
     }
 
-    /**
-     * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping,
-     *      org.apache.struts.action.ActionForm,
-     *      javax.servlet.http.HttpServletRequest,
-     *      javax.servlet.http.HttpServletResponse)
-     */
+
     @Override
     public ActionForward execute(ActionMapping mapping, ActionForm form,
                                  HttpServletRequest request,
                                  HttpServletResponse response) throws Exception {
         log.debug("ArtifactDatabaseActionBase.execute");
         try {
-            Collection<ArtifactObject> artifactFactories = ArtifactDatabaseClientFactory
-                    .getInstance().getArtifactDatabaseClient(getLocale(request))
+            Collection<ArtifactObject> artifactFactories =
+                ArtifactDatabaseClientFactory.getInstance()
+                    .getArtifactDatabaseClient(getLocale(request))
                     .getArtifactFactories();
-            SessionModel sm = SessionModelFactory.getInstance()
-                    .getSessionModel(request);
+
+            SessionModel sm = SessionModelFactory.getInstance().getSessionModel(
+                request);
+
             sm.setArtifacteFactories(artifactFactories);
+
             return super.execute(mapping, form, request, response);
-        } catch (Exception e) {
+        }
+        catch (ArtifactDatabaseClientException e) {
             log.error(e, e);
             request.setAttribute(
-                    CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
-                            .getMessage());
+                CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                e.getMessage());
+
+            return super.getExceptionForward(mapping);
+        }
+        catch (Exception e) {
+            log.error(e, e);
+            request.setAttribute(
+                CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                e.getMessage());
+
             return super.getExceptionForward(mapping);
         }
     }
 }
+// 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/gnv/src/main/java/de/intevation/gnv/action/LoadAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.fileupload.FileItemIterator;
+import org.apache.commons.fileupload.FileItemStream;
+import org.apache.commons.fileupload.servlet.ServletFileUpload;
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.w3c.dom.Document;
+
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException;
+import de.intevation.gnv.artifactdatabase.objects.Artifact;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactFactory;
+import de.intevation.gnv.util.ArtifactNamespaceContext;
+import de.intevation.gnv.util.XMLUtils;
+
+/**
+ * This controller is called for reloading projects from xml files. It waits for
+ * an xml document named 'document' and feeds the artifact server with this
+ * document. After a successful feed, the artifact description is fetched and
+ * displayed in the gui.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class LoadAction extends ArtifactDatabaseActionBase {
+
+    public static final String RESOURCE_UPLOAD_FAILURE   = "upload.failure";
+    public static final String RESOURCE_INVALID_ARTIFACT = "invalid.artifact";
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger logger = Logger.getLogger(LoadAction.class);
+
+    /**
+     * Constructor
+     */
+    public LoadAction() {
+        super();
+    }
+
+    @Override
+    public ActionForward execute(
+        ActionMapping       mapping,
+        ActionForm          form,
+        HttpServletRequest  request,
+        HttpServletResponse response)
+    throws Exception
+    {
+        if (isSessionExhausted(request)) {
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
+        logger.info("Import artifact.");
+
+        ServletFileUpload upload  = new ServletFileUpload();
+        Document artifactDocument = null;
+
+        try {
+            FileItemIterator iter = upload.getItemIterator(request);
+            while (iter.hasNext()) {
+                FileItemStream item = (FileItemStream) iter.next();
+                String name         = item.getFieldName();
+
+                // the file input field of our form is named 'document'
+                if (name.equals("document")) {
+                    InputStream stream = item.openStream();
+
+                    if (stream.available() == 0) {
+                        logger.error("No artifact document found.");
+                        request.setAttribute(
+                            CommunicationKeys.REQUEST_EXCEPTION_PROJECT,
+                            RESOURCE_UPLOAD_FAILURE);
+
+                        return super.getExceptionForward(mapping);
+                    }
+
+                    artifactDocument   = XMLUtils.readDocument(stream);
+                    if (artifactDocument == null) {
+                        request.setAttribute(
+                            CommunicationKeys.REQUEST_EXCEPTION_PROJECT,
+                            RESOURCE_INVALID_ARTIFACT);
+
+                        return super.getExceptionForward(mapping);
+                    }
+
+                    try {
+                        ArtifactDatabaseClientFactory adcf =
+                            ArtifactDatabaseClientFactory.getInstance();
+                        ArtifactDatabaseClient adc =
+                            adcf.getArtifactDatabaseClient(getLocale(request));
+                        ArtifactFactory factory = (ArtifactFactory)
+                            (( List)adc.getArtifactFactories()).get(0);
+
+                        SessionModelFactory sf =
+                            SessionModelFactory.getInstance();
+                        SessionModel        sm = sf.getSessionModel(request);
+                        sm.selectArtifactFactory(factory.getId());
+
+                        Document describe = adc.doImport(
+                            factory,
+                            artifactDocument);
+
+                        String uuid = XMLUtils.xpathString(
+                            describe,
+                            "/art:result/art:uuid/@value",
+                            ArtifactNamespaceContext.INSTANCE);
+                        String hash = XMLUtils.xpathString(
+                            describe,
+                            "/art:result/art:hash/@value",
+                            ArtifactNamespaceContext.INSTANCE);
+
+                        Artifact artifact = new Artifact(uuid, hash);
+                        sm.setCurrentArtifact(artifact);
+
+                        if (logger.isDebugEnabled()) {
+                            logger.debug(
+                                "Imported artifact UUID: "+artifact.getId());
+                            logger.debug(
+                                "Imported artifact HASH: "+artifact.getHash());
+                        }
+                    }
+                    catch (ArtifactDatabaseClientException adce) {
+                        logger.error(adce, adce);
+                        request.setAttribute(
+                            CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                            adce.getMessage());
+
+                        // XXX
+                        return super.getExceptionForward(mapping);
+                    }
+
+                    return new DescribeUIAction().execute(
+                        mapping, form, request, response);
+                }
+            }
+        }
+        catch (IOException ioe) {
+            logger.error(ioe, ioe);
+            request.setAttribute(
+                CommunicationKeys.REQUEST_EXCEPTION_PROJECT,
+                ioe.getMessage());
+
+            return super.getExceptionForward(mapping);
+        }
+
+        // no document found or not valid
+        logger.error("Upload failure: No document found or invalid.");
+
+        request.setAttribute(
+            CommunicationKeys.REQUEST_EXCEPTION_PROJECT,
+            RESOURCE_UPLOAD_FAILURE);
+
+        return super.getExceptionForward(mapping);
+    }
+}
+// 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/gnv/src/main/java/de/intevation/gnv/action/MapClientStandaloneAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+/**
+ *
+ */
+package de.intevation.gnv.action;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class MapClientStandaloneAction extends ArtifactDatabaseActionBase {
+
+    public final static String MAPCLIENTSTANDALONE_KEY = 
+                          "de.intevation.gnv.action.MapClientStandaloneAction";
+    /**
+     * Constructor
+     */
+    public MapClientStandaloneAction() {
+        super();
+    }
+
+    @Override
+    public ActionForward execute(ActionMapping mapping, ActionForm form,
+                                 HttpServletRequest request,
+                                 HttpServletResponse response) throws Exception {
+        
+        request.setAttribute(MAPCLIENTSTANDALONE_KEY, true);
+        return super.execute(mapping, form, request, response);
+    }
+    
+
+}
--- a/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/NextArtifactStepAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -14,24 +21,26 @@
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
-import org.w3c.dom.Node;
 
 import de.intevation.gnv.action.sessionmodel.SessionModel;
 import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseInputException;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
-import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet;
 import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter;
 import de.intevation.gnv.artifactdatabase.objects.InputParameter;
-import de.intevation.gnv.util.XMLUtils;
-import de.intevation.gnv.util.XSLTransformer;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This controller feeds the artifact server with the current input data and
+ * refreshes the gui with the current artifact description after the next state
+ * is reached.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public class NextArtifactStepAction extends ArtifactDatabaseActionBase {
+public class NextArtifactStepAction extends DescribeUIAction {
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
@@ -45,12 +54,6 @@
         super();
     }
 
-    /**
-     * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping,
-     *      org.apache.struts.action.ActionForm,
-     *      javax.servlet.http.HttpServletRequest,
-     *      javax.servlet.http.HttpServletResponse)
-     */
     @Override
     public ActionForward execute(ActionMapping mapping, ActionForm form,
                                  HttpServletRequest request,
@@ -59,6 +62,10 @@
             SessionModel sm = SessionModelFactory.getInstance()
                     .getSessionModel(request);
             ArtifactDescription ad = sm.getArtifactDescription();
+
+            Locale tmp    = sm.getCurrentLocale();
+            Locale locale = tmp != null ? tmp : request.getLocale();
+
             if (ad != null){
                 Collection<String> inputParameter = ad.getInputParameter();
                 Collection<InputParameter> ips = null;
@@ -73,10 +80,10 @@
                     }
                 }
                 ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
-                                                    .getInstance()
-                                                    .getArtifactDatabaseClient(getLocale(request));
-                if (ad.getReachableStates() != null
-                    && !ad.getReachableStates().isEmpty()) {
+                    .getInstance().getArtifactDatabaseClient(locale);
+
+                Map outs = ad.getOutputModes();
+                if (outs == null || outs.isEmpty()) {
                     // TODO: Woher kommt der zu erreichende Status;
                     String target = null;
                     if (ad.getReachableStates().size() > 1) {
@@ -89,110 +96,65 @@
                     } else {
                         target = ad.getReachableStates().iterator().next();
                     }
-    
-                    ArtifactDescription artifactDescription;
+
                     try {
-                        artifactDescription = adc.doNextStep(sm.getSelectedArtifactFactory(), 
-                                                             sm.getCurrentArtifact(),
-                                                             target, ips);
-                    } catch (Exception e) {
+                        adc.doNextStep(
+                            sm.getSelectedArtifactFactory(),
+                            sm.getCurrentArtifact(),
+                            target,
+                            ips
+                        );
+                    }
+                    catch (ArtifactDatabaseInputException e) {
                         log.error(e, e);
                         request.setAttribute(
-                                CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
-                                        .getMessage());
-                        artifactDescription = sm.getArtifactDescription();
+                            CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID,
+                            e.getMessage());
                     }
-    
-                    Node currentUI = artifactDescription.getCurrentUI();
-                    if (currentUI != null){
-                        XSLTransformer transformer = new XSLTransformer();
-                        Node dynamicUINode =  new XMLUtils().getNodeXPath(currentUI,"dynamic");
-                        if (dynamicUINode != null){
-                            String ui = transformer
-                                    .transform(
-                                            dynamicUINode,
-                                            "UTF-8",
-                                            request
-                                                    .getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
-            
-                            request.setAttribute("ui", ui);
-                        }
-                        
-                        Node staticUINode = new XMLUtils().getNodeXPath(currentUI, "static");
-                        if (staticUINode != null){
-                            String staticUI = transformer
-                                    .transform(
-                                            staticUINode,
-                                            "UTF-8",
-                                            request
-                                                    .getRealPath("WEB-INF/config/templates/describe-ui-static.xsl"));
-                            request.setAttribute("staticui", staticUI);
-                        }
-                    }
-                    request.setAttribute("furthertargets",
-                            (ad.getReachableStates() != null && !ad
-                                    .getReachableStates().isEmpty()));
-    
-                } else {
-                    // statistic abholen und in das sessionmodell schreiben.
-                    ArtifactDescription artifactDescription;
-                    try{
-                        
-                        Collection<ArtifactStatisticsSet> statistics = adc
-                                .calculateStatistics(sm.getSelectedArtifactFactory(),
-                                        sm.getCurrentArtifact());
-                        sm.setStatistics(statistics);
-                        artifactDescription = adc
-                                .getCurrentStepDescription(sm
-                                        .getSelectedArtifactFactory(), sm
-                                        .getCurrentArtifact(),
-                                        true);
-                        
-                        request.setAttribute("diagramm", true);
-                        
-                    } catch (Exception e) {
+                    catch (Exception e) {
                         log.error(e, e);
                         request.setAttribute(
-                                CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, e
-                                        .getMessage());
-                        artifactDescription = sm.getArtifactDescription();
+                            CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                            e.getMessage());
                     }
-    
-                    Node currentUI = artifactDescription.getCurrentUI();
-                    if (currentUI != null){
-                        XSLTransformer transformer = new XSLTransformer();
-                        Node dynamicUINode =  new XMLUtils().getNodeXPath(currentUI,"dynamic");
-                        if (dynamicUINode != null){
-                            String ui = transformer
-                                    .transform(
-                                            dynamicUINode,
-                                            "UTF-8",
-                                            request
-                                                    .getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
-            
-                            request.setAttribute("ui", ui);
-                        }
-                        
-                        Node staticUINode = new XMLUtils().getNodeXPath(currentUI, "static");
-                        if (staticUINode != null){
-                            String staticUI = transformer
-                                    .transform(
-                                            staticUINode,
-                                            "UTF-8",
-                                            request
-                                                    .getRealPath("WEB-INF/config/templates/describe-ui-static.xsl"));
-                            request.setAttribute("staticui", staticUI);
-                        }
+
+                    Map tmpOuts = ad.getOutputModes();
+                    request.setAttribute(
+                        "furthertargets",
+                        tmpOuts == null || tmpOuts.isEmpty()
+                    );
+                } else {
+                    try{
+                        adc.getCurrentStepDescription(
+                            sm.getSelectedArtifactFactory(),
+                            sm.getCurrentArtifact(),
+                            true
+                        );
+
+                        request.setAttribute("diagramm", true);
+
                     }
+                    catch (ArtifactDatabaseInputException e) {
+                        log.error(e, e);
+                        request.setAttribute(
+                            CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID,
+                            e.getMessage());
+                    }
+                    catch (Exception e) {
+                        log.error(e, e);
+                        request.setAttribute(
+                            CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                            e.getMessage());
+                    }
+
                     request.setAttribute("furthertargets", false);
                 }
             }else{
                 log.warn("SessionTimeout has occured");
-                request.setAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID, 
-                                     "SessionTimeout has occured");
-                new FetchArtifactFactoriesAction().execute(mapping, form, request, response);
+                return sessionExhaustedForward(mapping, form, request, response);
             }
             return super.execute(mapping, form, request, response);
     }
 
 }
+// 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/gnv/src/main/java/de/intevation/gnv/action/PreviousArtifactStepAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
+
+/**
+ * This controller is used to step back to a previous state of the current
+ * artifact. After calling the advance operation of the artifact server have
+ * been called successfully, the describe document of the current artifact is
+ * fetched and a new gui is rendered.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class PreviousArtifactStepAction extends DescribeUIAction {
+
+
+    public static final String URL_STATE_KEY = "target";
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger logger =
+        Logger.getLogger(PreviousArtifactStepAction.class);
+
+
+    /**
+     * Constructor
+     */
+    public PreviousArtifactStepAction() {
+        super();
+    }
+
+
+    @Override
+    public ActionForward execute(
+        ActionMapping       mapping,
+        ActionForm          form,
+        HttpServletRequest  request,
+        HttpServletResponse response
+    ) throws Exception {
+
+        SessionModel session = SessionModelFactory.getInstance().getSessionModel(
+            request);
+
+        ArtifactDescription ad = session.getArtifactDescription();
+        if (ad == null) {
+            logger.warn("Session timed out.");
+            request.setAttribute(
+                CommunicationKeys.REQUEST_EXCEPTION_SESSION_ID,
+                "SessionTimeout has occured");
+            return new FetchArtifactFactoriesAction().execute(
+                mapping, form, request, response);
+        }
+
+        // TODO check if target is reachable
+
+        ArtifactDatabaseClientFactory f =
+            ArtifactDatabaseClientFactory.getInstance();
+        ArtifactDatabaseClient client   =
+            f.getArtifactDatabaseClient(getLocale(request));
+
+        ArtifactObject artifactFactory = session.getSelectedArtifactFactory();
+        ArtifactObject currentArtifact = session.getCurrentArtifact();
+
+        String target = (String) request.getParameter(URL_STATE_KEY);
+        logger.debug("Step back to previous state: " + target);
+
+        try {
+            client.doAdvance(
+                artifactFactory,
+                currentArtifact,
+                target
+            );
+        }
+        catch (Exception e) {
+            logger.error(e, e);
+            request.setAttribute(
+                CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                e.getMessage());
+        }
+
+        return super.execute(mapping, form, request, response);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/SelectArtifactFactoryAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action;
 
 import java.util.Collection;
@@ -17,15 +22,15 @@
 import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
 import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
-import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
-import de.intevation.gnv.util.XSLTransformer;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This controller is called to select a specific fis.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
-public class SelectArtifactFactoryAction extends ArtifactDatabaseActionBase {
+public class SelectArtifactFactoryAction extends DescribeUIAction {
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
@@ -33,11 +38,12 @@
             .getLogger(SelectArtifactFactoryAction.class);
 
     /**
-     * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping,
-     *      org.apache.struts.action.ActionForm,
-     *      javax.servlet.http.HttpServletRequest,
-     *      javax.servlet.http.HttpServletResponse)
+     * Constructor
      */
+    public SelectArtifactFactoryAction() {
+        super();
+    }
+
     @Override
     public ActionForward execute(ActionMapping mapping, ActionForm form,
                                  HttpServletRequest request,
@@ -52,7 +58,7 @@
                     .getSessionModel(request);
             Collection<ArtifactObject> artifactFactories = sm
                     .getArtifactFactories();
-            // Löscht die Artifactspezifischen Attribute am Sessionmodel
+            // Removes the Artifactspecific Attributes from the SessionModel-
             sm.resetModel();
             if (artifactFactories == null || artifactFactories.isEmpty()) {
                 new FetchArtifactFactoriesAction().execute(mapping, form,
@@ -62,24 +68,13 @@
 
             sm.selectArtifactFactory(selectedArtifactFactoryID);
             ArtifactObject af = sm.getSelectedArtifactFactory();
-            ;
+
             ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
                                                 .getInstance()
                                                 .getArtifactDatabaseClient(getLocale(request));
             ArtifactObject artifact = adc.createNewArtifact(af);
             sm.setCurrentArtifact(artifact);
 
-            ArtifactDescription artifactdescription = adc
-                    .getCurrentStepDescription(af, artifact,true);
-
-            XSLTransformer transformer = new XSLTransformer();
-            String ui = transformer.transform(artifactdescription
-                    .getCurrentUI(), "UTF-8", request
-                    .getRealPath("WEB-INF/config/templates/describe-ui.xsl"));
-
-            request.setAttribute("ui", ui);
-
-            // return succsess
             return super.execute(mapping, form, request, response);
         } catch (Exception e) {
             log.error(e, e);
@@ -89,11 +84,5 @@
             return super.getExceptionForward(mapping);
         }
     }
-
-    /**
-     * Constructor
-     */
-    public SelectArtifactFactoryAction() {
-    }
-
 }
+// 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/gnv/src/main/java/de/intevation/gnv/action/SelectFisAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+
+/**
+ * This controller is used to step back to the fis selection. It is called when
+ * pushing the step-back button besides the currently selected fis.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class SelectFisAction extends ArtifactDatabaseActionBase {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger logger = Logger.getLogger(SelectFisAction.class);
+
+    @Override
+    public ActionForward execute(
+        ActionMapping       mapping,
+        ActionForm          form,
+        HttpServletRequest  request,
+        HttpServletResponse response
+    ) {
+        logger.info("Goto fis selection.");
+
+        try {
+
+            SessionModelFactory fac = SessionModelFactory.getInstance();
+            SessionModel sm         = fac.getSessionModel(request);
+
+            sm.resetModel();
+
+            return new FetchArtifactFactoriesAction().execute(
+                mapping, form, request, response);
+        }
+        catch (Exception e) {
+            logger.error(e, e);
+
+            request.setAttribute(
+                CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                e.getMessage());
+
+            return super.getExceptionForward(mapping);
+        }
+    }
+}
+// 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/gnv/src/main/java/de/intevation/gnv/action/ShowStatisticAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action;
+
+import java.util.Collection;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet;
+
+/**
+ * This controller is used to display to statistic of the current
+ * parameterization.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ShowStatisticAction extends DescribeUIAction {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger logger = Logger.getLogger(ShowStatisticAction.class);
+
+
+    /**
+     * Constructor
+     */
+    public ShowStatisticAction() {
+        super();
+    }
+
+
+    @Override
+    public ActionForward execute(
+        ActionMapping       mapping,
+        ActionForm          form,
+        HttpServletRequest  request,
+        HttpServletResponse response
+    ) throws Exception
+    {
+        if (isSessionExhausted(request)) {
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
+        logger.info("show statistic");
+        SessionModel sm = SessionModelFactory.getInstance().getSessionModel(
+            request);
+
+        ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory.getInstance()
+            .getArtifactDatabaseClient(getLocale(request));
+
+        try{
+            Collection<ArtifactStatisticsSet> statistics =
+                adc.calculateStatistics(sm.getSelectedArtifactFactory(),
+                sm.getCurrentArtifact());
+
+            sm.setStatistics(statistics);
+
+            request.setAttribute("statistic", true);
+        }
+        catch (Exception e) {
+            logger.error(e, e);
+        }
+
+        return super.execute(mapping, form, request, response);
+    }
+}
+// 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/gnv/src/main/java/de/intevation/gnv/action/StoreAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action;
+
+import java.io.OutputStream;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
+
+/**
+ * This controller is used to save the current artifact to an xml file. A file
+ * dialog is opened to save the file to the local disk.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class StoreAction extends ArtifactDatabaseActionBase {
+
+    public static final String RESOURCE_DOWNLOAD_FAILURE = "no.artifact.chosen";
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger logger = Logger.getLogger(StoreAction.class);
+
+    /**
+     * Constructor
+     */
+    public StoreAction() {
+        super();
+    }
+
+    @Override
+    public ActionForward execute(
+        ActionMapping       mapping,
+        ActionForm          form,
+        HttpServletRequest  request,
+        HttpServletResponse response)
+    throws Exception
+    {
+        if (isSessionExhausted(request)) {
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
+        SessionModelFactory sf = SessionModelFactory.getInstance();
+        SessionModel        sm = sf.getSessionModel(request);
+
+        ArtifactDatabaseClientFactory adcf =
+            ArtifactDatabaseClientFactory.getInstance();
+        ArtifactDatabaseClient adc =
+            adcf.getArtifactDatabaseClient(getLocale(request));
+        ArtifactObject artifact = sm.getCurrentArtifact();
+
+        // no artifact set at the moment (which means, the user didn't select a
+        // fis yet.
+        if (artifact == null) {
+            logger.warn("No artifact/fis selected yet.");
+
+            request.setAttribute(
+                CommunicationKeys.REQUEST_EXCEPTION_PROJECT,
+                RESOURCE_DOWNLOAD_FAILURE);
+
+            return super.execute(mapping, form, request, response);
+        }
+
+        logger.info("Export artifact " + artifact.getId());
+        setHeaders(response, artifact.getId());
+
+        OutputStream out = response.getOutputStream();
+        adc.doExport(
+            sm.getSelectedArtifactFactory(),
+            artifact,
+            out);
+
+        out.flush();
+        out.close();
+
+        return null;
+    }
+    
+    /**
+     * Sets the header of the response.
+     * @param response the response
+     * @param uuid the uuid of the artifact
+     */
+    protected void setHeaders(HttpServletResponse response, String uuid) {
+        String filename = "GNVArtefakt_" + uuid + ".xml";
+
+        response.setHeader("Content-Type", "application/xml");
+        response.setHeader(
+            "Content-Disposition",
+            "attachment;filename=" + filename);
+    }
+}
+// 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/gnv/src/main/java/de/intevation/gnv/action/SwitchLanguageAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action;
+
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
+
+import java.util.Locale;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+
+import org.apache.struts.Globals;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * Toggle the current language used to create the user interface. Two
+ * languages are available now - german and english.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class SwitchLanguageAction extends DescribeUIAction {
+
+    public static Logger logger = Logger.getLogger(SwitchLanguageAction.class);
+
+    @Override
+    public ActionForward execute(
+        ActionMapping       mapping,
+        ActionForm          form,
+        HttpServletRequest  request,
+        HttpServletResponse response
+    ) throws Exception
+    {
+        if (isSessionExhausted(request)) {
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
+        SessionModelFactory factory = SessionModelFactory.getInstance();
+        SessionModel        sm      = factory.getSessionModel(request);
+        Locale locale               = switchLanguage(sm.getCurrentLocale());
+
+        sm.setCurrentLocale(locale);
+        ArtifactObject artifactFactory = sm.getSelectedArtifactFactory();
+
+        if (artifactFactory == null) {
+            request.getSession().setAttribute(Globals.LOCALE_KEY, locale);
+            return mapping.findForward(SUCCSESS_FORWARD_ID);
+        }
+
+        return super.execute(mapping, form, request, response);
+    }
+
+
+    /**
+     * This method toggles between german and english language.
+     *
+     * @param currentLocale The locale which is currently used.
+     * @return an english locale, if the current locale is german - otherwise
+     * a german locale.
+     */
+    protected Locale switchLanguage(Locale currentLocale) {
+        if (currentLocale.getLanguage().equals(Locale.GERMAN.getLanguage())) {
+            logger.info("Switch from german to english locale.");
+            return Locale.ENGLISH;
+        }
+        else {
+            logger.info("Switch from english to german locale.");
+            return Locale.GERMAN;
+        }
+    }
+}
+// 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/gnv/src/main/java/de/intevation/gnv/action/WMSAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action;
+
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import de.intevation.gnv.action.sessionmodel.DiagrammOptions;
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
+import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter;
+import de.intevation.gnv.artifactdatabase.objects.InputParameter;
+import de.intevation.gnv.artifactdatabase.objects.OutputMode;
+import de.intevation.gnv.artifactdatabase.objects.OutputParameter;
+import de.intevation.gnv.artifactdatabase.objects.map.DefaultLayer;
+import de.intevation.gnv.artifactdatabase.objects.map.DefaultMapService;
+import de.intevation.gnv.artifactdatabase.objects.map.Layer;
+import de.intevation.gnv.artifactdatabase.objects.map.MapService;
+import de.intevation.gnv.util.XMLUtils;
+
+/**
+ * This controller is used to publish the results of the current artifact as
+ * WMS. The wms export mode of the artifact server is triggered which feeds a
+ * MapServer with the given shapefiles (path to the shapefiles is stored in the
+ * artifact). After calling this controller, the shapefiles are ready to be
+ * queried as WMS layers.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class WMSAction extends DescribeUIAction {
+
+    public static final String XPATH_MAPSERVER_PATH =
+        "/art:meta/art:mapserver/art:server/text()";
+
+    public static final String XPATH_MAPSERVER_MAPFILE =
+        "/art:meta/art:mapserver/art:map/text()";
+
+    public static final String XPATH_LAYERNODESET = 
+        "/art:meta/art:layer";
+
+    public static final String XPATH_LAYER_TITLE =
+        "art:title/text()";
+
+    public static final String XPATH_LAYER_NAME =
+        "art:name/text()";
+
+    public static final String XPATH_TTL =
+        "/art:meta/art:mapserver/art:ttl/text()";
+    
+    public static final String XPATH_BBOX =
+        "/art:meta/art:mapserver/art:Box/art:coordinates/text()";
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger logger = Logger.getLogger(WMSAction.class);
+
+    /**
+     * Constructor
+     */
+    public WMSAction() {
+        super();
+    }
+
+    @Override
+    public ActionForward execute(ActionMapping mapping, ActionForm form,
+                                 HttpServletRequest request,
+                                 HttpServletResponse response) throws Exception {
+        if (isSessionExhausted(request)) {
+            return sessionExhaustedForward(mapping, form, request, response);
+        }
+
+        logger.debug("WMSAction.execute");
+        try {
+            SessionModel sm = SessionModelFactory.getInstance().getSessionModel(
+                request);
+
+            OutputMode outputMode          = sm.getOutputMode("wms");
+            Collection<InputParameter> ips = null;
+            if (outputMode != null) {
+                Collection<OutputParameter> inputParameter =
+                    outputMode.getOutputParameters();
+
+                if (inputParameter != null) {
+                    ips = new ArrayList<InputParameter>(inputParameter.size());
+                    Iterator<OutputParameter> it = inputParameter.iterator();
+                    DiagrammOptions diagrammOptions = new DiagrammOptions();
+
+                    int params = 0;
+                    while (it.hasNext()) {
+                        String name       = it.next().getName();
+                        String[] values   = request.getParameterValues(name);
+                        String value      = request.getParameter(name);
+                        InputParameter ip = new DefaultInputParameter(name,
+                                encode(values));
+                        ips.add(ip);
+
+                        if (value != null) {
+                            ++params;
+                            diagrammOptions.setValue(name, encode(value));
+                        }
+                    }
+
+                    if (params > 0) {
+                        sm.setDiagrammOptions(diagrammOptions);
+                    }
+                }
+            }
+
+            ArtifactObject artifact = sm.getCurrentArtifact();
+
+            ArtifactDatabaseClientFactory factory =
+                ArtifactDatabaseClientFactory.getInstance();
+            ArtifactDatabaseClient adc = factory.getArtifactDatabaseClient(
+                getLocale(request));
+            ArtifactObject artifactfactory = sm.getSelectedArtifactFactory();
+
+            // do wms publishing
+            Document meta        = adc.publishWMS(artifactfactory,artifact,ips);
+
+            // read the Server-information
+            String mapserverPath = XMLUtils.getStringXPath(
+                meta, XPATH_MAPSERVER_PATH);
+            String mapfilePath   = XMLUtils.getStringXPath(
+                meta, XPATH_MAPSERVER_MAPFILE);
+            String tmpTTL        = XMLUtils.getStringXPath(
+                    meta, XPATH_TTL);
+            
+            String bbox = XMLUtils.getStringXPath(meta, XPATH_BBOX);
+            String ttl = null;
+            if (tmpTTL != null) {
+                DateFormat df = DateFormat.getDateTimeInstance(
+                    DateFormat.LONG,
+                    DateFormat.LONG,
+                    request.getLocale());
+
+                try {
+                    long tmp = Long.parseLong(tmpTTL);
+                    ttl      = df.format(new Date(tmp));
+                }
+                catch (NumberFormatException nfe) {
+                    logger.error("Error while parsing time to live.");
+                    logger.error(nfe,nfe);
+
+                    ttl = "";
+                }
+            }
+
+            if (logger.isDebugEnabled()) {
+                logger.debug("Mapserver path: " + mapserverPath);
+                logger.debug("Mapfile path: " + mapfilePath);
+                logger.debug("Layer ttl: " + ttl);
+            }
+            // read the layer information
+            
+            NodeList layerNodes = XMLUtils.getNodeSetXPath(meta,
+                                                           XPATH_LAYERNODESET);
+            Collection<Layer> layers = null;
+            if (layerNodes != null && layerNodes.getLength() > 0){
+                layers =  new ArrayList<Layer>(layerNodes.getLength());
+                for (int i = 0 ; i < layerNodes.getLength(); i++){
+                    Node tmpLayerNode = layerNodes.item(i);
+                    String layerName  = XMLUtils.getStringXPath(
+                                                tmpLayerNode, XPATH_LAYER_NAME);
+                    String layerTitle = XMLUtils.getStringXPath(
+                                               tmpLayerNode, XPATH_LAYER_TITLE);
+                 // TODO: write layerTitle to title and not to id
+                    Layer currentLayer = new DefaultLayer(layerTitle, layerName, 
+                                                          false, null);
+                    layers.add(currentLayer);
+                }
+            }
+            
+
+           
+
+            // TODO PUT MAPFILEPATH AND TTL to MapServiceObject
+            
+            if (mapserverPath != null &&
+                mapfilePath != null) {
+                request.setAttribute("wms_published", Boolean.TRUE);
+
+                MapService mapService = new DefaultMapService("0815", layers, 
+                                                          "UMN", mapserverPath,
+                                                          bbox,ttl);
+                sm.setLocalMapService(mapService);
+                return super.execute(mapping, form, request, response);
+            }else{
+                return super.execute(mapping, form, request, response);
+            }
+        }
+        catch (Exception e) {
+            logger.error(e, e);
+            request.setAttribute(
+                CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID,
+                e.getMessage());
+
+            return super.getExceptionForward(mapping);
+        }
+    }
+}
+// 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/gnv/src/main/java/de/intevation/gnv/action/mapviewer/MapViewerCallAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action.mapviewer;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import de.intevation.gnv.action.ArtifactDatabaseActionBase;
+import de.intevation.gnv.action.mapviewer.parser.ExternalCallParser;
+import de.intevation.gnv.action.mapviewer.parser.XMLExternalCallParser;
+import de.intevation.gnv.action.sessionmodel.SessionModel;
+import de.intevation.gnv.action.sessionmodel.SessionModelFactory;
+import de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClientFactory;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
+import de.intevation.gnv.artifactdatabase.objects.map.MapService;
+import de.intevation.gnv.util.CaptureInputStream;
+
+/**
+ * This class provides the businesslogic for handling an 
+ * MV-GNV-Interface-call.
+ * This call can be done in two ways.
+ * First is to put the requestbody into the body of the http-post-request.
+ * Second to put the requestbody to the parameter "document" of the
+ * http-post-request.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class MapViewerCallAction extends ArtifactDatabaseActionBase {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(MapViewerCallAction.class);
+
+    /**
+     * Constructor
+     */
+    public MapViewerCallAction() {
+        super();
+    }
+
+    /**
+     * @see de.intevation.gnv.action.ArtifactDatabaseActionBase#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+     */
+    @Override
+    public ActionForward execute(ActionMapping mapping, ActionForm form,
+                                 HttpServletRequest request,
+                                 HttpServletResponse response) throws Exception {
+        log.debug("MapViewerCallAction.execute");
+        InputStream inputStream = null;
+        String documentvalue = request.getParameter("document");
+        if (documentvalue != null){
+            documentvalue = documentvalue.trim();
+            inputStream = new ByteArrayInputStream(documentvalue.getBytes());
+        }else{
+            inputStream = request.getInputStream();
+        }
+
+        if (inputStream != null){
+            CaptureInputStream capture = log.isDebugEnabled()
+                ? new CaptureInputStream(inputStream)
+                : null;
+
+            try {
+                ExternalCallParser ecp = new XMLExternalCallParser(
+                    capture != null ? capture : inputStream);
+                ecp.parse();
+
+                // print incoming data to log
+                if (capture != null) {
+                    log.debug("REQUEST DOCUMENT: " + capture.copyToString());
+                }
+
+                String geometry = ecp.getGeometry();
+                String srs = ecp.getSRS();
+                Collection<MapService> mapServices = ecp.getMapServices();
+
+                Collection<ArtifactObject> availableFactories =
+                       ArtifactDatabaseClientFactory
+                          .getInstance()
+                          .getArtifactDatabaseClient(getLocale(request))
+                          .getArtifactFactoryMetaInformation(mapServices,
+                                                             geometry,
+                                                             srs);
+
+                Collection<ArtifactObject> providedFactories =
+                        ArtifactDatabaseClientFactory
+                           .getInstance()
+                           .getArtifactDatabaseClient(getLocale(request))
+                           .getArtifactFactories();
+
+                // Sort out which ArtifactFactories should not be used.
+                Collection<ArtifactObject> usedFactories =
+                       new ArrayList<ArtifactObject>(availableFactories.size());
+
+                Iterator<ArtifactObject> it = availableFactories.iterator();
+                while (it.hasNext()){
+                    ArtifactObject ao = it.next();
+                    if (providedFactories.contains(ao)){
+                        usedFactories.add(ao);
+                    }
+                }
+
+                SessionModel sm = SessionModelFactory
+                                     .getInstance()
+                                     .getSessionModel(request);
+                sm.resetModel();
+                sm.setArtifacteFactories(usedFactories);
+            } catch (Exception e) {
+                log.error(e,e);
+            }
+        }else{
+            log.error("Kein Anfragedokument übergeben.");
+        }
+        return super.execute(mapping, form, request, response);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/ShowMapViewerCallBodyAction.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action.mapviewer;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+import de.intevation.gnv.action.ArtifactDatabaseActionBase;
+
+/**
+ * This class provides the businesslogic to show the demo GUI for 
+ * testing the MV-GNV-Interface.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class ShowMapViewerCallBodyAction extends ArtifactDatabaseActionBase {
+
+    /**
+     * the logger, used to log exceptions and additionally information
+     */
+    private static Logger log = Logger
+            .getLogger(ShowMapViewerCallBodyAction.class);
+
+    /**
+     * Constructor
+     */
+    public ShowMapViewerCallBodyAction() {
+        super();
+    }
+
+    @Override
+    public ActionForward execute(ActionMapping mapping, ActionForm form,
+                                 HttpServletRequest request,
+                                 HttpServletResponse response) throws Exception {
+        log.debug("ShowMapViewerCallBodyAction.execute");
+        request.setAttribute("MAPVIEWERCALL", new Boolean(true));
+        return super.execute(mapping, form, request, response);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package provides actions for handling the MV-GNV-Interface calls.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParser.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action.mapviewer.parser;
+
+import java.util.Collection;
+
+import de.intevation.gnv.artifactdatabase.objects.map.MapService;
+
+/**
+ * Interfacedefinition for an XMl-parser of the MV-GNV-Interface requestdocument.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public interface ExternalCallParser {
+
+
+    /**
+     * Returns the geometry which was parsed from the XML-document.
+     * @return the geometry.
+     */
+    String getGeometry();
+
+    /**
+     * Returns the srid which was parsed from the XML-document.
+     * @return the srid.
+     */
+    String getSRS();
+
+    /**
+     * Returns the mapservices which was parsed from the XML-document.
+     * @return the mapservices.
+     */
+    Collection<MapService> getMapServices();
+
+    /**
+     * Does the parsing work.
+     * @throws ExternalCallParserException
+     */
+    void parse() throws ExternalCallParserException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action.mapviewer.parser;
+
+/**
+ * Exceptionclass for qualifying exception which were caused by the
+ * <code>ExternalCallParser.</code>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
+ */
+public class ExternalCallParserException extends Exception {
+
+    /**
+     * The UID of this Class
+     */
+    private static final long serialVersionUID = -4917914097058485262L;
+
+    /**
+     * Constructor
+     */
+    public ExternalCallParserException() {
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     */
+    public ExternalCallParserException(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     */
+    public ExternalCallParserException(Throwable arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     */
+    public ExternalCallParserException(String arg0, Throwable arg1) {
+        super(arg0, arg1);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/XMLExternalCallParser.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action.mapviewer.parser;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import de.intevation.gnv.artifactdatabase.objects.map.DefaultLayer;
+import de.intevation.gnv.artifactdatabase.objects.map.DefaultMapService;
+import de.intevation.gnv.artifactdatabase.objects.map.Layer;
+import de.intevation.gnv.artifactdatabase.objects.map.MapService;
+import de.intevation.gnv.util.XMLUtils;
+
+/**
+ * This class provides an XMl-Parser which try's to create an DOM from
+ * an given Inputstream. Is this is possible it try to read the required
+ * informations e.g. Mapservices, Layer, SRID and Geometry from the 
+ * document.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class XMLExternalCallParser implements ExternalCallParser {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(XMLExternalCallParser.class);
+
+    private static String XPATH_GEOMETRY = "/gnviewer/location/data";
+    private static String XPATH_SRS = "/gnviewer/location/srs";
+    private static String XPATH_MAPSERVICES_NODESET = "/gnviewer/mapservices/mapservice";
+    private static String XPATH_LAYER = "layer";
+    private static String ATTRIBUTE_ID = "id";
+    private static String ATTRIBUTE_NAME = "name";
+    private static String ATTRIBUTE_TYPE = "type";
+    private static String ATTRIBUTE_URL = "url";
+
+    /**
+     * The geometry which was parsed from the document.
+     */
+    private String geometry = null;
+    
+    /**
+     * The srid which was parsed from the document.
+     */
+    private String srs = null;
+
+    /**
+     * The mapservices that were parsed from the document.
+     */
+    private Collection<MapService> mapServices = null;
+
+    /**
+     * The inputstream where the data should be read from.
+     */
+    private InputStream inputStream = null;
+
+    /**
+     * Constructor
+     * @param inputStream The stream where the data should be read from
+     */
+    public XMLExternalCallParser(InputStream inputStream) {
+        this.inputStream = inputStream;
+    }
+
+    public String getGeometry() {
+        return this.geometry;
+    }
+
+    public Collection<MapService> getMapServices() {
+        return this.mapServices;
+    }
+
+    public void parse() throws ExternalCallParserException {
+        if (inputStream != null){
+            XMLUtils xmlUtils = new XMLUtils();
+            Document document = xmlUtils.readDocument(this.inputStream);
+            if (document != null){
+
+                this.geometry = xmlUtils.getStringXPath(document, 
+                                                        XPATH_GEOMETRY);
+                this.srs = xmlUtils.getStringXPath(document, XPATH_SRS);
+                NodeList mapservicesNodes =
+                      xmlUtils.getNodeSetXPath(document, 
+                                               XPATH_MAPSERVICES_NODESET);
+                if (mapservicesNodes != null){
+                    this.mapServices = new ArrayList<MapService>(mapservicesNodes.getLength());
+                    for (int i = 0; i < mapservicesNodes.getLength(); i++){
+                        Element mapserviceNode = (Element)mapservicesNodes.item(i);
+                        String mapserviceID = mapserviceNode.getAttribute(ATTRIBUTE_ID);
+                        String mapserviceType = mapserviceNode.getAttribute(ATTRIBUTE_TYPE);
+                        String mapserviceUrl = mapserviceNode.getAttribute(ATTRIBUTE_URL);
+                        NodeList layerNodes = xmlUtils.getNodeSetXPath(mapserviceNode, XPATH_LAYER);
+                        Collection<Layer> layer = null;
+                        if (layerNodes != null && layerNodes.getLength() > 0){
+                            layer = new  ArrayList<Layer>(layerNodes.getLength());
+                            layer = this.extractLayer(layer, null, layerNodes);
+                        }else{
+                            log.debug("No Layer given for this Mapservice");
+                        }
+                        MapService mapService =
+                             new DefaultMapService(mapserviceID, layer,
+                                                   mapserviceType, mapserviceUrl);
+                        this.mapServices.add(mapService);
+                    }
+
+                }else{
+                    String errMsg = "XML-Document does not contain any " +
+                                    "Mapservices which are required.";
+                    log.error(errMsg);
+                    throw new ExternalCallParserException(errMsg);
+                }
+
+            }else{
+                String errMsg = "XML-Document could not " +
+                                "be read from InputStream.";
+                log.error(errMsg);
+                throw new ExternalCallParserException(errMsg);
+            }
+        }else{
+            String errMsg = "No InputStream given for parsing the Call.";
+            log.error(errMsg);
+            throw new ExternalCallParserException(errMsg);
+        }
+    }
+
+    /**
+     * This Method extracts all Layers and put them into the Collection.
+     * @param layer the collection where the layer should be add to.
+     * @param groupId the id of the group of the layers
+     * @param layerNodes the Nodes which should contain the intormations 
+     *                   about layers
+     * @return the layer
+     */
+    private Collection<Layer> extractLayer(Collection<Layer> layer, 
+                                           String groupId, 
+                                           NodeList layerNodes){
+        for (int i = 0; i < layerNodes.getLength(); i++){
+            Element layerNode = (Element)layerNodes.item(i);
+            String id = layerNode.getAttribute(ATTRIBUTE_ID);
+            String name = layerNode.getAttribute(ATTRIBUTE_NAME);
+            NodeList localLayerNodes = XMLUtils.getNodeSetXPath(layerNode, 
+                                                                XPATH_LAYER);
+            Layer tmpLayer = new DefaultLayer(id, name,
+                                              (localLayerNodes != null &&
+                                               localLayerNodes.getLength() > 0),
+                                              groupId);
+            layer.add(tmpLayer);
+            if (localLayerNodes != null && localLayerNodes.getLength() > 0){
+                layer = this.extractLayer(layer, id, localLayerNodes);
+            }
+        }
+        return layer;
+    }
+
+    public String getSRS() {
+        return this.srs;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/mapviewer/parser/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package provides the XML-parser for parsing the XML-Documents which 
+were send by the MapViewer to the GMV-WebClient.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Controller triggered after user interactions.
+</body>
+</html>
--- a/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/DefaultSessionModel.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,10 +1,16 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action.sessionmodel;
 
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Locale;
 
 import org.apache.log4j.Logger;
 
@@ -12,13 +18,19 @@
 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet;
 import de.intevation.gnv.artifactdatabase.objects.OutputMode;
+import de.intevation.gnv.artifactdatabase.objects.map.MapService;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The default implementation of <code>SessionModel</code> which stores the
+ * current artifact object and the digram options selected by the user.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class DefaultSessionModel implements SessionModel {
 
+
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
@@ -29,26 +41,56 @@
      */
     private static final long serialVersionUID = 3431484439985158311L;
 
+    /**
+     * Container for <code>ArtifactFactory</code>-objects.
+     */
     private Collection<ArtifactObject> artifactFactories = null;
 
+    /**
+     * The selected <code>ArtifactFactory</code>
+     */
     private ArtifactObject selectedArtifactFactory = null;
 
+    /**
+     * The currently used artifact.
+     */
     private ArtifactObject currentArtifact = null;
 
+    /**
+     * The Diagrammoptions.
+     */
     private DiagrammOptions diagrammOptions = null;
 
+    /**
+     * The Container for statistic-values.
+     */
     private Collection<ArtifactStatisticsSet> statistics = null;
 
     /**
+     * The Locale that currently should be used.
+     */
+    private Locale currentLocale;
+
+    /**
+     * The Mapservice containing all Layers that should be displayed.
+     */
+    private MapService localMapService = null;
+    /**
      * Constructor
      */
     public DefaultSessionModel() {
-        super();
+        this(null);
     }
 
     /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#selectArtifactFactory(java.lang.String)
+     * Constructor
+     * @param currentLocale A locale used to create the user interface.
      */
+    public DefaultSessionModel(Locale currentLocale) {
+        this.currentLocale = currentLocale;
+    }
+
+
     public void selectArtifactFactory(String artiFactFactoryId) {
         Collection<ArtifactObject> artifactObjects = this
                 .getArtifactFactories();
@@ -70,59 +112,43 @@
         }
     }
 
-    /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#setArtifacteFactories(java.util.Collection)
-     */
+
     public void setArtifacteFactories(
-                                      Collection<ArtifactObject> artifactFactories) {
+                                Collection<ArtifactObject> artifactFactories) {
         this.artifactFactories = artifactFactories;
     }
 
-    /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#getAttributeFactories()
-     */
+
     public Collection<ArtifactObject> getArtifactFactories() {
         return this.artifactFactories;
     }
 
-    /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#getSelectedArtifactFactory()
-     */
+
     public ArtifactObject getSelectedArtifactFactory() {
         return this.selectedArtifactFactory;
     }
 
-    /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#getCurrentArtifact()
-     */
+
     public ArtifactObject getCurrentArtifact() {
         return this.currentArtifact;
     }
 
-    /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#setCurrentArtifact(de.intevation.gnv.artifactdatabase.objects.ArtifactObject)
-     */
+
     public void setCurrentArtifact(ArtifactObject artifact) {
         this.currentArtifact = artifact;
     }
 
-    /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#getDiagrammOptions()
-     */
+
     public DiagrammOptions getDiagrammOptions() {
         return this.diagrammOptions;
     }
 
-    /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#setDiagrammOptions(de.intevation.gnv.action.sessionmodel.DiagrammOptions)
-     */
+
     public void setDiagrammOptions(DiagrammOptions diagrammOptions) {
         this.diagrammOptions = diagrammOptions;
     }
 
-    /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#getArtifactDescription()
-     */
+
     public ArtifactDescription getArtifactDescription() {
         if (this.currentArtifact != null) {
             return (ArtifactDescription) this.currentArtifact;
@@ -130,9 +156,7 @@
         return null;
     }
 
-    /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#getOutputMode(java.lang.String)
-     */
+
     public OutputMode getOutputMode(String name) {
         ArtifactDescription ad = this.getArtifactDescription();
         if (ad != null) {
@@ -143,9 +167,7 @@
         return null;
     }
 
-    /**
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#resetModel()
-     */
+
     public void resetModel() {
         log.debug("DefaultSessionModel.resetModel");
         this.selectedArtifactFactory = null;
@@ -155,9 +177,7 @@
 
     }
 
-    /**b
-     * @see de.intevation.gnv.action.sessionmodel.SessionModel#getStatistics()
-     */
+
     public Collection<ArtifactStatisticsSet> getStatistics() {
         return this.statistics;
     }
@@ -165,4 +185,21 @@
     public void setStatistics(Collection<ArtifactStatisticsSet> statistics) {
         this.statistics = statistics;
     }
+
+    public Locale getCurrentLocale() {
+        return currentLocale;
+    }
+
+    public void setCurrentLocale(Locale currentLocale) {
+        this.currentLocale = currentLocale;
+    }
+    
+    public MapService getLocalMapService() {
+        return this.localMapService;
+    }
+
+    public void setLocalMapService(MapService mapService) {
+        this.localMapService = mapService;
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/DiagrammOptions.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,28 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action.sessionmodel;
 
+import java.text.NumberFormat;
+
 import java.util.HashMap;
+import java.util.Locale;
 import java.util.Map;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * Stores key-value pairs used to save user input for changing diagram
+ * attributes.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class DiagrammOptions {
 
-    private Map<String, String> values = new HashMap<String, String>();
+    private Map<String, Object> values = new HashMap<String, Object>();
 
     /**
      * Constructor
@@ -22,17 +32,42 @@
     }
 
     /**
-     * @return
+     * Returns the Value to a given Key
+     * @param  key The key of the value that should be returned.
+     * @return the value.
      */
-    public String getValue(String key) {
+    public Object getValue(String key) {
         return this.values.get(key);
     }
 
+
+    /**
+     * Returns the value as string.
+     * @param key The key of the value that should be returned.
+     * @param locale A locale object used to format numbers.
+     * @return the value as string.
+     */
+    public String getValue(String key, Locale locale) {
+        Object obj = values.get(key);
+
+        if (obj instanceof Double && locale != null) {
+            Double value        = (Double) obj;
+            NumberFormat format = NumberFormat.getNumberInstance(locale);
+
+            return format.format(value);
+        }
+
+        return (String) obj;
+    }
+
     /**
-     * @param width
+     * Set a value with the given key.
+     *
+     * @param key The given key.
+     * @param value The value to be stored.
      */
-    public void setValue(String key, String value) {
-        this.values.put(key, value);
+    public void setValue(String key, Object value) {
+        values.put(key, value);
     }
-
-}
\ No newline at end of file
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/SessionModel.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,46 +1,141 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action.sessionmodel;
 
 import java.io.Serializable;
 import java.util.Collection;
+import java.util.Locale;
 
 import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet;
 import de.intevation.gnv.artifactdatabase.objects.OutputMode;
+import de.intevation.gnv.artifactdatabase.objects.map.MapService;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This interface describe basic methods to store artifacts and diagram options.
+ * The SessionModel is saved in the session, which keeps alive during the work.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public interface SessionModel extends Serializable {
 
+    /**
+     * Returns all Artifactfactories which were retrieved from the 
+     * Artifactdatabases which are connected to the Client.
+     * @return the artifactfactories.
+     */
     Collection<ArtifactObject> getArtifactFactories();
 
+    /**
+     * Sets all Artifactfactories which were retieved from the Artifactdatabases
+     * to the SessionModel.
+     * @param artifactFactories the artifactfactories.
+     */
     void setArtifacteFactories(Collection<ArtifactObject> artifactFactories);
 
+    /**
+     * Set the Artifactfactory which match to the given id to selected.
+     * @param artiFactFactoryId the id of the artifactfactory which should 
+     *                          be selected.
+     */
     void selectArtifactFactory(String artiFactFactoryId);
 
+    /**
+     * Returns the Artifactfactory which is selected.
+     * @return the artifactfactory which is selected.
+     */
     ArtifactObject getSelectedArtifactFactory();
 
+    /**
+     * Returns the currently used artifact.
+     * This Artifact will retrieved from the selected artifactfactory and will 
+     * be used to do handle the special businesslogic.
+     * @return the artifact which is currently used.
+     */
     ArtifactObject getCurrentArtifact();
 
+    /**
+     * Sets a new Artifact as the artifact that should be used.
+     * @param artifact the new artifact which should be used.
+     */
     void setCurrentArtifact(ArtifactObject artifact);
 
+    /**
+     * Sets the currently used diagrammoptions to the Sessionmodel.
+     * Diagrammoptions will be used to manipulate the look of diagramms
+     * and render the GUI so that the user is enabled to switch the options.
+     * Diagrammoptions are also used for Histogram, all Exports and WMS 
+     * @param diagrammOptions the Options that should be used.
+     */
     void setDiagrammOptions(DiagrammOptions diagrammOptions);
 
+    /**
+     * Returns the diagrammoptions that currently set to the SessionModel.
+     * @return the diagrammoptions that currently set to the SessionModel.
+     */
     DiagrammOptions getDiagrammOptions();
 
+    /**
+     * Returns the Outputmode that matches to the given name of an mode.
+     * Outputmodes are used to define which kind of modes are defined to 
+     * generate an result for a given Artifact (chart, export, wms,...)
+     * @param name the name of the OutputMode that should be used
+     * @return the OutputMode that matches to the given name.
+     */
     OutputMode getOutputMode(String name);
 
+    /**
+     * Returns the description to the currently used Artifact.
+     * The description can be used to retrieve the supported OutputModes,
+     * the parameters that could be feed, ...
+     * @return the description of the artifact which is currently used.
+     */
     ArtifactDescription getArtifactDescription();
 
+    /**
+     * Reset the Model. So that it will have the status as no Artifactfactory
+     * was selected.
+     */
     void resetModel();
 
+    /**
+     * Sets the Statistics that were retrieved from the currently used Artifact
+     * to the SessionModel.
+     * @param statistics the Statistics that should be shown in the GUI.
+     */
     void setStatistics(Collection<ArtifactStatisticsSet> statistics);
 
+    /**
+     * Returns the statistics that are currently set to the SessionModel
+     * @return the statistics that are currently set to the SessionModel
+     */
     Collection<ArtifactStatisticsSet> getStatistics();
 
+    /**
+     * Sets the locale that should be used.
+     * The loacle will be used to customize the GUI for a language that matches
+     * to the locale or it will be used to tell the Artifactdatabase which locale
+     * has to be used.
+     * @param locale the locale that should be used.
+     */
+    void setCurrentLocale(Locale locale);
+
+    /**
+     * Returns the currently used locale.
+     * @return the locale that is currently used.
+     */
+    Locale getCurrentLocale();
+    
+    void setLocalMapService(MapService mapService);
+    
+    MapService getLocalMapService();
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/SessionModelFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.action.sessionmodel;
 
 import javax.servlet.http.HttpServletRequest;
@@ -8,12 +13,20 @@
 import org.apache.log4j.Logger;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * Creates and restores <code>SessionModel</code> objects from <code>
+ * HttpServletRequest</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class SessionModelFactory {
 
-    public final static String SESSION_MODEL_ID = "de.intevation.gnv.action.sessionmodel.SessionModel.ID";
+    /**
+     * The id of the <code>SessionModel</code> that must be used to lookup the 
+     * model from the given <code>HttpSession<Code> of the request.
+     */
+    public final static String SESSION_MODEL_ID = "de.intevation.gnv.action." +
+                                                 "sessionmodel.SessionModel.ID";
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
@@ -33,10 +46,10 @@
 
     /**
      * This Method provides an singleton Instance of this Class.
-     * 
      * @return an singleton Instance of this Class
      */
-    public static SessionModelFactory getInstance() {
+    public synchronized static SessionModelFactory getInstance() {
+        log.debug("SessionModelFactory.getInstance");
         if (instance == null) {
             instance = new SessionModelFactory();
         }
@@ -45,23 +58,23 @@
 
     /**
      * Getting the ArtifactDatabaseClient
-     * 
+     * @param request the tequest from which the SessionModel should be read.
      * @return the ArtifactDatabaseClient
      */
     public SessionModel getSessionModel(HttpServletRequest request) {
-        synchronized (this.getClass()) {
+        log.debug("SessionModelFactory.getSessionModel");
+        synchronized (request) {
             SessionModel sm = null;
-            if (request.getSession().getAttribute(SESSION_MODEL_ID) != null) {
-                sm = (SessionModel) request.getSession().getAttribute(
-                        SESSION_MODEL_ID);
-                ;
+            Object obj = request.getSession().getAttribute(SESSION_MODEL_ID);
+            if (obj instanceof SessionModel) {
+                sm = (SessionModel) obj;
             } else {
-                sm = new DefaultSessionModel();
+                sm = new DefaultSessionModel(request.getLocale());
                 request.getSession().setAttribute(SESSION_MODEL_ID, sm);
             }
 
             return sm;
         }
     }
-
 }
+// 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/gnv/src/main/java/de/intevation/gnv/action/sessionmodel/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package provides the classes and interface-definitions for providing an 
+SessionModel for storing Information which can be reused during a session.
+</body>
+</html>
+
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClient.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,21 +1,35 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.client;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Collection;
 import java.util.Locale;
 
+import org.w3c.dom.Document;
+
 import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException;
+import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseInputException;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactFactory;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet;
 import de.intevation.gnv.artifactdatabase.objects.InputParameter;
+import de.intevation.gnv.artifactdatabase.objects.map.MapService;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This interface describes basic methods for the communication between artifact
+ * server and this client.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public interface ArtifactDatabaseClient {
 
@@ -25,87 +39,208 @@
 
     /**
      * Return the Artifactfactories which can be resolved.
-     * 
+     *
      * @return the Artifactfactories which can be resolved.
-     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseClientException if a general error occured in the
+     * artifact server.
+     * @throws ArtifactDatabaseInputException if the input data was valid.
      */
     public Collection<ArtifactObject> getArtifactFactories()
-                                                            throws ArtifactDatabaseClientException;
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException;
 
     /**
-     * 
+     * Call the create operation of the artifact server and returns a new
+     * artifact with the information returned by the artifact server.
+     *
      * @param artifactFactory
      * @return the new Artifact
-     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseClientException if a general error occured in the
+     * artifact server.
+     * @throws ArtifactDatabaseInputException if the input data was valid.
      */
     public ArtifactObject createNewArtifact(ArtifactObject artifactFactory)
-                                            throws ArtifactDatabaseClientException;
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException;
 
     /**
-     * 
+     * Call the describe operation of the artifact server.
+     *
+     * @param artifactFactory
      * @param currentArtifact
+     * @param includeUI
      * @return the Current Artifact
-     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseClientException if a general error occured in the
+     * artifact server.
+     * @throws ArtifactDatabaseInputException if the input data was valid.
      */
     public ArtifactDescription getCurrentStepDescription(
-                                                         ArtifactObject artifactFactory,
-                                                         ArtifactObject currentArtifact,
-                                                         boolean includeUI)
-                                                         throws ArtifactDatabaseClientException;
+        ArtifactObject artifactFactory,
+        ArtifactObject currentArtifact,
+        boolean includeUI)
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException;
 
     /**
-     * 
+     *
      * @param artifactFactory
      * @param currentArtifact
      * @param target
      * @param inputParameter
-     * @return
-     * @throws ArtifactDatabaseClientException
+     * @return the artifact description.
+     * @throws ArtifactDatabaseClientException if a general error occured in the
+     * artifact server.
+     * @throws ArtifactDatabaseInputException if the input data was valid.
      */
     public ArtifactDescription doNextStep(
-                                          ArtifactObject artifactFactory,
-                                          ArtifactObject currentArtifact,
-                                          String target,
-                                          Collection<InputParameter> inputParameter)
-                                                                                    throws ArtifactDatabaseClientException;
+        ArtifactObject artifactFactory,
+        ArtifactObject currentArtifact,
+        String         target,
+        Collection<InputParameter> inputParameter)
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException;
+
+    /**
+     * Calls the advancecommand for the given Artifact at the Artifactdatabase.
+     * Stepping to the given target using the given Artifactfactory
+     * @param factory the Factory which provide the information about which 
+     *                Artifactdatabase has to be called.
+     * @param artifact the Artifact which should be moved to the next state.
+     * @param target the Id of the next State which should the artifact should 
+     *               be moved to.
+     * @throws IOException
+     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseInputException
+     */
+    public void doAdvance(
+        ArtifactObject factory,
+        ArtifactObject artifact,
+        String         target)
+    throws IOException, 
+           ArtifactDatabaseClientException, 
+           ArtifactDatabaseInputException;
 
     /**
      * @param artifactFactory
      * @param currentArtifact
      * @param inputParameter
-     * @return
-     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseClientException if a general error occured in the
+     * artifact server.
+     * @throws ArtifactDatabaseInputException if the input data was valid.
      */
     public void doFeed(ArtifactObject artifactFactory,
-                       ArtifactObject currentArtifact,
-                       Collection<InputParameter> inputParameter)
-                                                                 throws ArtifactDatabaseClientException;
+        ArtifactObject currentArtifact,
+        Collection<InputParameter> inputParameter)
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException;
 
     /**
-     * 
+     * Call the out operation of the artifact server.
+     *
      * @param artifactFactory
      * @param currentArtifact
      * @param stream
      * @param targetName
+     * @param exportMode
      * @param mimeType
+     * @param inputParameter
      * @throws ArtifactDatabaseClientException
      */
-    public void doOutput(ArtifactObject artifactFactory,
-                         ArtifactObject currentArtifact, OutputStream stream,
-                         String targetName, String mimeType,
-                         Collection<InputParameter> inputParameter)
-                                                                   throws ArtifactDatabaseClientException;
+    public void doOutput(
+        ArtifactObject artifactFactory,
+        ArtifactObject currentArtifact,
+        OutputStream   stream,
+        String         targetName,
+        String         exportMode,
+        String         mimeType,
+        Collection<InputParameter> inputParameter)
+    throws ArtifactDatabaseClientException;
+
 
     /**
+     * Write the current artifact to an xml file.
+     *
      * @param artifactFactory
      * @param currentArtifact
-     * @return
+     * @param out
+     * @throws ArtifactDatabaseClientException
+     */
+    public void doExport(
+        ArtifactObject artifactFactory,
+        ArtifactObject currentArtifact,
+        OutputStream   out)
+    throws ArtifactDatabaseClientException;
+
+
+    /**
+     * Import an artifact from xml file.
+     *
+     * @param factory
+     * @param document
+     * @return a status message. If the import was successful, it contains
+     * information about the imported artifact, otherwise a failure is
+     * contained.
+     * @throws ArtifactDatabaseClientException
+     * @throws IOException
+     */
+    public Document doImport(
+        ArtifactFactory factory,
+        Document        document)
+    throws ArtifactDatabaseClientException, IOException;
+
+    /**
+     * Publish shapefiles of an artifact as WMS layer.
+     *
+     * @param factory
+     * @param artifact
+     * @param inputParameter
+     * @return URL to wms service as string
+     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseInputException
+     */
+    public Document publishWMS(
+        ArtifactObject             factory,
+        ArtifactObject             artifact,
+        Collection<InputParameter> inputParameter
+    )throws ArtifactDatabaseClientException, ArtifactDatabaseInputException;
+
+
+    /**
+     * Start statistics calculation.
+     *
+     * @param artifactFactory
+     * @param currentArtifact
+     * @return the calculated statistic.
      * @throws ArtifactDatabaseClientException
      */
     public Collection<ArtifactStatisticsSet> calculateStatistics(
-                                                                  ArtifactObject artifactFactory,
-                                                                  ArtifactObject currentArtifact)
-                                                                                                 throws ArtifactDatabaseClientException;
-    
+        ArtifactObject artifactFactory,
+        ArtifactObject currentArtifact)
+    throws ArtifactDatabaseClientException;
+
+    /**
+     * Set the current locale.
+     * @param locale
+     */
     public void setLocale(Locale locale);
+
+    /**
+     * Get the current locale.
+     * @return the current locale.
+     */
+    public Locale getLocale();
+
+    /**
+     * Returns some meta information about the currently selected
+     * ArtifactFactory.
+     *
+     * @param mapServices
+     * @param geometry
+     * @param srs
+     * @return the information.
+     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseInputException
+     */
+    public Collection<ArtifactObject> getArtifactFactoryMetaInformation(
+        Collection<MapService> mapServices,
+        String                 geometry,
+        String                 srs)
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException;
+
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,15 +1,23 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.client;
 
+import java.util.Locale;
+
 import org.apache.log4j.Logger;
 
-import java.util.Locale;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * Used to start a session with a new artifact. A new
+ * <code>DefaultArtifactDatabaseClient</code> is created.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class ArtifactDatabaseClientFactory {
 
@@ -33,7 +41,7 @@
 
     /**
      * This Method provides an singleton Instance of this Class.
-     * 
+     *
      * @return an singleton Instance of this Class
      */
     public static synchronized ArtifactDatabaseClientFactory getInstance() {
@@ -52,7 +60,6 @@
         DefaultArtifactDatabaseClient adc = new DefaultArtifactDatabaseClient();
         adc.setLocale(locale);
         return adc;
-        
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/DefaultArtifactDatabaseClient.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,31 +1,35 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.client;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
+import java.io.OutputStreamWriter;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Map;
 import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 
 import org.apache.log4j.Logger;
-
 import org.restlet.Client;
-
+import org.restlet.Request;
+import org.restlet.Response;
+import org.restlet.data.ClientInfo;
+import org.restlet.data.Language;
 import org.restlet.data.Method;
+import org.restlet.data.Preference;
 import org.restlet.data.Protocol;
-import org.restlet.data.Request;
-import org.restlet.data.Response;
-import org.restlet.data.Preference;
-import org.restlet.data.Language;
-import org.restlet.data.ClientInfo;
-
 import org.restlet.representation.Representation;
 import org.restlet.representation.StringRepresentation;
 import org.w3c.dom.Document;
@@ -34,6 +38,7 @@
 import org.w3c.dom.NodeList;
 
 import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException;
+import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseInputException;
 import de.intevation.gnv.artifactdatabase.objects.Artifact;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
 import de.intevation.gnv.artifactdatabase.objects.ArtifactFactory;
@@ -41,18 +46,27 @@
 import de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet;
 import de.intevation.gnv.artifactdatabase.objects.DefaultArtifactStatisticValue;
 import de.intevation.gnv.artifactdatabase.objects.DefaultArtifactStatisticsSet;
+import de.intevation.gnv.artifactdatabase.objects.DefaultExportMode;
 import de.intevation.gnv.artifactdatabase.objects.DefaultOutputMode;
 import de.intevation.gnv.artifactdatabase.objects.DefaultOutputParameter;
+import de.intevation.gnv.artifactdatabase.objects.ExportMode;
 import de.intevation.gnv.artifactdatabase.objects.InputParameter;
 import de.intevation.gnv.artifactdatabase.objects.OutputMode;
 import de.intevation.gnv.artifactdatabase.objects.OutputParameter;
+import de.intevation.gnv.artifactdatabase.objects.ParametrizedArtifactFactory;
+import de.intevation.gnv.artifactdatabase.objects.ParametrizedArtifactObject;
+import de.intevation.gnv.artifactdatabase.objects.map.Layer;
+import de.intevation.gnv.artifactdatabase.objects.map.MapService;
 import de.intevation.gnv.propertiesreader.PropertiesReader;
 import de.intevation.gnv.propertiesreader.PropertiesReaderFactory;
 import de.intevation.gnv.util.XMLUtils;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The default implementation of <code>ArtifactDatabaseClient</code> which
+ * implements methods to communicate via HTTP protocol with the artifact server.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class DefaultArtifactDatabaseClient implements ArtifactDatabaseClient {
     /**
@@ -66,6 +80,19 @@
     public final static String NAMESPACE_PREFIX = "art";
 
     /**
+     * Xpath expression to get general exception messages related to server
+     * errors.
+     */
+    public static final String EXCEPTION_GENERAL =
+        "/art:exceptionreport/art:exception/text()";
+
+    /**
+     * Xpath expression to get exception messages related to invalid user input.
+     */
+    public static final String EXCEPTION_USER_INPUT =
+        "/art:exceptionreport/art:exception/art:input/text()";
+
+    /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger
@@ -91,14 +118,11 @@
      * Constructor
      */
     public DefaultArtifactDatabaseClient() {
-        
+
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#getArtifactFactories()
-     */
     public Collection<ArtifactObject> getArtifactFactories()
-                                                            throws ArtifactDatabaseClientException {
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException {
         Collection<ArtifactObject> resultValues = null;
         if (!initialized) {
             this.initialize();
@@ -111,10 +135,10 @@
                 String url = server + "/factories";
                 Document document = this.doGetRequest(url);
                 if (resultValues == null) {
-                    resultValues = this.getArtifactFactories(document, server);
+                    resultValues = this.getArtifactFactories(document, server,null);
                 } else {
                     resultValues.addAll(this.getArtifactFactories(document,
-                            server));
+                            server,null));
                 }
             }
         } catch (IOException e) {
@@ -124,45 +148,78 @@
         return resultValues;
     }
 
+
+    /**
+     * Returns a collection of artifact factories retrieved by <i>server</i>.
+     *
+     * @param document
+     * @param server
+     * @param geometry
+     * @return a collection of factories.
+     */
     private Collection<ArtifactObject> getArtifactFactories(Document document,
-                                                            String server) {
-        XMLUtils xmlUtils = new XMLUtils();
-        NodeList artifactFactories = xmlUtils.getNodeSetXPath(document,
-                "/result/factories/factory");
+                                                            String server,
+                                                            String geometry) {
+        NodeList artifactFactories = XMLUtils.getNodeSetXPath(document,
+                "/art:result/art:factories/art:factory");
         Collection<ArtifactObject> resultValues = new ArrayList<ArtifactObject>(
                 artifactFactories.getLength());
         if (artifactFactories != null) {
             for (int i = 0; i < artifactFactories.getLength(); i++) {
                 Node artifactFactoryNode = artifactFactories.item(i);
-                String name = xmlUtils.getStringXPath(artifactFactoryNode,
-                        "@name");
-                String description = xmlUtils.getStringXPath(
-                        artifactFactoryNode, "@description");
-                ArtifactFactory artifactFactory = new ArtifactFactory(name,
-                        description, server);
-                resultValues.add(artifactFactory);
+                String name = XMLUtils.getStringXPath(artifactFactoryNode,
+                        "@art:name");
+                String description = XMLUtils.getStringXPath(
+                        artifactFactoryNode, "@art:description");
+
+                NodeList parameterNodeList = XMLUtils.getNodeSetXPath(
+                                                            artifactFactoryNode,
+                                                            "art:parameter");
+
+                if ((parameterNodeList != null &&
+                    parameterNodeList.getLength() > 0) ||
+                    geometry != null){
+                    Collection<String> parameters =
+                          new ArrayList<String>(parameterNodeList.getLength());
+                    for (int j = 0; j < parameterNodeList.getLength(); j++){
+                        Element parameterNode = (Element)parameterNodeList.item(j);
+                        parameters.add(parameterNode.getAttribute("id"));
+                    }
+                    ParametrizedArtifactObject pao =
+                                    new ParametrizedArtifactFactory(name,
+                                                                    description,
+                                                                    server);
+                    pao.addParameters("parameter", parameters);
+                    resultValues.add(pao);
+                    if (geometry != null){
+                        Collection<String> geometryList = new ArrayList<String>(1);
+                        geometryList.add(geometry);
+                        pao.addParameters("geometry",geometryList);
+                    }
+                }else{
+                    ArtifactObject artifactFactory  = new ArtifactFactory(name,
+                                                                    description,
+                                                                    server);
+                    resultValues.add(artifactFactory);
+                }
             }
         }
+        log.debug("Artifact Factories: " + resultValues.size());
         return resultValues;
     }
 
-    /**
-     * @throws IOException
-     */
-    private Document doGetRequest(String requestUrl) throws IOException,
-                                                    ArtifactDatabaseClientException {
+
+    private Document doGetRequest(String requestUrl)
+    throws IOException, ArtifactDatabaseClientException, ArtifactDatabaseInputException {
         return this.doGetRequest(requestUrl, null);
     }
 
-    /**
-     * @throws IOException
-     */
+
     private Document doGetRequest(String requestUrl, Document requestBody)
-                                                                          throws IOException,
-                                                                          ArtifactDatabaseClientException {
+    throws IOException, ArtifactDatabaseClientException, ArtifactDatabaseInputException {
         XMLUtils xmlUtils = new XMLUtils();
         Representation output = doGetRequestInternal(requestUrl, requestBody);
-        Document document = xmlUtils.readDocument(output.getStream());
+        Document document = XMLUtils.readDocument(output.getStream());
         this.check4ExceptionReport(document);
         return document;
     }
@@ -171,6 +228,14 @@
         return initialize(request, locale);
     }
 
+    /**
+     * Initialize the <code>ClientInfo</code> object of <i>request</i> with the
+     * given <i>locale</i>.
+     *
+     * @param request The request object.
+     * @param locale The locale.
+     * @return the prepared request object.
+     */
     protected Request initialize(Request request, Locale locale) {
         if (locale != null) {
             ClientInfo clientInfo = request.getClientInfo();
@@ -185,17 +250,13 @@
         return request;
     }
 
-    /**
-     * @param requestUrl
-     * @param requestBody
-     * @return
-     */
+
     private Representation doGetRequestInternal(String requestUrl,
                                                 Document requestBody) throws IOException {
         Client client = new Client(Protocol.HTTP);
         Request request = initialize(new Request(Method.GET, requestUrl));
         if (requestBody != null) {
-            String documentBody = new XMLUtils()
+            String documentBody = XMLUtils
                     .writeDocument2String(requestBody);
             Representation representation = new StringRepresentation(
                     documentBody);
@@ -209,17 +270,17 @@
         return output;
     }
 
-    /**
-     * @throws IOException
-     */
+
     private InputStream doPostRequest(String requestUrl, Document requestBody)
                                                                               throws IOException {
-        log.debug("##################################################");
-        log.debug(new XMLUtils().writeDocument2String(requestBody));
-        log.debug("##################################################");
+        
+        log.debug("URL: "+ requestUrl);
+        log.debug("Body");
+        log.debug(XMLUtils.writeDocument2String(requestBody));
+        
         Client client = new Client(Protocol.HTTP);
         Request request = initialize(new Request(Method.POST, requestUrl));
-        String documentBody = new XMLUtils().writeDocument2String(requestBody);
+        String documentBody = XMLUtils.writeDocument2String(requestBody);
         Representation representation = new StringRepresentation(documentBody);
         request.setEntity(representation);
         Response response = client.handle(request);
@@ -246,15 +307,22 @@
 
     }
 
+
     /**
-     * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#createNewArtifact(de.intevation.gnv.artifactdatabase.objects.ArtifactObject)
+     * Creates a new artifact with the given <i>artifactFactory</i>. A POST call
+     * is sent to the artifact server which creates a new artifact.
+     *
+     * @param artifactFactory The artifact factory used to create a new
+     * artifact.
+     * @return the created artifact of the artifact server.
+     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseInputException
      */
     public ArtifactObject createNewArtifact(ArtifactObject artifactFactory)
-                                                                           throws ArtifactDatabaseClientException {
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException {
 
         try {
-            Document request = this.createCreateRequestBody(artifactFactory
-                    .getId());
+            Document request = this.createCreateRequestBody(artifactFactory);
             Document result = doPostRequest(artifactFactory, request, "create");
             return this.getArtifact(result);
         } catch (IOException e) {
@@ -263,25 +331,52 @@
         }
     }
 
+    /**
+     * Returns a new artifact defined by uuid and hash values of the document
+     * returned by the artifact server after creating a new artifact.
+     *
+     * @param document Contains information about the server-side created
+     * artifact.
+     * @return a new artifact object.
+     */
     private ArtifactObject getArtifact(Document document) {
         XMLUtils xmlUtils = new XMLUtils();
-        String uuid = xmlUtils.getStringXPath(document, "/result/uuid/@value");
-        String hash = xmlUtils.getStringXPath(document, "/result/hash/@value");
+        String uuid = XMLUtils.getStringXPath(document, "/art:result/art:uuid/@value");
+        String hash = XMLUtils.getStringXPath(document, "/art:result/art:hash/@value");
         log.info("NEW Artifact: " + uuid + " / " + hash);
         return new Artifact(uuid, hash);
     }
 
-    private Document createCreateRequestBody(String artifactFactoryName) {
-        Document document = new XMLUtils().newDocument();
+    private Document createCreateRequestBody(ArtifactObject artifactFactory) {
+        Document document = XMLUtils.newDocument();
         Node rootNode = this.createRootNode(document);
         Element typeNode = this.createArtifactElement(document, "type");
         typeNode.setAttribute("name", "create");
         rootNode.appendChild(typeNode);
 
-        Element factoyNode = this.createArtifactElement(document, "factory");
-        factoyNode.setAttribute("name", artifactFactoryName);
-        rootNode.appendChild(factoyNode);
+        Element factoryNode = this.createArtifactElement(document, "factory");
+        factoryNode.setAttribute("name", artifactFactory.getId());
+        rootNode.appendChild(factoryNode);
 
+        if (artifactFactory instanceof ParametrizedArtifactObject){
+            Map<String, Collection<String>> parameterMap =
+                ((ParametrizedArtifactObject)artifactFactory).getParameters();
+            if (parameterMap != null && !parameterMap.isEmpty() ){
+                Iterator<String> keyIt = parameterMap.keySet().iterator();
+                while (keyIt.hasNext()){
+                    String key = keyIt.next();
+                    Iterator<String> valueIt = parameterMap.get(key).iterator();
+                    while (valueIt.hasNext()){
+                        String value = valueIt.next();
+                        Element parameterNode =
+                             this.createArtifactElement(document, "parameter");
+                        parameterNode.setAttribute("name", key);
+                        parameterNode.setAttribute("value", value);
+                        factoryNode.appendChild(parameterNode);
+                    }
+                }
+            }
+        }
         return document;
     }
 
@@ -291,62 +386,65 @@
         return rootNode;
     }
 
-    /**
-     * @param document
-     * @return
-     */
+
     private Element createArtifactElement(Document document, String name) {
-        Element node = document.createElementNS(NAMESPACE_URI, name);
-        node.setPrefix(NAMESPACE_PREFIX);
-        return node;
+        XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(
+            document,
+            NAMESPACE_URI,
+            NAMESPACE_PREFIX
+        );
+
+        return creator.create(name);
     }
 
-    /**
-     * @param artifactFactory
-     * @param xmlUtils
-     * @param request
-     * @throws IOException
-     */
+
     private Document doPostRequest(ArtifactObject artifactFactory,
-                                   Document request, String suburl)
-                                                                   throws IOException,
-                                                                   ArtifactDatabaseClientException {
+        Document request, String suburl)
+    throws IOException, ArtifactDatabaseClientException, ArtifactDatabaseInputException {
         XMLUtils xmlUtils = new XMLUtils();
         String url = ((ArtifactFactory) artifactFactory).getDataBaseUrl();
         InputStream is = this.doPostRequest(url + "/" + suburl, request);
-        Document result = xmlUtils.readDocument(is);
+        Document result = XMLUtils.readDocument(is);
         this.check4ExceptionReport(result);
         return result;
     }
 
+
     /**
-     * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#getCurrentStepDescription(de.intevation.gnv.artifactdatabase.objects.ArtifactFactory,
-     *      de.intevation.gnv.artifactdatabase.objects.ArtifactObject)
+     * Retrieve the current artifact description after calling the describe
+     * operation of the artifact server.
+     *
+     * @param artifactFactory
+     * @param currentArtifact
+     * @param includeUI Set this option to true, if the user interface
+     * description is required.
+     * @return the artifact description.
+     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseInputException
      */
     public ArtifactDescription getCurrentStepDescription(
-                                                         ArtifactObject artifactFactory,
-                                                         ArtifactObject currentArtifact,
-                                                         boolean includeUI)
-                                                         throws ArtifactDatabaseClientException {
+        ArtifactObject artifactFactory,
+        ArtifactObject currentArtifact,
+        boolean includeUI)
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException {
         try {
             String url = this.getArtifactUrl(artifactFactory, currentArtifact);
             Document request = this.createDescribeRequestBody(currentArtifact,
                                                               includeUI);
             InputStream describeResult = this.doPostRequest(url, request);
-    
-            return this.readDescription(new XMLUtils().readDocument(describeResult), 
+
+            return this.readDescription(XMLUtils.readDocument(describeResult),
                                         currentArtifact);
         } catch (IOException e) {
             log.error(e, e);
             throw new ArtifactDatabaseClientException(e);
         }
     }
-    
-    
+
+
     private Document createDescribeRequestBody(ArtifactObject currentArtifact,
                                                          boolean includeUI){
-        
-        Document document = new XMLUtils().newDocument();
+        Document document = XMLUtils.newDocument();
         Node rootNode = this.createRootNode(document);
 
         Element typeNode = this.createArtifactElement(document, "type");
@@ -366,11 +464,7 @@
         return document;
     }
 
-    /**
-     * @param artifactFactory
-     * @param currentArtifact
-     * @return
-     */
+
     private String getArtifactUrl(ArtifactObject artifactFactory,
                                   ArtifactObject currentArtifact) {
         String url = ((ArtifactFactory) artifactFactory).getDataBaseUrl()
@@ -379,34 +473,33 @@
     }
 
     private ArtifactDescription readDescription(Document document,
-                                                ArtifactObject artifact)
-                                                                        throws ArtifactDatabaseClientException {
+        ArtifactObject artifact)
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException {
         // Check if there was an Error or Exception reported from the
         // ArtifactDatabase
         this.check4ExceptionReport(document);
-        XMLUtils xmlUtils = new XMLUtils();
         if (artifact instanceof ArtifactDescription) {
             ArtifactDescription ad = (ArtifactDescription) artifact;
-            Node uiNode = xmlUtils.getNodeXPath(document, "/result/ui");
-            Node outputNode = xmlUtils
-                    .getNodeXPath(document, "/result/outputs");
+            Node uiNode = XMLUtils.getNodeXPath(document, "/art:result/art:ui");
+            Node outputNode = XMLUtils
+                    .getNodeXPath(document, "/art:result/art:outputs");
 
             Map<String, OutputMode> outputModes = null;
             if (outputNode != null) {
-                NodeList outputModesNodes = xmlUtils.getNodeSetXPath(
-                        outputNode, "output");
+                NodeList outputModesNodes = XMLUtils.getNodeSetXPath(
+                        outputNode, "art:output");
                 if (outputModesNodes != null) {
                     outputModes = new HashMap<String, OutputMode>(
                             outputModesNodes.getLength());
                     for (int i = 0; i < outputModesNodes.getLength(); i++) {
                         Node outputModeNode = outputModesNodes.item(i);
-                        String name = xmlUtils.getStringXPath(outputModeNode,
+                        String name = XMLUtils.getStringXPath(outputModeNode,
                                 "@name");
-                        String mimeType = xmlUtils.getStringXPath(
+                        String mimeType = XMLUtils.getStringXPath(
                                 outputModeNode, "@mime-type");
 
-                        NodeList parameterNodes = xmlUtils.getNodeSetXPath(
-                                outputModeNode, "parameter/parameter");
+                        NodeList parameterNodes = XMLUtils.getNodeSetXPath(
+                                outputModeNode, "art:parameter/art:parameter");
                         Collection<OutputParameter> parameter = null;
                         if (parameterNodes != null) {
                             parameter = new ArrayList<OutputParameter>(
@@ -415,41 +508,61 @@
                                 Node outputParameterNode = parameterNodes
                                         .item(j);
                                 parameter.add(new DefaultOutputParameter(
-                                        xmlUtils.getStringXPath(
+                                        XMLUtils.getStringXPath(
                                                 outputParameterNode, "@name"),
-                                        xmlUtils.getStringXPath(
+                                        XMLUtils.getStringXPath(
                                                 outputParameterNode, "@value"),
-                                        xmlUtils.getStringXPath(
+                                        XMLUtils.getStringXPath(
                                                 outputParameterNode, "@name"),
-                                        xmlUtils.getStringXPath(
+                                        XMLUtils.getStringXPath(
                                                 outputParameterNode, "@type")));
                             }
                         }
+
+                        NodeList exportNodes = XMLUtils.getNodeSetXPath(
+                            outputModeNode, "art:exports/art:export");
+                        Map exports = null;
+
+                        if (exportNodes != null) {
+                            int size = exportNodes.getLength();
+                            exports = new HashMap<String, ExportMode>(size);
+
+                            for (int k = 0; k < size; k++) {
+                                Node export = exportNodes.item(k);
+                                String expName = XMLUtils.getStringXPath(
+                                    export, "@name");
+                                exports.put(expName, new DefaultExportMode(
+                                    expName,
+                                    XMLUtils.getStringXPath(export, "@description"),
+                                    XMLUtils.getStringXPath(export, "@mime-type")));
+                            }
+                        }
+
                         outputModes.put(name, new DefaultOutputMode(name,
-                                mimeType, parameter));
+                                mimeType, parameter, exports));
                     }
 
                 }
             }
 
-            String currentState = xmlUtils.getStringXPath(document,
-                    "/result/state/@name");
-            NodeList statesList = xmlUtils.getNodeSetXPath(document,
-                    "/result/reachable-states/state/@name");
+            String currentState = XMLUtils.getStringXPath(document,
+                    "/art:result/art:state/@name");
+            NodeList statesList = XMLUtils.getNodeSetXPath(document,
+                    "/art:result/art:reachable-states/art:state/@name");
             Collection<String> reachableStates = new ArrayList<String>(
                     statesList.getLength());
             for (int i = 0; i < statesList.getLength(); i++) {
                 reachableStates.add(statesList.item(i).getNodeValue());
             }
 
-            NodeList inputNodes = xmlUtils.getNodeSetXPath(document,
-                    "/result/model/input");
+            NodeList inputNodes = XMLUtils.getNodeSetXPath(document,
+                    "/art:result/art:model/art:input");
             if (inputNodes != null) {
                 Collection<String> inputParameter = new ArrayList<String>(
                         inputNodes.getLength());
                 for (int i = 0; i < inputNodes.getLength(); i++) {
                     Node inputNode = inputNodes.item(i);
-                    String name = xmlUtils.getStringXPath(inputNode, "@name");
+                    String name = XMLUtils.getStringXPath(inputNode, "@name");
                     inputParameter.add(name);
                 }
                 ad.setInputParameter(inputParameter);
@@ -469,37 +582,44 @@
 
     }
 
+
     /**
-     * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#doNextStep(de.intevation.gnv.artifactdatabase.objects.ArtifactObject,
-     *      de.intevation.gnv.artifactdatabase.objects.ArtifactObject,
-     *      java.lang.String, java.util.Collection)
+     * Feed, advance and describe in one single method.
+     *
+     * @param artifactFactory The factory which created the current artifact.
+     * @param currentArtifact The current artifact.
+     * @param target The target state for advance.
+     * @param inputParameter Input data for feed.
+     * @return the artifact description after calling feed and advance.
+     * @throws ArtifactDatabaseClientException if a general error occured in
+     * the artifact server.
+     * @throws ArtifactDatabaseInputException if the input data was invalid used
+     * for feed.
      */
     public ArtifactDescription doNextStep(
-                                          ArtifactObject artifactFactory,
-                                          ArtifactObject currentArtifact,
-                                          String target,
-                                          Collection<InputParameter> inputParameter)
-                                                                                    throws ArtifactDatabaseClientException {
+        ArtifactObject             artifactFactory,
+        ArtifactObject             currentArtifact,
+        String                     target,
+        Collection<InputParameter> inputParameter)
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException {
 
         try {
             // 1 Feed
             this.doFeed(artifactFactory, currentArtifact, inputParameter);
-            
+
             // 2. Noch einmal Describe um das jetzt zu erreichende Ziel zu ermitteln
-            ArtifactDescription ad = this.getCurrentStepDescription(artifactFactory, 
-                                                                    new Artifact(currentArtifact.getId(), 
-                                                                                 currentArtifact.getHash()),
-                                                                    false);
+            ArtifactDescription ad = getCurrentStepDescription(
+                artifactFactory,
+                new Artifact(currentArtifact.getId(),
+                currentArtifact.getHash()),
+                false
+            );
+
             target = ad.getReachableStates().iterator().next();
-            
+
             // 3 Advance
-            String url = this.getArtifactUrl(artifactFactory, currentArtifact);
-            Document advanceDocument = this.createAdvanceRequestBody(
-                    currentArtifact, target);
-            InputStream advanceResult = this
-                    .doPostRequest(url, advanceDocument);
-            this.check4ExceptionReport(new XMLUtils()
-                    .readDocument(advanceResult));
+            doAdvance(artifactFactory, currentArtifact, target);
+
             // 3 Describe
             return this.getCurrentStepDescription(artifactFactory,
                     currentArtifact,true);
@@ -509,10 +629,35 @@
         }
     }
 
+
+    /**
+     * Call the advance operation of the artifact server to step to the next
+     * step of the parameterization.
+     *
+     * @param factory The artifact factory which created the current artifact.
+     * @param artifact The current artifact.
+     * @param target The target state.
+     * @throws IOException if an error occured while reading/writing from/to
+     * stream.
+     * @throws ArtifactDatabaseClientException if a general error occured in
+     * the artifact server.
+     * @throws ArtifactDatabaseInputException if the input data was invalid.
+     */
+    public void doAdvance(
+        ArtifactObject factory,
+        ArtifactObject artifact,
+        String         target)
+    throws IOException, ArtifactDatabaseClientException, ArtifactDatabaseInputException {
+        String url                = getArtifactUrl(factory, artifact);
+        Document advanceDocument  = createAdvanceRequestBody(artifact, target);
+        InputStream advanceResult = doPostRequest(url, advanceDocument);
+        check4ExceptionReport(XMLUtils.readDocument(advanceResult));
+    }
+
     private Document createFeedRequestBody(
                                            ArtifactObject currentArtifact,
                                            Collection<InputParameter> inputParameter) {
-        Document document = new XMLUtils().newDocument();
+        Document document = XMLUtils.newDocument();
         Node rootNode = this.createRootNode(document);
 
         Element typeNode = this.createArtifactElement(document, "type");
@@ -534,11 +679,7 @@
         return document;
     }
 
-    /**
-     * @param inputParameter
-     * @param document
-     * @param rootNode
-     */
+
     private Node createParameterNodes(
                                       Collection<InputParameter> inputParameter,
                                       Document document, String nodeName) {
@@ -565,9 +706,17 @@
         return dataNode;
     }
 
+
+    /**
+     * Creates the xml body for the advance request.
+     *
+     * @param currentArtifact
+     * @param target
+     * @return the advance xml document.
+     */
     private Document createAdvanceRequestBody(ArtifactObject currentArtifact,
                                               String target) {
-        Document document = new XMLUtils().newDocument();
+        Document document = XMLUtils.newDocument();
         Node rootNode = this.createRootNode(document);
 
         Element typeNode = this.createArtifactElement(document, "type");
@@ -588,19 +737,29 @@
     }
 
     /**
-     * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#doOutput(de.intevation.gnv.artifactdatabase.objects.ArtifactObject,
-     *      de.intevation.gnv.artifactdatabase.objects.ArtifactObject,
-     *      java.io.OutputStream, java.lang.String, java.lang.String,
-     *      java.util.Collection)
+     * Call the out operation of the artifact server and writes the result to
+     * <i>stream</i>.
+     *
+     * @param exportMode
+     * @param inputParameter
      */
-    public void doOutput(ArtifactObject artifactFactory,
-                         ArtifactObject currentArtifact, OutputStream stream,
-                         String targetName, String mimeType,
-                         Collection<InputParameter> inputParameter)
-                                                                   throws ArtifactDatabaseClientException {
+    public void doOutput(
+        ArtifactObject artifactFactory,
+        ArtifactObject currentArtifact,
+        OutputStream   stream,
+        String         targetName,
+        String         exportMode,
+        String         mimeType,
+        Collection<InputParameter> inputParameter)
+    throws ArtifactDatabaseClientException
+    {
         try {
-            Document requestBody = this.createOutRequestBody(currentArtifact,
-                    targetName, mimeType, inputParameter);
+            Document requestBody = this.createOutRequestBody(
+                currentArtifact,
+                targetName,
+                exportMode,
+                mimeType,
+                inputParameter);
 
             String requestUrl = this.getArtifactUrl(artifactFactory,
                     currentArtifact)
@@ -618,12 +777,101 @@
         }
     }
 
+
+    /**
+     * Call the out method of the artifact server with a specific export mode.
+     *
+     * @param artifactFactory
+     * @param currentArtifact
+     * @param out
+     * @throws ArtifactDatabaseClientException if an error occured while
+     * reading/writing from/to stream.
+     */
+    public void doExport(
+        ArtifactObject artifactFactory,
+        ArtifactObject currentArtifact,
+        OutputStream   out)
+    throws ArtifactDatabaseClientException
+    {
+        InputStreamReader reader  = null;
+        OutputStreamWriter writer = null;
+
+        try {
+            String url = ((ArtifactFactory) artifactFactory).getDataBaseUrl();
+            url       += "/export/" + currentArtifact.getId();
+
+            Representation response = doGetRequestInternal(url, null);
+            InputStream in          = response.getStream();
+
+            reader = new InputStreamReader(in);
+            writer = new OutputStreamWriter(out);
+
+            int    c;
+            char[] buffer = new char[512];
+            while ((c = reader.read(buffer)) > 0) {
+                writer.write(buffer, 0, c);
+            }
+
+        }
+        catch (Exception e) {
+            log.error(e, e);
+            throw new ArtifactDatabaseClientException(e);
+        }
+        finally {
+            try {
+                reader.close();
+            } catch (IOException ioe) {}
+
+            try {
+                writer.flush();
+            } catch (IOException ioe) {}
+
+            try {
+                writer.close();
+            } catch (IOException ioe) {}
+        }
+    }
+
+
+    /**
+     * Start to import an artifact from xml document.
+     *
+     * @param factory
+     * @param document The artifact as xml document.
+     * @return A status description of the operation (success or failure).
+     * @throws ArtifactDatabaseClientException
+     * @throws IOException
+     */
+    public Document doImport(
+        ArtifactFactory factory,
+        Document        document)
+    throws ArtifactDatabaseClientException, IOException
+    {
+        String url           = factory.getDataBaseUrl() + "/import";
+        InputStream response = doPostRequest(url, document);
+
+        return XMLUtils.readDocument(response);
+    }
+
+
+    /**
+     * Creates the xml request body used for an out-call of the artifact server.
+     *
+     * @param currentArtifact
+     * @param target
+     * @param exportMode
+     * @param mimeType
+     * @param inputParameter
+     * @return the request body.
+     */
     private Document createOutRequestBody(
-                                          ArtifactObject currentArtifact,
-                                          String target,
-                                          String mimeType,
-                                          Collection<InputParameter> inputParameter) {
-        Document document = new XMLUtils().newDocument();
+        ArtifactObject             currentArtifact,
+        String                     target,
+        String                     exportMode,
+        String                     mimeType,
+        Collection<InputParameter> inputParameter)
+    {
+        Document document = XMLUtils.newDocument();
         Node rootNode = this.createRootNode(document);
 
         Element typeNode = this.createArtifactElement(document, "type");
@@ -642,6 +890,10 @@
         outNode.setAttribute("name", target);
         rootNode.appendChild(outNode);
 
+        Element exportNode = this.createArtifactElement(document, "export");
+        exportNode.setAttribute("name", exportMode);
+        outNode.appendChild(exportNode);
+
         Element mimeTypeNode = this.createArtifactElement(document, "mime-type");
         mimeTypeNode.setAttribute("value", mimeType);
         outNode.appendChild(mimeTypeNode);
@@ -653,22 +905,29 @@
         return document;
     }
 
+
     /**
-     * @see de.intevation.gnv.artifactdatabase.client.ArtifactDatabaseClient#doFeed(de.intevation.gnv.artifactdatabase.objects.ArtifactObject,
-     *      de.intevation.gnv.artifactdatabase.objects.ArtifactObject,
-     *      java.util.Collection)
+     * Calls the feed operation of the artifact server.
+     *
+     * @param artifactFactory The artifact factory which created the current
+     * artifact.
+     * @param currentArtifact The current artifact.
+     * @param inputParameter The user input.
+     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseInputException
      */
-    public void doFeed(ArtifactObject artifactFactory,
-                       ArtifactObject currentArtifact,
-                       Collection<InputParameter> inputParameter)
-                                                                 throws ArtifactDatabaseClientException {
+    public void doFeed(
+        ArtifactObject artifactFactory,
+        ArtifactObject currentArtifact,
+        Collection<InputParameter> inputParameter)
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException {
 
         try {
             Document feedDocument = this.createFeedRequestBody(currentArtifact,
                     inputParameter);
             String url = this.getArtifactUrl(artifactFactory, currentArtifact);
             InputStream feedResult = this.doPostRequest(url, feedDocument);
-            Document feedResultDocument = new XMLUtils()
+            Document feedResultDocument = XMLUtils
                     .readDocument(feedResult);
             this.check4ExceptionReport(feedResultDocument);
         } catch (IOException e) {
@@ -678,45 +937,86 @@
     }
 
     private void check4ExceptionReport(Document document)
-                                                         throws ArtifactDatabaseClientException {
-
-        String message = new XMLUtils().getStringXPath(document,
-                "/exceptionreport/exception");
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException {
+        String message = XMLUtils.getStringXPath(document,
+            EXCEPTION_GENERAL);
         if (message != null) {
             throw new ArtifactDatabaseClientException(message);
         }
 
+        String input = XMLUtils.getStringXPath(document, EXCEPTION_USER_INPUT);
+        if (input != null) {
+            throw new ArtifactDatabaseInputException(input);
+        }
     }
 
+
+    /**
+     * Call the specific wms export mode of the out operation of the artifact
+     * server.
+     *
+     * @param factory
+     * @param artifact
+     * @param inputParameter
+     * @return a document that contains information about the wms service and
+     * the created layer.
+     * @throws ArtifactDatabaseClientException
+     * @throws ArtifactDatabaseInputException
+     */
+    public Document publishWMS(
+        ArtifactObject             factory,
+        ArtifactObject             artifact,
+        Collection<InputParameter> inputParameter
+    ) throws ArtifactDatabaseClientException, ArtifactDatabaseInputException{
+        log.debug("Start wms publishing...");
+
+        String target     = "wms";
+        String requestURL = getArtifactUrl(factory, artifact) + "/" + target;
+        Document request  = createOutRequestBody(
+            artifact, target, "", "text/xml", inputParameter);
+        try {
+            InputStream input = doPostRequest(requestURL, request);
+            Document result   = XMLUtils.readDocument(input);
+            this.check4ExceptionReport(result);
+            return result;
+        }
+        catch (IOException ioe) {
+            log.error(ioe, ioe);
+            throw new ArtifactDatabaseClientException(ioe);
+        }
+    }
+
+
     public Collection<ArtifactStatisticsSet> calculateStatistics(
-                                                                  ArtifactObject artifactFactory,
-                                                                  ArtifactObject currentArtifact)
-                                                                                                 throws ArtifactDatabaseClientException {
+        ArtifactObject artifactFactory,
+        ArtifactObject currentArtifact)
+    throws ArtifactDatabaseClientException
+    {
         log.debug("DefaultArtifactDatabaseClient.calculateStatistics");
         Collection<ArtifactStatisticsSet> resultValues = null;
-        
+
         try {
             String targetName = "statistics";
             String requestUrl = this.getArtifactUrl(artifactFactory,
                     currentArtifact) + "/" + targetName;
             Document requestBody = this.createOutRequestBody(currentArtifact,
-                    targetName, "text/xml", null);
+                    targetName, "", "text/xml", null);
             XMLUtils xmlUtils = new XMLUtils();
             InputStream is = this.doPostRequest(requestUrl, requestBody);
-            Document resultDocument = xmlUtils.readDocument(is);
+            Document resultDocument = XMLUtils.readDocument(is);
             if (resultDocument != null) {
-                
-                NodeList statisticSetNodes = xmlUtils.getNodeSetXPath(resultDocument,
-                                                  "/statistics/statistic");
+
+                NodeList statisticSetNodes = XMLUtils.getNodeSetXPath(resultDocument,
+                                                  "/art:statistics/art:statistic");
                 resultValues = new ArrayList<ArtifactStatisticsSet>
                                           (statisticSetNodes.getLength());
                 for (int i = 0; i < statisticSetNodes.getLength(); i++) {
                     Element statisticSetNode = (Element)statisticSetNodes.item(i);
                     String name = statisticSetNode.getAttribute("name");
-                    ArtifactStatisticsSet set = 
+                    ArtifactStatisticsSet set =
                                new DefaultArtifactStatisticsSet(name);
-                    NodeList resultNodes = xmlUtils.getNodeSetXPath(statisticSetNode,
-                            "statistic-value");
+                    NodeList resultNodes = XMLUtils.getNodeSetXPath(statisticSetNode,
+                            "art:statistic-value");
                     if (resultNodes != null) {
                         for (int j = 0; j < resultNodes.getLength(); j++) {
                             Element statisticNode = (Element)resultNodes.item(j);
@@ -743,4 +1043,92 @@
     public void setLocale(Locale locale) {
         this.locale = locale;
     }
+
+    public Locale getLocale() {
+        return locale;
+    }
+
+
+    public Collection<ArtifactObject> getArtifactFactoryMetaInformation(
+        Collection<MapService> mapServices,
+        String geometry,
+        String srs)
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException {
+        log.debug("DefaultArtifactDatabaseClient.getArtifactFactories");
+        Collection<ArtifactObject> resultValues = null;
+        try {
+            this.initialize();
+            Iterator<String> it = artifactDatabases.iterator();
+            Document requestBody = this.createMetaDataRequestBody(mapServices,
+                                                                  geometry,
+                                                                  srs);
+            while (it.hasNext()) {
+                String server = it.next();
+                String url = server + "/service/metadata/";
+                log.debug(url);
+
+                InputStream resultStream = this.doPostRequest(url, requestBody);
+                resultValues = this.parseMetaDataResult(resultStream, server,geometry);
+            }
+        } catch (IOException e) {
+            log.error(e,e);
+        }
+        return resultValues;
+    }
+
+    private Collection<ArtifactObject> parseMetaDataResult(
+        InputStream inputStream,
+        String      server,
+        String      geometry)
+    throws ArtifactDatabaseClientException, ArtifactDatabaseInputException {
+        XMLUtils xmlUtils = new XMLUtils();
+        Document document = XMLUtils.readDocument(inputStream);
+        this.check4ExceptionReport(document);
+        return this.getArtifactFactories(document, server,geometry);
+    }
+
+    private Document createMetaDataRequestBody(Collection<MapService> mapServices,
+                                               String geometry,
+                                               String srs){
+        log.debug("DefaultArtifactDatabaseClient.createMetaDataRequestBody");
+        Document document = XMLUtils.newDocument();
+        Node rootNode = this.createArtifactElement(document, "GetMetaData");
+        document.appendChild(rootNode);
+
+        if (geometry != null){
+            Element locationNode = this.createArtifactElement(document, "location");
+            locationNode.setAttribute("srs", srs);
+            locationNode.appendChild(document.createTextNode(geometry));
+            rootNode.appendChild(locationNode);
+        }
+        Element mapServicesNode = this.createArtifactElement(document,
+                                                             "mapservices");
+        Iterator<MapService> it = mapServices.iterator();
+        while (it.hasNext()){
+            MapService mapService = it.next();
+            Element mapServiceNode = this.createArtifactElement(document,
+                                                                "mapservice");
+            mapServiceNode.setAttribute("id", mapService.getID());
+            mapServiceNode.setAttribute("type", mapService.getType());
+            mapServiceNode.setAttribute("url", mapService.getURL());
+            if (mapService.getLayer() != null){
+                Iterator<Layer> layer = mapService.getLayer().iterator();
+                while (layer.hasNext()){
+                    Layer tmpLayer = layer.next();
+                    Element layerNode = this.createArtifactElement(document,
+                                                                   "layer");
+                    layerNode.setAttribute("id", tmpLayer.getID());
+                    layerNode.setAttribute("name", tmpLayer.getName());
+                    layerNode.setAttribute("isgrouplayer",
+                                           ""+tmpLayer.isGroupLayer());
+                    layerNode.setAttribute("parentid", tmpLayer.parentID());
+                    mapServiceNode.appendChild(layerNode);
+                }
+            }
+            mapServicesNode.appendChild(mapServiceNode);
+        }
+        rootNode.appendChild(mapServicesNode);
+        return document;
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseClientException.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseClientException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.client.exception;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * Exception used for general errors in the artifact server.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class ArtifactDatabaseClientException extends Exception {
 
@@ -23,7 +30,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param arg0
      */
     public ArtifactDatabaseClientException(String arg0) {
@@ -32,7 +39,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param arg0
      */
     public ArtifactDatabaseClientException(Throwable arg0) {
@@ -41,12 +48,12 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param arg0
      * @param arg1
      */
     public ArtifactDatabaseClientException(String arg0, Throwable arg1) {
         super(arg0, arg1);
     }
-
 }
+// 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/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/exception/ArtifactDatabaseInputException.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifactdatabase.client.exception;
+
+/**
+ * Exception used if an error occured caused by invalid input.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ArtifactDatabaseInputException extends Exception {
+
+    /**
+     * The UID of this Class
+     */
+    private static final long serialVersionUID = -8979622024425251952L;
+
+    /**
+     * Constructor
+     */
+    public ArtifactDatabaseInputException() {
+        super();
+    }
+
+    /**
+     * Constructor
+     *
+     * @param arg0
+     */
+    public ArtifactDatabaseInputException(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Constructor
+     *
+     * @param arg0
+     */
+    public ArtifactDatabaseInputException(Throwable arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Constructor
+     *
+     * @param arg0
+     * @param arg1
+     */
+    public ArtifactDatabaseInputException(String arg0, Throwable arg1) {
+        super(arg0, arg1);
+    }
+
+}
+// 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/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/exception/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Exceptions that are thrown if server side errors occur.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/client/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+The communication between this client and an artifact server is defined in the
+classes and interfaces of this package.
+</body>
+</html>
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/Artifact.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/Artifact.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 import java.util.Collection;
@@ -9,8 +14,10 @@
 import org.w3c.dom.Node;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * An <code>ArtifactObject</code> representing an artifact.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class Artifact implements ArtifactObject, ArtifactDescription {
 
@@ -19,150 +26,149 @@
      * The UID of this Class
      */
     private static final long serialVersionUID = 8606869493141810364L;
-    
+
+    /**
+     * The uuid of this Artifact which must be used to identify 
+     * the artifact at the <code>ArtifactDatabase</code>.
+     */
     private String id = null;
+
+    /**
+     * The hash of the artifact which was send be the <code>ArtifactDatabase</code>.
+     */
     private String hash = null;
+
+    /**
+     * Flag which marks if the Artifact is currently selected or not. 
+     */
     private boolean selected = false;
 
+    /**
+     * The XML-Node of the current User-Interface
+     */
     private Node currentUI = null;
+    
+    /**
+     * The XML-Nodes of the OutputModes.
+     */
     private Node currentOut = null;
 
+    /**
+     * The ids of the states which could be reached.
+     */
     private Collection<String> reachableStates;
+
+    /**
+     * The parameters whcih could be feed to the artifact at the current state.
+     */
     private Collection<String> inputParameter;
+
+    /**
+     * The <code>OutputModes</code> that could be reached at the current state.
+     */
     private Map<String, OutputMode> outputModes;
+
+    /**
+     * The id of the state which is currently used.
+     */
     private String currentState = null;
 
     /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getCurrentUI()
+     * Constructor
+     * @param uuid the uuid of this Artifact which must be used to identify 
+     *             the artifact at the <code>ArtifactDatabase</code>
+     * @param hash the hash of the artifact which was send be the 
+     *             <code>ArtifactDatabase</code>
      */
+    public Artifact(String uuid, String hash) {
+        this.id = uuid;
+        this.hash = hash;
+    }
+
     public Node getCurrentUI() {
         return currentUI;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setCurrentUI(org.w3c.dom.Node)
-     */
+
     public void setCurrentUI(Node currentUI) {
         this.currentUI = currentUI;
     }
 
-    /**
-     * @return the currentOut
-     */
+
     public Node getCurrentOut() {
         return currentOut;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setCurrentOut(org.w3c.dom.Node)
-     */
+
     public void setCurrentOut(Node currentOut) {
         this.currentOut = currentOut;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getReachableStates()
-     */
+
     public Collection<String> getReachableStates() {
         return reachableStates;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setReachableStates(java.util.Collection)
-     */
+
     public void setReachableStates(Collection<String> reachableStates) {
         this.reachableStates = reachableStates;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getCurrentState()
-     */
+
     public String getCurrentState() {
         return currentState;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setCurrentState(java.lang.String)
-     */
+
     public void setCurrentState(String currentState) {
         this.currentState = currentState;
     }
 
-    /**
-     * Constructor
-     */
-    public Artifact(String uuid, String hash) {
-
-        this.id = uuid;
-        this.hash = hash;
-    }
-
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getHash()
-     */
     public String getHash() {
         return this.hash;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getDescription()
-     */
+
     public String getDescription() {
         return this.id;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getId()
-     */
+
     public String getId() {
         return this.id;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getName()
-     */
+
     public String getName() {
         return this.id;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#isSelected()
-     */
+
     public boolean isSelected() {
         return this.selected;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#setSelected(boolean)
-     */
+
     public void setSelected(boolean selected) {
         this.selected = selected;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getInputParameter()
-     */
+
     public Collection<String> getInputParameter() {
         return this.inputParameter;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setInputParameter(java.util.Collection)
-     */
+
     public void setInputParameter(Collection<String> inputParameter) {
         this.inputParameter = inputParameter;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getOutputModes()
-     */
+
     public Map<String, OutputMode> getOutputModes() {
         return this.outputModes;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#getOutputModesAsCollection()
-     */
+
     public Collection<OutputMode> getOutputModesAsCollection() {
         if (this.outputModes != null) {
             return this.outputModes.values();
@@ -170,10 +176,9 @@
         return null;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactDescription#setOutputModes(java.util.Map)
-     */
+
     public void setOutputModes(Map<String, OutputMode> outputModes) {
         this.outputModes = outputModes;
     }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactDescription.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactDescription.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,82 +1,110 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 import java.io.Serializable;
+
 import java.util.Collection;
 import java.util.Map;
 
 import org.w3c.dom.Node;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This interface describes basic methods to describe the user interface of an
+ * artifact.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface ArtifactDescription extends Serializable {
 
     /**
+     * Retrieves the xml node of the current user interface.
+     *
      * @return the currentUI
      */
     public Node getCurrentUI();
 
     /**
-     * @param currentUI
-     *            the currentUI to set
+     * Set the xml node of the current user interface.
+     *
+     * @param currentUI the currentUI to set
      */
     public void setCurrentUI(Node currentUI);
 
     /**
-     * @param currentOut
-     *            the currentOut to set
+     * Set the xml node of the possible output modes.
+     *
+     * @param currentOut the currentOut to set
      */
     public void setCurrentOut(Node currentOut);
 
     /**
+     * Retrieves a collection of reachable states.
+     *
      * @return the reachableStates
      */
     public Collection<String> getReachableStates();
 
     /**
-     * @param reachableStates
-     *            the reachableStates to set
+     * Set the reachable states.
+     *
+     * @param reachableStates the reachableStates to set
      */
     public void setReachableStates(Collection<String> reachableStates);
 
     /**
+     * Retrieves the current state.
+     *
      * @return the currentState
      */
     public String getCurrentState();
 
     /**
-     * @param currentState
-     *            the currentState to set
+     * Set the current state.
+     *
+     * @param currentState the currentState to set
      */
     public void setCurrentState(String currentState);
 
     /**
+     * Get a collection of input parameters.
+     *
      * @return the reachableStates
      */
     public Collection<String> getInputParameter();
 
     /**
+     * Set a collection of input parameters.
+     *
      * @param inputParameter
      */
     public void setInputParameter(Collection<String> inputParameter);
 
     /**
-     * @return the reachableStates
+     * Retrieves a map of available output modes.
+     *
+     * @return the available output modes.
      */
     public Map<String, OutputMode> getOutputModes();
 
     /**
-     * @return the reachableStates
+     * Retrieves a collection of available output modes.
+     *
+     * @return the available output modes.
      */
     public Collection<OutputMode> getOutputModesAsCollection();
 
     /**
-     * @param outputParameter
+     * Set the available output modes.
+     *
+     * @param outputModes A map that contains output modes.
      */
     public void setOutputModes(Map<String, OutputMode> outputModes);
-
-}
\ No newline at end of file
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,21 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * Implementation of an <code>ArtifactObject> which represents an
+ * <code>ArtifactFactory</code>
+ * This Class provides the name, the description, the URL where the 
+ * the <code>ArtifactDatabase</code> the factory belongs to could be reached 
+ * and if the <code>ArtifacFactory</code> is currently selected or not.
+ *  
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class ArtifactFactory implements ArtifactObject {
 
@@ -14,15 +24,30 @@
      */
     private static final long serialVersionUID = 5453748230625831527L;
 
+    /**
+     * The name of the factory.
+     */
     private String name = null;
 
+    /**
+     * The description of the Factory.
+     */
     private String description = null;
 
+    /**
+     * Flag which mark the Artifactfactory as selected if value is true
+     * unselected if value is false.
+     */
     private boolean selected = false;
 
+    /**
+     * The URL where the Factory could be reached.
+     */
     private String dataBaseUrl = null;
 
     /**
+     * Returns the url of the artifact server.
+     *
      * @return the dataBaseUrl
      */
     public String getDataBaseUrl() {
@@ -31,59 +56,66 @@
 
     /**
      * Constructor
-     * 
-     * @param name
-     * @param description
-     * @param dataBaseUrl
+     * @param name the name of the factory
+     * @param description the description of the Factory
+     * @param dataBaseUrl the URL where the Factory could be reached.
      */
-    public ArtifactFactory(String name, String description, String dataBaseUrl) {
+    public ArtifactFactory(String name, 
+                           String description, 
+                           String dataBaseUrl) {
         super();
         this.name = name;
         this.description = description;
         this.dataBaseUrl = dataBaseUrl;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getId()
-     */
+
     public String getId() {
         return this.name;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#isSelected()
-     */
+
     public boolean isSelected() {
 
         return this.selected;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#setSelected(boolean)
-     */
+
     public void setSelected(boolean selected) {
         this.selected = selected;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getName()
-     */
+
     public String getName() {
         return name;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getDescription()
-     */
+
     public String getDescription() {
         return description;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactObject#getHash()
-     */
+
     public String getHash() {
         return null;
     }
 
+    /**
+     * Two ArtifactFactories are equal, if the name and the url to the artifact
+     * server are equal.
+     *
+     * @param obj
+     * @return true, if the factories are equal - otherwise false.
+     */
+    @Override
+    public boolean equals(Object obj) {
+        boolean returnValue = false;
+        if (obj instanceof ArtifactFactory){
+            ArtifactFactory af = (ArtifactFactory)obj;
+            returnValue = this.getName().equals(af.getName()) &&
+                          this.getDataBaseUrl().equals(af.getDataBaseUrl());
+        }
+        return returnValue;
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactObject.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactObject.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,26 +1,62 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 import java.io.Serializable;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The <code>ArtifactObject</code> provides some information about an artifact.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface ArtifactObject extends Serializable {
 
+    /**
+     * Retrieves the id of this object.
+     *
+     * @return the id.
+     */
     public String getId();
 
+    /**
+     * Retrieves information about the selection state of this object.
+     *
+     * @return true, if this object is selected - otherwise false.
+     */
     public boolean isSelected();
 
+    /**
+     * Set the selection of this object.
+     *
+     * @param selected the new selection.
+     */
     public void setSelected(boolean selected);
 
+    /**
+     * Retrieves the name of this object.
+     *
+     * @return the name.
+     */
     public String getName();
 
+    /**
+     * Retrieves the  description of the object.
+     *
+     * @return the description.
+     */
     public String getDescription();
 
+    /**
+     * Retrieves the hash value of this object.
+     *
+     * @return the hash value.
+     */
     public String getHash();
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticValue.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticValue.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,33 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 import java.io.Serializable;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This is the Interfacedefinition for Statistic values that belongs
+ * to an Artifact.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public interface ArtifactStatisticValue extends Serializable {
 
+    /**
+     * Returns the Key of the Object
+     * @return the Key of the Object
+     */
     String getKey();
 
+    /**
+     * Returns the stored Value
+     * @return the stored Value
+     */
     String getValue();
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticsSet.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ArtifactStatisticsSet.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,22 +1,43 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 import java.io.Serializable;
+
 import java.util.Collection;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * An inteface description for a container storing statistics.
  *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface ArtifactStatisticsSet extends Serializable {
-    
-    
+
+    /**
+     * Retrieves the name of this container.
+     *
+     * @return the name.
+     */
     String getName();
-    
+
+    /**
+     * Retrieves the statistics as collection.
+     *
+     * @return the statistics.
+     */
     Collection<ArtifactStatisticValue> getStatisticValues();
-    
+
+    /**
+     * Add a new statistic to this container.
+     *
+     * @param value A statistic.
+     */
     void addStatisticValues(ArtifactStatisticValue value);
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticValue.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticValue.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,17 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The Defaultimplementation of <code>ArtifactStatisticValue</code>
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class DefaultArtifactStatisticValue implements ArtifactStatisticValue {
 
@@ -14,10 +20,21 @@
      */
     private static final long serialVersionUID = -8409111023127835398L;
 
+    /**
+     * The key of the new Value.
+     */
     private String key = null;
 
+    /**
+     * The value of the Object.
+     */
     private String value = null;
 
+    /**
+     * Constructor
+     * @param key the key of the new Value
+     * @param value the value of the Object.
+     */
     public DefaultArtifactStatisticValue(String key, String value) {
         super();
         this.key = key;
@@ -31,5 +48,4 @@
     public String getValue() {
         return this.value;
     }
-
 }
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticsSet.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultArtifactStatisticsSet.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,13 +1,20 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * The default implementation of <code>ArtifactStatisticsSet</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  *
  */
 public class DefaultArtifactStatisticsSet implements ArtifactStatisticsSet{
@@ -17,36 +24,37 @@
      */
     private static final long serialVersionUID = 6738878381515708602L;
 
+    /**
+     * The name of the StatisticsSet.
+     */
     private String name = null;
-    
-    private Collection<ArtifactStatisticValue> statisticValues = 
+
+    /**
+     * The statisticsvalues which belong to this set.
+     */
+    private Collection<ArtifactStatisticValue> statisticValues =
                                        new ArrayList<ArtifactStatisticValue>();
     /**
      * Constructor
+     * @param name the name of the StatisticsSet
      */
     public DefaultArtifactStatisticsSet(String name) {
         this.name = name;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet#addStatisticValues(de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticValue)
-     */
+
     public void addStatisticValues(ArtifactStatisticValue value) {
         this.statisticValues.add(value);
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet#getName()
-     */
+
     public String getName() {
         return this.name;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet#getStatisticValues()
-     */
+
     public Collection<ArtifactStatisticValue> getStatisticValues() {
         return this.statisticValues;
     }
-
 }
+// 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/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultExportMode.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifactdatabase.objects;
+
+/**
+ * This is the default implementation of <code>ExportMode</code> which stores
+ * information about a specific output target (e.g. pdf, svg, image).
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class DefaultExportMode
+implements   ExportMode
+{
+    /**
+     * The name of this parameter.
+     */
+    protected String name;
+
+    /**
+     * The description of this mode.
+     */
+    protected String description;
+
+    /**
+     * The mimetype used for this mode.
+     */
+    protected String mimeType;
+
+    /**
+     * Creates a new <code>ExportMode</code>.
+     *
+     * @param name The name of the mode.
+     * @param description A description of this mode.
+     * @param mimeType The mimetype used for this mode.
+     */
+    public DefaultExportMode(String name, String description, String mimeType){
+        this.name        = name;
+        this.description = description;
+        this.mimeType    = mimeType;
+    }
+
+
+    public String getName() {
+        return name;
+    }
+
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getMimeType() {
+        return mimeType;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultInputParameter.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultInputParameter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The default implementation of <code>InputParameter</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class DefaultInputParameter implements InputParameter {
 
@@ -14,15 +21,20 @@
      */
     private static final long serialVersionUID = 6597439837482244211L;
 
+    /**
+     * The name of this parameter.
+     */
     private String name = null;
 
+    /**
+     * The values of this parameter.
+     */
     private String[] values = null;
 
     /**
      * Constructor
-     * 
-     * @param name
-     * @param values
+     * @param name The name of this parameter.
+     * @param values The values of this parameter.
      */
     public DefaultInputParameter(String name, String[] values) {
         super();
@@ -30,18 +42,12 @@
         this.values = values;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.InputParameter#getName()
-     */
     public String getName() {
         return this.name;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.InputParameter#getValues()
-     */
     public String[] getValues() {
         return this.values;
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputMode.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,13 +1,20 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 import java.util.Collection;
+import java.util.Map;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The default implementation of an <code>OutputMode</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class DefaultOutputMode implements OutputMode {
 
@@ -16,39 +23,60 @@
      */
     private static final long serialVersionUID = 7487880486604174521L;
 
+    /**
+     * The name of the OutputMode
+     */
     private String name = null;
 
+    /**
+     * The mimetype of the OutputMode
+     */
     private String mimeType = null;
 
+    /**
+     * The parameters that could be used for this OutputMode
+     */
     private Collection<OutputParameter> outputParameter = null;
 
-    public DefaultOutputMode(String name, String mimeType,
-                             Collection<OutputParameter> outputParameter) {
+    /**
+     * The exports that can be called using this outputMode
+     */
+    private Map<String, ExportMode> exports;
+
+    /**
+     * Constructor
+     * @param name The name of the OutputMode
+     * @param mimeType The mimetype of the OutputMode
+     * @param outputParameter The parameters that could be used for this OutputMode
+     * @param exports The exports that can be called using this outputMode
+     */
+    public DefaultOutputMode(
+        String name,
+        String mimeType,
+        Collection<OutputParameter> outputParameter,
+        Map<String, ExportMode> exports)
+    {
         super();
-        this.name = name;
-        this.mimeType = mimeType;
+        this.name            = name;
+        this.mimeType        = mimeType;
         this.outputParameter = outputParameter;
+        this.exports         = exports;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.OutputMode#getMimeType()
-     */
     public String getMimeType() {
         return this.mimeType;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.OutputMode#getName()
-     */
     public String getName() {
         return this.name;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.OutputMode#getOutputParameters()
-     */
     public Collection<OutputParameter> getOutputParameters() {
         return this.outputParameter;
     }
 
+    public ExportMode getExportMode(String mode) {
+        return exports.get(mode);
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputParameter.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/DefaultOutputParameter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,17 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * The default implementation of <code>OutputParameter</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class DefaultOutputParameter implements OutputParameter {
 
@@ -14,20 +20,33 @@
      */
     private static final long serialVersionUID = -8416057640116638152L;
 
+    /**
+     * The name of the parameter
+     */
     private String name = null;
 
+    /**
+     * The value of the parameter
+     */
     private String value = null;
 
+    /**
+     * The description of the parameter
+     */
     private String description = null;
 
+    /**
+     * The type of the parameter
+     */
     private String type = null;
 
     /**
      * Constructor
-     * 
-     * @param name
-     * @param value
-     * @param description
+     *
+     * @param name The name of the parameter
+     * @param value The value of the parameter
+     * @param description The description of the parameter
+     * @param type The type of the parameter
      */
     public DefaultOutputParameter(String name, String value,
                                   String description, String type) {
@@ -38,16 +57,10 @@
         this.type = type;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.OutputParameter#getName()
-     */
     public String getName() {
         return this.name;
     }
 
-    /**
-     * @see de.intevation.gnv.artifactdatabase.objects.OutputParameter#getValue()
-     */
     public String getValue() {
         return this.value;
     }
@@ -59,5 +72,5 @@
     public String getType() {
         return this.type;
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ExportMode.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifactdatabase.objects;
+
+import java.io.Serializable;
+
+/**
+ * An <code>ExportMode</code> describes a specific format of an output mode
+ * (e.g. pdf, svg, image).
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public interface ExportMode
+extends          Serializable
+{
+    /**
+     * Returns the name of this export mode.
+     *
+     * @return the name.
+     */
+    public String getName();
+
+    /**
+     * Returns the description of this export mode.
+     *
+     * @return the description.
+     */
+    public String getDescription();
+
+    /**
+     * Returns the mimetype used for this export mode.
+     *
+     * @return the mimetype.
+     */
+    public String getMimeType();
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/InputParameter.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/InputParameter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,18 +1,35 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 import java.io.Serializable;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * <code>InputParameter</code> objects are used to store multiple values for a
+ * single key.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface InputParameter extends Serializable {
 
+    /**
+     * Returns the name of the input parameter.
+     *
+     * @return the name.
+     */
     public String getName();
 
+    /**
+     * Returns the values of this input parameter as array.
+     *
+     * @return the values as array.
+     */
     public String[] getValues();
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputMode.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputMode.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,21 +1,54 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 import java.io.Serializable;
+
 import java.util.Collection;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * <code>OutputMode</code> objects give information possible types of exports
+ * for an artifact (e.g. chart, histogram, csv, odv, statistic).
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public interface OutputMode extends Serializable{
 
+    /**
+     * Retrieve the name of an output mode.
+     *
+     * @return the name.
+     */
     public String getName();
 
+    /**
+     * Retrieve the mimetype of an output mode.
+     *
+     * @return the mimetype.
+     */
     public String getMimeType();
 
+    /**
+     * Retrieve the output parameters available to adjust the output.
+     *
+     * @return the output parameters.
+     */
     public Collection<OutputParameter> getOutputParameters();
 
+    /**
+     * Retrieve possible export modes which describe specific output modes
+     * (e.g. pdf, svg, image).
+     *
+     * @param mode The export mode's name.
+     * @return the export mode.
+     */
+    public ExportMode getExportMode(String mode);
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputParameter.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/OutputParameter.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,22 +1,49 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.objects;
 
 import java.io.Serializable;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * An <code>OutputParameter</code> describes the input for an export mode and
+ * stores the value inserted by the user.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface OutputParameter extends Serializable{
 
+    /**
+     * Retrieves the name of the parameter.
+     *
+     * @return the name.
+     */
     String getName();
 
+    /**
+     * Retrieves the value of this parameters.
+     *
+     * @return the value.
+     */
     String getValue();
 
+    /**
+     * Retrieves the description of this parameter.
+     *
+     * @return the description.
+     */
     String getDescription();
 
+    /**
+     * Retrieves the type of this parameter (e.g. String, Integer, Double, Date).
+     *
+     * @return the type.
+     */
     String getType();
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifactdatabase.objects;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This Class is an Extention of the Class ArtifactFactory.
+ * Its only job is to store optional Parameters that might be
+ * used to instantiate a new Artifact.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class ParametrizedArtifactFactory
+extends ArtifactFactory implements ParametrizedArtifactObject {
+
+    /**
+     * The UID of this Class
+     */
+    private static final long serialVersionUID = 4516368434861819032L;
+
+    /**
+     * The Parameters that belongs to the Artifactfactory and might be used
+     * during the Initializationprocess of an Artifact.
+     */
+    private Map<String, Collection<String>> parameters = null;
+
+    /**
+     * Constructor
+     * @param name the name of the factory
+     * @param description the description of the Factory
+     * @param dataBaseUrl the URL where the Factory could be reached.
+     */
+    public ParametrizedArtifactFactory(String name, String description,
+                                       String dataBaseUrl) {
+        super(name, description, dataBaseUrl);
+        this.parameters = new HashMap<String, Collection<String>>();
+    }
+
+    public Map<String, Collection<String>> getParameters() {
+        return parameters;
+    }
+
+    public void addParameters(String key, Collection<String> values) {
+        this.parameters.put(key, values);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/ParametrizedArtifactObject.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifactdatabase.objects;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * Interface which extends the funtionality of the Interface
+ * <code>ArtifactObject</code> with methods for storing and retrieving
+ * optional Parameters.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public interface ParametrizedArtifactObject extends ArtifactObject {
+
+    /**
+     * Returns the Parameters which could be used to manage (e.g. create) an
+     * ArtifactObject.
+     * @return a map storing parameters.
+     */
+    Map<String, Collection<String>> getParameters();
+
+    /**
+     * Add a further parameter to the parameter map.
+     *
+     * @param key the Key of the Parameter (unique)
+     * @param values the Values of the Parameter
+     */
+    void addParameters(String key, Collection<String> values);
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultLayer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifactdatabase.objects.map;
+
+/**
+ * The default implementation of <code>Layer</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class DefaultLayer implements Layer {
+
+
+    /**
+     * The id of this layer.
+     */
+    private String id = null;
+
+    /**
+     * The name of this layer.
+     */
+    private String name = null;
+
+    /**
+     * Flag which defines if this layer is an grouplayer.
+     */
+    private boolean groupLayer = false;
+
+    /**
+     * The id of the parent layer or null if this layer is an rootlayer.
+     */
+    private String parentId = null;
+
+    /**
+     * Constructor
+     * 
+     * @param id the id of this layer
+     * @param name the name of this layer
+     * @param groupLayer flag which defines if this layer is an grouplayer
+     * @param parentId the id of the parent layer or null if this layer is an 
+     *                 rootlayer
+     */
+    public DefaultLayer(String id,String name,
+                        boolean groupLayer,String parentId) {
+        this.id = id;
+        this.name = name;
+        this.groupLayer = groupLayer;
+        this.parentId = parentId;
+    }
+
+
+    public String getID() {
+        return this.id;
+    }
+
+
+    public String getName() {
+        return this.name;
+    }
+
+
+    public boolean isGroupLayer() {
+        return this.groupLayer;
+    }
+
+
+    public String parentID() {
+        return this.parentId;
+    }
+
+    @Override
+    public String toString() {
+        return "ID: "+ this.id + " Name: "+this.name+
+               " IsGroupLayer: "+this.groupLayer+
+               " ParentID: "+this.parentId;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/DefaultMapService.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifactdatabase.objects.map;
+
+import java.util.Collection;
+
+/**
+ * The default implementation of <code>MapService</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class DefaultMapService implements MapService {
+
+    /**
+     * The id of this mapservice.
+     */
+    private String id = null;
+
+    /**
+     * The layer which are provided by this mapservice.
+     */
+    private Collection<Layer> layer = null;
+
+    /**
+     * The type of this mapservice.
+     */
+    private String type = null;
+
+    /**
+     * The URl of this mapservice.
+     */
+    private String url = null;
+    
+    /**
+     * The Bbox which surrounds the data of the Mapservice
+     */
+    private String bbox = null;
+    
+    /**
+     * The time until the server will provide the data.
+     */
+    private String ttl = null;
+
+    /**
+     * Constructor
+     * 
+     * @param id  the id of this mapservice
+     * @param layer the layer which are provided by this mapservice
+     * @param type the type of this mapservice
+     * @param url the URl of this mapservice
+     */
+    public DefaultMapService(String id, Collection<Layer> layer,
+                             String type, String url) {
+        super();
+        this.id = id;
+        this.layer = layer;
+        this.type = type;
+        this.url = url;
+    }
+    
+    /**
+     * Constructor
+     * 
+     * @param id  the id of this mapservice
+     * @param layer the layer which are provided by this mapservice
+     * @param type the type of this mapservice
+     * @param url the URl of this mapservice
+     * @param bbox the Bbox which surrounds the data of the Mapservice
+     * @param ttl the time until the server will provide the data.
+     */
+    public DefaultMapService(String id, Collection<Layer> layer,
+                             String type, String url, String bbox, String ttl) {
+        this(id,layer,type,url);
+        this.bbox = bbox;
+        this.ttl = ttl;
+    }
+
+
+    public String getID() {
+        return this.id;
+    }
+
+
+    public Collection<Layer> getLayer() {
+        return this.layer;
+    }
+
+
+    public String getType() {
+        return this.type;
+    }
+
+
+    public String getURL() {
+        return this.url;
+    }
+    
+    public String getBBoxValue() {
+        return this.bbox;
+    }
+    public String getTtl() {
+        return this.ttl;
+}
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/Layer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifactdatabase.objects.map;
+
+/**
+ * This interface defines some basic methods providing information about a map
+ * layer.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public interface Layer {
+
+    /**
+     * Retrieves the name of a layer.
+     *
+     * @return the name of a layer.
+     */
+    String getName();
+
+    /**
+     * Retrieves the id of a layer.
+     *
+     * @return the id of a layer.
+     */
+    String getID();
+
+    /**
+     * Retrieves true, if this layer is a group layer - otherwise false.
+     *
+     * @return true, if this layer is a group layer - otherwise false.
+     */
+    boolean isGroupLayer();
+
+    /**
+     * Retrieves the id of the parent layer.
+     *
+     * @return the id of the parent layer.
+     */
+    String parentID();
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/MapService.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.artifactdatabase.objects.map;
+
+import java.util.Collection;
+
+/**
+ * This interface defines some basic methods to provide information about a map
+ * service.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public interface MapService {
+
+    /**
+     * Retrieves the id of a map service.
+     *
+     * @return the id of a map service.
+     */
+    String getID();
+
+
+    /**
+     * Retrieves the URL of a map service.
+     *
+     * @return the URL of a map service.
+     */
+    String getURL();
+
+
+    /**
+     * Retrieves the type of a map service.
+     *
+     * @return the type of a map service.
+     */
+    String getType();
+
+    /**
+     * Retrieves the layers served by a map service.
+     *
+     * @return the layers served by a map service.
+     */
+    Collection<Layer> getLayer();
+    
+    /**
+     * Retrieves the bboxvalue served by a map service.
+     * @return the bboxvalue
+     */
+    String getBBoxValue ();
+    
+    /**
+     * Returns the Time until the Service will provide the Data.
+     * @return the Time until the Service will provide the Data.
+     */
+    String getTtl();
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/map/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Objects used to store information about map services and provided layers.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/objects/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Objects used to represent an artifact in this client.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/artifactdatabase/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package and it's subpackages provides the required infrastructure to
+communicate with the <code>ArtifactDatabase</code>.
+</body>
+</html>
--- a/gnv/src/main/java/de/intevation/gnv/propertiesreader/MapPropertiesReader.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/propertiesreader/MapPropertiesReader.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.propertiesreader;
 
 import java.util.Map;
@@ -8,29 +13,31 @@
 import org.apache.log4j.Logger;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * A <code>PropertiesReader</code> storing properties in a <code>Map</code>.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class MapPropertiesReader implements PropertiesReader {
-    /**
-     * the logger, used to log exceptions and additonaly information
-     */
+
     private static Logger log = Logger.getLogger(MapPropertiesReader.class);
 
+    /**
+     * The properties which are served by this <code>PropertiesReader</code>.
+     */
     private Map<String, String> properties = null;
 
     /**
-     * Constructor
+     * Constructs a new MapPropertiesReader with an initial map.
+     * 
+     * @param properties the properties which should be served by this 
+     *                   <code>PropertiesReader</code>.
      */
     public MapPropertiesReader(Map<String, String> properties) {
         super();
         this.properties = properties;
     }
 
-    /**
-     * @see de.intevation.gnv.propertiesreader.PropertiesReader#getPropertieValue(java.lang.String,
-     *      java.lang.String)
-     */
     public String getPropertieValue(String key, String defaultValue) {
         String value = this.properties.get(key);
         if (value == null) {
@@ -38,5 +45,5 @@
         }
         return value;
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/propertiesreader/PropertiesReader.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/propertiesreader/PropertiesReader.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,14 +1,29 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.propertiesreader;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * An interface that defines a single method to retrieve properties specified by
+ * a key.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public interface PropertiesReader {
 
+    /**
+     * Retrieves a property by the given <i>ke<</i>.
+     *
+     * @param key The key of a property.
+     * @param defaultValue The default value which is returned if no property
+     * is found by <i>key</i>.
+     * @return the value of a property.
+     */
     public String getPropertieValue(String key, String defaultValue);
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/propertiesreader/PropertiesReaderFactory.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/propertiesreader/PropertiesReaderFactory.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.propertiesreader;
 
 import java.util.Map;
@@ -10,8 +15,8 @@
 import org.apache.log4j.Logger;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class PropertiesReaderFactory {
 
@@ -39,7 +44,7 @@
 
     /**
      * This Method provides an singleton Instance of this Class.
-     * 
+     *
      * @return an singleton Instance of this Class
      */
     public static PropertiesReaderFactory getInstance() {
@@ -51,7 +56,7 @@
 
     /**
      * Getting the ConnectionPool
-     * 
+     *
      * @return the ConnectionPool
      */
     public PropertiesReader getPropertiesReader() {
@@ -60,9 +65,8 @@
 
     /**
      * Getting the ConnectionPool
-     * 
-     * @param config
-     *            The Config that should be read
+     *
+     * @param config The Config that should be read
      */
     public void initPropertiesReader(Object config) {
         if (config instanceof ServletConfig) {
@@ -77,5 +81,5 @@
         }
 
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/gnv/src/main/java/de/intevation/gnv/propertiesreader/ServletPropertiesReader.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/propertiesreader/ServletPropertiesReader.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,11 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.propertiesreader;
 
 import java.util.Enumeration;
@@ -12,8 +17,13 @@
 import org.apache.log4j.Logger;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
+ * This reader fetches the properties it will provide from the 
+ * <code>ServletConfig</code> of an <code>Context</code>.
+ * It will read the InitParameters which could be configured using
+ * the <code>web.xml</code-file of each <code>context</code>.
  * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class ServletPropertiesReader implements PropertiesReader {
 
@@ -22,10 +32,16 @@
      */
     private static Logger log = Logger.getLogger(ServletPropertiesReader.class);
 
+    /**
+     * The properties which are read from the <code>ServletConfig</code>.
+     */
     private Map<String, String> properties = null;
 
     /**
      * Constructor
+     * 
+     * @param config the <code>ServletConfig</code> where 
+     *               the properties should be read from.
      */
     public ServletPropertiesReader(ServletConfig config) {
         super();
@@ -43,10 +59,7 @@
         }
     }
 
-    /**
-     * @see de.intevation.gnv.propertiesreader.PropertiesReader#getPropertieValue(java.lang.String,
-     *      java.lang.String)
-     */
+
     public String getPropertieValue(String key, String defaultValue) {
         String value = this.properties.get(key);
         if (value == null) {
@@ -54,5 +67,5 @@
         }
         return value;
     }
-
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/propertiesreader/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package provides reader and factories which will provide properties which
+are configured in different files (e.g. web.xml) in the whole system.
+</body>
+</html>
--- a/gnv/src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/servlet/GNVActionServlet.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,55 +1,63 @@
-/*
- * 
- */
-package de.intevation.gnv.servlet;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-
-import org.apache.log4j.Logger;
-import org.apache.log4j.PropertyConfigurator;
-import org.apache.struts.action.ActionServlet;
-
-import de.intevation.gnv.propertiesreader.PropertiesReaderFactory;
-
-/**
- * 
- * @author Tim Englich <tim.englich@intevation.de>
- * 
- */
-public class GNVActionServlet extends ActionServlet {
-    /**
-     * the logger, used to log exceptions and additonaly information
-     */
-    private static Logger log = null;
-
-    static {
-        // BasicConfigurator.configure();
-
-    }
-
-    static String LOGGINIG_CONFIG_FILE_ID = "de.intevation.gnv.servlet.log4j.configuration";
-
-    /**
-     * The UID of this Class
-     */
-    private static final long serialVersionUID = 3597396283436383943L;
-
-    /**
-     * @see javax.servlet.GenericServlet#init(javax.servlet.ServletConfig)
-     */
-    @Override
-    public void init(ServletConfig config) throws ServletException {
-        super.init(config);
-        try {
-            String path = config.getServletContext().getRealPath("/")
-                          + config.getInitParameter(LOGGINIG_CONFIG_FILE_ID);
-            PropertyConfigurator.configure(path);
-            log = Logger.getLogger(GNVActionServlet.class);
-        } catch (Exception e) {
-            log.error(e, e);
-        }
-        log.info("PropertiesReader will be configured.");
-        PropertiesReaderFactory.getInstance().initPropertiesReader(config);
-    }
-}
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.servlet;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+import org.apache.struts.action.ActionServlet;
+
+import de.intevation.gnv.propertiesreader.PropertiesReaderFactory;
+
+/**
+ * The GNV ActionServlet.
+ * This Servelt will be used to handle all requests which are
+ * send to the GNV-WebClient.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ */
+public class GNVActionServlet extends ActionServlet {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = null;
+
+    /**
+     * The id which must be used to lookup the path to the 
+     * <code>log4j.properties</code> file which is configured 
+     * in the <code>web.xml</code>
+     */
+    private final static String LOGGINIG_CONFIG_FILE_ID = "de.intevation.gnv." +
+                                                  "servlet.log4j.configuration";
+
+    /**
+     * The UID of this class.
+     */
+    private static final long serialVersionUID = 3597396283436383943L;
+
+
+    @Override
+    public void init(ServletConfig config) throws ServletException {
+        super.init(config);
+        try {
+            String path = config.getServletContext().getRealPath("/")
+                          + config.getInitParameter(LOGGINIG_CONFIG_FILE_ID);
+            PropertyConfigurator.configure(path);
+            log = Logger.getLogger(GNVActionServlet.class);
+        } catch (Exception e) {
+            log.error(e, e);
+        }
+        log.info("PropertiesReader will be configured.");
+        PropertiesReaderFactory.getInstance().initPropertiesReader(config);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/servlet/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,9 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+This package provides the <code>Servlet</code> which will be used to handle 
+all requests which are send to the GNV-WebClient.
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/util/ArtifactNamespaceContext.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.util;
+
+import java.util.Iterator;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+
+/**
+ * The namespacecontext object used in xml documents retrieved by the artifact
+ * server.
+ *
+ * @author <a href="mailto:sascha.teichmann@intevation">Sascha L. Teichmann</a>
+ */
+public class ArtifactNamespaceContext
+implements   NamespaceContext
+{
+    /**
+     * The URI of the namespace of the artifacts.
+     */
+    public final static String NAMESPACE_URI = "http://www.intevation.de/2009/artifacts";
+
+    /**
+     * The XML prefix for the artifacts namespace.
+     */
+    public final static String NAMESPACE_PREFIX = "art";
+
+    /**
+     * The singleton instance of this <code>NamespaceContext</code>
+     */
+    public static final ArtifactNamespaceContext INSTANCE =
+        new ArtifactNamespaceContext();
+
+    /**
+     * Constructor
+     */
+    public ArtifactNamespaceContext() {
+    }
+
+    public String getNamespaceURI(String prefix) {
+
+        if (prefix == null) {
+            throw new NullPointerException("Null prefix");
+        }
+
+        if (NAMESPACE_PREFIX.equals(prefix)) {
+            return NAMESPACE_URI;
+        }
+
+        if ("xml".equals(prefix)) {
+            return XMLConstants.XML_NS_URI;
+        }
+
+        return XMLConstants.NULL_NS_URI;
+    }
+
+    public String getPrefix(String uri) {
+        throw new UnsupportedOperationException();
+    }
+
+    public Iterator getPrefixes(String uri) {
+        throw new UnsupportedOperationException();
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/util/CaptureInputStream.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.util;
+
+import java.io.FilterInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+
+/**
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha Teichmann</a>
+ */
+public class CaptureInputStream
+extends      FilterInputStream
+{
+    protected ByteArrayOutputStream copy;
+
+    public CaptureInputStream(InputStream in) {
+        super(in);
+        copy = new ByteArrayOutputStream(10*1024);
+    }
+
+    public int read() throws IOException {
+        int x = in.read();
+        if (x != -1) {
+            copy.write(x);
+        }
+        return x;
+    }
+
+    public int read(byte [] b, int off, int len) throws IOException {
+        int r = in.read(b, off, len);
+        if (r > 0) {
+            copy.write(b, off, r);
+        }
+        return r;
+    }
+
+    public long skip(long n) throws IOException {
+        long m = in.skip(n);
+        for (long i = m; i > 0L; --i) { // simulate gab
+            copy.write(0);
+        }
+        return m;
+    }
+
+    public String copyToString() {
+        return copy.toString();
+    }
+
+    public String copyToString(String charsetName)
+    throws UnsupportedEncodingException
+    {
+        return copy.toString(charsetName);
+    }
+
+    public byte [] toByteArray() {
+        return copy.toByteArray();
+    }
+
+    public void clear() {
+        copy.reset();
+    }
+}
--- a/gnv/src/main/java/de/intevation/gnv/util/XMLUtils.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/util/XMLUtils.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,7 +1,16 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
 package de.intevation.gnv.util;
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
 import java.io.StringBufferInputStream;
 import java.io.StringWriter;
 
@@ -31,31 +40,75 @@
 import org.xml.sax.SAXException;
 
 /**
- * @author Sascha L. Teichmann
+ * This class provides many helper-Methods for handling different kinds of 
+ * XML-stuff.
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
  */
 public class XMLUtils {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
     private static Logger logger = Logger.getLogger(XMLUtils.class);
 
+    /**
+     * Constructor
+     */
     public XMLUtils() {
     }
 
+    /**
+     * Class which could be used to create XML-Elements
+     * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a>
+     *
+     */
     public static class ElementCreator {
+
+        /**
+         * The document the elements should be placed in.
+         */
         protected Document document;
+
+        /**
+         * The namespace that should be used.
+         */
         protected String ns;
+
+        /**
+         * The prefix of the namespace that should be used.
+         */
         protected String prefix;
 
+        /**
+         * Constructor
+         * @param document the document the elements should be placed in
+         * @param ns the namespace that should be used
+         * @param prefix the prefix of the namespace that should be used
+         */
         public ElementCreator(Document document, String ns, String prefix) {
             this.document = document;
             this.ns = ns;
             this.prefix = prefix;
         }
 
+        /**
+         * Creates a new element using the given name.
+         * @param name the name of the new element.
+         * @return the new element
+         */
         public Element create(String name) {
             Element element = document.createElementNS(ns, name);
             element.setPrefix(prefix);
             return element;
         }
 
+        /**
+         * Adds a new attribute to the given element. 
+         * @param element the element where the attribute should be placed in.
+         * @param name the name of the attribute
+         * @param value the value of the attribute
+         */
         public void addAttr(Element element, String name, String value) {
             Attr attr = document.createAttributeNS(ns, name);
             attr.setValue(value);
@@ -64,7 +117,11 @@
         }
     } // class ElementCreator
 
-    public Document newDocument() {
+    /**
+     * Creates a new document.
+     * @return the new document
+     */
+    public static Document newDocument() {
         try {
             return DocumentBuilderFactory.newInstance().newDocumentBuilder()
                     .newDocument();
@@ -74,11 +131,20 @@
         return null;
     }
 
-    public XPath newXPath() {
+    /**
+     * Creates a new <code>XPath</code>-expression
+     * @return the new <code>XPath</code>-expression
+     */
+    public static XPath newXPath() {
         return newXPath(null);
     }
 
-    public XPath newXPath(NamespaceContext namespaceContext) {
+    /**
+     * Creates a new <code>XPath</code>-expression
+     * @param namespaceContext the namespacecontext that should be used.
+     * @return the new <code>XPath</code>-expression
+     */
+    public static XPath newXPath(NamespaceContext namespaceContext) {
         XPathFactory factory = XPathFactory.newInstance();
         XPath xpath = factory.newXPath();
         if (namespaceContext != null) {
@@ -87,65 +153,133 @@
         return xpath;
     }
 
-    public Object xpath(Object root, String query, QName returnTyp) {
-        return xpath(root, query, returnTyp, null);
-    }
-
-    public final String xpathString(Object root, String query,
+    /**
+     * Fetch the value of an element or attribute from the given resource 
+     * using the query.
+     * @param root the source where the value should be fetch from
+     * @param query the query that should be used to fetch the value
+     * @param namespaceContext the namespacecontext that must match to
+     *                         fetch the value.
+     * @return the value
+     */
+    public static final String xpathString(Object root, String query,
                                     NamespaceContext namespaceContext) {
         return (String) xpath(root, query, XPathConstants.STRING,
                 namespaceContext);
     }
 
+    /**
+     * Fetch the object rom the given resource  using the query.
+     * @param root the source where the value should be fetch from
+     * @param query the query that should be used to fetch the object
+     * @param returnType the Type that must be used to return the object,
+     * @param namespaceContext the namespacecontext that must match to
+     *                         fetch the object.
+     * @return the value
+     */
     public static final Object xpath(Object root, String query,
                                      QName returnType,
                                      NamespaceContext namespaceContext) {
         if (root == null) {
             return null;
         }
-
         try {
-            XPath xpath = new XMLUtils().newXPath(namespaceContext);
+            XPath xpath = XMLUtils.newXPath(namespaceContext);
             if (xpath != null) {
                 return xpath.evaluate(query, root, returnType);
             }
         } catch (XPathExpressionException xpee) {
             logger.error(xpee.getLocalizedMessage(), xpee);
         }
-
         return null;
     }
 
-    public Object getXPath(Object root, String query, QName returnType) {
-        return xpath(root, query, returnType);
+    /**
+     * Fetch the object rom the given resource  using the query
+     * and the default <code>ArtifactNamespaceContext</code>
+     * @param root the source where the value should be fetch from
+     * @param query the query that should be used to fetch the object
+     * @param returnType the Type that must be used to return the object
+     * @return the value
+     */
+    public static Object getXPath(Object root, String query, QName returnType) {
+        return getXPath(root,query,returnType,ArtifactNamespaceContext.INSTANCE);
     }
 
-    public String getStringXPath(String xpath) {
-        return getStringXPath(xpath, null);
+    /**
+     * Fetch the object rom the given resource  using the query
+     * and the default <code>ArtifactNamespaceContext</code>
+     * @param root the source where the value should be fetch from
+     * @param query the query that should be used to fetch the object
+     * @param returnType the Type that must be used to return the object.
+     * @param context the namespacecontext that must match to
+     *                         fetch the object.
+     * @return the value
+     */
+    public static Object getXPath(
+        Object root, String query, QName returnType, NamespaceContext context
+    ) {
+        return xpath(root, query, returnType, context);
     }
 
-    public NodeList getNodeSetXPath(Object root, String query) {
+    /**
+     * Fetch a Nodeset value from a XML-Fragment or XML-Document using the 
+     * given query.
+     * @param root the source where the String should be fetched from
+     * @param query the query that should be used,
+     * @return the Nodeset fetched from the source
+     */
+    public static NodeList getNodeSetXPath(Object root, String query) {
         return (NodeList) getXPath(root, query, XPathConstants.NODESET);
     }
 
-    public Node getNodeXPath(Object root, String query) {
+    /**
+     * Fetch a Node from a XML-Fragment or XML-Document using the 
+     * given query.
+     * @param root the source where the Node should be fetched from
+     * @param query the query that should be used,
+     * @return the Node fetched from the source
+     */
+    public static Node getNodeXPath(Object root, String query) {
         return (Node) getXPath(root, query, XPathConstants.NODE);
     }
 
-    public String getStringXPath(Object root, String xpath) {
+    /**
+     * Fetch a String value from a XML-Fragment or XML-Document using the 
+     * given query.
+     * @param root the source where the String should be fetched from
+     * @param xpath the query that should be used,
+     * @return the String fetched from the source
+     */
+    public static String getStringXPath(Object root, String xpath) {
         return getStringXPath(root, xpath, null);
     }
 
-    public String getStringXPath(Object root, String query, String def) {
+    /**
+     * Fetch a String value from a XML-Fragment or XML-Document using the 
+     * given query.
+     * @param root the source where the String should be fetched from
+     * @param query the query that should be used,
+     * @param def the default-value that will be returned id no value was found
+     * @return the String fetched from the source
+     */
+    public static String getStringXPath(Object root, String query, String def) {
         String s = (String) getXPath(root, query, XPathConstants.STRING);
         return s == null || s.length() == 0 ? def : s;
     }
 
-    public Document readDocument(InputStream inputStream) {
+    /**
+     * Reads an XML-document from a given <code>InputStream</code>
+     * @param inputStream the <code>InputStream</code> where the document
+     *                    should be read from
+     * @return the document that could be read.
+     */
+    public static Document readDocument(InputStream inputStream) {
         Document returnValue = null;
         try {
             DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory
                     .newInstance();
+            docBuilderFactory.setNamespaceAware(true);
             DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
             returnValue = docBuilder.parse(inputStream);
         } catch (ParserConfigurationException e) {
@@ -158,7 +292,12 @@
         return returnValue;
     }
 
-    public String writeNode2String(Node node) {
+    /**
+     * Writes an single <code>XML-Node</code> to a string
+     * @param node the <code>XML-Node</code> that should be written
+     * @return the encoded <code>XML-Node</code>
+     */
+    public static String writeNode2String(Node node) {
         try {
             DOMSource source = new DOMSource(node);
             return writeDOMSource2String(source);
@@ -172,14 +311,26 @@
         return null;
     }
 
-    public Document reInitDocument(Document document) {
-
-        StringBufferInputStream inputStream = new StringBufferInputStream(this
-                .writeDocument2String(document));
-        return this.readDocument(inputStream);
+    /**
+     * Reinitialize the doument.
+     * This is neccessary because the namespace sometimes is invalid
+     * using a document which was created and used in the same step.
+     * @param document the document which should be reinitialize
+     * @return the document
+     */
+    public static Document reInitDocument(Document document) {
+        StringBufferInputStream inputStream = new StringBufferInputStream(
+                writeDocument2String(document));
+        return readDocument(inputStream);
     }
 
-    public String writeDocument2String(Document document) {
+    /**
+     * Writes the given Document into a String.
+     * This is very helpful for debugging.
+     * @param document the document which should be written to the string.
+     * @return the encoded xml-document.
+     */
+    public static String writeDocument2String(Document document) {
         try {
             DOMSource source = new DOMSource(document);
             return writeDOMSource2String(source);
@@ -194,13 +345,14 @@
     }
 
     /**
-     * @param source
-     * @return
+     * Writes a given <code>DOMSource</code> into a String
+     * @param source the source that should be written to string
+     * @return the encoded <code>DOMSource</code>
      * @throws TransformerFactoryConfigurationError
      * @throws TransformerConfigurationException
      * @throws TransformerException
      */
-    private String writeDOMSource2String(DOMSource source)
+    private static String writeDOMSource2String(DOMSource source)
                                                           throws TransformerFactoryConfigurationError,
                                                           TransformerConfigurationException,
                                                           TransformerException {
@@ -212,5 +364,32 @@
         transformer.transform(source, result);
         return sw.getBuffer().toString();
     }
+
+    /**
+     * Writes a given Document to an <code>OutputStream</code>
+     * @param document the document that should be written
+     * @param out the stream where the document should be written to,
+     * @return true if it was successful, false if not.
+     */
+    public static boolean toStream(Document document, OutputStream out) {
+        try {
+            Transformer transformer =
+                TransformerFactory.newInstance().newTransformer();
+            DOMSource    source = new DOMSource(document);
+            StreamResult result = new StreamResult(out);
+            transformer.transform(source, result);
+            return true;
+        }
+        catch (TransformerConfigurationException tce) {
+            logger.error(tce.getLocalizedMessage(), tce);
+        }
+        catch (TransformerFactoryConfigurationError tfce) {
+            logger.error(tfce.getLocalizedMessage(), tfce);
+        }
+        catch (TransformerException te) {
+            logger.error(te.getLocalizedMessage(), te);
+        }
+        return false;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8:
--- a/gnv/src/main/java/de/intevation/gnv/util/XSLTransformer.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/java/de/intevation/gnv/util/XSLTransformer.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,11 +1,18 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.util;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.xml.transform.Source;
 import javax.xml.transform.Transformer;
@@ -21,31 +28,56 @@
 import org.w3c.dom.Node;
 
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * This xsl transformer is used to transform incoming xml documents with the
+ * help of templates into a html representation.
+ *
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
  */
 public class XSLTransformer {
+
     /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = Logger.getLogger(XSLTransformer.class);
 
     /**
+     * The parameter that is required in the XSL sheet.
+     */
+    private Map<String, String> params;
+
+    /**
      * Constructor
      */
     public XSLTransformer() {
         super();
     }
 
+    /**
+     * Turns <i>toTransform</i> into another format using the template <i>
+     * templateFileName</i> with the <i>encoding</i>. The parameters added in
+     * {@link #addParameter(java.lang.String, java.lang.String)} are available
+     * in the transformer.
+     *
+     * @param toTransform The node to be transformed.
+     * @param encoding The encoding to be used.
+     * @param templateFileName The template used for transformation.
+     * @return the transformed document as string.
+     */
     public String transform(Node toTransform, String encoding,
                             String templateFileName) {
         String resultValue = null;
         try {
-            XMLUtils xmlUtils = new XMLUtils();
             Source templateSource = new StreamSource(new File(templateFileName));
             TransformerFactory xformFactory = TransformerFactory.newInstance();
             Transformer transformer = xformFactory
                     .newTransformer(templateSource);
+
+            if (params != null) {
+                for(Map.Entry<String, String> entry: params.entrySet()) {
+                    transformer.setParameter(entry.getKey(), entry.getValue());
+                }
+            }
+
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             StreamResult scrResult = new StreamResult(baos);
             // log.debug(xmlUtils.writeNode2String(toTransform));
@@ -65,4 +97,19 @@
         return resultValue;
     }
 
+
+    /**
+     * Add a parameter that is required in the XSL sheet.
+     *
+     * @param name The name of the parameter.
+     * @param value The value of the parameter.
+     */
+    public void addParameter(String name, String value) {
+        if (params == null) {
+            params = new HashMap<String, String>(3);
+        }
+
+        params.put(name, value);
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/util/package.html	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,8 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+</head>
+<body>
+Some helper classes mainly used to work with XML documents.
+</body>
+</html>
--- a/gnv/src/main/resources/applicationMessages.properties	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/resources/applicationMessages.properties	Fri Sep 28 12:15:18 2012 +0200
@@ -2,12 +2,24 @@
 application.name=${pom.name}
 application.version=${pom.version}
 application.releasedate=${timestamp}
+application.reload=Klicken Sie hier, um es erneut zu versuchen.
+
+gnviewer.footer.home = Home
+gnviewer.footer.contact = Kontakt
+gnviewer.footer.about = Impressum
+
+gnviewer.header.restart = Neustart
+gnviewer.header.language = Englisch
+gnviewer.header.info = Info
 
 gnviewer.app.title = BSH-GDI genericViewer
 
 gnviewer.project.save = Projekt speichern
 gnviewer.project.load = Projekt laden
-gnviewer.project.load.button = Laden
+gnviewer.project.load.button.src = ./images/laden.png
+
+gnviewer.history.title=\u00dcberblick
+gnviewer.history.back.button=Bearbeiten
 
 gnviewer.fis.fis_marnet = Marnet
 gnviewer.fis.fis_imis = IMIS
@@ -25,11 +37,17 @@
 gnviewer.fis.fis_seacat = SeaCat
 gnviewer.fis.fis_currentmeter = Strommesser
 gnviewer.fis.fis_icestations = Eismeldungen
+gnviewer.fis.fis_nauthis = Nauthis
+gnviewer.fis.fis_contis=Contis
+gnviewer.fis.fis_marinefeatures = Marine Basisdaten
 
 gnviewer.select.button = Ausw\u00e4hlen
-gnviewer.draw.button = Zeichnen
+gnviewer.select.button.src = ./images/auswaehlen.png
+gnviewer.draw.button = Aktualisieren
+gnviewer.example.linestring=Beispiel WKT-Linestring einf\u00fcgen
+gnviewer.example.polygon=Beispiel WKT-Polygon einf\u00fcgen
 
-gnviewer.productselection.overlay.title = Die Anfrage wird bearbeitet, bitte gedulden Sie sich einen Moment.
+gnviewer.productselection.overlay.title = Die Anfrage wird bearbeitet. Bitte gedulden Sie sich einen Moment.
 gnviewer.productselection.fisselection.title = Fachinformationssystem
 
 # Statistik
@@ -52,30 +70,81 @@
 gnviewer.statistics.descriptive.variance=Varianz
 gnviewer.statistics.descriptive.intercept=Intercept
 gnviewer.statistics.descriptive.slope=Steigung
+gnviewer.statistic.button = Statistik
+
+# Histogramm
+gnviewer.histogram.button=Histogramm
+gnviewer.histogram.options.header.title=Histogrammoptionen
+bincount=Anzahl der Klassen
+binwidth=Breite einer Klasse
 
 # diagram options dialog
+gnviewer.diagram.button=Diagramm
 gnviewer.diagram.options.header.title=Diagrammoptionen
 
+# wms
+gnviewer.wms.server.path=URL des WMS
+gnviewer.wms.layer.ttl=Layer ist g\u00fcltig bis
+gnviewer.wms.options.header.title=WMS Optionen
 
 # attachedOutputOptions
 gnviewer.output.options.diagramm.alt=Diagramm
-gnviewer.output.options.save.title=Diagramm speichern
+gnviewer.output.options.histogram.alt=Histogramm
+gnviewer.output.options.refresh.title=Diagramm aktualisieren
 gnviewer.output.options.export.csv.title=Daten als CSV exportieren
 gnviewer.output.options.export.odv.title=Daten als ODV exportieren
+gnviewer.output.options.export.png.title=Diagramm als PNG exportieren
 gnviewer.output.options.export.pdf.title=Diagramm als PDF exportieren
 gnviewer.output.options.export.svg.title=Diagramm als SVG exportieren
+gnviewer.output.options.export.zip.title=ZIP-Archiv exportieren
+gnviewer.output.options.export.wms.title=WMS-Layer bereitstellen
+
+# export options
+gnviewer.export.fieldset.title=Aktionen
 
 height=H\u00f6he
 width=Breite
-
-
+points=Zeichne Datenpunkte
+title=Titel
 
 # Fehlermeldungen:
 
 java.io.ioexception..connection.refused=Die Verbindung zur Artifaktdatenbank ist unterbrochen. Bitte probieren Sie es zu einem sp\u00e4teren Zeitpunkt erneut.
+java.io.ioexception..connection.reset=Die Verbindung zur Artifaktdatenbank ist unterbrochen. Bitte probieren Sie es zu einem sp\u00e4teren Zeitpunkt erneut.
 java.io.ioexception..unable.to.parse.the.response.http.version..end.of.stream.reached.too.early=Die Verbindung zur Artifaktdatenbank wurde unerwartet unterbrochen.
 no.inputdata.given..please.select.at.least.one.entry=Es wurde kein Eintrag ausgew\u00e4hlt. Bitte w\u00e4hlen sie mindestens einen Eintrag aus.
 de.intevation.gnv.geobackend.base.query.exception.queryexception..java.sql.sqlexception =Es ist ein interner Serverfehler aufgetreten. Bitte benachrichtigen Sie den Support.
 java.io.ioexception..the.server.encountered.an.unexpected.condition.which.prevented.it.from.fulfilling.the.request=Es ist ein interner Serverfehler aufgetreten. Bitte benachrichtigen Sie den Support.
 java.lang.illegalargumentexception..inputstream.cannot.be.null=Es ist ein interner Serverfehler aufgetreten. Bitte benachrichtigen Sie den Support.
- 
+input.is.not.valid.for.this.state=Der von Ihnen eingegebene Wert ist ung\u00fcltig. Bitte versuchen Sie es erneut.
+input.not.a.integer= ist keine g\u00fcltige Ganzzahl. Bitte versuchen Sie es erneut.
+input.not.a.double= ist keine g\u00fcltige Flie\u00dfkommazahl. Bitte versuchen Sie es erneut.
+upload.failure=Beim Hochladen der Datei ist ein Fehler aufgetreten.
+no.artifact.chosen=Es ist noch kein FIS gew\u00e4hlt.
+invalid.artifact=Ung\u00fcltiges Artefakt Dokument gefunden.
+mismatching.checksum=Ung\u00fcltiges Artefakt Dokument gefunden.
+no.such.factory=Ung\u00fcltiges Artefakt Dokument gefunden.
+java.io.ioexception..no.such.artifact=Ihr Artefakt ist ung\u00fcltig oder bereits abgelaufen.
+java.io.ioexception..java.heap.space =Es ist ein interner Serverfehler aufgetreten. Bitte benachrichtigen Sie den Support.
+sessiontimeout.has.occured=Ihre Sitzung ist abgelaufen.
+
+# the map client
+gnvview.mapclient.fullscreen = Vollbild
+gnviewer.mapclient.layercontrol = Layerkontrolle
+gnviewer.mapclient.layercontrol.baselayer = Hintergrundlayer
+gnviewer.mapclient.layercontrol.overlay = Generierte Layer
+gnviewer.mapclient.legend = Legende
+gnviewer.mapclient.wms.load.title = Weitere Layer hinzuf\u00fcgen
+gnviewer.mapclient.wms.load.addlayer = Layer hinzuf\u00fcgen
+gnviewer.mapclient.wms.load.grid.name = Name
+gnviewer.mapclient.wms.load.grid.title = Titel
+gnviewer.mapclient.wms.load.bt.text = Laden
+gnviewer.mapclient.wms.load.bt.tooltip = L\u00e4d das Capabilities Dokument vom angegebenen Server
+gnviewer.mapclient.wms.load.grid.error.title = Fehler
+gnviewer.mapclient.wms.load.grid.error.message = Unter der angegebenen Url konnten keine Layer ermittelt werden.
+gnviewer.mapclient.controls.nav.previous.title = Springt zum letzten Kartenausschnitt
+gnviewer.mapclient.controls.nav.next.title = Springt zum vorherigen Kartenausschnitt
+gnviewer.mapclient.controls.navigate.title = Verschieben der Karte
+gnviewer.mapclient.controls.zoombox.title = Zum Zoomen ziehen Sie eine Box auf, indem Sie klicken und ziehen
+gnviewer.mapclient.controls.info.title = Detailinformationen zu Objekten durch Klicken in die Karte
+gnviewer.mapclient.wms.local.service.name = GNV Web Map Service
--- a/gnv/src/main/resources/applicationMessages_en.properties	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/resources/applicationMessages_en.properties	Fri Sep 28 12:15:18 2012 +0200
@@ -2,12 +2,24 @@
 application.name=${pom.name}
 application.version=${pom.version}
 application.releasedate=${timestamp}
+application.reload=Click here to try again
+
+gnviewer.footer.home = Home
+gnviewer.footer.contact = Contact
+gnviewer.footer.about = Imprint
+
+gnviewer.header.restart = Restart
+gnviewer.header.language = German
+gnviewer.header.info = Info
 
 gnviewer.app.title = BSH-GDI genericViewer
 
+gnviewer.history.title=Summary
+gnviewer.history.back.button=Change
+
 gnviewer.project.save = Save Project
 gnviewer.project.load = Load Project
-gnviewer.project.load.button = Load
+gnviewer.project.load.button.src = ./images/load.png
 
 gnviewer.fis.fis_marnet = Marnet
 gnviewer.fis.fis_imis = IMIS
@@ -25,9 +37,15 @@
 gnviewer.fis.fis_seacat = SeaCat
 gnviewer.fis.fis_currentmeter = Current Meter
 gnviewer.fis.fis_icestations = Ice Station Report
+gnviewer.fis.fis_nauthis = Nauthis
+gnviewer.fis.fis_contis=Contis
+gnviewer.fis.fis_marinefeatures = Marine Features
 
 gnviewer.select.button = Choose
-gnviewer.draw.button = Draw
+gnviewer.select.button.src = ./images/choose.png
+gnviewer.draw.button = Update
+gnviewer.example.linestring=Insert an example linestring as wkt
+gnviewer.example.polygon=Insert an example polygon as wkt
 
 gnviewer.productselection.overlay.title = Your request will be processed. Please wait...
 gnviewer.productselection.fisselection.title = Data set
@@ -52,25 +70,79 @@
 gnviewer.statistics.descriptive.variance=Variance
 gnviewer.statistics.descriptive.intercept=Intercept
 gnviewer.statistics.descriptive.slope=Increase
+gnviewer.statistic.button = Statistic
+
+# Histogramm
+gnviewer.histogram.button=Histogram
+gnviewer.histogram.options.header.title=Histogram Options
+bincount=Number of classes
+binwidth=Class width
 
 # diagram options dialog
+gnviewer.diagram.button=Diagram
 gnviewer.diagram.options.header.title=Diagram options
 
+# wms
+gnviewer.wms.server.path=WMS URL
+gnviewer.wms.layer.ttl=Layer is valid to
+gnviewer.wms.options.header.title=WMS Optionen
 
 # attachedOutputOptions
 gnviewer.output.options.diagramm.alt=Diagram
-gnviewer.output.options.save.title=Save Diagram
+gnviewer.output.options.histogram.alt=Histogram
+gnviewer.output.options.refresh.title=Refresh chart
 gnviewer.output.options.export.csv.title=Export Data as CSV
 gnviewer.output.options.export.odv.title=Export Data as ODV
+gnviewer.output.options.export.png.title=Export chart as PNG
 gnviewer.output.options.export.pdf.title=Export chart as PDF
 gnviewer.output.options.export.svg.title=Export chart as SVG
+gnviewer.output.options.export.zip.title=Export as ZIP archive
+gnviewer.output.options.export.wms.title=Serve as WMS layer
+
+# export options
+gnviewer.export.fieldset.title=Actions
 
 height=Height
 width=Width
+points=Draw data points
+title=Title
 
 java.io.ioexception..connection.refused = The Connection to the ArtifactDatabase is interrupted. Please try again later.
+java.io.ioexception..connection.reset = The Connection to the ArtifactDatabase is interrupted. Please try again later.
 java.io.ioexception..unable.to.parse.the.response.http.version..end.of.stream.reached.too.early= The Connection to the ArtifactDatabase was interrupted unexpected.
 no.inputdata.given..please.select.at.least.one.entry = No Entry was chosen. Please select at least one entry.
-de.intevation.gnv.geobackend.base.query.exception.queryexception..java.sql.sqlexception: A internal Server error has occurred. Please contact the Support.
-java.io.ioexception..the.server.encountered.an.unexpected.condition.which.prevented.it.from.fulfilling.the.request = A internal Server error has occurred. Please contact the Support.
-java.lang.illegalargumentexception..inputstream.cannot.be.null = A internal Server error has occurred. Please contact the Support.
+de.intevation.gnv.geobackend.base.query.exception.queryexception..java.sql.sqlexception=An internal server error has occurred. Please contact the support.
+java.io.ioexception..the.server.encountered.an.unexpected.condition.which.prevented.it.from.fulfilling.the.request=An internal server error has occurred. Please contact the support.
+java.lang.illegalargumentexception..inputstream.cannot.be.null = An internal server error has occurred. Please contact the support.
+input.is.not.valid.for.this.state=You entered an invalid value. Please try again.
+input.not.a.integer= is not a valid integer. Please try again.
+input.not.a.double= is not a valid floating-point number. Please try again.
+upload.failure=An error occured while uploading file.
+no.artifact.chosen=No fis selected yet.
+invalid.artifact=Invalid artifact found.
+mismatching.checksum=Invalid artifact found.
+no.such.factory=Invalid artifact found.
+java.io.ioexception..no.such.artifact=Your artifact is invalid or out of date.
+java.io.ioexception..java.heap.space = An internal server error has occurred. Please contact the support.
+sessiontimeout.has.occured=Your session timed out.
+
+# the map client
+gnvview.mapclient.fullscreen = Full screen
+gnviewer.mapclient.layercontrol = Layercontrol
+gnviewer.mapclient.layercontrol.baselayer = Baselayer
+gnviewer.mapclient.layercontrol.overlay = Overlay
+gnviewer.mapclient.legend = Legend
+gnviewer.mapclient.wms.load.title = Add further Layer
+gnviewer.mapclient.wms.load.addlayer = Add Layer
+gnviewer.mapclient.wms.load.grid.name = Name
+gnviewer.mapclient.wms.load.grid.title = Title
+gnviewer.mapclient.wms.load.bt.text = Load
+gnviewer.mapclient.wms.load.bt.tooltip = Load the Capabilities document from the given destination.
+gnviewer.mapclient.wms.load.grid.error.title = Error
+gnviewer.mapclient.wms.load.grid.error.message = No layer could be determined under the given url.
+gnviewer.mapclient.controls.nav.previous.title = Jumps to the last Mapview
+gnviewer.mapclient.controls.nav.next.title = Jumps to the last Mapview
+gnviewer.mapclient.controls.navigate.title = Moves the map
+gnviewer.mapclient.controls.zoombox.title = Zoom by clicking an moving the mouse to generate a box
+gnviewer.mapclient.controls.info.title = Identify features by clicking
+gnviewer.mapclient.wms.local.service.name = GNV Web Map Service
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/classes/log4j.properties	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,19 @@
+#### Log just errors and warnings to a file.
+log4j.rootLogger=WARN, BSH
+
+## The following line enables the output of the MapViewer call document.
+log4j.category.de.intevation.gnv.action.mapviewer.MapViewerCallAction=DEBUG
+
+#### Log everything to a file.
+#log4j.rootLogger=DEBUG, BSH
+
+log4j.appender.BSH=org.apache.log4j.RollingFileAppender
+log4j.appender.BSH.File=${catalina.base}/logs/gnv.log
+log4j.appender.BSH.layout=org.apache.log4j.PatternLayout
+log4j.appender.BSH.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
+
+# set WARN log level for following packages to reduce output.
+log4j.category.org.apache.jasper=WARN
+log4j.category.org.apache.catalina=WARN
+log4j.category.org.apache.commons=WARN
+log4j.category.org.apache.struts=WARN
--- a/gnv/src/main/webapp/WEB-INF/config/log4j.properties	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-# Set root logger level to DEBUG and its only appender to A1.
-log4j.rootLogger=DEBUG, A1
-
-# A1 is set to be a ConsoleAppender.
-log4j.appender.A1=org.apache.log4j.ConsoleAppender
-
-# A1 uses PatternLayout.
-log4j.appender.A1.layout=org.apache.log4j.PatternLayout
-log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
-
-# Abschalten des geschwätzigen Loggings in dre Klasse JspServlet
-log4j.category.org.apache.jasper.servlet.JspServlet=WARN
-log4j.category.org.apache.catalina.core.ContainerBase=WARN
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/config/reachable-servers.conf	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,34 @@
+['BSH WMS Background','http://gdisrv.bsh.de/arcgis/services/Background/Background/MapServer/WMSServer'],
+['BSH WMS CONTIS Administration','http://gdisrv.bsh.de/arcgis/services/CONTIS/Administration/MapServer/WMSServer'],
+['BSH WMS CONTIS Facilities','http://gdisrv.bsh.de/arcgis/services/CONTIS/Facilities/MapServer/WMSServer'],
+['BSH WMS NAUTHIS Skin of the Earth','http://gdisrv.bsh.de/arcgis/services/Nauthis/SkinOfTheEarth/MapServer/WMSServer '],
+['BSH WMS NAUTHIS Navigational Aids','http://gdisrv.bsh.de/arcgis/services/Nauthis/NavigationalAids/MapServer/WMSServer '],
+['BSH WMS NAUTHIS Seawards Limits','http://gdisrv.bsh.de/arcgis/services/Nauthis/SeawardsLimits/MapServer/WMSServer'],
+['BSH WMS NAUTHIS Rocks Wrecks Obstructions','http://gdisrv.bsh.de/arcgis/services/Nauthis/RocksWrecksObstructions/MapServer/WMSServer'],
+['BSH WMS NAUTHIS Hydrography','http://gdisrv.bsh.de/arcgis/services/Nauthis/Hydrography/MapServer/WMSServer'],
+['BSH WMS NAUTHIS Topography','http://gdisrv.bsh.de/arcgis/services/Nauthis/Topography/MapServer/WMSServer'],
+['BSH WMS Water Pollution Reports','http://gdisrv.bsh.de/arcgis/services/WaterPollution/WaterPollution/MapServer/WMSServer'],
+['BSH WMS Marine Environmental Monitoring Network','http://gdisrv.bsh.de/arcgis/services/MARNET/MARNET/MapServer/WMSServer'],
+['BSH WMS Remote Sensing Sea Surface Temperature','http://gdisrv.bsh.de/arcgis/services/RemoteSensing/SeaSurfaceTemperature/MapServer/WMSServer'],
+['BSH WMS Sea Surface Temperature Analysis','http://gdisrv.bsh.de/arcgis/services/SeaSurfaceTemperature/SeaSurfaceTemperature/MapServer/WMSServer'],
+['BSH WMS Prediction Model Current','http://gdisrv.bsh.de/arcgis/services/PredictionModel/WaterCurrent/MapServer/WMSServer'],
+['BSH WMS Prediction Model Water Level NN','http://gdisrv.bsh.de/arcgis/services/PredictionModel/WaterLevelNN/MapServer/WMSServer'],
+['BSH WMS Prediction Model Water Temperature','http://gdisrv.bsh.de/arcgis/services/PredictionModel/WaterTemperature/MapServer/WMSServer'],
+['BSH WMS Prediction Model Salinity','http://gdisrv.bsh.de/arcgis/services/PredictionModel/WaterSalinity/MapServer/WMSServer'],
+['BSH WMS SGE Additional Information','http://gdisrv.bsh.de/arcgis/services/SGE/AdditionalInformation/MapServer/WMSServer'],
+['BSH WMS SGE Seabed Sediments','http://gdisrv.bsh.de/arcgis/services/SGE/SeabedSediments/MapServer/WMSServer'],
+['BSH WMS SGE Subsurface Sediments','http://gdisrv.bsh.de/arcgis/services/SGE/SubsurfaceSediments/MapServer/WMSServer'],
+['BSH WMS SGE Survey','http://gdisrv.bsh.de/arcgis/services/SGE/Survey/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Sediment PCB','http://gdisrv.bsh.de/arcgis/services/MUDAB/SedimentPCB/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Sediment Metalle','http://gdisrv.bsh.de/arcgis/services/MUDAB/SedimentMetals/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Sediment HCH','http://gdisrv.bsh.de/arcgis/services/MUDAB/SedimentHCH/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Wasser PCB','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterPCB/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Wasser Nährstoffe','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterNutrients/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Wasser Metalle','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterMetals/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Wasser HCH','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterHCH/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Wasser Physik','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterPhysical/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Wasser PAH','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterPAH/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Wasser Pestizide','http://gdisrv.bsh.de/arcgis/services/MUDAB/WaterPesticide/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Biota PCB','http://gdisrv.bsh.de/arcgis/services/MUDAB/BiotaPCB/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Biota Metalle','http://gdisrv.bsh.de/arcgis/services/MUDAB/BiotaMetals/MapServer/WMSServer'],
+['BSH WMS MUDAB BLMP Biota HCH','http://gdisrv.bsh.de/arcgis/services/MUDAB/BiotaHCH/MapServer/WMSServer']
\ No newline at end of file
--- a/gnv/src/main/webapp/WEB-INF/config/struts-config.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/config/struts-config.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -6,9 +6,21 @@
     <global-exceptions/>
      <global-forwards>
         <forward name="entrance" path="/start.do"/>
+        <forward name="imprint" path="/imprint.do"/>
+        <forward name="info" path="/info.do"/>
     </global-forwards>
-    
+
     <action-mappings>
+        <action path="/imprint"
+                type="org.apache.struts.actions.ForwardAction"
+                parameter="/WEB-INF/jsp/imprint.jsp"
+                scope="request"
+                validate="false" />
+        <action path="/info"
+                type="org.apache.struts.actions.ForwardAction"
+                parameter="/WEB-INF/jsp/info.jsp"
+                scope="request"
+                validate="false" />
         <action path="/version"
                 type="de.intevation.gnv.action.ArtifactDatabaseActionBase"
                 scope="request"
@@ -17,6 +29,50 @@
                 name="success"
                 path="/WEB-INF/jsp/version.jsp"/>
         </action>
+        <action path="/extcall" 
+                type="de.intevation.gnv.action.mapviewer.MapViewerCallAction"
+                scope="request"
+                validate="false">
+           <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+        </action>
+        <action path="/mvcall" 
+                type="de.intevation.gnv.action.mapviewer.ShowMapViewerCallBodyAction"
+                scope="request"
+                validate="false">
+           <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+        </action>
+        <action path="/store"
+                type="de.intevation.gnv.action.StoreAction"
+                scope="request"
+                validate="false">
+           <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+           <forward
+                name="failure"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+        </action>
+        <action path="/load"
+                type="de.intevation.gnv.action.LoadAction"
+                scope="request"
+                validate="false">
+           <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+           <forward
+                name="failure"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+           <forward
+               name="back"
+               path="/gnv/back.do"/>
+           <forward
+               name="selectfis"
+               path="/gnv/selectFis.do"/>
+        </action>
         <action path="/start" 
                 type="de.intevation.gnv.action.FetchArtifactFactoriesAction"
                 scope="request"
@@ -32,34 +88,176 @@
            <forward
                 name="success"
                 path="/WEB-INF/jsp/mainlayout.jsp"/>
+           <forward
+               name="back"
+               path="/gnv/back.do"/>
+            <forward
+                name="selectfis"
+                path="/gnv/selectFis.do"/>
         </action>
-        <action path="/next" 
-                type="de.intevation.gnv.action.NextArtifactStepAction"
+        <action path="/back"
+                 type="de.intevation.gnv.action.PreviousArtifactStepAction"
+                 scope="request"
+                 validate="false">
+            <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+            <forward
+                name="back"
+                path="/gnv/back.do"/>
+            <forward
+                name="selectfis"
+                path="/gnv/selectFis.do"/>
+        </action>
+        <action path="/selectFis"
+                type="de.intevation.gnv.action.SelectFisAction"
                 scope="request"
                 validate="false">
            <forward
                 name="success"
                 path="/WEB-INF/jsp/mainlayout.jsp"/>
         </action>
-                <action path="/out" 
+        <action path="/next"
+                type="de.intevation.gnv.action.NextArtifactStepAction"
+                scope="request"
+                validate="false">
+           <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+            <forward
+                name="back"
+                path="/gnv/back.do"/>
+            <forward
+                name="selectfis"
+                path="/gnv/selectFis.do"/>
+            <forward
+                name="store"
+                path="/gnv/store.do"/>
+            <forward
+                name="load"
+                path="/gnv/load.do"/>
+        </action>
+        <action path="/out" 
                 type="de.intevation.gnv.action.DoOutputAction"
                 scope="request"
                 validate="false">
         </action>
+        <action path="/wms" 
+                type="de.intevation.gnv.action.WMSAction"
+                scope="request"
+                validate="false">
+            <forward
+                name="success"
+                path="/WEB-INF/jsp/wmslayout.jsp"/>
+            <forward
+                name="back"
+                path="/gnv/back.do"/>
+            <forward
+                name="selectfis"
+                path="/gnv/selectFis.do"/>
+        </action>
+                <action path="/mapclient" 
+                type="de.intevation.gnv.action.MapClientStandaloneAction"
+                scope="request"
+                validate="false">
+            <forward
+                name="success"
+                path="/WEB-INF/jsp/wmsstandalone.jsp"/>
+        </action>
+        
         <action path="/export" 
                 type="de.intevation.gnv.action.DoExportAction"
                 scope="request"
                 validate="false">
+            <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
         </action>
         <action path="/changeOptions" 
                 type="de.intevation.gnv.action.ChangeOptionsAction"
                 scope="request"
                 validate="false">
-                <forward
+            <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+            <forward
+                name="back"
+                path="/gnv/back.do"/>
+            <forward
+                name="selectfis"
+                path="/gnv/selectFis.do"/>
+        </action>
+        <action path="/histogram" 
+                type="de.intevation.gnv.action.CreateHistogramAction"
+                scope="request"
+                validate="false">
+            <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+            <forward
+                name="back"
+                path="/gnv/back.do"/>
+            <forward
+                name="selectfis"
+                path="/gnv/selectFis.do"/>
+        </action>
+        <action path="/chart" 
+                type="de.intevation.gnv.action.CreateChartAction"
+                scope="request"
+                validate="false">
+            <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+            <forward
+                name="back"
+                path="/gnv/back.do"/>
+            <forward
+                name="selectfis"
+                path="/gnv/selectFis.do"/>
+        </action>
+        <action path="/statistic"
+                type="de.intevation.gnv.action.ShowStatisticAction"
+                scope="request"
+                validate="false">
+            <forward
+                name="back"
+                path="/gnv/back.do"/>
+            <forward
+                name="selectfis"
+                path="/gnv/selectFis.do"/>
+            <forward
                 name="success"
                 path="/WEB-INF/jsp/mainlayout.jsp"/>
         </action>
-       </action-mappings>
+        <action path="/describe"
+                type="de.intevation.gnv.action.DescribeUIAction"
+                scope="request"
+                validate="false">
+            <forward
+                name="back"
+                path="/gnv/back.do"/>
+            <forward
+                name="selectfis"
+                path="/gnv/selectFis.do"/>
+            <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+        </action>
+        <action path="/language" 
+                type="de.intevation.gnv.action.SwitchLanguageAction"
+                scope="request"
+                validate="false">
+            <forward
+                name="success"
+                path="/WEB-INF/jsp/mainlayout.jsp"/>
+            <forward
+                name="back"
+                path="/gnv/back.do"/>
+            <forward
+                name="selectfis"
+                path="/gnv/selectFis.do"/>
+        </action>
+    </action-mappings>
        
        <message-resources parameter="applicationMessages" null="false"/>
 </struts-config>
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui-static.xsl	Fri Sep 28 12:15:18 2012 +0200
@@ -3,67 +3,109 @@
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                 xmlns="http://www.w3.org/2002/xforms" 
                 xmlns:xform="http://www.w3.org/2002/xforms" 
-                xmlns:art="http://www.intevation.de/2009/artifacts">
-    <xsl:output method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/>
-    
-    <xsl:template match="*[local-name() = 'select']">
-        <xsl:variable name="selectName" select="@ref"/>
-             <div id="timeseriesfilter">
-                <form id="{$selectName}Form" method="post">
-                   <fieldset>
-                    <legend><xsl:value-of select="*[local-name() = 'label']"/></legend>
-                    <select name="{$selectName}" multiple="multiple" size="6" disabled="disabled"> <xsl:apply-templates/></select>
-                    </fieldset>
-                </form>
-             </div> 
+                xmlns:art="http://www.intevation.de/2009/artifacts"
+                exclude-result-prefixes="xform art">
+
+    <xsl:output
+        method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no" />
+
+    <xsl:param name="back-url"/>
+    <xsl:param name="selectfis"/>
+    <xsl:param name="edit"></xsl:param>
+    <xsl:param name="total"><xsl:value-of select="count(*)"/></xsl:param>
+
+    <!-- start parsing document -->
+    <xsl:template match="*">
+        <table class="static">
+            <xsl:apply-templates />
+        </table>
     </xsl:template>
-    <xsl:template match="*[local-name() = 'select1']">
-        <xsl:variable name="selectName" select="@ref"/>
-            <div id="timeseriesfilter">
-                <form id="{$selectName}Form" method="post">
-                   <fieldset>
-                    <legend><xsl:value-of select="*[local-name() = 'label']"/></legend>
-                    <select name="{$selectName}" disabled="disabled"> <xsl:apply-templates/></select>
-                    </fieldset>
-                </form>
-             </div>
-    </xsl:template>
+
     
-    <xsl:template match="*[local-name() = 'item']">
-        <xsl:variable name="optionValue" select="*[local-name() = 'value']"/>
-        <xsl:choose>
-           <xsl:when test="@selected = 'true'">
-               <option value="{$optionValue}" selected="selected"><xsl:value-of select="*[local-name() = 'label']"></xsl:value-of></option>
-           </xsl:when>
-           <xsl:otherwise>
-               <option value="{$optionValue}"><xsl:value-of select="*[local-name() = 'label']"></xsl:value-of></option>
-           </xsl:otherwise>
-        </xsl:choose>
+    <!-- match multi select boxes -->
+    <xsl:template match="xform:select">
+        <tr>
+            <th class="parameter"><xsl:value-of select="xform:label" /></th>
+            <td><xsl:apply-templates select="xform:choices" /></td>
+            <td class="historyback">
+                <xsl:call-template name="InsertEdit">
+                    <xsl:with-param name="state" select="@art:state" />
+                    <xsl:with-param name="index" select="position()" />
+                    <xsl:with-param name="fis" select="@art:fis" />
+                </xsl:call-template>
+            </td>
+        </tr>
     </xsl:template>
+
+
+    <xsl:template name="InsertEdit">
+        <xsl:param name="state" />
+        <xsl:param name="index" />
+        <xsl:param name="fis" />
+        <xsl:if test="$state != ''">
+            <a href="{$back-url}?target={$state}">
+                <img title="{$edit}" alt="{$edit}" src="images/back_button.png"/>
+            </a>
+        </xsl:if>
+        <xsl:if test="$fis">
+            <a href="{$selectfis}"><img title="{$edit}" alt="{$edit}" src="images/back_button.png"/></a>
+        </xsl:if>
+    </xsl:template>
+
+
+    <!-- match select boxes -->
+    <xsl:template match="xform:select1">
+        <tr>
+            <th class="parameter"><xsl:value-of select="xform:label" /></th>
+            <td><xsl:apply-templates select="xform:choices" /></td>
+            <td class="historyback">
+                <xsl:call-template name="InsertEdit">
+                    <xsl:with-param name="state" select="@art:state" />
+                    <xsl:with-param name="index" select="position()" />
+                    <xsl:with-param name="fis" select="@art:fis" />
+                </xsl:call-template>
+            </td>
+        </tr>
+    </xsl:template>
+
     
-    <xsl:template match="*[local-name() = 'group']">
-        <xsl:variable name="inputName" select="*[local-name() = 'label']"/>
-         <div id="timeseriesfilter">
-            <form id="{$inputName}Form" method="post">
-            <fieldset>
-                <legend><xsl:value-of select="*[local-name() = 'label']"/></legend>
-                <xsl:apply-templates/>
-            </fieldset>
-            </form>
-        </div>
+    <!-- match item list of select boxes or multi select boxes -->
+    <xsl:template match="xform:choices">
+        <table class="choices"><xsl:apply-templates select="xform:item" /></table>
     </xsl:template>
-    
-    <xsl:template match="*[local-name() = 'input']">
-        <xsl:variable name="inputValue" select="*[local-name() = 'value']"/>
-        <xsl:variable name="inputName" select="*[local-name() = 'label']"/>
-        <xsl:choose>
-           <xsl:when test="*[local-name() = 'label']!= ''">
-               <xsl:value-of select="*[local-name() = 'label']"/>: 
-           </xsl:when>
-        </xsl:choose>
-        <input type="text" id="{$inputName}" name="{$inputName}" value="{$inputValue}" disabled="disabled"/>
+
+
+    <!-- match item of select boxes or multi select boxes -->
+    <xsl:template match="xform:item">
+        <tr>
+            <td class="value"><xsl:value-of select="xform:label" /></td>
+        </tr>
     </xsl:template>
-    
-    <xsl:template match="*[local-name() = 'label']">
+
+
+    <!-- match group items -->
+    <xsl:template match="xform:group">
+        <tr>
+            <th class="parameter"><xsl:value-of select="xform:label" /></th>
+            <td>
+                <table><xsl:apply-templates select="xform:input" /></table>
+            </td>
+            <td class="historyback">
+                <xsl:call-template name="InsertEdit">
+                    <xsl:with-param name="state" select="@art:state" />
+                    <xsl:with-param name="index" select="position()" />
+                    <xsl:with-param name="fis" select="@art:fis" />
+                </xsl:call-template>
+            </td>
+        </tr>
     </xsl:template>
-</xsl:stylesheet>
\ No newline at end of file
+
+
+    <!-- match single group item -->
+    <xsl:template match="xform:input">
+        <tr>
+            <td class="value"><xsl:value-of select="xform:label" />&#160;<xsl:value-of select="xform:value" /></td>
+        </tr>
+    </xsl:template>
+
+</xsl:stylesheet>
--- a/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/config/templates/describe-ui.xsl	Fri Sep 28 12:15:18 2012 +0200
@@ -3,56 +3,186 @@
                 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                 xmlns="http://www.w3.org/2002/xforms" 
                 xmlns:xform="http://www.w3.org/2002/xforms" 
-                xmlns:art="http://www.intevation.de/2009/artifacts">
-    <xsl:output method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/>
-    
-    <xsl:template match="*[local-name() = 'select']">
-        <xsl:variable name="selectName" select="@ref"/>
-	                <legend><xsl:value-of select="*[local-name() = 'label']"/></legend>
-	                <select name="{$selectName}" multiple="multiple" size="6"> <xsl:apply-templates/></select>
-	                <br/>
-    </xsl:template>
-    <xsl:template match="*[local-name() = 'select1']">
+                xmlns:art="http://www.intevation.de/2009/artifacts"
+                exclude-result-prefixes="xform art">
+
+    <xsl:output
+        method="html" version="1.0" encoding="UTF-8" omit-xml-declaration="no" />
+
+    <xsl:param name="example-linestring"/>
+    <xsl:param name="example-polygon"/>
+
+    <!-- single select -->
+    <xsl:template match="xform:select1">
         <xsl:variable name="selectName" select="@ref"/>
-                    <legend><xsl:value-of select="*[local-name() = 'label']"/></legend>
-                    <select name="{$selectName}"> <xsl:apply-templates/></select>
-                    <br/>
-    </xsl:template>
-    <xsl:template match="*[local-name() = 'item']">
-        <xsl:variable name="optionValue" select="*[local-name() = 'value']"/>
+        <legend><xsl:value-of select="xform:label"/></legend>
+        <select name="{$selectName}">
+            <xsl:apply-templates />
+        </select>
+    </xsl:template>
+
+
+    <!-- multi select -->
+    <xsl:template match="xform:select">
+        <xsl:variable name="selectName" select="@ref"/>
+        <xsl:variable name="items" select="count(//xform:item)"/>
+        <legend>
+            <xsl:value-of select="xform:label"/>
+        </legend>
+
         <xsl:choose>
-           <xsl:when test="@selected = 'true'">
-               <option value="{$optionValue}" selected="selected"><xsl:value-of select="*[local-name() = 'label']"></xsl:value-of></option>
-           </xsl:when>
-           <xsl:otherwise>
-               <option value="{$optionValue}"><xsl:value-of select="*[local-name() = 'label']"></xsl:value-of></option>
-           </xsl:otherwise>
+            <xsl:when test="$items = 1">
+                <select name="{$selectName}" multiple="multiple" size="{$items}">
+                    <xsl:apply-templates mode="selected"/>
+                </select>
+            </xsl:when>
+            <xsl:when test="$items &lt; 5">
+                <select name="{$selectName}" multiple="multiple" size="{$items}">
+                    <xsl:apply-templates/>
+                </select>
+            </xsl:when>
+            <xsl:otherwise>
+                <select name="{$selectName}" multiple="multiple" size="5">
+                    <xsl:apply-templates />
+                </select>
+            </xsl:otherwise>
         </xsl:choose>
     </xsl:template>
-    
-    <xsl:template match="*[local-name() = 'group']">
-        <xsl:variable name="selectName" select="@ref"/>
-                    <legend><xsl:value-of select="*[local-name() = 'label']"/></legend>
-                    <xsl:apply-templates/>
-    </xsl:template>
-    
-    <xsl:template match="*[local-name() = 'input']">
-        <xsl:variable name="inputValue" select="*[local-name() = 'value']"/>
-        <xsl:variable name="inputName" select="@ref"/>
-        
-        <xsl:if test="$inputName = 'mesh_linestring'">
-            <a href="javascript:copy_demo_wkt_line();"><xsl:text>Beispiel WKT-Linestring einf&#252;gen:</xsl:text></a><br/>
-        </xsl:if>
+
+
+    <!-- options for select -->
+    <xsl:template match="xform:item">
+        <xsl:variable name="optionValue" select="xform:value"/>
+        <xsl:choose>
+            <xsl:when test="@selected = 'true'">
+                <option value="{$optionValue}" selected="selected">
+                    <xsl:value-of select="xform:label"/>
+                </option>
+            </xsl:when>
+            <xsl:otherwise>
+                <option value="{$optionValue}">
+                    <xsl:value-of select="xform:label"/>
+                </option>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+
+    <xsl:template match="xform:item" mode="selected">
+        <xsl:variable name="optionValue" select="xform:value"/>
+            <option value="{$optionValue}" selected="selected">
+                <xsl:value-of select="xform:label"/>
+            </option>
+    </xsl:template>
+
+
+
+    <xsl:template match="xform:group">
+        <xsl:variable name="selectcount" select="count(xform:select)"/>
+
+        <legend>
+            <xsl:value-of select="xform:label"/>
+        </legend>
 
         <xsl:choose>
-           <xsl:when test="*[local-name() = 'label']!= ''">
-               <xsl:value-of select="*[local-name() = 'label']"/>: 
-           </xsl:when>
+            <xsl:when test="$selectcount &lt; '1'">
+                <table class="dynamic">
+                    <xsl:apply-templates/>
+                </table>
+            </xsl:when>
+            <xsl:otherwise>
+                <table class="static">
+                    <tr>
+                        <td><!-- nothing here --></td>
+                        <!-- take the first select node to render column labels -->
+                        <xsl:apply-templates select="xform:select[1]/xform:item" mode="matrixHeader"/>
+                    </tr>
+                    <tr>
+                        <td><!-- nothing here --></td>
+                        <xsl:apply-templates select="xform:select[1]/xform:item" mode="matrixSelectable"/>
+                    </tr>
+                    <!-- render matrix' body -->
+                    <xsl:apply-templates select="xform:select" mode="matrix" />
+                </table>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+
+    <!-- rendering column headers (measurements) -->
+    <xsl:template match="xform:item" mode="matrixHeader">
+        <td class="matrixHeader">
+            <xsl:value-of select="xform:label/text()"/>
+        </td>
+    </xsl:template>
+
+    <!-- -->
+    <xsl:template match="xform:item" mode="matrixSelectable">
+        <xsl:variable name="value" select="xform:value/text()"/>
+        <xsl:variable name="name" select="@ref"/>
+        <td class="matrixSelectableHeader">
+            <input type="checkbox" name="{$name}" value="{$value}" />
+        </td>
+    </xsl:template>
+
+
+    <!-- render the first column with parameter names into matrix -->
+    <xsl:template match="xform:select" mode="matrix">
+        <tr>
+            <td><xsl:value-of select="@label" /></td>
+            <xsl:apply-templates mode="matrix" />
+        </tr>
+    </xsl:template>
+
+
+    <!-- render checkboxes and disable checkboxes for invalid parameter 
+         measurements -->
+    <xsl:template match="xform:item" mode="matrix">
+        <xsl:variable name="value" select="xform:value/text()"/>
+        <xsl:variable name="name" select="@ref"/>
+        <td class="matrixContent">
+            <xsl:choose>
+            <xsl:when test="@disabled = 'true'">
+                <img src="./images/delete.png"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <img src="./images/tick.png"/>
+            </xsl:otherwise>
+            </xsl:choose>
+        </td>
+    </xsl:template>
+
+
+    <xsl:template match="xform:input">
+        <xsl:variable name="inputValue" select="xform:value"/>
+        <xsl:variable name="inputName" select="@ref"/>
+        <xsl:variable name="label" select="xform:label"/>
+        
+        <!-- TODO: Remove this when we have the GIS interface. (slt) --> 
+        <xsl:choose>
+            <xsl:when test="$inputName = 'mesh_linestring'">
+                <a href="javascript:copy_demo_wkt_line();"><xsl:value-of select="$example-linestring"/>:</a><br/>
+            </xsl:when>
+            <xsl:when test="$inputName = 'mesh_polygon'">
+                <a href="javascript:copy_demo_wkt_polygon();"><xsl:value-of select="$example-polygon"/>:</a><br/>
+            </xsl:when>
         </xsl:choose>
 
-        <input type="text" id="{$inputName}" name="{$inputName}" value="{$inputValue}" /><br/> 
+        <tr>
+            <xsl:choose>
+                <xsl:when test="$label != ''">
+                    <td class="parameter"><xsl:value-of select="$label"/>:</td>
+               </xsl:when>
+            </xsl:choose>
+
+            <td>
+                <input type="text" id="{$inputName}" name="{$inputName}" value="{$inputValue}" /><br/>
+            </td>
+        </tr>
     </xsl:template>
-    
-    <xsl:template match="*[local-name() = 'label']">
+
+
+    <xsl:template match="xform:label">
+        <!-- do nothing here -->
     </xsl:template>
+
 </xsl:stylesheet>
--- a/gnv/src/main/webapp/WEB-INF/jsp/footer.jsp	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/jsp/footer.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -1,6 +1,35 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
 <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" language="java" %>
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
-<html:xhtml/>
-<%--div style="clear: left; margin-top: 40px;"/--%>
\ No newline at end of file
+<table class="footerTable">
+    <tr>
+        <td class="footerLine">© 2010 Bundesamt für Seeschifffahrt und Hydrographie</td>
+        <td></td>
+    </tr>
+    <tr>
+        <td colspan="2">
+            <table class="footerTableLinks">
+                <tr>
+                    <td align="left"></td>
+                    <td align="right">
+                        <html:link styleClass="footerLineLinks" href="http://www.bsh.de"><bean:message key="gnviewer.footer.home"/></html:link>
+                        <font color="white">&middot;</font>
+                        <html:link styleClass="footerLineLinks" href="mailto:"><bean:message key="gnviewer.footer.contact"/></html:link>
+                        <font color="white">&middot;</font>
+                        <html:link styleClass="footerLineLinks" page="/imprint.do"><bean:message key="gnviewer.footer.about"/></html:link>
+                    </td>
+                </tr>
+            </table>
+        </td>
+    </tr>
+</table>
+<%--div style="clear: left; margin-top: 40px;"/--%>
--- a/gnv/src/main/webapp/WEB-INF/jsp/header.jsp	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/jsp/header.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -1,43 +1,33 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
 <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" language="java"%>
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %>
 <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles"%>
-<% Object exceptionMessage = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID);
-    exceptionMessage = (exceptionMessage != null ? exceptionMessage.toString().replaceAll(" ", ".").replaceAll(":",".").toLowerCase() : null);
-    exceptionMessage = (exceptionMessage != null && exceptionMessage.toString().endsWith(".") ? exceptionMessage.toString().substring(0,exceptionMessage.toString().length()-1) : exceptionMessage);
-    
-%>
-<%@page import="de.intevation.gnv.action.CommunicationKeys"%><html:xhtml />
-<!-- Kopfleiste-->
-<div id="head" title="GDI BSH genericViewer"> 
-	<div id="logo">
-	
-	
-	</div>
-	<a href="<html:rewrite action="/start"/>">
-		<h1>
-			<bean:message key="gnviewer.app.title" />
-		</h1>
-	</a>
-	
-	<div id="project">
-		<label style="font-weight:bold;">
-		         <bean:message key="gnviewer.project.load"/>
-			| 
-			     <bean:message	key="gnviewer.project.save" />
-	 	</label>
-		<div id="project_load">
-			
-		</div>
-		<br/>
-		
-	</div>
-	<div class="errormsg" id="load_error">
-         <%if (exceptionMessage != null){ %>
-            <bean-el:message key="<%=exceptionMessage.toString()%>"/>
-         <%}%>
-     </div>
+
+<div id="headline">
+    <h1 class="headline">BSH Generischer Viewer</h1>
 </div>
 
+<br/>
+
+<table class="headerTableLinks">
+    <tr>
+        <td align="left"></td>
+        <td align="right">
+            <html:link styleClass="headerLineLinks" href="./start.do"><bean:message key="gnviewer.header.restart"/></html:link>
+            <font color="white">&middot;</font>
+            <a class="headerLineLinks" href="<%=response.encodeURL("language.do?uid="+System.currentTimeMillis())%>"><bean:message key="gnviewer.header.language"/></a>
+            <font color="white">&middot;</font>
+            <html:link styleClass="headerLineLinks" page="/info.do"><bean:message key="gnviewer.header.info"/></html:link>
+        </td>
+    </tr>
+</table>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/imprint.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,50 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>
+            <bean:message key="gnviewer.app.title"/>
+        </title>
+        <link href="styles/gnv.css" rel="stylesheet" type="text/css"/>
+    </head>
+
+    <body id="gnviewerbody">
+        <div id="page">
+            <div id="headline">
+                <h1 class="headline">BSH Generischer Viewer</h1>
+            </div>
+
+            <br/>
+
+            <div id="headerElement">
+                <table class="headerTableLinks">
+                    <tr>
+                        <td align="left"></td>
+                        <td align="right">
+                            <html:link styleClass="headerLineLinks" page="/start.do"><bean:message key="gnviewer.header.restart"/></html:link>
+                            <font size="1.5em" color="white">&middot;</font>
+                            <html:link styleClass="headerLineLinks" page="/info.do"><bean:message key="gnviewer.header.info"/></html:link>
+                        </td>
+                    </tr>
+                </table>
+            </div>
+            <div id="contentElement" class="contentElement">
+                TODO: Impressum.
+             </div>
+             <div id="footerElement">
+                <jsp:include page="footer.jsp" />
+            </div>
+        </div>
+    </body>
+</html>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_adons_inc.jsp	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-<div id="diagramoptions">
-    <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp"></jsp:include>
-    <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp"></jsp:include>
-</div>
\ No newline at end of file
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,11 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
@@ -6,80 +14,33 @@
 <%@page import="java.util.Collection"%>
 <%@page import="java.util.Iterator"%>
 <%@page import="java.net.URLEncoder"%>
-<%Object diagramm = request.getAttribute("diagramm");
-SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
-if (diagramm != null){
-    String target = "chart"; 
-    String targetCSV = "csv";
-    String targetODV = "odv";
-    String targetPDF = "pdf";
-    String targetSVG = "svg";
+<%
+    // fetch diagramm parameter from request if the user clicked 'draw'
+    SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
+
+    String target          = "chart"; 
+    String mimeType        = null;
+    String parameterString = "";
+
     boolean supportChart = sm.getOutputMode(target) != null;
-    boolean supportCSV   = sm.getOutputMode(targetCSV) != null;
-    boolean supportODV   = sm.getOutputMode(targetODV) != null;
-    boolean supportPDF   = sm.getOutputMode(targetPDF) != null;
-    boolean supportSVG   = sm.getOutputMode(targetSVG) != null;
-    String mimeType = null;
-    String parameterString = "";
+
     if (supportChart){
-       mimeType = sm.getOutputMode(target).getMimeType();
+       mimeType                        = sm.getOutputMode(target).getMimeType();
        DiagrammOptions diagrammOptions = sm.getDiagrammOptions();
-       Collection<OutputParameter> op = sm.getOutputMode(target).getOutputParameters();
+       Collection<OutputParameter> op  = sm.getOutputMode(target).getOutputParameters();
+
        if (op != null){
            Iterator<OutputParameter> it = op.iterator();
            while (it.hasNext()){
                OutputParameter parameter = it.next(); 
-               parameterString = parameterString +"&"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue());
+               parameterString = parameterString +"&amp;"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue());
            }
        }
     }
-    String mimeTypePDF = null;
-    if (supportPDF) {
-       mimeTypePDF = sm.getOutputMode(targetPDF).getMimeType();
-    }
-    String mimeTypeSVG = null;
-    if (supportSVG) {
-        mimeTypeSVG = sm.getOutputMode(targetSVG).getMimeType();
-        mimeTypeSVG = URLEncoder.encode(mimeTypeSVG, "UTF-8");
-    }
-    String mimeTypeCSV = null;
-    if (supportCSV){
-        mimeTypeCSV = sm.getOutputMode(targetCSV).getMimeType();
-    }
+%> 
 
-    String mimeTypeODV = null;
-    if (supportODV){
-        mimeTypeODV = sm.getOutputMode(targetODV).getMimeType();
-    }
-%>
+<%-- diagramm is not null if the user clicked the 'draw' button --%>
 <div id="diagram">
-        <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&target="+target+parameterString+"&uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.diagramm.alt"/>'/>
-        <br/>
-        <div id="export">
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeType+"&target="+target+parameterString+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.save.title"/>">
-                <img src="images/diagram_export.png" border="0"/>
-            </a>
-            <%if (supportPDF) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypePDF+"&target="+targetPDF+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.pdf.title"/>">
-                <img src="images/diagram_export.png" border="0"/>
-            </a>
-            <%}%>
-            <%if (supportSVG) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeSVG+"&target="+targetSVG+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.svg.title"/>">
-                <img src="images/diagram_export.png" border="0"/>
-            </a>
-            <%}%>
-            <%if (supportCSV) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeCSV+"&target="+targetCSV+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.csv.title"/>">
-                <img src="images/data_export.png" border="0"/>
-            </a>
-            <%}%>
-            <%if (supportODV) { %>
-            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeODV+"&target="+targetODV+"&uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.odv.title"/>">
-                <img src="images/data_export.png" border="0"/>
-            </a>
-            <%}%>
-        </div>
-        <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_adons_inc.jsp"></jsp:include>
-    </div>
-<%}%>
+    <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&amp;target="+target+"&amp;mode=img"+parameterString+"&amp;uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.diagramm.alt"/>'/>
+    <br/>
+</div>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -1,51 +1,120 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %>
+<%@page import="de.intevation.gnv.action.CommunicationKeys"%>
 <%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%>
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
 <%@page import="de.intevation.gnv.artifactdatabase.objects.OutputMode"%>
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.ExportMode"%>
 <%@page import="java.util.Collection"%>
-<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%>
 <%@page import="java.util.Iterator"%>
-<%
-  SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
-  DiagrammOptions diagrammOptions = sm.getDiagrammOptions();
-  boolean useDiagrammOptions = diagrammOptions != null;
-  String target = "chart";
-  OutputMode outputMode = sm.getOutputMode(target);
+<%@page import="java.util.Locale"%>
+<%@page import="java.net.URLEncoder"%>
+<% 
+    String exceptionMsg             = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE);
+    String exceptionValue           = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_VALUE);
+    String target                   = "chart";
+    String targetPDF                = "pdf";
+    String targetSVG                = "svg";
+    String targetIMG                = "img";
+    SessionModel sm                 = SessionModelFactory.getInstance().getSessionModel(request);
+    Locale locale                   = sm.getCurrentLocale();
+    OutputMode outputMode           = sm.getOutputMode(target);
+    DiagrammOptions diagrammOptions = sm.getDiagrammOptions();
+
+    boolean useDiagrammOptions = diagrammOptions != null;
+    ExportMode supportIMG      = outputMode.getExportMode(targetIMG);
+    ExportMode supportPDF      = outputMode.getExportMode(targetPDF);
+    ExportMode supportSVG      = outputMode.getExportMode(targetSVG);
+
+    String mimeType                 = outputMode.getMimeType();
+    String parameterString          = "";
+    Collection<OutputParameter> op  = outputMode.getOutputParameters();
+
+    if (op != null){
+        Iterator<OutputParameter> it = op.iterator();
+        while (it.hasNext()){
+            OutputParameter parameter = it.next();
+            parameterString = parameterString +"&amp;"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue());
+        }
+    }
+
+
+    String mimeTypeIMG = null;
+    if (supportIMG != null) {
+        mimeTypeIMG = supportIMG.getMimeType();
+    } 
+    String mimeTypePDF = null;
+    if (supportPDF != null) {
+        mimeTypePDF = supportPDF.getMimeType();
+    }
+    String mimeTypeSVG = null;
+    if (supportSVG != null) {
+        mimeTypeSVG = supportSVG.getMimeType();
+        mimeTypeSVG = URLEncoder.encode(mimeTypeSVG, "UTF-8");
+    }
 %>
 <div id="diagramOptionsContent">
     <fieldset>
         <legend onmousedown="displayDiv('diagramOptionsContent');" class="expandableFieldset">
            <bean:message key="gnviewer.diagram.options.header.title"/>
         </legend>
-        <form id="outputOptionsForm" method="post" action="<%=response.encodeURL("changeOptions.do")%>">
-           <table>
+
+        <% if (exceptionMsg != null) {%>
+            <div id="chartException" class="chartException">
+                '<%=exceptionValue%>' <bean-el:message key="<%=exceptionMsg%>"/>
+            </div>
+        <%}%>
+
+        <form id="outputOptionsForm" method="post" action="<%=response.encodeURL("changeOptions.do?target="+target)%>">
+           <table class="static">
            <%if (outputMode != null && outputMode.getOutputParameters() != null && !outputMode.getOutputParameters().isEmpty()){
                Iterator<OutputParameter> it = outputMode.getOutputParameters().iterator();
                while (it.hasNext()){
                    OutputParameter om = it.next(); %>
                <tr>
-                  <td>
+                  <td class="parameter">
                       <bean-el:message key="<%=om.getName()%>"/>
                   </td>
                   <td>
                       <%if (om.getType().equalsIgnoreCase("boolean")){
-                          boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName())) : om.getValue().equalsIgnoreCase("true");
+                          boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName(), locale)) : om.getValue().equalsIgnoreCase("true");
                       %>
                             <input type="checkbox" 
                                    name="<%=om.getName() %>" 
                                    <%=checked ? " value=\"true\" checked=\"checked\"": "" %>/>
                       <%}else{%>
-                            <input type="text" name="<%=om.getName() %>" value="<%=useDiagrammOptions ? diagrammOptions.getValue(om.getName()): om.getValue()%>"/>
+                            <input type="text" name="<%=om.getName() %>" value="<%=useDiagrammOptions ? diagrammOptions.getValue(om.getName(), locale): om.getValue()%>"/>
                       <%}%>
                   </td>
               </tr>
            <%}%>
            </table>
-           <input type="hidden" name="target" value="<%=target%>"/>
-           <input type="submit" value="<bean:message key="gnviewer.select.button"/>"/>
-           <%}%>
+           <div class="exportBar">
+               <input type="image" name="target" value="chart" src="images/arrow_refresh.png" alt="<bean:message key="gnviewer.draw.button"/>" title="<bean:message key="gnviewer.output.options.refresh.title"/>"/>
+               <%}%>
+                <%if (supportIMG != null) { %>
+                   <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeIMG+"&amp;target="+target+"&amp;mode="+targetIMG+parameterString+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.png.title"/>">
+                        <img src="images/diagram_export.png" border="0"/></a>
+                <%}%>
+                <%if (supportPDF != null) { %>
+                    <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypePDF+"&amp;target="+target+"&amp;mode="+targetPDF+parameterString+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.pdf.title"/>">
+                        <img src="images/pdf.png" border="0"/></a>
+                <%}%>
+                <%if (supportSVG != null) { %>
+                    <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeSVG+"&amp;target="+target+"&amp;mode="+targetSVG+parameterString+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.svg.title"/>">
+                        <img src="images/svg.png" border="0"/></a>
+                <%}%>
+            </div>
         </form>
     </fieldset>
-</div>
\ No newline at end of file
+</div>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_diagramm_statistics_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,11 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %>
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
@@ -5,7 +13,8 @@
 <%@page import="java.util.Collection"%>
 <%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticValue"%>
 <%@page import="java.util.Iterator"%>
-<%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet"%><div id="statistics">
+<%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactStatisticsSet"%>
+<div class="statistics">
 <%
     SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
     Collection<ArtifactStatisticsSet> statistics = sm.getStatistics();
@@ -19,25 +28,24 @@
             while (it.hasNext()){
                 ArtifactStatisticsSet set = it.next(); 
         %>
-        <div id="statisticValues">
-             <h1><%=set.getName()%></h1>
-            <table id="statistics">
+            <h1><%=set.getName()%></h1>
+            <table class="statistics">
               <tr>
                   <th><bean:message key="gnviewer.statistics.table.header.param"/></th>
                   <th><bean:message key="gnviewer.statistics.table.header.value"/></th>
               </tr>
-              <% Iterator<ArtifactStatisticValue> sit = set.getStatisticValues().iterator();
-                 while (sit.hasNext()){
-                     ArtifactStatisticValue asv = sit.next(); 
+              <% 
+                Iterator<ArtifactStatisticValue> sit = set.getStatisticValues().iterator();
+                while (sit.hasNext()){
+                    ArtifactStatisticValue asv = sit.next(); 
               %>
-              <tr>
-                  <td><bean-el:message key="<%=asv.getKey()%>"/></td>
-                  <td><%=asv.getValue()%></td>
-              </tr>
-        <%}%>
+                  <tr>
+                      <td><bean-el:message key="<%=asv.getKey()%>"/></td>
+                      <td><%=asv.getValue()%></td>
+                  </tr>
+                <%}%>
             </table>
-        <%} %>
-        </div>
+            <%} %>
         <%}%>
     </fieldset>
-</div>
\ No newline at end of file
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_export_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,114 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactObject"%>
+<%@page import="java.util.Collection"%>
+<%@page import="java.util.Iterator"%>
+<%@page import="java.net.URLEncoder"%>
+<%
+    SessionModel sm         = SessionModelFactory.getInstance().getSessionModel(request);
+    ArtifactObject artifact = sm.getCurrentArtifact();
+    String mimeType         = null;
+    String wmslayer         = null;
+    String parameterString  = "";
+
+    String target    = "chart";
+    String targetCSV = "csv";
+    String targetODV = "odv";
+    String targetZIP = "zip";
+    String targetWMS = "wms";
+    String targetSta = "statistics";
+    String targetHis = "histogram";
+
+    boolean supportChart = sm.getOutputMode(target)    != null;
+    boolean supportCSV   = sm.getOutputMode(targetCSV) != null;
+    boolean supportODV   = sm.getOutputMode(targetODV) != null;
+    boolean supportZIP   = sm.getOutputMode(targetZIP) != null;
+    boolean supportWMS   = sm.getOutputMode(targetWMS) != null;
+    boolean supportSta   = sm.getOutputMode(targetSta) != null;
+    boolean supportHis   = sm.getOutputMode(targetHis) != null;
+
+    if (supportChart){
+        mimeType = sm.getOutputMode(target).getMimeType();
+        DiagrammOptions diagrammOptions = sm.getDiagrammOptions();
+        Collection<OutputParameter> op  = sm.getOutputMode(target).getOutputParameters();
+
+       if (op != null){
+           Iterator<OutputParameter> it = op.iterator();
+           while (it.hasNext()){
+               OutputParameter parameter = it.next(); 
+               parameterString = parameterString +"&amp;"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue());
+           }
+       }
+    }
+
+    String mimeTypeCSV = null;
+    if (supportCSV){
+        mimeTypeCSV = sm.getOutputMode(targetCSV).getMimeType();
+    }
+
+    String mimeTypeODV = null;
+    if (supportODV){
+        mimeTypeODV = sm.getOutputMode(targetODV).getMimeType();
+    }
+
+    String mimeTypeZIP = null;
+    if (supportZIP) {
+        mimeTypeZIP = sm.getOutputMode(targetZIP).getMimeType();
+    }
+
+    String mimeTypeWMS = null;
+    if (supportWMS) {
+        mimeTypeWMS = sm.getOutputMode(targetWMS).getMimeType();
+        wmslayer    = artifact.getId();
+    }
+%>
+
+<%-- display export options if one is supported in this state --%>
+<% if (supportChart || supportCSV || supportODV || supportWMS || supportZIP) { %>
+    <div id="export">
+        <fieldset>
+            <legend><bean:message key="gnviewer.export.fieldset.title"/></legend>
+            <%if (supportChart) { %>
+            <a href="<%=response.encodeURL("chart.do?mimetype="+mimeType+"&amp;target="+target+"&amp;mode=img"+parameterString+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.diagram.button"/>">
+                <img src="images/chart_curve.png" border="0"/></a>
+            <%}%>
+            <%if (supportWMS) { %>
+            <a href="<%=response.encodeURL("wms.do?mimetype="+mimeTypeWMS+"&amp;target="+targetWMS+"&amp;uid="+System.currentTimeMillis()+"&amp;layer="+wmslayer)%>" title="<bean:message key="gnviewer.output.options.export.wms.title"/>">
+                <img src="images/map_go.png" border="0"/></a>
+            <%}%>
+            <%if (supportZIP) { %>
+            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeZIP+"&amp;target="+targetZIP+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.zip.title"/>">
+                <img src="images/disk.png" border="0"/></a>
+            <%}%>
+
+            <%if (supportSta) { %>
+                <a href="<%=response.encodeURL("statistic.do")%>" title="<bean:message key="gnviewer.statistic.button"/>">
+                    <img src="images/statistics.png" border="0"/></a>
+            <%}%>
+
+            <%if (supportHis) { %>
+                <a href="<%=response.encodeURL("histogram.do")%>" title="<bean:message key="gnviewer.histogram.button"/>">
+                    <img src="images/chart_bar.png" border="0"/></a>
+            <%}%> 
+            <%if (supportCSV) { %>
+            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeCSV+"&amp;target="+targetCSV+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.csv.title"/>">
+                <img src="images/data_export.png" border="0"/></a>
+            <%}%>
+            <%if (supportODV) { %>
+            <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeODV+"&amp;target="+targetODV+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.odv.title"/>">
+                <img src="images/data_export.png" border="0"/></a> 
+            <%}%>
+        </fieldset>
+    </div>
+<%}%>
--- a/gnv/src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_fis_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -1,3 +1,11 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %>
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
@@ -25,7 +33,7 @@
            </select>
     <%}%>
            <br/>
-           <input type="submit" value="<bean:message key="gnviewer.select.button"/>" />
+            <input style="margin-top: 5px;" type="image" src="<bean:message key="gnviewer.select.button.src"/>"/>
         </fieldset>
     </form>
-</div>
\ No newline at end of file
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,40 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%>
+<%@page import="java.util.Collection"%>
+<%@page import="java.util.Iterator"%>
+<%
+    SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
+
+    String parameterString = "";
+    String target          = "histogram";
+    String mimeType        = sm.getOutputMode(target).getMimeType();
+
+    DiagrammOptions diagrammOptions = sm.getDiagrammOptions();
+    Collection<OutputParameter> op  = sm.getOutputMode(target).getOutputParameters();
+
+    if (op != null){
+        Iterator<OutputParameter> it = op.iterator();
+        while (it.hasNext()){
+            OutputParameter parameter = it.next(); 
+            parameterString = parameterString +"&amp;"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue());
+        }
+
+        parameterString += "&amp;bintype="+request.getAttribute("bintype");
+    }
+%>
+
+<div class="histogram">
+    <img src='<%=response.encodeURL("out.do?mimetype="+mimeType+"&amp;target="+target+"&amp;mode=img"+parameterString+"&amp;uid="+System.currentTimeMillis())%>' alt='<bean:message key="gnviewer.output.options.histogram.alt"/>'/>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_histogram_options_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,143 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %>
+<%@page import="de.intevation.gnv.action.CommunicationKeys"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputMode"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.ExportMode"%>
+<%@page import="java.util.Collection"%>
+<%@page import="java.util.Iterator"%>
+<%@page import="java.util.Locale"%>
+<%@page import="java.net.URLEncoder"%>
+<%
+    String exceptionMsg             = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE);
+    String exceptionValue           = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_VALUE);
+    String target                   = "histogram";
+    String targetPDF                = "pdf";
+    String targetSVG                = "svg";
+    String targetIMG                = "img";
+    SessionModel sm                 = SessionModelFactory.getInstance().getSessionModel(request);
+    Locale locale                   = sm.getCurrentLocale();
+    OutputMode outputMode           = sm.getOutputMode(target);
+    DiagrammOptions diagrammOptions = sm.getDiagrammOptions();
+
+    boolean useDiagrammOptions = diagrammOptions != null;
+    ExportMode supportIMG      = outputMode.getExportMode(targetIMG);
+    ExportMode supportPDF      = outputMode.getExportMode(targetPDF);
+    ExportMode supportSVG      = outputMode.getExportMode(targetSVG);
+
+    String mimeType                 = outputMode.getMimeType();
+    String parameterString          = "";
+    Collection<OutputParameter> op  = outputMode.getOutputParameters();
+
+    if (op != null){
+        Iterator<OutputParameter> it = op.iterator();
+        while (it.hasNext()){
+            OutputParameter parameter = it.next(); 
+            parameterString = parameterString +"&amp;"+parameter.getName()+"="+(diagrammOptions != null ? diagrammOptions.getValue(parameter.getName()): parameter.getValue());
+        }
+    } 
+
+    String mimeTypeIMG = null;
+    if (supportIMG != null) {
+        mimeTypeIMG = supportIMG.getMimeType();
+    } 
+    String mimeTypePDF = null;
+    if (supportPDF != null) {
+        mimeTypePDF = supportPDF.getMimeType();
+    }
+    String mimeTypeSVG = null;
+    if (supportSVG != null) {
+        mimeTypeSVG = supportSVG.getMimeType();
+        mimeTypeSVG = URLEncoder.encode(mimeTypeSVG, "UTF-8");
+    }
+%>
+<div id="diagramOptionsContent">
+    <fieldset>
+        <legend onmousedown="displayDiv('histogramOptionsContent');" class="expandableFieldset">
+           <bean:message key="gnviewer.histogram.options.header.title"/>
+        </legend>
+
+        <% if (exceptionMsg != null) {%>
+            <div id="chartException" class="chartException">
+                '<%=exceptionValue%>' <bean-el:message key="<%=exceptionMsg%>"/>
+            </div>
+        <%}%>
+
+        <form id="outputOptionsForm" method="post" action="<%=response.encodeURL("changeOptions.do?target="+target)%>">
+           <table>
+           <%if (outputMode != null && outputMode.getOutputParameters() != null && !outputMode.getOutputParameters().isEmpty()){
+               Iterator<OutputParameter> it = outputMode.getOutputParameters().iterator();
+               while (it.hasNext()){
+                   OutputParameter om = it.next();
+                   String diaOpts = null;
+                   if (diagrammOptions != null) {
+                       diaOpts = request.getParameter("bintype");
+                   }%>
+               <tr>
+                  <td>
+                        <%if (om.getName().equals("bincount")) {
+                            String check = "";
+                            if (diaOpts != null && diaOpts.equalsIgnoreCase("binwidth")) {
+                                check = "";
+                            }
+                            else {
+                                check = "checked=\"checked\"";
+                            }%>
+                            <input type="checkbox" <%= check %> name="bintype" value="bincount" id="checkCount" onClick="toggleBinType('checkWidth')"/>
+                        <%}%>
+                        <%if (om.getName().equals("binwidth")) {
+                            String check = "";
+                            if (diaOpts != null && diaOpts.equalsIgnoreCase("binwidth")) {
+                                check = "checked=\"checked\"";
+                            }
+                            else if (diaOpts == null) {
+                                check = "";
+                            }%>
+                            <input type="checkbox" <%= check %> name="bintype" value="binwidth" id="checkWidth" onClick="toggleBinType('checkCount')"/>
+                        <%}%>
+                  </td>
+                  <td class="parameter">
+                      <bean-el:message key="<%=om.getName()%>"/>
+                  </td>
+                  <td>
+                      <%if (om.getType().equalsIgnoreCase("boolean")){
+                          boolean checked = useDiagrammOptions ? "true".equalsIgnoreCase(diagrammOptions.getValue(om.getName(), locale)) : om.getValue().equalsIgnoreCase("true");
+                      %>
+                            <input type="checkbox" 
+                                   name="<%=om.getName() %>" 
+                                   <%=checked ? " value=\"true\" checked=\"checked\"": "" %>/>
+                      <%}else{%>
+                            <input type="text" name="<%=om.getName() %>" value="<%=useDiagrammOptions ? diagrammOptions.getValue(om.getName(), locale): om.getValue()%>"/>
+                      <%}%>
+                  </td>
+              </tr>
+           <%}%>
+           </table>
+           <input type="image" name="target" value="histogram" src="images/arrow_refresh.png" alt="<bean:message key="gnviewer.draw.button"/>"/>
+           <%}%>
+           <%if (supportIMG != null) { %>
+               <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeIMG+"&amp;target="+target+"&amp;mode="+targetIMG+parameterString+"uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.save.title"/>">
+                    <img src="images/diagram_export.png" border="0"/></a>
+            <%}%>
+            <%if (supportPDF != null) { %>
+                <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypePDF+"&amp;target="+target+"&amp;mode="+targetPDF+parameterString+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.pdf.title"/>">
+                    <img src="images/pdf.png" border="0"/></a>
+            <%}%>
+            <%if (supportSVG != null) { %>
+                <a href="<%=response.encodeURL("export.do?mimetype="+mimeTypeSVG+"&amp;target="+target+"&amp;mode="+targetSVG+parameterString+"&amp;uid="+System.currentTimeMillis())%>" title="<bean:message key="gnviewer.output.options.export.svg.title"/>">
+                    <img src="images/svg.png" border="0"/></a>
+            <%}%>
+        </form>
+    </fieldset>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,19 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
+<div id="headline">
+    <h1 class="headline">BSH Generischer Viewer</h1>
+</div>
+<div id="cap" style="height: 100%; width: 100%; overflow: auto">
+    <div id="remoteinput">
+        <div id="urlinput" style="width: 96%"><!-- Just a Comment --></div>
+        <div id="urlbutton"><!-- Just a Comment --></div>
+    </div>
+    <div id="capgrid"><!-- Just a Comment --></div>
+</div>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_map_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,24 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
+<jsp:include page="display_wms_basic_informations.jsp" />
+<div>
+<p align="right">
+  <a target="blank" href="<%=response.encodeURL("mapclient.do?uid="+System.currentTimeMillis())%>"><bean:message key="gnvview.mapclient.fullscreen"/></a>
+</p>
+</div>
+<br/>
+<div id="cap" style="height: 100%; width: 100%; overflow: auto">
+    <div id="remoteinput">
+        <div id="urlinput" style="width: 96%"><!-- Just a Comment --></div>
+        <div id="urlbutton"><!-- Just a Comment --></div>
+    </div>
+    <div id="capgrid"><!-- Just a Comment --></div>
+</div>
+<div id="mapcontainer" style="width: 100%; height: 100%"><!-- Just a Comment --></div>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_mapviewercall_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,74 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%
+String geometry = "POINT (6.3333 56.5)";
+String geometrytype = request.getParameter("gt");
+if(geometrytype != null){
+    if (geometrytype.equals("POINT")){
+        geometry = "POINT (6.3333 56.5)";
+    }else if (geometrytype.equals("LINESTRING")){
+        geometry = "LINESTRING (0.4911 56.2489,10.4464 58.1608,12.2321 56.4127,13.1250 54.8832,15.4018 54.5008,19.6875 56.4127,20.6250 59.0349,28.1250 60.2640)";
+    }else if (geometrytype.equals("POLYGON")){
+        geometry = "POLYGON ((-1.5763 58.3616, 0.7526 53.8428, 4.2686 53.1972, 7.9217 54.1441, 7.6020 56.2959, 11.5747 57.2857, 0.4788 58.4908, 4.2686 58.8996, 0.0219 58.5768, -1.5763 58.3616))";
+    }
+}
+%>
+
+<div id="basefilter" style="left:310px;position:absolute;width:350px">
+    <form action="<%=response.encodeURL("extcall.do")%>" method="post">
+        <fieldset>
+           <legend>Kartenviewer Request</legend>
+            <textarea id="mapviewer" class="mapviewer" name="document" rows="25" cols="80">
+                    <?xml version='1.0' encoding='UTF-8'?>
+                    <gnviewer>
+                        <mapservices>
+                            <mapservice id='BSH_IMS_Prediction_Model_Current' type='arcims' url='http://foo.bar.de'>
+                               <Modeldata />
+                                <layer id='3' name='Speed Today 00:00 (Surface)'/>
+                                <layer id='146' name='Surface Current Day After Tomorrow'>
+                                    <layer id='207' name='Day After Tomorrow 20:00 (Surface)'>
+                                         <layer id='208' name='Speed Day After Tomorrow 21:00 (Surface)'/>
+                                         <layer id='209' name='Speed Day After Tomorrow 20:00 (Surface)'/>
+                                     </layer>
+                                 </layer>
+                            </mapservice>
+                            <mapservice id='BSH_IMS_Marine_Environmental_Monitoring_Network' type='wms' url='http://foo1.bar.de'>
+                                 <MARNET/>
+                                 <layer id='26' name='Air'>
+                                    <layer id='27' name='Temperature'/>
+                                 </layer>
+                                 <layer id='9' name='Salinity'>
+                                    <layer id='10' name='depth: (0m- -6m)'/>
+                                 </layer>
+                                 <layer id='13' name='OxygenSaturation'>
+                                    <layer id='14' name='depth: (0m- -6m)'/>
+                                    <layer id='15' name='depth: (-6m- -20m)'/>
+                                    <layer id='16' name='depth: (-20m- -50m)'/>
+                                 </layer>
+                            </mapservice>
+                            <mapservice id='BSH_IMS_Sea_Surface_Temperature_Analysis' type='arcims' url='http://foo.bar.de'>
+                                <SST/>
+                            </mapservice>
+                            <mapservice id='BSH_IMS_Prediction_Model_Salinity' type='arcims' url='http://foo.bar.de'>
+                                <Modeldata />
+                            </mapservice>
+                            <mapservice id='BSH_IMS_CONTIS_Resources' type='arcims' url='http://foo.bar.de'>
+                                <Contis />
+                            </mapservice>
+                        </mapservices> 
+                        <location>
+                            <srs>EPSG:4324</srs>
+                            <data><%=geometry%></data>
+                        </location>
+                    </gnviewer>
+             </textarea>
+            <input type="submit" name="btClick" value="Ausführen" />
+        </fieldset>
+    </form>
+</div>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_wms_basic_informations.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,32 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%
+SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
+MapService localMapService = sm.getLocalMapService();
+Collection<Layer> layer = localMapService.getLayer(); 
+%>
+
+<%@page import="java.util.Collection"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.map.Layer"%>
+<%@page import="java.util.Iterator"%><div id="wms">
+    <table>
+        <tr>
+            <td class="parameter"><bean:message key="gnviewer.wms.server.path"/>:</td>
+            <td class="wmsvalue"><%=localMapService.getURL()%>?SERVICE=WMS&amp;REQUEST=GetCapabilities</td>
+        </tr>
+        <tr>
+            <td class="parameter"><bean:message key="gnviewer.wms.layer.ttl"/>:</td>
+            <td class="wmsvalue"><%=localMapService.getTtl()%></td>
+        </tr>
+    </table>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/display_wms_options_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,76 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %>
+<%@page import="de.intevation.gnv.action.CommunicationKeys"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.DiagrammOptions"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputMode"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.OutputParameter"%>
+<%@page import="java.util.Collection"%>
+<%@page import="java.util.Iterator"%>
+<%@page import="java.util.Locale"%>
+<%@page import="java.net.URLEncoder"%>
+<%
+    String exceptionMsg  = (String) request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE);
+    String exceptionValue= (String) request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_VALUE);
+    String layer         = (String) request.getAttribute("layer");
+    String target        = "wms";
+    SessionModel      sm = SessionModelFactory.getInstance().getSessionModel(request);
+    Locale locale        = sm.getCurrentLocale();
+    OutputMode        om = sm.getOutputMode(target);
+    DiagrammOptions opts = sm.getDiagrammOptions();
+    String uuid          = sm.getCurrentArtifact().getId();
+%>
+
+<div id="diagramOptionsContent">
+    <fieldset>
+        <legend onmousedown="displayDiv('diagramOptionsContent');" class="expandableFieldset">
+            <bean:message key="gnviewer.wms.options.header.title"/>
+        </legend>
+
+        <% if (exceptionMsg != null) {%>
+            <div id="chartException" class="chartException">
+                '<%=exceptionValue%>' <bean-el:message key="<%=exceptionMsg%>"/>
+            </div>
+        <%}%>
+
+        <form id="outputOptionsForm" method="POST" action="<%=response.encodeURL("wms.do")%>">
+            <table>
+            <%  Collection<OutputParameter> params = om.getOutputParameters();
+                if (om != null && params != null && !params.isEmpty()) {
+                    Iterator<OutputParameter> iter = params.iterator();
+                    while (iter.hasNext()) {
+                        OutputParameter param = iter.next(); %>
+
+                        <tr>
+                            <td class="parameter"><bean-el:message key="<%=param.getName()%>"/></td>
+                            <td>
+                                <%if (param.getType().equalsIgnoreCase("boolean")) {
+                                    boolean checked = (opts != null) ? "true".equalsIgnoreCase(opts.getValue(param.getName(), locale)) : param.getValue().equalsIgnoreCase("true");
+                                %>
+                                    <input type="checkbox" name="<%=param.getName()%>" <%=checked ? " value=\"true\" checked=\"checked\"": "" %>/>
+                                <%}
+                                else {%>
+                                    <input type="text" name="<%=param.getName() %>" value="<%= (opts != null) ? opts.getValue(param.getName()) : param.getValue()%>"/>
+                                <%}%>
+                            </td>
+                        </tr>
+                    <%}
+                }%>
+                <tr>
+                    <td>
+                        <input type="image" name="target" value="wms" src="images/arrow_refresh.png" alt="<bean:message key="gnviewer.draw.button"/>"/>
+                    </td>
+                </tr>
+            </table>
+        </form>
+    </fieldset>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/info_english.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,13 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<div class="info-content">
+    <div style="padding-top: 15px;">Further information are available in German only.</div>
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/info_german.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,67 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<div class="info-content">
+
+    <h2 class="headline infoheadline">Informationen &uuml;ber den Generischen Viewer in der GDI BSH</h2>
+
+    In der Geodateninfrastruktur des <a href="http://www.bsh.de/" target="_new">
+    Bundesamtes f&uuml;r Seeschifffahrt und Hydrographie (BSH)</a> werden alle
+    wesentlichen marinen Geodaten in einem Data Warehouse vorgehalten. Neben dem
+    Geodatenportal, dem <a href="http://www.geoseaportal.de/" target="_new">
+    GeoSeaPortal</a>, werden v.a. die Parameter, die r&auml;umlich und zeitlich
+    variieren, &uuml;ber den Generischen Viewer bereitgestellt.
+    <br/>Der Generische Viewer &uuml;bernimmt die Aufgaben, den umfangreichen
+    Datenbestand des Data Warehouses Endnutzern strukturierbar anzubieten, um
+    fachliche Analysen wie Zeitreihen, unterschiedliche Profile, Schnittoperationen
+    und Statistiken browsergest&uuml;tzt durchf&uuml;hren zu k&ouml;nnen. &Uuml;ber umfangreiche
+    Exportfunktionen stehen Fachdaten und Visualisierungsprodukte zur weiteren
+    Bearbeitung bereit. Der Generische Viewer liefert damit einen zentralen
+    Zugangspunkt f&uuml;r Fachdaten, die &uuml;ber eine rein kartographische Visualisierung
+    hinausgehen.
+    <br/>
+    Weitere Informationen zur Geodateninfrastruktur des BSH (GDI-BSH) unter 
+    <a href="http://www.geoseaportal.de" target="_new">http://www.geoseaportal.de</a>
+
+    <h2 class="headline infoheadline">Kontakt</h2>
+
+    Projektgruppe GDI BSH im <a href="http://www.bsh.de/" target="_new">Bundesamt
+    f&uuml;r Seeschifffahrt und Hydrographie</a> Bernhard-Nocht-Stra&szlig;e 78 20359 Hamburg
+    <br/><br/>
+    Fachliche Fragen <a href="mailto:juergen.schulz-ohlberg@bsh.de">J&uuml;rgen Schulz-Ohlberg</a>
+    <br/><br/>
+    Technische Fragen <a href="mailto:joerg.gerdes@bsh.de">J&ouml;rg Gerdes</a>
+    <br/><br/>
+    <h2 class="headline infoheadline">&Uuml;ber Generischen Viewer (GNV)</h2>
+
+    Die Software "Generische Viewer GDI-BSH" setzt auf dem verteilbaren Softwaresystem
+    des "Open Water Analyst" auf, um auf die umfangreichen Datenbest&auml;nde des
+    Data Warehouses des BSH, realisiert auf ESRI ArcSDE und Oracle. &Uuml;ber ein
+    einheitliches Protokoll auf der Basis von REST steuert die webgest&uuml;tzte Oberfl&auml;che
+    des Generischen Viewers die Serverkomponente an, die f&uuml;r die Datenbeschaffung, die
+    -analyse und Ausgabengenerierung verantwortlich ist. Um vor allem Datenzugriffe zu
+    beschleunigen, sind Caching-Mechanismen integriert worden, die Zwischenergebnisse
+    vorhalten.
+
+    Die Implementierung ist vollst&auml;ndig auf Basis Freier Software realisiert worden
+    und bindet alleinig properiet&auml;re Elemente zum Zugriff auf ESRI ArcSDE ein. Der
+    Generische Viewer ist eine Fachapplikation des Open Water Analyst. Die Umsetzung
+    weitere Fachl&ouml;sungen ist aufgrund des Designs und eingesetzten Protokolles m&ouml;glich.
+
+    <h2 class="headline infoheadline">Umsetzung</h2>
+
+    Design und Implementation der Software durch die <a href="http://www.intevation.de" target="_new">
+    Intevation GmbH</a>, Bereich Geospatial: Hans Plum (Projektleitung), Tim
+    Englich, Sascha L. Teichmann und Ingo Weinzierl.
+
+    <h2 class="headline infoheadline">Lizenz</h2>
+
+    Die Software wird voraussichtlich im Sommer 2010 als Freie Software ver&ouml;ffentlicht.
+</div>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/includes/wms_header_inc.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,48 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@page import="de.intevation.gnv.action.MapClientStandaloneAction"%>
+<%
+boolean standalone = request.getAttribute(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY) != null;
+%>
+    
+<head>
+        <title>
+            <bean:message key="gnviewer.app.title"/>
+        </title>
+        <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
+        <meta http-equiv="Content-Script-Type" content="text/javascript"/>
+        <meta http-equiv="Content-Style-Type" content="text/css"/>
+        <meta http-equiv="Expires" content="Mon, 01 Jan 1990 00:00:01 GMT"/>
+        <meta http-equiv="pragma" content="no-cache"/>
+        <meta http-equiv="cache-control" content="no-cache"/>
+        <meta name="robots" content="noindex"/>
+        
+        <link rel="stylesheet" type="text/css" href="scripts/ext/ext-2.3.0/resources/css/ext-all.css"></link>
+        <link rel="stylesheet" type="text/css" href="scripts/geoext/geoext-0.6/resources/css/geoext-all.css"></link>
+        <link rel="stylesheet" type="text/css" href="scripts/openlayers/OpenLayers-2.9/theme/default/style.css"></link>
+        <link rel="stylesheet" type="text/css" href="styles/gnv.css"/>
+        <link rel="stylesheet" type="text/css" href="styles/ol_style.css"/>
+        <link rel="stylesheet" type="text/css" href="styles/extjs-override.css"/>
+        
+        <script type="text/javascript" src="scripts/ext/ext-2.3.0/adapter/ext/ext-base.js"></script>
+        <script type="text/javascript" src="scripts/ext/ext-2.3.0/ext-all.js"></script>
+        <script type="text/javascript" src="scripts/openlayers/OpenLayers-2.9/OpenLayers.js"></script>
+        <script type="text/javascript" src="scripts/geoext/geoext-0.6/script/GeoExt.js"></script>
+        <script type="text/javascript" src="<%=response.encodeURL("scripts/olutils.jsp?uid="+System.currentTimeMillis())%>">"></script>
+        <script type="text/javascript" src="<%=response.encodeURL("scripts/layers.jsp?uid="+System.currentTimeMillis())%>"></script>
+        <script type="text/javascript" src="<%=response.encodeURL("scripts/viewport.jsp?uid="+System.currentTimeMillis()+"&"+MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY+"="+standalone)%>"></script>
+         
+         <!-- save necessary variables here -->
+         <script type="text/javascript">
+             var options, layer, extent, map, mapPanel, infoControls, capfield;
+             var controls,layers, mouseLoc, grid;
+             var infoActive = false;
+         </script>
+    </head>
\ No newline at end of file
--- a/gnv/src/main/webapp/WEB-INF/jsp/index.jsp	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/jsp/index.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -1,38 +1,180 @@
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean-el" prefix="bean-el" %>
 <%@page import="java.util.Collection"%>
 <%@page import="de.intevation.gnv.artifactdatabase.objects.ArtifactObject"%>
+<%@page import="de.intevation.gnv.action.CommunicationKeys"%>
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
 <%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
 <%@page import="java.util.Iterator"%>
-<%Object ui = request.getAttribute("ui");
-  Object staticui = request.getAttribute("staticui");
-  boolean furthertargets = true;
-      
-  Object furthertargetsObject = request.getAttribute("furthertargets");
-  if (furthertargetsObject != null){
-      furthertargets = ((Boolean)furthertargetsObject).booleanValue();
-  }
+<%  
+    String exception       = (String)request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_INPUT_ID);
+    SessionModel sm        = SessionModelFactory.getInstance().getSessionModel(request);
+    Object ui              = request.getAttribute("ui");
+    Object staticui        = request.getAttribute("staticui");
+    Object chart           = request.getAttribute("chart");
+    Object statistic       = request.getAttribute("statistic");
+    Object histogram       = request.getAttribute("histogram");
+    Object wms_published   = request.getAttribute("wms_published");
+    boolean furthertargets = true;
+
+    if (chart == null && statistic == null && histogram == null && wms_published == null) {
+        boolean supportChart = sm.getOutputMode("chart") != null;
+        if (supportChart) {
+            chart = "true";
+        }
+    }
+
+    Object furthertargetsObject = request.getAttribute("furthertargets");
+    if (furthertargetsObject != null){
+        furthertargets = ((Boolean)furthertargetsObject).booleanValue();
+    }
+
+    Object exceptionMessage = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_MESSAGE_ID);
+    exceptionMessage = (exceptionMessage != null ? exceptionMessage.toString().replaceAll(" ", ".").replaceAll(":",".").toLowerCase() : null);
+    exceptionMessage = (exceptionMessage != null && exceptionMessage.toString().endsWith(".") ? exceptionMessage.toString().substring(0,exceptionMessage.toString().length()-1) : exceptionMessage);
+
+    Object sessionException = request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_SESSION_ID);
+    sessionException = (sessionException != null ? sessionException.toString().replaceAll(" ", ".").replaceAll(":",".").toLowerCase() : null);
+    sessionException = (sessionException != null && sessionException.toString().endsWith(".") ? sessionException.toString().substring(0,sessionException.toString().length()-1) : sessionException);
+
+    boolean showmapviewercallBody = request.getAttribute("MAPVIEWERCALL") != null;
+
+    String exceptionProject = (String) request.getAttribute(CommunicationKeys.REQUEST_EXCEPTION_PROJECT);
+    exceptionProject        = exceptionProject != null ? exceptionProject.toLowerCase() : null;
+    exceptionProject        = exceptionProject != null ? exceptionProject.replaceAll(" ", ".") : null;
 %>
-    <div>
-    <jsp:include page="includes/display_fis_inc.jsp"></jsp:include>
-    <%if (staticui != null){ %>
-        <%=staticui.toString()%>
-    <%}%>
-    
-    <%if (ui != null){%>
-    <div id="timeseriesfilter">
-        <form id="fisSelectionForm" onsubmit="displayOverlay()" action="<%=response.encodeURL("next.do")%>") method="post">
-           <fieldset>
-            <%=ui != null ? ui.toString().replaceAll("&nbsp;", "") : "" %>
-           
-            <%if(furthertargets){%>
-            <input type="submit" value="<bean:message key="gnviewer.select.button"/>"/>
-            <%}else{%>
-            <input type="submit" value="<bean:message key="gnviewer.draw.button"/>"/>
-            <%}%>
-            </fieldset>
-        </form>
+
+    <%-- div container for project loading/saving and error messages related to this --%>
+    <div id="project"> 
+        <table width="100%">
+            <tr>
+                <td style="float: left; width: 225px;">
+                    <a href="<%=response.encodeURL("store.do")%>"><bean:message key="gnviewer.project.save"/></a>
+                    |
+                    <a href="#" onclick="toggle('projectload');"><bean:message key="gnviewer.project.load"/></a>
+                </td>
+                <td style="float: left; width: 400px;">
+                    <div id="projectload">
+                        <form id="loadProject" action="<%=response.encodeURL("load.do")%>" method="post" enctype="multipart/form-data">
+                            <div id="browseDiv"><input type="file"   name="document"     accept="application/xml"/></div>
+                            <div id="loadDiv"><input type="image" src="<bean:message key="gnviewer.project.load.button.src"/>"/></div>
+                        </form>
+                    </div>
+                </td>
+            </tr>
+        </table>
+        <%if (exceptionProject != null) {%>
+            <div class="projectException">
+                <bean:message key="<%=exceptionProject%>"/>
+                <br/>
+                <a href="<%=response.encodeURL("describe.do?uid="+System.currentTimeMillis())%>" title="<bean:message key="application.reload"/>">
+                    <bean:message key="application.reload"/>
+                </a>
+            </div>
+        <%}%>
+         <%if (showmapviewercallBody){ %>
+            <jsp:include page="includes/display_mapviewercall_inc.jsp" />
+        <%}%>
     </div>
-    <%}%>
-    </div>
-    <jsp:include page="includes/display_diagramm_inc.jsp"></jsp:include>
\ No newline at end of file
+
+    <table style="width:100%;">
+        <tr id="contentRow">
+            <td id="parameterColumn">
+                <%-- the parameter panel is following --%>
+                <div id="parameterPanel">
+                <%if (staticui == null){ %>
+                    <jsp:include page="includes/display_fis_inc.jsp"></jsp:include>
+                <%} else {%>
+                    <div class="down">
+                        <fieldset>
+                            <legend><bean:message key="gnviewer.history.title"/></legend>
+                            <%=staticui.toString()%>
+                        </fieldset>
+                    </div>
+                <%}%>
+
+                <%-- render the dynamic part to feed the state and advance to the next state --%>
+                <%if (ui != null){%> 
+                    <div id="timeseriesfilter"> 
+                        <form id="fisSelectionForm" onsubmit="displayOverlay()" action="<%=response.encodeURL("next.do")%>" method="post">
+                           <fieldset>
+
+                            <%-- error message, if user input was not valid --%>
+                            <%if (exception != null) {%>
+                                <div class="inputException"><%=exception%></div>
+                            <%}%>
+                            <%=ui != null ? ui.toString().replaceAll("&nbsp;", "") : "" %>
+
+                            <%if(furthertargets){%>
+                                <br/>
+                                <input style="margin-top: 5px;" type="image" src="<bean:message key="gnviewer.select.button.src"/>"/>
+                            <%}%>
+                            </fieldset>
+                        </form>
+                    </div>
+                <%}%>
+
+                    <%-- render export options if existing for this state --%>
+                    <jsp:include page="includes/display_export_inc.jsp"></jsp:include>
+
+                    <%if (chart != null) {%>
+                        <jsp:include page="/WEB-INF/jsp/includes/display_diagramm_options_inc.jsp"></jsp:include>
+                    <%}%>
+
+
+                    <%if (histogram != null) {%>
+                        <jsp:include page="/WEB-INF/jsp/includes/display_histogram_options_inc.jsp"></jsp:include>
+                    <%}%>
+
+                    <%-- render wms options --%>
+                    <%if (wms_published != null) {%>
+                        <jsp:include page="/WEB-INF/jsp/includes/display_wms_options_inc.jsp"></jsp:include>
+                    <%}%>
+                </div>
+            </td>
+            <td id="contentColumn">
+                 <%if (exceptionMessage != null){ %>
+                    <div class="errormsg" id="load_error">
+                        <bean-el:message key="<%=exceptionMessage.toString()%>"/>
+                        <p class="reload">
+                            <a href="<%=response.encodeURL("describe.do?uid="+System.currentTimeMillis())%>" title="<bean:message key="application.reload"/>">
+                                <bean:message key="application.reload"/>
+                            </a>
+                        </p>
+                    </div>
+                 <%}%>
+                <%if (sessionException != null){ %>
+                    <div class="errormsg" id="load_error">
+                        <bean-el:message key="<%=sessionException.toString()%>"/>
+                    </div>
+                 <%}%>
+                <%if (chart != null) {%>
+                <%-- render chart options if existing for this state --%>
+                <jsp:include page="includes/display_diagramm_inc.jsp"></jsp:include>
+                <%}%>
+
+                <%-- render statistic --%>
+                <%if (statistic != null) {%>
+                    <jsp:include page="includes/display_diagramm_statistics_inc.jsp"></jsp:include>
+                <%}%>
+
+                <%-- render histogram --%>
+                <%if (histogram != null) {%>
+                    <jsp:include page="includes/display_histogram_inc.jsp"></jsp:include>
+                <%}%>
+
+                <%-- render wms layer --%>
+                <%if (wms_published != null) {%>
+                    <jsp:include page="includes/display_map_inc.jsp"></jsp:include>
+                <%}%>
+            </td>
+        </tr>
+    </table>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/info.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,69 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%@ page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
+<%@ page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%@ page import="java.util.Locale"%>
+
+<%
+    SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
+    Locale locale   = sm.getCurrentLocale();
+%>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <head>
+        <title>
+            <bean:message key="gnviewer.app.title"/>
+        </title>
+        <link href="styles/gnv.css" rel="stylesheet" type="text/css"/>
+    </head>
+
+    <body id="gnviewerbody">
+        <div id="page">
+            <div id="headline">
+                <h1 class="headline">BSH Generischer Viewer</h1>
+            </div>
+
+            <br/>
+
+            <div id="headerElement">
+                <table class="headerTableLinks">
+                    <tr>
+                        <td align="left"></td>
+                        <td align="right">
+                            <html:link styleClass="headerLineLinks" page="/start.do"><bean:message key="gnviewer.header.restart"/></html:link>
+                            <font size="1.5em" color="white">&middot;</font>
+                            <html:link styleClass="headerLineLinks" page="/info.do"><bean:message key="gnviewer.header.info"/></html:link>
+                        </td>
+                    </tr>
+                </table>
+            </div>
+            <div id="contentElement" class="contentElement">
+            <%
+                if (locale.getLanguage().equals(Locale.GERMAN.getLanguage())) {
+            %>
+                    <jsp:include page="/WEB-INF/jsp/includes/info_german.jsp" />
+            <%
+                }
+                else {
+            %>
+                    <jsp:include page="/WEB-INF/jsp/includes/info_english.jsp" />
+            <%
+                }
+            %>
+             </div>
+             <div id="footerElement">
+                <jsp:include page="footer.jsp" />
+            </div>
+        </div>
+    </body>
+</html>
--- a/gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/jsp/mainlayout.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -1,7 +1,16 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
-<html xhtml="true" locale="true">
+<html xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <title>
             <bean:message key="gnviewer.app.title"/>
@@ -13,7 +22,7 @@
         <meta http-equiv="pragma" content="no-cache"/>
         <meta http-equiv="cache-control" content="no-cache"/>
         <meta name="robots" content="noindex"/>
-        <link href="styles/default.css" rel="stylesheet" type="text/css"/>
+        <link href="styles/gnv.css" rel="stylesheet" type="text/css"/>
         <script type="text/javascript" src="scripts/gnviewer.js"></script>
         <script type="text/javascript">
             function copy_demo_wkt_line() {
@@ -28,22 +37,65 @@
               "20.6250 59.0349, " +
               "28.1250 60.2640)";
             }
+            function copy_demo_wkt_polygon() {
+              document.getElementById('mesh_polygon').value =
+"POLYGON ((" +
+"-1.5763 58.3616, " +
+" 0.7526 53.8428, " +
+" 4.2686 53.1972, " +
+" 7.9217 54.1441, " +
+" 7.6020 56.2959, " +
+"11.5747 57.2857, " +
+"10.4788 58.4908, " +
+" 4.2686 58.8996, " +
+" 0.0219 58.5768, " +
+"-1.5763 58.3616))";
+            }
+
+            function toggleBinType(toDeactivate) {
+                var ele = document.getElementById(toDeactivate);
+
+                if (ele != null) {
+                    ele.checked = false;
+                }
+            }
+
+function toggle(element) {
+    var ele = document.getElementById(element);
+    var vis = ele.style.visibility;
+    if (vis != "visible") {
+        ele.style.visibility = "visible";
+    }
+    else {
+        ele.style.visibility = "hidden";
+    }
+}
+
         </script>
     </head>
 
     <body id="gnviewerbody">
     <div id="overlay"></div>
-    <div style="width:100%;left:0;top:0;width:100%;height:100%;position:absolute">
+    <div style="width:100%;left:0;top:0;width:100%;height:100%;position:absolute;visibility:hidden;">
         <div id="overlayContent">
-            <p>
-                <bean:message key="gnviewer.productselection.overlay.title"/>
+            <bean:message key="gnviewer.productselection.overlay.title"/>
+            <p class="reload">
+                <a href="<%=response.encodeURL("describe.do?uid="+System.currentTimeMillis())%>" title="<bean:message key="application.reload"/>">
+                    <bean:message key="application.reload"/>
+                </a>
             </p>
         </div>
     </div>
     <div id="page">
-        <jsp:include page="header.jsp" />
-         <jsp:include page="index.jsp" />
-        <jsp:include page="footer.jsp" />
+        <div id="headerElement">
+            <jsp:include page="header.jsp" />
+        </div>
+        <div id="contentElement" class="contentElement">
+            <jsp:include page="index.jsp" />
+         </div>
+         <div id="footerElement">
+            <jsp:include page="footer.jsp" />
+        </div>
     </div>
     </body>
 </html>
--- a/gnv/src/main/webapp/WEB-INF/jsp/version.jsp	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/jsp/version.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -1,7 +1,16 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
 <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
-<html xhtml="true" locale="true">
+<html xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <title>
             <bean:message key="gnviewer.app.title"/>
@@ -42,4 +51,4 @@
         <jsp:include page="footer.jsp" />
     </div>
     </body>
-</html>
\ No newline at end of file
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/wmslayout.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <jsp:include page="/WEB-INF/jsp/includes/wms_header_inc.jsp" />
+    <body id="gnviewerbody">
+    <div id="overlay"></div>
+    <div style="width:100%;left:0;top:0;width:100%;height:100%;position:absolute;visibility:hidden;">
+        <div id="overlayContent">
+            <p>
+                <bean:message key="gnviewer.productselection.overlay.title"/>
+            </p>
+        </div>
+    </div>
+    <div id="page">
+        <div id="headerElement">
+            <jsp:include page="header.jsp" />
+        </div>
+        <div id="contentElement" class="contentElement">
+            <jsp:include page="index.jsp" />
+         </div>
+         <br/>
+         <div id="footerElement">
+            <jsp:include page="footer.jsp" />
+        </div>
+    </div>
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/WEB-INF/jsp/wmsstandalone.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,16 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<%--
+ Copyright (c) 2010 by Intevation GmbH
+
+ This program is free software under the LGPL (>=v2.1)
+ Read the file LGPL.txt coming with the software for details
+ or visit http://www.gnu.org/licenses/ if it does not exist.
+--%>
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+    <jsp:include page="/WEB-INF/jsp/includes/wms_header_inc.jsp" />
+    <body id="gnviewerbody">
+        <jsp:include page="/WEB-INF/jsp/includes/display_map_fullscreen_inc.jsp" />
+    </body>
+</html>
--- a/gnv/src/main/webapp/WEB-INF/web.xml	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/WEB-INF/web.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -15,13 +15,6 @@
             <param-value>/WEB-INF/config/struts-config.xml</param-value>
         </init-param>
         
-        <!--  The Log4J Configuration, relative to the Project-Folder,
-              which should be used in this Project.  -->
-        <init-param>
-            <param-name>de.intevation.gnv.servlet.log4j.configuration</param-name>
-            <param-value>WEB-INF/config/log4j.properties</param-value>
-        </init-param>
-        
         <!--  The Number of ArtifacDatabases which are configured in this Document. -->
         <init-param>
             <param-name>de.intevation.gnv.artifactdatabase.client.ArtifactDatabase.count</param-name>
Binary file gnv/src/main/webapp/images/arrow_refresh.png has changed
Binary file gnv/src/main/webapp/images/auswaehlen.png has changed
Binary file gnv/src/main/webapp/images/back_button.png has changed
Binary file gnv/src/main/webapp/images/bg_fieldset.gif has changed
Binary file gnv/src/main/webapp/images/bg_fieldset_ie6.gif has changed
Binary file gnv/src/main/webapp/images/chart_bar.png has changed
Binary file gnv/src/main/webapp/images/chart_curve.png has changed
Binary file gnv/src/main/webapp/images/choose.png has changed
Binary file gnv/src/main/webapp/images/data_export.png has changed
Binary file gnv/src/main/webapp/images/delete.png has changed
Binary file gnv/src/main/webapp/images/diagram_export.png has changed
Binary file gnv/src/main/webapp/images/disk.png has changed
Binary file gnv/src/main/webapp/images/img.gif has changed
Binary file gnv/src/main/webapp/images/laden.png has changed
Binary file gnv/src/main/webapp/images/list-item.gif has changed
Binary file gnv/src/main/webapp/images/load.png has changed
Binary file gnv/src/main/webapp/images/map_go.png has changed
Binary file gnv/src/main/webapp/images/ol/cloud-popup-relative.png has changed
Binary file gnv/src/main/webapp/images/ol/east-mini.png has changed
Binary file gnv/src/main/webapp/images/ol/feature_info_off.png has changed
Binary file gnv/src/main/webapp/images/ol/feature_info_on.png has changed
Binary file gnv/src/main/webapp/images/ol/folder-open.gif has changed
Binary file gnv/src/main/webapp/images/ol/folder.gif has changed
Binary file gnv/src/main/webapp/images/ol/leaf.gif has changed
Binary file gnv/src/main/webapp/images/ol/navigation_history.png has changed
Binary file gnv/src/main/webapp/images/ol/north-mini.png has changed
Binary file gnv/src/main/webapp/images/ol/pan_off.png has changed
Binary file gnv/src/main/webapp/images/ol/pan_on.png has changed
Binary file gnv/src/main/webapp/images/ol/slider.png has changed
Binary file gnv/src/main/webapp/images/ol/south-mini.png has changed
Binary file gnv/src/main/webapp/images/ol/tool-sprites.gif has changed
Binary file gnv/src/main/webapp/images/ol/west-mini.png has changed
Binary file gnv/src/main/webapp/images/ol/zoom-minus-mini.png has changed
Binary file gnv/src/main/webapp/images/ol/zoom-plus-mini.png has changed
Binary file gnv/src/main/webapp/images/ol/zoom-world-mini.png has changed
Binary file gnv/src/main/webapp/images/ol/zoom_box_off.png has changed
Binary file gnv/src/main/webapp/images/ol/zoom_box_on.png has changed
Binary file gnv/src/main/webapp/images/ol/zoombar.png has changed
Binary file gnv/src/main/webapp/images/pdf.png has changed
Binary file gnv/src/main/webapp/images/statistics.png has changed
Binary file gnv/src/main/webapp/images/stock_data-save.png has changed
Binary file gnv/src/main/webapp/images/svg.png has changed
Binary file gnv/src/main/webapp/images/tick.png has changed
--- a/gnv/src/main/webapp/scripts/calendar-de.js	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,129 +0,0 @@
-// ** I18N
-
-// Calendar DE language
-// Author: Jack (tR), <jack@jtr.de>
-// Encoding: any
-// Distributed under the same terms as the calendar itself.
-
-// For translators: please use UTF-8 if possible.  We strongly believe that
-// Unicode is the answer to a real internationalized world.  Also please
-// include your contact information in the header, as can be seen above.
-
-// full day names
-Calendar._DN = new Array
-("Sonntag",
- "Montag",
- "Dienstag",
- "Mittwoch",
- "Donnerstag",
- "Freitag",
- "Samstag",
- "Sonntag");
-
-// Please note that the following array of short day names (and the same goes
-// for short month names, _SMN) isn't absolutely necessary.  We give it here
-// for exemplification on how one can customize the short day names, but if
-// they are simply the first N letters of the full name you can simply say:
-//
-//   Calendar._SDN_len = N; // short day name length
-//   Calendar._SMN_len = N; // short month name length
-//
-// If N = 3 then this is not needed either since we assume a value of 3 if not
-// present, to be compatible with translation files that were written before
-// this feature.
-
-// short day names
-Calendar._SDN = new Array
-("So",
- "Mo",
- "Di",
- "Mi",
- "Do",
- "Fr",
- "Sa",
- "So");
- 
- // First day of the week. "0" means display Sunday first, "1" means display
-// Monday first, etc.
-Calendar._FD = 0;
- 
-
-// full month names
-Calendar._MN = new Array
-("Januar",
- "Februar",
- "M\u00e4rz",
- "April",
- "Mai",
- "Juni",
- "Juli",
- "August",
- "September",
- "Oktober",
- "November",
- "Dezember");
-
-// short month names
-Calendar._SMN = new Array
-("Jan",
- "Feb",
- "M\u00e4r",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Okt",
- "Nov",
- "Dez");
-
-// tooltips
-Calendar._TT = {};
-Calendar._TT["INFO"] = "\u00DCber dieses Kalendarmodul";
-
-Calendar._TT["ABOUT"] =
-"DHTML Date/Time Selector\n" +
-"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this ;-)
-"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
-"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
-"\n\n" +
-"Datum ausw\u00e4hlen:\n" +
-"- Benutzen Sie die \xab, \xbb Buttons um das Jahr zu w\u00e4hlen\n" +
-"- Benutzen Sie die " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " Buttons um den Monat zu w\u00e4hlen\n" +
-"- F\u00fcr eine Schnellauswahl halten Sie die Maustaste \u00fcber diesen Buttons fest.";
-Calendar._TT["ABOUT_TIME"] = "\n\n" +
-"Zeit ausw\u00e4hlen:\n" +
-"- Klicken Sie auf die Teile der Uhrzeit, um diese zu erh\u00F6hen\n" +
-"- oder klicken Sie mit festgehaltener Shift-Taste um diese zu verringern\n" +
-"- oder klicken und festhalten f\u00fcr Schnellauswahl.";
-
-Calendar._TT["TOGGLE"] = "Ersten Tag der Woche w\u00e4hlen";
-Calendar._TT["PREV_YEAR"] = "Voriges Jahr (Festhalten f\u00fcr Schnellauswahl)";
-Calendar._TT["PREV_MONTH"] = "Voriger Monat (Festhalten f\u00fcr Schnellauswahl)";
-Calendar._TT["GO_TODAY"] = "Heute ausw\u00e4hlen";
-Calendar._TT["NEXT_MONTH"] = "N\u00e4chst. Monat (Festhalten f\u00fcr Schnellauswahl)";
-Calendar._TT["NEXT_YEAR"] = "N\u00e4chst. Jahr (Festhalten f\u00fcr Schnellauswahl)";
-Calendar._TT["SEL_DATE"] = "Datum ausw\u00e4hlen";
-Calendar._TT["DRAG_TO_MOVE"] = "Zum Bewegen festhalten";
-Calendar._TT["PART_TODAY"] = " (Heute)";
-
-// the following is to inform that "%s" is to be the first day of week
-// %s will be replaced with the day name.
-Calendar._TT["DAY_FIRST"] = "Woche beginnt mit %s ";
-
-// This may be locale-dependent.  It specifies the week-end days, as an array
-// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
-// means Monday, etc.
-Calendar._TT["WEEKEND"] = "0,6";
-
-Calendar._TT["CLOSE"] = "Schlie\u00dfen";
-Calendar._TT["TODAY"] = "Heute";
-Calendar._TT["TIME_PART"] = "(Shift-)Klick oder Festhalten und Ziehen um den Wert zu \u00e4ndern";
-
-// date formats
-Calendar._TT["DEF_DATE_FORMAT"] = "%d.%m.%Y";
-Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
-
-Calendar._TT["WK"] = "wk";
-Calendar._TT["TIME"] = "Zeit:";
--- a/gnv/src/main/webapp/scripts/calendar-en.js	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-// ** I18N
-
-// Calendar EN language
-// Author: Mihai Bazon, <mihai_bazon@yahoo.com>
-// Encoding: any
-// Distributed under the same terms as the calendar itself.
-
-// For translators: please use UTF-8 if possible.  We strongly believe that
-// Unicode is the answer to a real internationalized world.  Also please
-// include your contact information in the header, as can be seen above.
-
-// full day names
-Calendar._DN = new Array
-("Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday",
- "Sunday");
-
-// Please note that the following array of short day names (and the same goes
-// for short month names, _SMN) isn't absolutely necessary.  We give it here
-// for exemplification on how one can customize the short day names, but if
-// they are simply the first N letters of the full name you can simply say:
-//
-//   Calendar._SDN_len = N; // short day name length
-//   Calendar._SMN_len = N; // short month name length
-//
-// If N = 3 then this is not needed either since we assume a value of 3 if not
-// present, to be compatible with translation files that were written before
-// this feature.
-
-// short day names
-Calendar._SDN = new Array
-("Sun",
- "Mon",
- "Tue",
- "Wed",
- "Thu",
- "Fri",
- "Sat",
- "Sun");
-
-// First day of the week. "0" means display Sunday first, "1" means display
-// Monday first, etc.
-Calendar._FD = 0;
-
-// full month names
-Calendar._MN = new Array
-("January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December");
-
-// short month names
-Calendar._SMN = new Array
-("Jan",
- "Feb",
- "Mar",
- "Apr",
- "May",
- "Jun",
- "Jul",
- "Aug",
- "Sep",
- "Oct",
- "Nov",
- "Dec");
-
-// tooltips
-Calendar._TT = {};
-Calendar._TT["INFO"] = "About the calendar";
-
-Calendar._TT["ABOUT"] =
-"DHTML Date/Time Selector\n" +
-"(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" + // don't translate this this ;-)
-"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
-"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
-"\n\n" +
-"Date selection:\n" +
-"- Use the \xab, \xbb buttons to select year\n" +
-"- Use the " + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + " buttons to select month\n" +
-"- Hold mouse button on any of the above buttons for faster selection.";
-Calendar._TT["ABOUT_TIME"] = "\n\n" +
-"Time selection:\n" +
-"- Click on any of the time parts to increase it\n" +
-"- or Shift-click to decrease it\n" +
-"- or click and drag for faster selection.";
-
-Calendar._TT["PREV_YEAR"] = "Prev. year (hold for menu)";
-Calendar._TT["PREV_MONTH"] = "Prev. month (hold for menu)";
-Calendar._TT["GO_TODAY"] = "Go Today";
-Calendar._TT["NEXT_MONTH"] = "Next month (hold for menu)";
-Calendar._TT["NEXT_YEAR"] = "Next year (hold for menu)";
-Calendar._TT["SEL_DATE"] = "Select date";
-Calendar._TT["DRAG_TO_MOVE"] = "Drag to move";
-Calendar._TT["PART_TODAY"] = " (today)";
-
-// the following is to inform that "%s" is to be the first day of week
-// %s will be replaced with the day name.
-Calendar._TT["DAY_FIRST"] = "Display %s first";
-
-// This may be locale-dependent.  It specifies the week-end days, as an array
-// of comma-separated numbers.  The numbers are from 0 to 6: 0 means Sunday, 1
-// means Monday, etc.
-Calendar._TT["WEEKEND"] = "0,6";
-
-Calendar._TT["CLOSE"] = "Close";
-Calendar._TT["TODAY"] = "Today";
-Calendar._TT["TIME_PART"] = "(Shift-)Click or drag to change value";
-
-// date formats
-Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";
-Calendar._TT["TT_DATE_FORMAT"] = "%a, %b %e";
-
-Calendar._TT["WK"] = "wk";
-Calendar._TT["TIME"] = "Time:";
--- a/gnv/src/main/webapp/scripts/calendar-setup.js	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/*  Copyright Mihai Bazon, 2002, 2003  |  http://dynarch.com/mishoo/
- * ---------------------------------------------------------------------------
- *
- * The DHTML Calendar
- *
- * Details and latest version at:
- * http://dynarch.com/mishoo/calendar.epl
- *
- * This script is distributed under the GNU Lesser General Public License.
- * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
- *
- * This file defines helper functions for setting up the calendar.  They are
- * intended to help non-programmers get a working calendar on their site
- * quickly.  This script should not be seen as part of the calendar.  It just
- * shows you what one can do with the calendar, while in the same time
- * providing a quick and simple method for setting it up.  If you need
- * exhaustive customization of the calendar creation process feel free to
- * modify this code to suit your needs (this is recommended and much better
- * than modifying calendar.js itself).
- */
-
-// $Id: calendar-setup.js,v 1.1 2007/12/06 13:55:16 drewnak Exp $
-
-/**
- *  This function "patches" an input field (or other element) to use a calendar
- *  widget for date selection.
- *
- *  The "params" is a single object that can have the following properties:
- *
- *    prop. name   | description
- *  -------------------------------------------------------------------------------------------------
- *   inputField    | the ID of an input field to store the date
- *   displayArea   | the ID of a DIV or other element to show the date
- *   button        | ID of a button or other element that will trigger the calendar
- *   eventName     | event that will trigger the calendar, without the "on" prefix (default: "click")
- *   ifFormat      | date format that will be stored in the input field
- *   daFormat      | the date format that will be used to display the date in displayArea
- *   singleClick   | (true/false) wether the calendar is in single click mode or not (default: true)
- *   firstDay      | numeric: 0 to 6.  "0" means display Sunday first, "1" means display Monday first, etc.
- *   align         | alignment (default: "Br"); if you don't know what's this see the calendar documentation
- *   range         | array with 2 elements.  Default: [1900, 2999] -- the range of years available
- *   weekNumbers   | (true/false) if it's true (default) the calendar will display week numbers
- *   flat          | null or element ID; if not null the calendar will be a flat calendar having the parent with the given ID
- *   flatCallback  | function that receives a JS Date object and returns an URL to point the browser to (for flat calendar)
- *   disableFunc   | function that receives a JS Date object and should return true if that date has to be disabled in the calendar
- *   onSelect      | function that gets called when a date is selected.  You don't _have_ to supply this (the default is generally okay)
- *   onClose       | function that gets called when the calendar is closed.  [default]
- *   onUpdate      | function that gets called after the date is updated in the input field.  Receives a reference to the calendar.
- *   date          | the date that the calendar will be initially displayed to
- *   showsTime     | default: false; if true the calendar will include a time selector
- *   timeFormat    | the time format; can be "12" or "24", default is "12"
- *   electric      | if true (default) then given fields/date areas are updated for each move; otherwise they're updated only on close
- *   step          | configures the step of the years in drop-down boxes; default: 2
- *   position      | configures the calendar absolute position; default: null
- *   cache         | if "true" (but default: "false") it will reuse the same calendar object, where possible
- *   showOthers    | if "true" (but default: "false") it will show days from other months too
- *
- *  None of them is required, they all have default values.  However, if you
- *  pass none of "inputField", "displayArea" or "button" you'll get a warning
- *  saying "nothing to setup".
- */
-Calendar.setup = function (params) {
-	function param_default(pname, def) { if (typeof params[pname] == "undefined") { params[pname] = def; } };
-
-	param_default("inputField",     null);
-	param_default("displayArea",    null);
-	param_default("button",         null);
-	param_default("eventName",      "click");
-	param_default("ifFormat",       "%Y/%m/%d");
-	param_default("daFormat",       "%Y/%m/%d");
-	param_default("singleClick",    true);
-	param_default("disableFunc",    null);
-	param_default("dateStatusFunc", params["disableFunc"]);	// takes precedence if both are defined
-	param_default("dateText",       null);
-	param_default("firstDay",       null);
-	param_default("align",          "Br");
-	param_default("range",          [1900, 2999]);
-	param_default("weekNumbers",    true);
-	param_default("flat",           null);
-	param_default("flatCallback",   null);
-	param_default("onSelect",       null);
-	param_default("onClose",        null);
-	param_default("onUpdate",       null);
-	param_default("date",           null);
-	param_default("showsTime",      false);
-	param_default("timeFormat",     "24");
-	param_default("electric",       true);
-	param_default("step",           2);
-	param_default("position",       null);
-	param_default("cache",          false);
-	param_default("showOthers",     false);
-	param_default("multiple",       null);
-
-	var tmp = ["inputField", "displayArea", "button"];
-	for (var i in tmp) {
-		if (typeof params[tmp[i]] == "string") {
-			params[tmp[i]] = document.getElementById(params[tmp[i]]);
-		}
-	}
-	if (!(params.flat || params.multiple || params.inputField || params.displayArea || params.button)) {
-		alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");
-		return false;
-	}
-
-	function onSelect(cal) {
-		var p = cal.params;
-		var update = (cal.dateClicked || p.electric);
-		if (update && p.inputField) {
-			p.inputField.value = cal.date.print(p.ifFormat);
-			if (typeof p.inputField.onchange == "function")
-				p.inputField.onchange();
-		}
-		if (update && p.displayArea)
-			p.displayArea.innerHTML = cal.date.print(p.daFormat);
-		if (update && typeof p.onUpdate == "function")
-			p.onUpdate(cal);
-		if (update && p.flat) {
-			if (typeof p.flatCallback == "function")
-				p.flatCallback(cal);
-		}
-		if (update && p.singleClick && cal.dateClicked)
-			cal.callCloseHandler();
-	};
-
-	if (params.flat != null) {
-		if (typeof params.flat == "string")
-			params.flat = document.getElementById(params.flat);
-		if (!params.flat) {
-			alert("Calendar.setup:\n  Flat specified but can't find parent.");
-			return false;
-		}
-		var cal = new Calendar(params.firstDay, params.date, params.onSelect || onSelect);
-		cal.showsOtherMonths = params.showOthers;
-		cal.showsTime = params.showsTime;
-		cal.time24 = (params.timeFormat == "24");
-		cal.params = params;
-		cal.weekNumbers = params.weekNumbers;
-		cal.setRange(params.range[0], params.range[1]);
-		cal.setDateStatusHandler(params.dateStatusFunc);
-		cal.getDateText = params.dateText;
-		if (params.ifFormat) {
-			cal.setDateFormat(params.ifFormat);
-		}
-		if (params.inputField && typeof params.inputField.value == "string") {
-			cal.parseDate(params.inputField.value);
-		}
-		cal.create(params.flat);
-		cal.show();
-		return false;
-	}
-
-	var triggerEl = params.button || params.displayArea || params.inputField;
-	triggerEl["on" + params.eventName] = function() {
-		var dateEl = params.inputField || params.displayArea;
-		var dateFmt = params.inputField ? params.ifFormat : params.daFormat;
-		var mustCreate = false;
-		var cal = window.calendar;
-		if (dateEl)
-			params.date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt);
-		if (!(cal && params.cache)) {
-			window.calendar = cal = new Calendar(params.firstDay,
-							     params.date,
-							     params.onSelect || onSelect,
-							     params.onClose || function(cal) { cal.hide(); });
-			cal.showsTime = params.showsTime;
-			cal.time24 = (params.timeFormat == "24");
-			cal.weekNumbers = params.weekNumbers;
-			mustCreate = true;
-		} else {
-			if (params.date)
-				cal.setDate(params.date);
-			cal.hide();
-		}
-		if (params.multiple) {
-			cal.multiple = {};
-			for (var i = params.multiple.length; --i >= 0;) {
-				var d = params.multiple[i];
-				var ds = d.print("%Y%m%d");
-				cal.multiple[ds] = d;
-			}
-		}
-		cal.showsOtherMonths = params.showOthers;
-		cal.yearStep = params.step;
-		cal.setRange(params.range[0], params.range[1]);
-		cal.params = params;
-		cal.setDateStatusHandler(params.dateStatusFunc);
-		cal.getDateText = params.dateText;
-		cal.setDateFormat(dateFmt);
-		if (mustCreate)
-			cal.create();
-		cal.refresh();
-		if (!params.position)
-			cal.showAtElement(params.button || params.displayArea || params.inputField, params.align);
-		else
-			cal.showAt(params.position[0], params.position[1]);
-		return false;
-	};
-
-	return cal;
-};
--- a/gnv/src/main/webapp/scripts/calendar-setup_stripped.js	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,21 +0,0 @@
-/*  Copyright Mihai Bazon, 2002, 2003  |  http://dynarch.com/mishoo/
- * ---------------------------------------------------------------------------
- *
- * The DHTML Calendar
- *
- * Details and latest version at:
- * http://dynarch.com/mishoo/calendar.epl
- *
- * This script is distributed under the GNU Lesser General Public License.
- * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
- *
- * This file defines helper functions for setting up the calendar.  They are
- * intended to help non-programmers get a working calendar on their site
- * quickly.  This script should not be seen as part of the calendar.  It just
- * shows you what one can do with the calendar, while in the same time
- * providing a quick and simple method for setting it up.  If you need
- * exhaustive customization of the calendar creation process feel free to
- * modify this code to suit your needs (this is recommended and much better
- * than modifying calendar.js itself).
- */
- Calendar.setup=function(params){function param_default(pname,def){if(typeof params[pname]=="undefined"){params[pname]=def;}};param_default("inputField",null);param_default("displayArea",null);param_default("button",null);param_default("eventName","click");param_default("ifFormat","%Y/%m/%d");param_default("daFormat","%Y/%m/%d");param_default("singleClick",true);param_default("disableFunc",null);param_default("dateStatusFunc",params["disableFunc"]);param_default("dateText",null);param_default("firstDay",null);param_default("align","Br");param_default("range",[1900,2999]);param_default("weekNumbers",true);param_default("flat",null);param_default("flatCallback",null);param_default("onSelect",null);param_default("onClose",null);param_default("onUpdate",null);param_default("date",null);param_default("showsTime",false);param_default("timeFormat","24");param_default("electric",true);param_default("step",2);param_default("position",null);param_default("cache",false);param_default("showOthers",false);param_default("multiple",null);var tmp=["inputField","displayArea","button"];for(var i in tmp){if(typeof params[tmp[i]]=="string"){params[tmp[i]]=document.getElementById(params[tmp[i]]);}}if(!(params.flat||params.multiple||params.inputField||params.displayArea||params.button)){alert("Calendar.setup:\n  Nothing to setup (no fields found).  Please check your code");return false;}function onSelect(cal){var p=cal.params;var update=(cal.dateClicked||p.electric);if(update&&p.inputField){p.inputField.value=cal.date.print(p.ifFormat);if(typeof p.inputField.onchange=="function")p.inputField.onchange();}if(update&&p.displayArea)p.displayArea.innerHTML=cal.date.print(p.daFormat);if(update&&typeof p.onUpdate=="function")p.onUpdate(cal);if(update&&p.flat){if(typeof p.flatCallback=="function")p.flatCallback(cal);}if(update&&p.singleClick&&cal.dateClicked)cal.callCloseHandler();};if(params.flat!=null){if(typeof params.flat=="string")params.flat=document.getElementById(params.flat);if(!params.flat){alert("Calendar.setup:\n  Flat specified but can't find parent.");return false;}var cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect);cal.showsOtherMonths=params.showOthers;cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.params=params;cal.weekNumbers=params.weekNumbers;cal.setRange(params.range[0],params.range[1]);cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;if(params.ifFormat){cal.setDateFormat(params.ifFormat);}if(params.inputField&&typeof params.inputField.value=="string"){cal.parseDate(params.inputField.value);}cal.create(params.flat);cal.show();return false;}var triggerEl=params.button||params.displayArea||params.inputField;triggerEl["on"+params.eventName]=function(){var dateEl=params.inputField||params.displayArea;var dateFmt=params.inputField?params.ifFormat:params.daFormat;var mustCreate=false;var cal=window.calendar;if(dateEl)params.date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt);if(!(cal&&params.cache)){window.calendar=cal=new Calendar(params.firstDay,params.date,params.onSelect||onSelect,params.onClose||function(cal){cal.hide();});cal.showsTime=params.showsTime;cal.time24=(params.timeFormat=="24");cal.weekNumbers=params.weekNumbers;mustCreate=true;}else{if(params.date)cal.setDate(params.date);cal.hide();}if(params.multiple){cal.multiple={};for(var i=params.multiple.length;--i>=0;){var d=params.multiple[i];var ds=d.print("%Y%m%d");cal.multiple[ds]=d;}}cal.showsOtherMonths=params.showOthers;cal.yearStep=params.step;cal.setRange(params.range[0],params.range[1]);cal.params=params;cal.setDateStatusHandler(params.dateStatusFunc);cal.getDateText=params.dateText;cal.setDateFormat(dateFmt);if(mustCreate)cal.create();cal.refresh();if(!params.position)cal.showAtElement(params.button||params.displayArea||params.inputField,params.align);else cal.showAt(params.position[0],params.position[1]);return false;};return cal;};
\ No newline at end of file
--- a/gnv/src/main/webapp/scripts/calendar.js	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1806 +0,0 @@
-/*  Copyright Mihai Bazon, 2002-2005  |  www.bazon.net/mishoo
- * -----------------------------------------------------------
- *
- * The DHTML Calendar, version 1.0 "It is happening again"
- *
- * Details and latest version at:
- * www.dynarch.com/projects/calendar
- *
- * This script is developed by Dynarch.com.  Visit us at www.dynarch.com.
- *
- * This script is distributed under the GNU Lesser General Public License.
- * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
- */
-
-// $Id: calendar.js,v 1.1 2007/12/06 13:55:16 drewnak Exp $
-
-/** The Calendar object constructor. */
-Calendar = function (firstDayOfWeek, dateStr, onSelected, onClose) {
-	// member variables
-	this.activeDiv = null;
-	this.currentDateEl = null;
-	this.getDateStatus = null;
-	this.getDateToolTip = null;
-	this.getDateText = null;
-	this.timeout = null;
-	this.onSelected = onSelected || null;
-	this.onClose = onClose || null;
-	this.dragging = false;
-	this.hidden = false;
-	this.minYear = 1970;
-	this.maxYear = 2050;
-	this.dateFormat = Calendar._TT["DEF_DATE_FORMAT"];
-	this.ttDateFormat = Calendar._TT["TT_DATE_FORMAT"];
-	this.isPopup = true;
-	this.weekNumbers = true;
-	this.firstDayOfWeek = typeof firstDayOfWeek == "number" ? firstDayOfWeek : Calendar._FD; // 0 for Sunday, 1 for Monday, etc.
-	this.showsOtherMonths = false;
-	this.dateStr = dateStr;
-	this.ar_days = null;
-	this.showsTime = false;
-	this.time24 = true;
-	this.yearStep = 2;
-	this.hiliteToday = true;
-	this.multiple = null;
-	// HTML elements
-	this.table = null;
-	this.element = null;
-	this.tbody = null;
-	this.firstdayname = null;
-	// Combo boxes
-	this.monthsCombo = null;
-	this.yearsCombo = null;
-	this.hilitedMonth = null;
-	this.activeMonth = null;
-	this.hilitedYear = null;
-	this.activeYear = null;
-	// Information
-	this.dateClicked = false;
-
-	// one-time initializations
-	if (typeof Calendar._SDN == "undefined") {
-		// table of short day names
-		if (typeof Calendar._SDN_len == "undefined")
-			Calendar._SDN_len = 3;
-		var ar = new Array();
-		for (var i = 8; i > 0;) {
-			ar[--i] = Calendar._DN[i].substr(0, Calendar._SDN_len);
-		}
-		Calendar._SDN = ar;
-		// table of short month names
-		if (typeof Calendar._SMN_len == "undefined")
-			Calendar._SMN_len = 3;
-		ar = new Array();
-		for (var i = 12; i > 0;) {
-			ar[--i] = Calendar._MN[i].substr(0, Calendar._SMN_len);
-		}
-		Calendar._SMN = ar;
-	}
-};
-
-// ** constants
-
-/// "static", needed for event handlers.
-Calendar._C = null;
-
-/// detect a special case of "web browser"
-Calendar.is_ie = ( /msie/i.test(navigator.userAgent) &&
-		   !/opera/i.test(navigator.userAgent) );
-
-Calendar.is_ie5 = ( Calendar.is_ie && /msie 5\.0/i.test(navigator.userAgent) );
-
-/// detect Opera browser
-Calendar.is_opera = /opera/i.test(navigator.userAgent);
-
-/// detect KHTML-based browsers
-Calendar.is_khtml = /Konqueror|Safari|KHTML/i.test(navigator.userAgent);
-
-// BEGIN: UTILITY FUNCTIONS; beware that these might be moved into a separate
-//        library, at some point.
-
-Calendar.getAbsolutePos = function(el) {
-	var SL = 0, ST = 0;
-	var is_div = /^div$/i.test(el.tagName);
-	if (is_div && el.scrollLeft)
-		SL = el.scrollLeft;
-	if (is_div && el.scrollTop)
-		ST = el.scrollTop;
-	var r = { x: el.offsetLeft - SL, y: el.offsetTop - ST };
-	if (el.offsetParent) {
-		var tmp = this.getAbsolutePos(el.offsetParent);
-		r.x += tmp.x;
-		r.y += tmp.y;
-	}
-	return r;
-};
-
-Calendar.isRelated = function (el, evt) {
-	var related = evt.relatedTarget;
-	if (!related) {
-		var type = evt.type;
-		if (type == "mouseover") {
-			related = evt.fromElement;
-		} else if (type == "mouseout") {
-			related = evt.toElement;
-		}
-	}
-	while (related) {
-		if (related == el) {
-			return true;
-		}
-		related = related.parentNode;
-	}
-	return false;
-};
-
-Calendar.removeClass = function(el, className) {
-	if (!(el && el.className)) {
-		return;
-	}
-	var cls = el.className.split(" ");
-	var ar = new Array();
-	for (var i = cls.length; i > 0;) {
-		if (cls[--i] != className) {
-			ar[ar.length] = cls[i];
-		}
-	}
-	el.className = ar.join(" ");
-};
-
-Calendar.addClass = function(el, className) {
-	Calendar.removeClass(el, className);
-	el.className += " " + className;
-};
-
-// FIXME: the following 2 functions totally suck, are useless and should be replaced immediately.
-Calendar.getElement = function(ev) {
-	var f = Calendar.is_ie ? window.event.srcElement : ev.currentTarget;
-	while (f.nodeType != 1 || /^div$/i.test(f.tagName))
-		f = f.parentNode;
-	return f;
-};
-
-Calendar.getTargetElement = function(ev) {
-	var f = Calendar.is_ie ? window.event.srcElement : ev.target;
-	while (f.nodeType != 1)
-		f = f.parentNode;
-	return f;
-};
-
-Calendar.stopEvent = function(ev) {
-	ev || (ev = window.event);
-	if (Calendar.is_ie) {
-		ev.cancelBubble = true;
-		ev.returnValue = false;
-	} else {
-		ev.preventDefault();
-		ev.stopPropagation();
-	}
-	return false;
-};
-
-Calendar.addEvent = function(el, evname, func) {
-	if (el.attachEvent) { // IE
-		el.attachEvent("on" + evname, func);
-	} else if (el.addEventListener) { // Gecko / W3C
-		el.addEventListener(evname, func, true);
-	} else {
-		el["on" + evname] = func;
-	}
-};
-
-Calendar.removeEvent = function(el, evname, func) {
-	if (el.detachEvent) { // IE
-		el.detachEvent("on" + evname, func);
-	} else if (el.removeEventListener) { // Gecko / W3C
-		el.removeEventListener(evname, func, true);
-	} else {
-		el["on" + evname] = null;
-	}
-};
-
-Calendar.createElement = function(type, parent) {
-	var el = null;
-	if (document.createElementNS) {
-		// use the XHTML namespace; IE won't normally get here unless
-		// _they_ "fix" the DOM2 implementation.
-		el = document.createElementNS("http://www.w3.org/1999/xhtml", type);
-	} else {
-		el = document.createElement(type);
-	}
-	if (typeof parent != "undefined") {
-		parent.appendChild(el);
-	}
-	return el;
-};
-
-// END: UTILITY FUNCTIONS
-
-// BEGIN: CALENDAR STATIC FUNCTIONS
-
-/** Internal -- adds a set of events to make some element behave like a button. */
-Calendar._add_evs = function(el) {
-	with (Calendar) {
-		addEvent(el, "mouseover", dayMouseOver);
-		addEvent(el, "mousedown", dayMouseDown);
-		addEvent(el, "mouseout", dayMouseOut);
-		if (is_ie) {
-			addEvent(el, "dblclick", dayMouseDblClick);
-			el.setAttribute("unselectable", true);
-		}
-	}
-};
-
-Calendar.findMonth = function(el) {
-	if (typeof el.month != "undefined") {
-		return el;
-	} else if (typeof el.parentNode.month != "undefined") {
-		return el.parentNode;
-	}
-	return null;
-};
-
-Calendar.findYear = function(el) {
-	if (typeof el.year != "undefined") {
-		return el;
-	} else if (typeof el.parentNode.year != "undefined") {
-		return el.parentNode;
-	}
-	return null;
-};
-
-Calendar.showMonthsCombo = function () {
-	var cal = Calendar._C;
-	if (!cal) {
-		return false;
-	}
-	var cal = cal;
-	var cd = cal.activeDiv;
-	var mc = cal.monthsCombo;
-	if (cal.hilitedMonth) {
-		Calendar.removeClass(cal.hilitedMonth, "hilite");
-	}
-	if (cal.activeMonth) {
-		Calendar.removeClass(cal.activeMonth, "active");
-	}
-	var mon = cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];
-	Calendar.addClass(mon, "active");
-	cal.activeMonth = mon;
-	var s = mc.style;
-	s.display = "block";
-	if (cd.navtype < 0)
-		s.left = cd.offsetLeft + "px";
-	else {
-		var mcw = mc.offsetWidth;
-		if (typeof mcw == "undefined")
-			// Konqueror brain-dead techniques
-			mcw = 50;
-		s.left = (cd.offsetLeft + cd.offsetWidth - mcw) + "px";
-	}
-	s.top = (cd.offsetTop + cd.offsetHeight) + "px";
-};
-
-Calendar.showYearsCombo = function (fwd) {
-	var cal = Calendar._C;
-	if (!cal) {
-		return false;
-	}
-	var cal = cal;
-	var cd = cal.activeDiv;
-	var yc = cal.yearsCombo;
-	if (cal.hilitedYear) {
-		Calendar.removeClass(cal.hilitedYear, "hilite");
-	}
-	if (cal.activeYear) {
-		Calendar.removeClass(cal.activeYear, "active");
-	}
-	cal.activeYear = null;
-	var Y = cal.date.getFullYear() + (fwd ? 1 : -1);
-	var yr = yc.firstChild;
-	var show = false;
-	for (var i = 12; i > 0; --i) {
-		if (Y >= cal.minYear && Y <= cal.maxYear) {
-			yr.innerHTML = Y;
-			yr.year = Y;
-			yr.style.display = "block";
-			show = true;
-		} else {
-			yr.style.display = "none";
-		}
-		yr = yr.nextSibling;
-		Y += fwd ? cal.yearStep : -cal.yearStep;
-	}
-	if (show) {
-		var s = yc.style;
-		s.display = "block";
-		if (cd.navtype < 0)
-			s.left = cd.offsetLeft + "px";
-		else {
-			var ycw = yc.offsetWidth;
-			if (typeof ycw == "undefined")
-				// Konqueror brain-dead techniques
-				ycw = 50;
-			s.left = (cd.offsetLeft + cd.offsetWidth - ycw) + "px";
-		}
-		s.top = (cd.offsetTop + cd.offsetHeight) + "px";
-	}
-};
-
-// event handlers
-
-Calendar.tableMouseUp = function(ev) {
-	var cal = Calendar._C;
-	if (!cal) {
-		return false;
-	}
-	if (cal.timeout) {
-		clearTimeout(cal.timeout);
-	}
-	var el = cal.activeDiv;
-	if (!el) {
-		return false;
-	}
-	var target = Calendar.getTargetElement(ev);
-	ev || (ev = window.event);
-	Calendar.removeClass(el, "active");
-	if (target == el || target.parentNode == el) {
-		Calendar.cellClick(el, ev);
-	}
-	var mon = Calendar.findMonth(target);
-	var date = null;
-	if (mon) {
-		date = new Date(cal.date);
-		if (mon.month != date.getMonth()) {
-			date.setMonth(mon.month);
-			cal.setDate(date);
-			cal.dateClicked = false;
-			cal.callHandler();
-		}
-	} else {
-		var year = Calendar.findYear(target);
-		if (year) {
-			date = new Date(cal.date);
-			if (year.year != date.getFullYear()) {
-				date.setFullYear(year.year);
-				cal.setDate(date);
-				cal.dateClicked = false;
-				cal.callHandler();
-			}
-		}
-	}
-	with (Calendar) {
-		removeEvent(document, "mouseup", tableMouseUp);
-		removeEvent(document, "mouseover", tableMouseOver);
-		removeEvent(document, "mousemove", tableMouseOver);
-		cal._hideCombos();
-		_C = null;
-		return stopEvent(ev);
-	}
-};
-
-Calendar.tableMouseOver = function (ev) {
-	var cal = Calendar._C;
-	if (!cal) {
-		return;
-	}
-	var el = cal.activeDiv;
-	var target = Calendar.getTargetElement(ev);
-	if (target == el || target.parentNode == el) {
-		Calendar.addClass(el, "hilite active");
-		Calendar.addClass(el.parentNode, "rowhilite");
-	} else {
-		if (typeof el.navtype == "undefined" || (el.navtype != 50 && (el.navtype == 0 || Math.abs(el.navtype) > 2)))
-			Calendar.removeClass(el, "active");
-		Calendar.removeClass(el, "hilite");
-		Calendar.removeClass(el.parentNode, "rowhilite");
-	}
-	ev || (ev = window.event);
-	if (el.navtype == 50 && target != el) {
-		var pos = Calendar.getAbsolutePos(el);
-		var w = el.offsetWidth;
-		var x = ev.clientX;
-		var dx;
-		var decrease = true;
-		if (x > pos.x + w) {
-			dx = x - pos.x - w;
-			decrease = false;
-		} else
-			dx = pos.x - x;
-
-		if (dx < 0) dx = 0;
-		var range = el._range;
-		var current = el._current;
-		var count = Math.floor(dx / 10) % range.length;
-		for (var i = range.length; --i >= 0;)
-			if (range[i] == current)
-				break;
-		while (count-- > 0)
-			if (decrease) {
-				if (--i < 0)
-					i = range.length - 1;
-			} else if ( ++i >= range.length )
-				i = 0;
-		var newval = range[i];
-		el.innerHTML = newval;
-
-		cal.onUpdateTime();
-	}
-	var mon = Calendar.findMonth(target);
-	if (mon) {
-		if (mon.month != cal.date.getMonth()) {
-			if (cal.hilitedMonth) {
-				Calendar.removeClass(cal.hilitedMonth, "hilite");
-			}
-			Calendar.addClass(mon, "hilite");
-			cal.hilitedMonth = mon;
-		} else if (cal.hilitedMonth) {
-			Calendar.removeClass(cal.hilitedMonth, "hilite");
-		}
-	} else {
-		if (cal.hilitedMonth) {
-			Calendar.removeClass(cal.hilitedMonth, "hilite");
-		}
-		var year = Calendar.findYear(target);
-		if (year) {
-			if (year.year != cal.date.getFullYear()) {
-				if (cal.hilitedYear) {
-					Calendar.removeClass(cal.hilitedYear, "hilite");
-				}
-				Calendar.addClass(year, "hilite");
-				cal.hilitedYear = year;
-			} else if (cal.hilitedYear) {
-				Calendar.removeClass(cal.hilitedYear, "hilite");
-			}
-		} else if (cal.hilitedYear) {
-			Calendar.removeClass(cal.hilitedYear, "hilite");
-		}
-	}
-	return Calendar.stopEvent(ev);
-};
-
-Calendar.tableMouseDown = function (ev) {
-	if (Calendar.getTargetElement(ev) == Calendar.getElement(ev)) {
-		return Calendar.stopEvent(ev);
-	}
-};
-
-Calendar.calDragIt = function (ev) {
-	var cal = Calendar._C;
-	if (!(cal && cal.dragging)) {
-		return false;
-	}
-	var posX;
-	var posY;
-	if (Calendar.is_ie) {
-		posY = window.event.clientY + document.body.scrollTop;
-		posX = window.event.clientX + document.body.scrollLeft;
-	} else {
-		posX = ev.pageX;
-		posY = ev.pageY;
-	}
-	cal.hideShowCovered();
-	var st = cal.element.style;
-	st.left = (posX - cal.xOffs) + "px";
-	st.top = (posY - cal.yOffs) + "px";
-	return Calendar.stopEvent(ev);
-};
-
-Calendar.calDragEnd = function (ev) {
-	var cal = Calendar._C;
-	if (!cal) {
-		return false;
-	}
-	cal.dragging = false;
-	with (Calendar) {
-		removeEvent(document, "mousemove", calDragIt);
-		removeEvent(document, "mouseup", calDragEnd);
-		tableMouseUp(ev);
-	}
-	cal.hideShowCovered();
-};
-
-Calendar.dayMouseDown = function(ev) {
-	var el = Calendar.getElement(ev);
-	if (el.disabled) {
-		return false;
-	}
-	var cal = el.calendar;
-	cal.activeDiv = el;
-	Calendar._C = cal;
-	if (el.navtype != 300) with (Calendar) {
-		if (el.navtype == 50) {
-			el._current = el.innerHTML;
-			addEvent(document, "mousemove", tableMouseOver);
-		} else
-			addEvent(document, Calendar.is_ie5 ? "mousemove" : "mouseover", tableMouseOver);
-		addClass(el, "hilite active");
-		addEvent(document, "mouseup", tableMouseUp);
-	} else if (cal.isPopup) {
-		cal._dragStart(ev);
-	}
-	if (el.navtype == -1 || el.navtype == 1) {
-		if (cal.timeout) clearTimeout(cal.timeout);
-		cal.timeout = setTimeout("Calendar.showMonthsCombo()", 250);
-	} else if (el.navtype == -2 || el.navtype == 2) {
-		if (cal.timeout) clearTimeout(cal.timeout);
-		cal.timeout = setTimeout((el.navtype > 0) ? "Calendar.showYearsCombo(true)" : "Calendar.showYearsCombo(false)", 250);
-	} else {
-		cal.timeout = null;
-	}
-	return Calendar.stopEvent(ev);
-};
-
-Calendar.dayMouseDblClick = function(ev) {
-	Calendar.cellClick(Calendar.getElement(ev), ev || window.event);
-	if (Calendar.is_ie) {
-		document.selection.empty();
-	}
-};
-
-Calendar.dayMouseOver = function(ev) {
-	var el = Calendar.getElement(ev);
-	if (Calendar.isRelated(el, ev) || Calendar._C || el.disabled) {
-		return false;
-	}
-	if (el.ttip) {
-		if (el.ttip.substr(0, 1) == "_") {
-			el.ttip = el.caldate.print(el.calendar.ttDateFormat) + el.ttip.substr(1);
-		}
-		el.calendar.tooltips.innerHTML = el.ttip;
-	}
-	if (el.navtype != 300) {
-		Calendar.addClass(el, "hilite");
-		if (el.caldate) {
-			Calendar.addClass(el.parentNode, "rowhilite");
-		}
-	}
-	return Calendar.stopEvent(ev);
-};
-
-Calendar.dayMouseOut = function(ev) {
-	with (Calendar) {
-		var el = getElement(ev);
-		if (isRelated(el, ev) || _C || el.disabled)
-			return false;
-		removeClass(el, "hilite");
-		if (el.caldate)
-			removeClass(el.parentNode, "rowhilite");
-		if (el.calendar)
-			el.calendar.tooltips.innerHTML = _TT["SEL_DATE"];
-		return stopEvent(ev);
-	}
-};
-
-/**
- *  A generic "click" handler :) handles all types of buttons defined in this
- *  calendar.
- */
-Calendar.cellClick = function(el, ev) {
-	var cal = el.calendar;
-	var closing = false;
-	var newdate = false;
-	var date = null;
-	if (typeof el.navtype == "undefined") {
-		if (cal.currentDateEl) {
-			Calendar.removeClass(cal.currentDateEl, "selected");
-			Calendar.addClass(el, "selected");
-			closing = (cal.currentDateEl == el);
-			if (!closing) {
-				cal.currentDateEl = el;
-			}
-		}
-		cal.date.setDateOnly(el.caldate);
-		date = cal.date;
-		var other_month = !(cal.dateClicked = !el.otherMonth);
-		if (!other_month && !cal.currentDateEl)
-			cal._toggleMultipleDate(new Date(date));
-		else
-			newdate = !el.disabled;
-		// a date was clicked
-		if (other_month)
-			cal._init(cal.firstDayOfWeek, date);
-	} else {
-		if (el.navtype == 200) {
-			Calendar.removeClass(el, "hilite");
-			cal.callCloseHandler();
-			return;
-		}
-		date = new Date(cal.date);
-		if (el.navtype == 0)
-			date.setDateOnly(new Date()); // TODAY
-		// unless "today" was clicked, we assume no date was clicked so
-		// the selected handler will know not to close the calenar when
-		// in single-click mode.
-		// cal.dateClicked = (el.navtype == 0);
-		cal.dateClicked = false;
-		var year = date.getFullYear();
-		var mon = date.getMonth();
-		function setMonth(m) {
-			var day = date.getDate();
-			var max = date.getMonthDays(m);
-			if (day > max) {
-				date.setDate(max);
-			}
-			date.setMonth(m);
-		};
-		switch (el.navtype) {
-		    case 400:
-			Calendar.removeClass(el, "hilite");
-			var text = Calendar._TT["ABOUT"];
-			if (typeof text != "undefined") {
-				text += cal.showsTime ? Calendar._TT["ABOUT_TIME"] : "";
-			} else {
-				// FIXME: this should be removed as soon as lang files get updated!
-				text = "Help and about box text is not translated into this language.\n" +
-					"If you know this language and you feel generous please update\n" +
-					"the corresponding file in \"lang\" subdir to match calendar-en.js\n" +
-					"and send it back to <mihai_bazon@yahoo.com> to get it into the distribution  ;-)\n\n" +
-					"Thank you!\n" +
-					"http://dynarch.com/mishoo/calendar.epl\n";
-			}
-			alert(text);
-			return;
-		    case -2:
-			if (year > cal.minYear) {
-				date.setFullYear(year - 1);
-			}
-			break;
-		    case -1:
-			if (mon > 0) {
-				setMonth(mon - 1);
-			} else if (year-- > cal.minYear) {
-				date.setFullYear(year);
-				setMonth(11);
-			}
-			break;
-		    case 1:
-			if (mon < 11) {
-				setMonth(mon + 1);
-			} else if (year < cal.maxYear) {
-				date.setFullYear(year + 1);
-				setMonth(0);
-			}
-			break;
-		    case 2:
-			if (year < cal.maxYear) {
-				date.setFullYear(year + 1);
-			}
-			break;
-		    case 100:
-			cal.setFirstDayOfWeek(el.fdow);
-			return;
-		    case 50:
-			var range = el._range;
-			var current = el.innerHTML;
-			for (var i = range.length; --i >= 0;)
-				if (range[i] == current)
-					break;
-			if (ev && ev.shiftKey) {
-				if (--i < 0)
-					i = range.length - 1;
-			} else if ( ++i >= range.length )
-				i = 0;
-			var newval = range[i];
-			el.innerHTML = newval;
-			cal.onUpdateTime();
-			return;
-		    case 0:
-			// TODAY will bring us here
-			if ((typeof cal.getDateStatus == "function") &&
-			    cal.getDateStatus(date, date.getFullYear(), date.getMonth(), date.getDate())) {
-				return false;
-			}
-			break;
-		}
-		if (!date.equalsTo(cal.date)) {
-			cal.setDate(date);
-			newdate = true;
-		} else if (el.navtype == 0)
-			newdate = closing = true;
-	}
-	if (newdate) {
-		ev && cal.callHandler();
-	}
-	if (closing) {
-		Calendar.removeClass(el, "hilite");
-		ev && cal.callCloseHandler();
-	}
-};
-
-// END: CALENDAR STATIC FUNCTIONS
-
-// BEGIN: CALENDAR OBJECT FUNCTIONS
-
-/**
- *  This function creates the calendar inside the given parent.  If _par is
- *  null than it creates a popup calendar inside the BODY element.  If _par is
- *  an element, be it BODY, then it creates a non-popup calendar (still
- *  hidden).  Some properties need to be set before calling this function.
- */
-Calendar.prototype.create = function (_par) {
-	var parent = null;
-	if (! _par) {
-		// default parent is the document body, in which case we create
-		// a popup calendar.
-		parent = document.getElementsByTagName("body")[0];
-		this.isPopup = true;
-	} else {
-		parent = _par;
-		this.isPopup = false;
-	}
-	this.date = this.dateStr ? new Date(this.dateStr) : new Date();
-
-	var table = Calendar.createElement("table");
-	this.table = table;
-	table.cellSpacing = 0;
-	table.cellPadding = 0;
-	table.calendar = this;
-	Calendar.addEvent(table, "mousedown", Calendar.tableMouseDown);
-
-	var div = Calendar.createElement("div");
-	this.element = div;
-	div.className = "calendar";
-	if (this.isPopup) {
-		div.style.position = "absolute";
-		div.style.display = "none";
-	}
-	div.appendChild(table);
-
-	var thead = Calendar.createElement("thead", table);
-	var cell = null;
-	var row = null;
-
-	var cal = this;
-	var hh = function (text, cs, navtype) {
-		cell = Calendar.createElement("td", row);
-		cell.colSpan = cs;
-		cell.className = "button";
-		if (navtype != 0 && Math.abs(navtype) <= 2)
-			cell.className += " nav";
-		Calendar._add_evs(cell);
-		cell.calendar = cal;
-		cell.navtype = navtype;
-		cell.innerHTML = "<div unselectable='on'>" + text + "</div>";
-		return cell;
-	};
-
-	row = Calendar.createElement("tr", thead);
-	var title_length = 6;
-	(this.isPopup) && --title_length;
-	(this.weekNumbers) && ++title_length;
-
-	hh("?", 1, 400).ttip = Calendar._TT["INFO"];
-	this.title = hh("", title_length, 300);
-	this.title.className = "title";
-	if (this.isPopup) {
-		this.title.ttip = Calendar._TT["DRAG_TO_MOVE"];
-		this.title.style.cursor = "move";
-		hh("&#x00d7;", 1, 200).ttip = Calendar._TT["CLOSE"];
-	}
-
-	row = Calendar.createElement("tr", thead);
-	row.className = "headrow";
-
-	this._nav_py = hh("&#x00ab;", 1, -2);
-	this._nav_py.ttip = Calendar._TT["PREV_YEAR"];
-
-	this._nav_pm = hh("&#x2039;", 1, -1);
-	this._nav_pm.ttip = Calendar._TT["PREV_MONTH"];
-
-	this._nav_now = hh(Calendar._TT["TODAY"], this.weekNumbers ? 4 : 3, 0);
-	this._nav_now.ttip = Calendar._TT["GO_TODAY"];
-
-	this._nav_nm = hh("&#x203a;", 1, 1);
-	this._nav_nm.ttip = Calendar._TT["NEXT_MONTH"];
-
-	this._nav_ny = hh("&#x00bb;", 1, 2);
-	this._nav_ny.ttip = Calendar._TT["NEXT_YEAR"];
-
-	// day names
-	row = Calendar.createElement("tr", thead);
-	row.className = "daynames";
-	if (this.weekNumbers) {
-		cell = Calendar.createElement("td", row);
-		cell.className = "name wn";
-		cell.innerHTML = Calendar._TT["WK"];
-	}
-	for (var i = 7; i > 0; --i) {
-		cell = Calendar.createElement("td", row);
-		if (!i) {
-			cell.navtype = 100;
-			cell.calendar = this;
-			Calendar._add_evs(cell);
-		}
-	}
-	this.firstdayname = (this.weekNumbers) ? row.firstChild.nextSibling : row.firstChild;
-	this._displayWeekdays();
-
-	var tbody = Calendar.createElement("tbody", table);
-	this.tbody = tbody;
-
-	for (i = 6; i > 0; --i) {
-		row = Calendar.createElement("tr", tbody);
-		if (this.weekNumbers) {
-			cell = Calendar.createElement("td", row);
-		}
-		for (var j = 7; j > 0; --j) {
-			cell = Calendar.createElement("td", row);
-			cell.calendar = this;
-			Calendar._add_evs(cell);
-		}
-	}
-
-	if (this.showsTime) {
-		row = Calendar.createElement("tr", tbody);
-		row.className = "time";
-
-		cell = Calendar.createElement("td", row);
-		cell.className = "time";
-		cell.colSpan = 2;
-		cell.innerHTML = Calendar._TT["TIME"] || "&nbsp;";
-
-		cell = Calendar.createElement("td", row);
-		cell.className = "time";
-		cell.colSpan = this.weekNumbers ? 4 : 3;
-
-		(function(){
-			function makeTimePart(className, init, range_start, range_end) {
-				var part = Calendar.createElement("span", cell);
-				part.className = className;
-				part.innerHTML = init;
-				part.calendar = cal;
-				part.ttip = Calendar._TT["TIME_PART"];
-				part.navtype = 50;
-				part._range = [];
-				if (typeof range_start != "number")
-					part._range = range_start;
-				else {
-					for (var i = range_start; i <= range_end; ++i) {
-						var txt;
-						if (i < 10 && range_end >= 10) txt = '0' + i;
-						else txt = '' + i;
-						part._range[part._range.length] = txt;
-					}
-				}
-				Calendar._add_evs(part);
-				return part;
-			};
-			var hrs = cal.date.getHours();
-			var mins = cal.date.getMinutes();
-			var t12 = !cal.time24;
-			var pm = (hrs > 12);
-			if (t12 && pm) hrs -= 12;
-			var H = makeTimePart("hour", hrs, t12 ? 1 : 0, t12 ? 12 : 23);
-			var span = Calendar.createElement("span", cell);
-			span.innerHTML = ":";
-			span.className = "colon";
-			var M = makeTimePart("minute", mins, 0, 59);
-			var AP = null;
-			cell = Calendar.createElement("td", row);
-			cell.className = "time";
-			cell.colSpan = 2;
-			if (t12)
-				AP = makeTimePart("ampm", pm ? "pm" : "am", ["am", "pm"]);
-			else
-				cell.innerHTML = "&nbsp;";
-
-			cal.onSetTime = function() {
-				var pm, hrs = this.date.getHours(),
-					mins = this.date.getMinutes();
-				if (t12) {
-					pm = (hrs >= 12);
-					if (pm) hrs -= 12;
-					if (hrs == 0) hrs = 12;
-					AP.innerHTML = pm ? "pm" : "am";
-				}
-				H.innerHTML = (hrs < 10) ? ("0" + hrs) : hrs;
-				M.innerHTML = (mins < 10) ? ("0" + mins) : mins;
-			};
-
-			cal.onUpdateTime = function() {
-				var date = this.date;
-				var h = parseInt(H.innerHTML, 10);
-				if (t12) {
-					if (/pm/i.test(AP.innerHTML) && h < 12)
-						h += 12;
-					else if (/am/i.test(AP.innerHTML) && h == 12)
-						h = 0;
-				}
-				var d = date.getDate();
-				var m = date.getMonth();
-				var y = date.getFullYear();
-				date.setHours(h);
-				date.setMinutes(parseInt(M.innerHTML, 10));
-				date.setFullYear(y);
-				date.setMonth(m);
-				date.setDate(d);
-				this.dateClicked = false;
-				this.callHandler();
-			};
-		})();
-	} else {
-		this.onSetTime = this.onUpdateTime = function() {};
-	}
-
-	var tfoot = Calendar.createElement("tfoot", table);
-
-	row = Calendar.createElement("tr", tfoot);
-	row.className = "footrow";
-
-	cell = hh(Calendar._TT["SEL_DATE"], this.weekNumbers ? 8 : 7, 300);
-	cell.className = "ttip";
-	if (this.isPopup) {
-		cell.ttip = Calendar._TT["DRAG_TO_MOVE"];
-		cell.style.cursor = "move";
-	}
-	this.tooltips = cell;
-
-	div = Calendar.createElement("div", this.element);
-	this.monthsCombo = div;
-	div.className = "combo";
-	for (i = 0; i < Calendar._MN.length; ++i) {
-		var mn = Calendar.createElement("div");
-		mn.className = Calendar.is_ie ? "label-IEfix" : "label";
-		mn.month = i;
-		mn.innerHTML = Calendar._SMN[i];
-		div.appendChild(mn);
-	}
-
-	div = Calendar.createElement("div", this.element);
-	this.yearsCombo = div;
-	div.className = "combo";
-	for (i = 12; i > 0; --i) {
-		var yr = Calendar.createElement("div");
-		yr.className = Calendar.is_ie ? "label-IEfix" : "label";
-		div.appendChild(yr);
-	}
-
-	this._init(this.firstDayOfWeek, this.date);
-	parent.appendChild(this.element);
-};
-
-/** keyboard navigation, only for popup calendars */
-Calendar._keyEvent = function(ev) {
-	var cal = window._dynarch_popupCalendar;
-	if (!cal || cal.multiple)
-		return false;
-	(Calendar.is_ie) && (ev = window.event);
-	var act = (Calendar.is_ie || ev.type == "keypress"),
-		K = ev.keyCode;
-	if (ev.ctrlKey) {
-		switch (K) {
-		    case 37: // KEY left
-			act && Calendar.cellClick(cal._nav_pm);
-			break;
-		    case 38: // KEY up
-			act && Calendar.cellClick(cal._nav_py);
-			break;
-		    case 39: // KEY right
-			act && Calendar.cellClick(cal._nav_nm);
-			break;
-		    case 40: // KEY down
-			act && Calendar.cellClick(cal._nav_ny);
-			break;
-		    default:
-			return false;
-		}
-	} else switch (K) {
-	    case 32: // KEY space (now)
-		Calendar.cellClick(cal._nav_now);
-		break;
-	    case 27: // KEY esc
-		act && cal.callCloseHandler();
-		break;
-	    case 37: // KEY left
-	    case 38: // KEY up
-	    case 39: // KEY right
-	    case 40: // KEY down
-		if (act) {
-			var prev, x, y, ne, el, step;
-			prev = K == 37 || K == 38;
-			step = (K == 37 || K == 39) ? 1 : 7;
-			function setVars() {
-				el = cal.currentDateEl;
-				var p = el.pos;
-				x = p & 15;
-				y = p >> 4;
-				ne = cal.ar_days[y][x];
-			};setVars();
-			function prevMonth() {
-				var date = new Date(cal.date);
-				date.setDate(date.getDate() - step);
-				cal.setDate(date);
-			};
-			function nextMonth() {
-				var date = new Date(cal.date);
-				date.setDate(date.getDate() + step);
-				cal.setDate(date);
-			};
-			while (1) {
-				switch (K) {
-				    case 37: // KEY left
-					if (--x >= 0)
-						ne = cal.ar_days[y][x];
-					else {
-						x = 6;
-						K = 38;
-						continue;
-					}
-					break;
-				    case 38: // KEY up
-					if (--y >= 0)
-						ne = cal.ar_days[y][x];
-					else {
-						prevMonth();
-						setVars();
-					}
-					break;
-				    case 39: // KEY right
-					if (++x < 7)
-						ne = cal.ar_days[y][x];
-					else {
-						x = 0;
-						K = 40;
-						continue;
-					}
-					break;
-				    case 40: // KEY down
-					if (++y < cal.ar_days.length)
-						ne = cal.ar_days[y][x];
-					else {
-						nextMonth();
-						setVars();
-					}
-					break;
-				}
-				break;
-			}
-			if (ne) {
-				if (!ne.disabled)
-					Calendar.cellClick(ne);
-				else if (prev)
-					prevMonth();
-				else
-					nextMonth();
-			}
-		}
-		break;
-	    case 13: // KEY enter
-		if (act)
-			Calendar.cellClick(cal.currentDateEl, ev);
-		break;
-	    default:
-		return false;
-	}
-	return Calendar.stopEvent(ev);
-};
-
-/**
- *  (RE)Initializes the calendar to the given date and firstDayOfWeek
- */
-Calendar.prototype._init = function (firstDayOfWeek, date) {
-	var today = new Date(),
-		TY = today.getFullYear(),
-		TM = today.getMonth(),
-		TD = today.getDate();
-	this.table.style.visibility = "hidden";
-	var year = date.getFullYear();
-	if (year < this.minYear) {
-		year = this.minYear;
-		date.setFullYear(year);
-	} else if (year > this.maxYear) {
-		year = this.maxYear;
-		date.setFullYear(year);
-	}
-	this.firstDayOfWeek = firstDayOfWeek;
-	this.date = new Date(date);
-	var month = date.getMonth();
-	var mday = date.getDate();
-	var no_days = date.getMonthDays();
-
-	// calendar voodoo for computing the first day that would actually be
-	// displayed in the calendar, even if it's from the previous month.
-	// WARNING: this is magic. ;-)
-	date.setDate(1);
-	var day1 = (date.getDay() - this.firstDayOfWeek) % 7;
-	if (day1 < 0)
-		day1 += 7;
-	date.setDate(-day1);
-	date.setDate(date.getDate() + 1);
-
-	var row = this.tbody.firstChild;
-	var MN = Calendar._SMN[month];
-	var ar_days = this.ar_days = new Array();
-	var weekend = Calendar._TT["WEEKEND"];
-	var dates = this.multiple ? (this.datesCells = {}) : null;
-	for (var i = 0; i < 6; ++i, row = row.nextSibling) {
-		var cell = row.firstChild;
-		if (this.weekNumbers) {
-			cell.className = "day wn";
-			cell.innerHTML = date.getWeekNumber();
-			cell = cell.nextSibling;
-		}
-		row.className = "daysrow";
-		var hasdays = false, iday, dpos = ar_days[i] = [];
-		for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) {
-			iday = date.getDate();
-			var wday = date.getDay();
-			cell.className = "day";
-			cell.pos = i << 4 | j;
-			dpos[j] = cell;
-			var current_month = (date.getMonth() == month);
-			if (!current_month) {
-				if (this.showsOtherMonths) {
-					cell.className += " othermonth";
-					cell.otherMonth = true;
-				} else {
-					cell.className = "emptycell";
-					cell.innerHTML = "&nbsp;";
-					cell.disabled = true;
-					continue;
-				}
-			} else {
-				cell.otherMonth = false;
-				hasdays = true;
-			}
-			cell.disabled = false;
-			cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday;
-			if (dates)
-				dates[date.print("%Y%m%d")] = cell;
-			if (this.getDateStatus) {
-				var status = this.getDateStatus(date, year, month, iday);
-				if (this.getDateToolTip) {
-					var toolTip = this.getDateToolTip(date, year, month, iday);
-					if (toolTip)
-						cell.title = toolTip;
-				}
-				if (status === true) {
-					cell.className += " disabled";
-					cell.disabled = true;
-				} else {
-					if (/disabled/i.test(status))
-						cell.disabled = true;
-					cell.className += " " + status;
-				}
-			}
-			if (!cell.disabled) {
-				cell.caldate = new Date(date);
-				cell.ttip = "_";
-				if (!this.multiple && current_month
-				    && iday == mday && this.hiliteToday) {
-					cell.className += " selected";
-					this.currentDateEl = cell;
-				}
-				if (date.getFullYear() == TY &&
-				    date.getMonth() == TM &&
-				    iday == TD) {
-					cell.className += " today";
-					cell.ttip += Calendar._TT["PART_TODAY"];
-				}
-				if (weekend.indexOf(wday.toString()) != -1)
-					cell.className += cell.otherMonth ? " oweekend" : " weekend";
-			}
-		}
-		if (!(hasdays || this.showsOtherMonths))
-			row.className = "emptyrow";
-	}
-	this.title.innerHTML = Calendar._MN[month] + ", " + year;
-	this.onSetTime();
-	this.table.style.visibility = "visible";
-	this._initMultipleDates();
-	// PROFILE
-	// this.tooltips.innerHTML = "Generated in " + ((new Date()) - today) + " ms";
-};
-
-Calendar.prototype._initMultipleDates = function() {
-	if (this.multiple) {
-		for (var i in this.multiple) {
-			var cell = this.datesCells[i];
-			var d = this.multiple[i];
-			if (!d)
-				continue;
-			if (cell)
-				cell.className += " selected";
-		}
-	}
-};
-
-Calendar.prototype._toggleMultipleDate = function(date) {
-	if (this.multiple) {
-		var ds = date.print("%Y%m%d");
-		var cell = this.datesCells[ds];
-		if (cell) {
-			var d = this.multiple[ds];
-			if (!d) {
-				Calendar.addClass(cell, "selected");
-				this.multiple[ds] = date;
-			} else {
-				Calendar.removeClass(cell, "selected");
-				delete this.multiple[ds];
-			}
-		}
-	}
-};
-
-Calendar.prototype.setDateToolTipHandler = function (unaryFunction) {
-	this.getDateToolTip = unaryFunction;
-};
-
-/**
- *  Calls _init function above for going to a certain date (but only if the
- *  date is different than the currently selected one).
- */
-Calendar.prototype.setDate = function (date) {
-	if (!date.equalsTo(this.date)) {
-		this._init(this.firstDayOfWeek, date);
-	}
-};
-
-/**
- *  Refreshes the calendar.  Useful if the "disabledHandler" function is
- *  dynamic, meaning that the list of disabled date can change at runtime.
- *  Just * call this function if you think that the list of disabled dates
- *  should * change.
- */
-Calendar.prototype.refresh = function () {
-	this._init(this.firstDayOfWeek, this.date);
-};
-
-/** Modifies the "firstDayOfWeek" parameter (pass 0 for Synday, 1 for Monday, etc.). */
-Calendar.prototype.setFirstDayOfWeek = function (firstDayOfWeek) {
-	this._init(firstDayOfWeek, this.date);
-	this._displayWeekdays();
-};
-
-/**
- *  Allows customization of what dates are enabled.  The "unaryFunction"
- *  parameter must be a function object that receives the date (as a JS Date
- *  object) and returns a boolean value.  If the returned value is true then
- *  the passed date will be marked as disabled.
- */
-Calendar.prototype.setDateStatusHandler = Calendar.prototype.setDisabledHandler = function (unaryFunction) {
-	this.getDateStatus = unaryFunction;
-};
-
-/** Customization of allowed year range for the calendar. */
-Calendar.prototype.setRange = function (a, z) {
-	this.minYear = a;
-	this.maxYear = z;
-};
-
-/** Calls the first user handler (selectedHandler). */
-Calendar.prototype.callHandler = function () {
-	if (this.onSelected) {
-		this.onSelected(this, this.date.print(this.dateFormat));
-	}
-};
-
-/** Calls the second user handler (closeHandler). */
-Calendar.prototype.callCloseHandler = function () {
-	if (this.onClose) {
-		this.onClose(this);
-	}
-	this.hideShowCovered();
-};
-
-/** Removes the calendar object from the DOM tree and destroys it. */
-Calendar.prototype.destroy = function () {
-	var el = this.element.parentNode;
-	el.removeChild(this.element);
-	Calendar._C = null;
-	window._dynarch_popupCalendar = null;
-};
-
-/**
- *  Moves the calendar element to a different section in the DOM tree (changes
- *  its parent).
- */
-Calendar.prototype.reparent = function (new_parent) {
-	var el = this.element;
-	el.parentNode.removeChild(el);
-	new_parent.appendChild(el);
-};
-
-// This gets called when the user presses a mouse button anywhere in the
-// document, if the calendar is shown.  If the click was outside the open
-// calendar this function closes it.
-Calendar._checkCalendar = function(ev) {
-	var calendar = window._dynarch_popupCalendar;
-	if (!calendar) {
-		return false;
-	}
-	var el = Calendar.is_ie ? Calendar.getElement(ev) : Calendar.getTargetElement(ev);
-	for (; el != null && el != calendar.element; el = el.parentNode);
-	if (el == null) {
-		// calls closeHandler which should hide the calendar.
-		window._dynarch_popupCalendar.callCloseHandler();
-		return Calendar.stopEvent(ev);
-	}
-};
-
-/** Shows the calendar. */
-Calendar.prototype.show = function () {
-	var rows = this.table.getElementsByTagName("tr");
-	for (var i = rows.length; i > 0;) {
-		var row = rows[--i];
-		Calendar.removeClass(row, "rowhilite");
-		var cells = row.getElementsByTagName("td");
-		for (var j = cells.length; j > 0;) {
-			var cell = cells[--j];
-			Calendar.removeClass(cell, "hilite");
-			Calendar.removeClass(cell, "active");
-		}
-	}
-	this.element.style.display = "block";
-	this.hidden = false;
-	if (this.isPopup) {
-		window._dynarch_popupCalendar = this;
-		Calendar.addEvent(document, "keydown", Calendar._keyEvent);
-		Calendar.addEvent(document, "keypress", Calendar._keyEvent);
-		Calendar.addEvent(document, "mousedown", Calendar._checkCalendar);
-	}
-	this.hideShowCovered();
-};
-
-/**
- *  Hides the calendar.  Also removes any "hilite" from the class of any TD
- *  element.
- */
-Calendar.prototype.hide = function () {
-	if (this.isPopup) {
-		Calendar.removeEvent(document, "keydown", Calendar._keyEvent);
-		Calendar.removeEvent(document, "keypress", Calendar._keyEvent);
-		Calendar.removeEvent(document, "mousedown", Calendar._checkCalendar);
-	}
-	this.element.style.display = "none";
-	this.hidden = true;
-	this.hideShowCovered();
-};
-
-/**
- *  Shows the calendar at a given absolute position (beware that, depending on
- *  the calendar element style -- position property -- this might be relative
- *  to the parent's containing rectangle).
- */
-Calendar.prototype.showAt = function (x, y) {
-	var s = this.element.style;
-	s.left = x + "px";
-	s.top = y + "px";
-	this.show();
-};
-
-/** Shows the calendar near a given element. */
-Calendar.prototype.showAtElement = function (el, opts) {
-	var self = this;
-	var p = Calendar.getAbsolutePos(el);
-	if (!opts || typeof opts != "string") {
-		this.showAt(p.x, p.y + el.offsetHeight);
-		return true;
-	}
-	function fixPosition(box) {
-		if (box.x < 0)
-			box.x = 0;
-		if (box.y < 0)
-			box.y = 0;
-		var cp = document.createElement("div");
-		var s = cp.style;
-		s.position = "absolute";
-		s.right = s.bottom = s.width = s.height = "0px";
-		document.body.appendChild(cp);
-		var br = Calendar.getAbsolutePos(cp);
-		document.body.removeChild(cp);
-		if (Calendar.is_ie) {
-			br.y += document.body.scrollTop;
-			br.x += document.body.scrollLeft;
-		} else {
-			br.y += window.scrollY;
-			br.x += window.scrollX;
-		}
-		var tmp = box.x + box.width - br.x;
-		if (tmp > 0) box.x -= tmp;
-		tmp = box.y + box.height - br.y;
-		if (tmp > 0) box.y -= tmp;
-	};
-	this.element.style.display = "block";
-	Calendar.continuation_for_the_fucking_khtml_browser = function() {
-		var w = self.element.offsetWidth;
-		var h = self.element.offsetHeight;
-		self.element.style.display = "none";
-		var valign = opts.substr(0, 1);
-		var halign = "l";
-		if (opts.length > 1) {
-			halign = opts.substr(1, 1);
-		}
-		// vertical alignment
-		switch (valign) {
-		    case "T": p.y -= h; break;
-		    case "B": p.y += el.offsetHeight; break;
-		    case "C": p.y += (el.offsetHeight - h) / 2; break;
-		    case "t": p.y += el.offsetHeight - h; break;
-		    case "b": break; // already there
-		}
-		// horizontal alignment
-		switch (halign) {
-		    case "L": p.x -= w; break;
-		    case "R": p.x += el.offsetWidth; break;
-		    case "C": p.x += (el.offsetWidth - w) / 2; break;
-		    case "l": p.x += el.offsetWidth - w; break;
-		    case "r": break; // already there
-		}
-		p.width = w;
-		p.height = h + 40;
-		self.monthsCombo.style.display = "none";
-		fixPosition(p);
-		self.showAt(p.x, p.y);
-	};
-	if (Calendar.is_khtml)
-		setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()", 10);
-	else
-		Calendar.continuation_for_the_fucking_khtml_browser();
-};
-
-/** Customizes the date format. */
-Calendar.prototype.setDateFormat = function (str) {
-	this.dateFormat = str;
-};
-
-/** Customizes the tooltip date format. */
-Calendar.prototype.setTtDateFormat = function (str) {
-	this.ttDateFormat = str;
-};
-
-/**
- *  Tries to identify the date represented in a string.  If successful it also
- *  calls this.setDate which moves the calendar to the given date.
- */
-Calendar.prototype.parseDate = function(str, fmt) {
-	if (!fmt)
-		fmt = this.dateFormat;
-	this.setDate(Date.parseDate(str, fmt));
-};
-
-Calendar.prototype.hideShowCovered = function () {
-	if (!Calendar.is_ie && !Calendar.is_opera)
-		return;
-	function getVisib(obj){
-		var value = obj.style.visibility;
-		if (!value) {
-			if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // Gecko, W3C
-				if (!Calendar.is_khtml)
-					value = document.defaultView.
-						getComputedStyle(obj, "").getPropertyValue("visibility");
-				else
-					value = '';
-			} else if (obj.currentStyle) { // IE
-				value = obj.currentStyle.visibility;
-			} else
-				value = '';
-		}
-		return value;
-	};
-
-	var tags = new Array("applet", "iframe", "select");
-	var el = this.element;
-
-	var p = Calendar.getAbsolutePos(el);
-	var EX1 = p.x;
-	var EX2 = el.offsetWidth + EX1;
-	var EY1 = p.y;
-	var EY2 = el.offsetHeight + EY1;
-
-	for (var k = tags.length; k > 0; ) {
-		var ar = document.getElementsByTagName(tags[--k]);
-		var cc = null;
-
-		for (var i = ar.length; i > 0;) {
-			cc = ar[--i];
-
-			p = Calendar.getAbsolutePos(cc);
-			var CX1 = p.x;
-			var CX2 = cc.offsetWidth + CX1;
-			var CY1 = p.y;
-			var CY2 = cc.offsetHeight + CY1;
-
-			if (this.hidden || (CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
-				if (!cc.__msh_save_visibility) {
-					cc.__msh_save_visibility = getVisib(cc);
-				}
-				cc.style.visibility = cc.__msh_save_visibility;
-			} else {
-				if (!cc.__msh_save_visibility) {
-					cc.__msh_save_visibility = getVisib(cc);
-				}
-				cc.style.visibility = "hidden";
-			}
-		}
-	}
-};
-
-/** Internal function; it displays the bar with the names of the weekday. */
-Calendar.prototype._displayWeekdays = function () {
-	var fdow = this.firstDayOfWeek;
-	var cell = this.firstdayname;
-	var weekend = Calendar._TT["WEEKEND"];
-	for (var i = 0; i < 7; ++i) {
-		cell.className = "day name";
-		var realday = (i + fdow) % 7;
-		if (i) {
-			cell.ttip = Calendar._TT["DAY_FIRST"].replace("%s", Calendar._DN[realday]);
-			cell.navtype = 100;
-			cell.calendar = this;
-			cell.fdow = realday;
-			Calendar._add_evs(cell);
-		}
-		if (weekend.indexOf(realday.toString()) != -1) {
-			Calendar.addClass(cell, "weekend");
-		}
-		cell.innerHTML = Calendar._SDN[(i + fdow) % 7];
-		cell = cell.nextSibling;
-	}
-};
-
-/** Internal function.  Hides all combo boxes that might be displayed. */
-Calendar.prototype._hideCombos = function () {
-	this.monthsCombo.style.display = "none";
-	this.yearsCombo.style.display = "none";
-};
-
-/** Internal function.  Starts dragging the element. */
-Calendar.prototype._dragStart = function (ev) {
-	if (this.dragging) {
-		return;
-	}
-	this.dragging = true;
-	var posX;
-	var posY;
-	if (Calendar.is_ie) {
-		posY = window.event.clientY + document.body.scrollTop;
-		posX = window.event.clientX + document.body.scrollLeft;
-	} else {
-		posY = ev.clientY + window.scrollY;
-		posX = ev.clientX + window.scrollX;
-	}
-	var st = this.element.style;
-	this.xOffs = posX - parseInt(st.left);
-	this.yOffs = posY - parseInt(st.top);
-	with (Calendar) {
-		addEvent(document, "mousemove", calDragIt);
-		addEvent(document, "mouseup", calDragEnd);
-	}
-};
-
-// BEGIN: DATE OBJECT PATCHES
-
-/** Adds the number of days array to the Date object. */
-Date._MD = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
-
-/** Constants used for time computations */
-Date.SECOND = 1000 /* milliseconds */;
-Date.MINUTE = 60 * Date.SECOND;
-Date.HOUR   = 60 * Date.MINUTE;
-Date.DAY    = 24 * Date.HOUR;
-Date.WEEK   =  7 * Date.DAY;
-
-Date.parseDate = function(str, fmt) {
-	var today = new Date();
-	var y = 0;
-	var m = -1;
-	var d = 0;
-	var a = str.split(/\W+/);
-	var b = fmt.match(/%./g);
-	var i = 0, j = 0;
-	var hr = 0;
-	var min = 0;
-	for (i = 0; i < a.length; ++i) {
-		if (!a[i])
-			continue;
-		switch (b[i]) {
-		    case "%d":
-		    case "%e":
-			d = parseInt(a[i], 10);
-			break;
-
-		    case "%m":
-			m = parseInt(a[i], 10) - 1;
-			break;
-
-		    case "%Y":
-		    case "%y":
-			y = parseInt(a[i], 10);
-			(y < 100) && (y += (y > 29) ? 1900 : 2000);
-			break;
-
-		    case "%b":
-		    case "%B":
-			for (j = 0; j < 12; ++j) {
-				if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { m = j; break; }
-			}
-			break;
-
-		    case "%H":
-		    case "%I":
-		    case "%k":
-		    case "%l":
-			hr = parseInt(a[i], 10);
-			break;
-
-		    case "%P":
-		    case "%p":
-			if (/pm/i.test(a[i]) && hr < 12)
-				hr += 12;
-			else if (/am/i.test(a[i]) && hr >= 12)
-				hr -= 12;
-			break;
-
-		    case "%M":
-			min = parseInt(a[i], 10);
-			break;
-		}
-	}
-	if (isNaN(y)) y = today.getFullYear();
-	if (isNaN(m)) m = today.getMonth();
-	if (isNaN(d)) d = today.getDate();
-	if (isNaN(hr)) hr = today.getHours();
-	if (isNaN(min)) min = today.getMinutes();
-	if (y != 0 && m != -1 && d != 0)
-		return new Date(y, m, d, hr, min, 0);
-	y = 0; m = -1; d = 0;
-	for (i = 0; i < a.length; ++i) {
-		if (a[i].search(/[a-zA-Z]+/) != -1) {
-			var t = -1;
-			for (j = 0; j < 12; ++j) {
-				if (Calendar._MN[j].substr(0, a[i].length).toLowerCase() == a[i].toLowerCase()) { t = j; break; }
-			}
-			if (t != -1) {
-				if (m != -1) {
-					d = m+1;
-				}
-				m = t;
-			}
-		} else if (parseInt(a[i], 10) <= 12 && m == -1) {
-			m = a[i]-1;
-		} else if (parseInt(a[i], 10) > 31 && y == 0) {
-			y = parseInt(a[i], 10);
-			(y < 100) && (y += (y > 29) ? 1900 : 2000);
-		} else if (d == 0) {
-			d = a[i];
-		}
-	}
-	if (y == 0)
-		y = today.getFullYear();
-	if (m != -1 && d != 0)
-		return new Date(y, m, d, hr, min, 0);
-	return today;
-};
-
-/** Returns the number of days in the current month */
-Date.prototype.getMonthDays = function(month) {
-	var year = this.getFullYear();
-	if (typeof month == "undefined") {
-		month = this.getMonth();
-	}
-	if (((0 == (year%4)) && ( (0 != (year%100)) || (0 == (year%400)))) && month == 1) {
-		return 29;
-	} else {
-		return Date._MD[month];
-	}
-};
-
-/** Returns the number of day in the year. */
-Date.prototype.getDayOfYear = function() {
-	var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
-	var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0);
-	var time = now - then;
-	return Math.floor(time / Date.DAY);
-};
-
-/** Returns the number of the week in year, as defined in ISO 8601. */
-Date.prototype.getWeekNumber = function() {
-	var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
-	var DoW = d.getDay();
-	d.setDate(d.getDate() - (DoW + 6) % 7 + 3); // Nearest Thu
-	var ms = d.valueOf(); // GMT
-	d.setMonth(0);
-	d.setDate(4); // Thu in Week 1
-	return Math.round((ms - d.valueOf()) / (7 * 864e5)) + 1;
-};
-
-/** Checks date and time equality */
-Date.prototype.equalsTo = function(date) {
-	return ((this.getFullYear() == date.getFullYear()) &&
-		(this.getMonth() == date.getMonth()) &&
-		(this.getDate() == date.getDate()) &&
-		(this.getHours() == date.getHours()) &&
-		(this.getMinutes() == date.getMinutes()));
-};
-
-/** Set only the year, month, date parts (keep existing time) */
-Date.prototype.setDateOnly = function(date) {
-	var tmp = new Date(date);
-	this.setDate(1);
-	this.setFullYear(tmp.getFullYear());
-	this.setMonth(tmp.getMonth());
-	this.setDate(tmp.getDate());
-};
-
-/** Prints the date in a string according to the given format. */
-Date.prototype.print = function (str) {
-	var m = this.getMonth();
-	var d = this.getDate();
-	var y = this.getFullYear();
-	var wn = this.getWeekNumber();
-	var w = this.getDay();
-	var s = {};
-	var hr = this.getHours();
-	var pm = (hr >= 12);
-	var ir = (pm) ? (hr - 12) : hr;
-	var dy = this.getDayOfYear();
-	if (ir == 0)
-		ir = 12;
-	var min = this.getMinutes();
-	var sec = this.getSeconds();
-	s["%a"] = Calendar._SDN[w]; // abbreviated weekday name [FIXME: I18N]
-	s["%A"] = Calendar._DN[w]; // full weekday name
-	s["%b"] = Calendar._SMN[m]; // abbreviated month name [FIXME: I18N]
-	s["%B"] = Calendar._MN[m]; // full month name
-	// FIXME: %c : preferred date and time representation for the current locale
-	s["%C"] = 1 + Math.floor(y / 100); // the century number
-	s["%d"] = (d < 10) ? ("0" + d) : d; // the day of the month (range 01 to 31)
-	s["%e"] = d; // the day of the month (range 1 to 31)
-	// FIXME: %D : american date style: %m/%d/%y
-	// FIXME: %E, %F, %G, %g, %h (man strftime)
-	s["%H"] = (hr < 10) ? ("0" + hr) : hr; // hour, range 00 to 23 (24h format)
-	s["%I"] = (ir < 10) ? ("0" + ir) : ir; // hour, range 01 to 12 (12h format)
-	s["%j"] = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; // day of the year (range 001 to 366)
-	s["%k"] = hr;		// hour, range 0 to 23 (24h format)
-	s["%l"] = ir;		// hour, range 1 to 12 (12h format)
-	s["%m"] = (m < 9) ? ("0" + (1+m)) : (1+m); // month, range 01 to 12
-	s["%M"] = (min < 10) ? ("0" + min) : min; // minute, range 00 to 59
-	s["%n"] = "\n";		// a newline character
-	s["%p"] = pm ? "PM" : "AM";
-	s["%P"] = pm ? "pm" : "am";
-	// FIXME: %r : the time in am/pm notation %I:%M:%S %p
-	// FIXME: %R : the time in 24-hour notation %H:%M
-	s["%s"] = Math.floor(this.getTime() / 1000);
-	s["%S"] = (sec < 10) ? ("0" + sec) : sec; // seconds, range 00 to 59
-	s["%t"] = "\t";		// a tab character
-	// FIXME: %T : the time in 24-hour notation (%H:%M:%S)
-	s["%U"] = s["%W"] = s["%V"] = (wn < 10) ? ("0" + wn) : wn;
-	s["%u"] = w + 1;	// the day of the week (range 1 to 7, 1 = MON)
-	s["%w"] = w;		// the day of the week (range 0 to 6, 0 = SUN)
-	// FIXME: %x : preferred date representation for the current locale without the time
-	// FIXME: %X : preferred time representation for the current locale without the date
-	s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
-	s["%Y"] = y;		// year with the century
-	s["%%"] = "%";		// a literal '%' character
-
-	var re = /%./g;
-	if (!Calendar.is_ie5 && !Calendar.is_khtml)
-		return str.replace(re, function (par) { return s[par] || par; });
-
-	var a = str.match(re);
-	for (var i = 0; i < a.length; i++) {
-		var tmp = s[a[i]];
-		if (tmp) {
-			re = new RegExp(a[i], 'g');
-			str = str.replace(re, tmp);
-		}
-	}
-
-	return str;
-};
-
-Date.prototype.__msh_oldSetFullYear = Date.prototype.setFullYear;
-Date.prototype.setFullYear = function(y) {
-	var d = new Date(this);
-	d.__msh_oldSetFullYear(y);
-	if (d.getMonth() != this.getMonth())
-		this.setDate(28);
-	this.__msh_oldSetFullYear(y);
-};
-
-// END: DATE OBJECT PATCHES
-
-
-// global object that remembers the calendar
-window._dynarch_popupCalendar = null;
--- a/gnv/src/main/webapp/scripts/calendar_stripped.js	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-/*  Copyright Mihai Bazon, 2002-2005  |  www.bazon.net/mishoo
- * -----------------------------------------------------------
- *
- * The DHTML Calendar, version 1.0 "It is happening again"
- *
- * Details and latest version at:
- * www.dynarch.com/projects/calendar
- *
- * This script is developed by Dynarch.com.  Visit us at www.dynarch.com.
- *
- * This script is distributed under the GNU Lesser General Public License.
- * Read the entire license text here: http://www.gnu.org/licenses/lgpl.html
- */
- Calendar=function(firstDayOfWeek,dateStr,onSelected,onClose){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=onSelected||null;this.onClose=onClose||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT["DEF_DATE_FORMAT"];this.ttDateFormat=Calendar._TT["TT_DATE_FORMAT"];this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof firstDayOfWeek=="number"?firstDayOfWeek:Calendar._FD;this.showsOtherMonths=false;this.dateStr=dateStr;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined")Calendar._SDN_len=3;var ar=new Array();for(var i=8;i>0;){ar[--i]=Calendar._DN[i].substr(0,Calendar._SDN_len);}Calendar._SDN=ar;if(typeof Calendar._SMN_len=="undefined")Calendar._SMN_len=3;ar=new Array();for(var i=12;i>0;){ar[--i]=Calendar._MN[i].substr(0,Calendar._SMN_len);}Calendar._SMN=ar;}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(el){var SL=0,ST=0;var is_div=/^div$/i.test(el.tagName);if(is_div&&el.scrollLeft)SL=el.scrollLeft;if(is_div&&el.scrollTop)ST=el.scrollTop;var r={x:el.offsetLeft-SL,y:el.offsetTop-ST};if(el.offsetParent){var tmp=this.getAbsolutePos(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}return r;};Calendar.isRelated=function(el,evt){var related=evt.relatedTarget;if(!related){var type=evt.type;if(type=="mouseover"){related=evt.fromElement;}else if(type=="mouseout"){related=evt.toElement;}}while(related){if(related==el){return true;}related=related.parentNode;}return false;};Calendar.removeClass=function(el,className){if(!(el&&el.className)){return;}var cls=el.className.split(" ");var ar=new Array();for(var i=cls.length;i>0;){if(cls[--i]!=className){ar[ar.length]=cls[i];}}el.className=ar.join(" ");};Calendar.addClass=function(el,className){Calendar.removeClass(el,className);el.className+=" "+className;};Calendar.getElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.currentTarget;while(f.nodeType!=1||/^div$/i.test(f.tagName))f=f.parentNode;return f;};Calendar.getTargetElement=function(ev){var f=Calendar.is_ie?window.event.srcElement:ev.target;while(f.nodeType!=1)f=f.parentNode;return f;};Calendar.stopEvent=function(ev){ev||(ev=window.event);if(Calendar.is_ie){ev.cancelBubble=true;ev.returnValue=false;}else{ev.preventDefault();ev.stopPropagation();}return false;};Calendar.addEvent=function(el,evname,func){if(el.attachEvent){el.attachEvent("on"+evname,func);}else if(el.addEventListener){el.addEventListener(evname,func,true);}else{el["on"+evname]=func;}};Calendar.removeEvent=function(el,evname,func){if(el.detachEvent){el.detachEvent("on"+evname,func);}else if(el.removeEventListener){el.removeEventListener(evname,func,true);}else{el["on"+evname]=null;}};Calendar.createElement=function(type,parent){var el=null;if(document.createElementNS){el=document.createElementNS("http://www.w3.org/1999/xhtml",type);}else{el=document.createElement(type);}if(typeof parent!="undefined"){parent.appendChild(el);}return el;};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true);}}};Calendar.findMonth=function(el){if(typeof el.month!="undefined"){return el;}else if(typeof el.parentNode.month!="undefined"){return el.parentNode;}return null;};Calendar.findYear=function(el){if(typeof el.year!="undefined"){return el;}else if(typeof el.parentNode.year!="undefined"){return el.parentNode;}return null;};Calendar.showMonthsCombo=function(){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var mc=cal.monthsCombo;if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}if(cal.activeMonth){Calendar.removeClass(cal.activeMonth,"active");}var mon=cal.monthsCombo.getElementsByTagName("div")[cal.date.getMonth()];Calendar.addClass(mon,"active");cal.activeMonth=mon;var s=mc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var mcw=mc.offsetWidth;if(typeof mcw=="undefined")mcw=50;s.left=(cd.offsetLeft+cd.offsetWidth-mcw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";};Calendar.showYearsCombo=function(fwd){var cal=Calendar._C;if(!cal){return false;}var cal=cal;var cd=cal.activeDiv;var yc=cal.yearsCombo;if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}if(cal.activeYear){Calendar.removeClass(cal.activeYear,"active");}cal.activeYear=null;var Y=cal.date.getFullYear()+(fwd?1:-1);var yr=yc.firstChild;var show=false;for(var i=12;i>0;--i){if(Y>=cal.minYear&&Y<=cal.maxYear){yr.innerHTML=Y;yr.year=Y;yr.style.display="block";show=true;}else{yr.style.display="none";}yr=yr.nextSibling;Y+=fwd?cal.yearStep:-cal.yearStep;}if(show){var s=yc.style;s.display="block";if(cd.navtype<0)s.left=cd.offsetLeft+"px";else{var ycw=yc.offsetWidth;if(typeof ycw=="undefined")ycw=50;s.left=(cd.offsetLeft+cd.offsetWidth-ycw)+"px";}s.top=(cd.offsetTop+cd.offsetHeight)+"px";}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false;}if(cal.timeout){clearTimeout(cal.timeout);}var el=cal.activeDiv;if(!el){return false;}var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev);}var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}else{var year=Calendar.findYear(target);if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler();}}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev);}};Calendar.tableMouseOver=function(ev){var cal=Calendar._C;if(!cal){return;}var el=cal.activeDiv;var target=Calendar.getTargetElement(ev);if(target==el||target.parentNode==el){Calendar.addClass(el,"hilite active");Calendar.addClass(el.parentNode,"rowhilite");}else{if(typeof el.navtype=="undefined"||(el.navtype!=50&&(el.navtype==0||Math.abs(el.navtype)>2)))Calendar.removeClass(el,"active");Calendar.removeClass(el,"hilite");Calendar.removeClass(el.parentNode,"rowhilite");}ev||(ev=window.event);if(el.navtype==50&&target!=el){var pos=Calendar.getAbsolutePos(el);var w=el.offsetWidth;var x=ev.clientX;var dx;var decrease=true;if(x>pos.x+w){dx=x-pos.x-w;decrease=false;}else dx=pos.x-x;if(dx<0)dx=0;var range=el._range;var current=el._current;var count=Math.floor(dx/10)%range.length;for(var i=range.length;--i>=0;)if(range[i]==current)break;while(count-->0)if(decrease){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();}var mon=Calendar.findMonth(target);if(mon){if(mon.month!=cal.date.getMonth()){if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}Calendar.addClass(mon,"hilite");cal.hilitedMonth=mon;}else if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}}else{if(cal.hilitedMonth){Calendar.removeClass(cal.hilitedMonth,"hilite");}var year=Calendar.findYear(target);if(year){if(year.year!=cal.date.getFullYear()){if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}Calendar.addClass(year,"hilite");cal.hilitedYear=year;}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}else if(cal.hilitedYear){Calendar.removeClass(cal.hilitedYear,"hilite");}}return Calendar.stopEvent(ev);};Calendar.tableMouseDown=function(ev){if(Calendar.getTargetElement(ev)==Calendar.getElement(ev)){return Calendar.stopEvent(ev);}};Calendar.calDragIt=function(ev){var cal=Calendar._C;if(!(cal&&cal.dragging)){return false;}var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posX=ev.pageX;posY=ev.pageY;}cal.hideShowCovered();var st=cal.element.style;st.left=(posX-cal.xOffs)+"px";st.top=(posY-cal.yOffs)+"px";return Calendar.stopEvent(ev);};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false;}cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev);}cal.hideShowCovered();};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false;}var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300)with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver);}else addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver);addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp);}else if(cal.isPopup){cal._dragStart(ev);}if(el.navtype==-1||el.navtype==1){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout("Calendar.showMonthsCombo()",250);}else if(el.navtype==-2||el.navtype==2){if(cal.timeout)clearTimeout(cal.timeout);cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250);}else{cal.timeout=null;}return Calendar.stopEvent(ev);};Calendar.dayMouseDblClick=function(ev){Calendar.cellClick(Calendar.getElement(ev),ev||window.event);if(Calendar.is_ie){document.selection.empty();}};Calendar.dayMouseOver=function(ev){var el=Calendar.getElement(ev);if(Calendar.isRelated(el,ev)||Calendar._C||el.disabled){return false;}if(el.ttip){if(el.ttip.substr(0,1)=="_"){el.ttip=el.caldate.print(el.calendar.ttDateFormat)+el.ttip.substr(1);}el.calendar.tooltips.innerHTML=el.ttip;}if(el.navtype!=300){Calendar.addClass(el,"hilite");if(el.caldate){Calendar.addClass(el.parentNode,"rowhilite");}}return Calendar.stopEvent(ev);};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled)return false;removeClass(el,"hilite");if(el.caldate)removeClass(el.parentNode,"rowhilite");if(el.calendar)el.calendar.tooltips.innerHTML=_TT["SEL_DATE"];return stopEvent(ev);}};Calendar.cellClick=function(el,ev){var cal=el.calendar;var closing=false;var newdate=false;var date=null;if(typeof el.navtype=="undefined"){if(cal.currentDateEl){Calendar.removeClass(cal.currentDateEl,"selected");Calendar.addClass(el,"selected");closing=(cal.currentDateEl==el);if(!closing){cal.currentDateEl=el;}}cal.date.setDateOnly(el.caldate);date=cal.date;var other_month=!(cal.dateClicked=!el.otherMonth);if(!other_month&&!cal.currentDateEl)cal._toggleMultipleDate(new Date(date));else newdate=!el.disabled;if(other_month)cal._init(cal.firstDayOfWeek,date);}else{if(el.navtype==200){Calendar.removeClass(el,"hilite");cal.callCloseHandler();return;}date=new Date(cal.date);if(el.navtype==0)date.setDateOnly(new Date());cal.dateClicked=false;var year=date.getFullYear();var mon=date.getMonth();function setMonth(m){var day=date.getDate();var max=date.getMonthDays(m);if(day>max){date.setDate(max);}date.setMonth(m);};switch(el.navtype){case 400:Calendar.removeClass(el,"hilite");var text=Calendar._TT["ABOUT"];if(typeof text!="undefined"){text+=cal.showsTime?Calendar._TT["ABOUT_TIME"]:"";}else{text="Help and about box text is not translated into this language.\n"+"If you know this language and you feel generous please update\n"+"the corresponding file in \"lang\" subdir to match calendar-en.js\n"+"and send it back to <mihai_bazon@yahoo.com> to get it into the distribution  ;-)\n\n"+"Thank you!\n"+"http://dynarch.com/mishoo/calendar.epl\n";}alert(text);return;case-2:if(year>cal.minYear){date.setFullYear(year-1);}break;case-1:if(mon>0){setMonth(mon-1);}else if(year-->cal.minYear){date.setFullYear(year);setMonth(11);}break;case 1:if(mon<11){setMonth(mon+1);}else if(year<cal.maxYear){date.setFullYear(year+1);setMonth(0);}break;case 2:if(year<cal.maxYear){date.setFullYear(year+1);}break;case 100:cal.setFirstDayOfWeek(el.fdow);return;case 50:var range=el._range;var current=el.innerHTML;for(var i=range.length;--i>=0;)if(range[i]==current)break;if(ev&&ev.shiftKey){if(--i<0)i=range.length-1;}else if(++i>=range.length)i=0;var newval=range[i];el.innerHTML=newval;cal.onUpdateTime();return;case 0:if((typeof cal.getDateStatus=="function")&&cal.getDateStatus(date,date.getFullYear(),date.getMonth(),date.getDate())){return false;}break;}if(!date.equalsTo(cal.date)){cal.setDate(date);newdate=true;}else if(el.navtype==0)newdate=closing=true;}if(newdate){ev&&cal.callHandler();}if(closing){Calendar.removeClass(el,"hilite");ev&&cal.callCloseHandler();}};Calendar.prototype.create=function(_par){var parent=null;if(!_par){parent=document.getElementsByTagName("body")[0];this.isPopup=true;}else{parent=_par;this.isPopup=false;}this.date=this.dateStr?new Date(this.dateStr):new Date();var table=Calendar.createElement("table");this.table=table;table.cellSpacing=0;table.cellPadding=0;table.calendar=this;Calendar.addEvent(table,"mousedown",Calendar.tableMouseDown);var div=Calendar.createElement("div");this.element=div;div.className="calendar";if(this.isPopup){div.style.position="absolute";div.style.display="none";}div.appendChild(table);var thead=Calendar.createElement("thead",table);var cell=null;var row=null;var cal=this;var hh=function(text,cs,navtype){cell=Calendar.createElement("td",row);cell.colSpan=cs;cell.className="button";if(navtype!=0&&Math.abs(navtype)<=2)cell.className+=" nav";Calendar._add_evs(cell);cell.calendar=cal;cell.navtype=navtype;cell.innerHTML="<div unselectable='on'>"+text+"</div>";return cell;};row=Calendar.createElement("tr",thead);var title_length=6;(this.isPopup)&&--title_length;(this.weekNumbers)&&++title_length;hh("?",1,400).ttip=Calendar._TT["INFO"];this.title=hh("",title_length,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT["DRAG_TO_MOVE"];this.title.style.cursor="move";hh("&#x00d7;",1,200).ttip=Calendar._TT["CLOSE"];}row=Calendar.createElement("tr",thead);row.className="headrow";this._nav_py=hh("&#x00ab;",1,-2);this._nav_py.ttip=Calendar._TT["PREV_YEAR"];this._nav_pm=hh("&#x2039;",1,-1);this._nav_pm.ttip=Calendar._TT["PREV_MONTH"];this._nav_now=hh(Calendar._TT["TODAY"],this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT["GO_TODAY"];this._nav_nm=hh("&#x203a;",1,1);this._nav_nm.ttip=Calendar._TT["NEXT_MONTH"];this._nav_ny=hh("&#x00bb;",1,2);this._nav_ny.ttip=Calendar._TT["NEXT_YEAR"];row=Calendar.createElement("tr",thead);row.className="daynames";if(this.weekNumbers){cell=Calendar.createElement("td",row);cell.className="name wn";cell.innerHTML=Calendar._TT["WK"];}for(var i=7;i>0;--i){cell=Calendar.createElement("td",row);if(!i){cell.navtype=100;cell.calendar=this;Calendar._add_evs(cell);}}this.firstdayname=(this.weekNumbers)?row.firstChild.nextSibling:row.firstChild;this._displayWeekdays();var tbody=Calendar.createElement("tbody",table);this.tbody=tbody;for(i=6;i>0;--i){row=Calendar.createElement("tr",tbody);if(this.weekNumbers){cell=Calendar.createElement("td",row);}for(var j=7;j>0;--j){cell=Calendar.createElement("td",row);cell.calendar=this;Calendar._add_evs(cell);}}if(this.showsTime){row=Calendar.createElement("tr",tbody);row.className="time";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;cell.innerHTML=Calendar._TT["TIME"]||"&nbsp;";cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=this.weekNumbers?4:3;(function(){function makeTimePart(className,init,range_start,range_end){var part=Calendar.createElement("span",cell);part.className=className;part.innerHTML=init;part.calendar=cal;part.ttip=Calendar._TT["TIME_PART"];part.navtype=50;part._range=[];if(typeof range_start!="number")part._range=range_start;else{for(var i=range_start;i<=range_end;++i){var txt;if(i<10&&range_end>=10)txt='0'+i;else txt=''+i;part._range[part._range.length]=txt;}}Calendar._add_evs(part);return part;};var hrs=cal.date.getHours();var mins=cal.date.getMinutes();var t12=!cal.time24;var pm=(hrs>12);if(t12&&pm)hrs-=12;var H=makeTimePart("hour",hrs,t12?1:0,t12?12:23);var span=Calendar.createElement("span",cell);span.innerHTML=":";span.className="colon";var M=makeTimePart("minute",mins,0,59);var AP=null;cell=Calendar.createElement("td",row);cell.className="time";cell.colSpan=2;if(t12)AP=makeTimePart("ampm",pm?"pm":"am",["am","pm"]);else cell.innerHTML="&nbsp;";cal.onSetTime=function(){var pm,hrs=this.date.getHours(),mins=this.date.getMinutes();if(t12){pm=(hrs>=12);if(pm)hrs-=12;if(hrs==0)hrs=12;AP.innerHTML=pm?"pm":"am";}H.innerHTML=(hrs<10)?("0"+hrs):hrs;M.innerHTML=(mins<10)?("0"+mins):mins;};cal.onUpdateTime=function(){var date=this.date;var h=parseInt(H.innerHTML,10);if(t12){if(/pm/i.test(AP.innerHTML)&&h<12)h+=12;else if(/am/i.test(AP.innerHTML)&&h==12)h=0;}var d=date.getDate();var m=date.getMonth();var y=date.getFullYear();date.setHours(h);date.setMinutes(parseInt(M.innerHTML,10));date.setFullYear(y);date.setMonth(m);date.setDate(d);this.dateClicked=false;this.callHandler();};})();}else{this.onSetTime=this.onUpdateTime=function(){};}var tfoot=Calendar.createElement("tfoot",table);row=Calendar.createElement("tr",tfoot);row.className="footrow";cell=hh(Calendar._TT["SEL_DATE"],this.weekNumbers?8:7,300);cell.className="ttip";if(this.isPopup){cell.ttip=Calendar._TT["DRAG_TO_MOVE"];cell.style.cursor="move";}this.tooltips=cell;div=Calendar.createElement("div",this.element);this.monthsCombo=div;div.className="combo";for(i=0;i<Calendar._MN.length;++i){var mn=Calendar.createElement("div");mn.className=Calendar.is_ie?"label-IEfix":"label";mn.month=i;mn.innerHTML=Calendar._SMN[i];div.appendChild(mn);}div=Calendar.createElement("div",this.element);this.yearsCombo=div;div.className="combo";for(i=12;i>0;--i){var yr=Calendar.createElement("div");yr.className=Calendar.is_ie?"label-IEfix":"label";div.appendChild(yr);}this._init(this.firstDayOfWeek,this.date);parent.appendChild(this.element);};Calendar._keyEvent=function(ev){var cal=window._dynarch_popupCalendar;if(!cal||cal.multiple)return false;(Calendar.is_ie)&&(ev=window.event);var act=(Calendar.is_ie||ev.type=="keypress"),K=ev.keyCode;if(ev.ctrlKey){switch(K){case 37:act&&Calendar.cellClick(cal._nav_pm);break;case 38:act&&Calendar.cellClick(cal._nav_py);break;case 39:act&&Calendar.cellClick(cal._nav_nm);break;case 40:act&&Calendar.cellClick(cal._nav_ny);break;default:return false;}}else switch(K){case 32:Calendar.cellClick(cal._nav_now);break;case 27:act&&cal.callCloseHandler();break;case 37:case 38:case 39:case 40:if(act){var prev,x,y,ne,el,step;prev=K==37||K==38;step=(K==37||K==39)?1:7;function setVars(){el=cal.currentDateEl;var p=el.pos;x=p&15;y=p>>4;ne=cal.ar_days[y][x];};setVars();function prevMonth(){var date=new Date(cal.date);date.setDate(date.getDate()-step);cal.setDate(date);};function nextMonth(){var date=new Date(cal.date);date.setDate(date.getDate()+step);cal.setDate(date);};while(1){switch(K){case 37:if(--x>=0)ne=cal.ar_days[y][x];else{x=6;K=38;continue;}break;case 38:if(--y>=0)ne=cal.ar_days[y][x];else{prevMonth();setVars();}break;case 39:if(++x<7)ne=cal.ar_days[y][x];else{x=0;K=40;continue;}break;case 40:if(++y<cal.ar_days.length)ne=cal.ar_days[y][x];else{nextMonth();setVars();}break;}break;}if(ne){if(!ne.disabled)Calendar.cellClick(ne);else if(prev)prevMonth();else nextMonth();}}break;case 13:if(act)Calendar.cellClick(cal.currentDateEl,ev);break;default:return false;}return Calendar.stopEvent(ev);};Calendar.prototype._init=function(firstDayOfWeek,date){var today=new Date(),TY=today.getFullYear(),TM=today.getMonth(),TD=today.getDate();this.table.style.visibility="hidden";var year=date.getFullYear();if(year<this.minYear){year=this.minYear;date.setFullYear(year);}else if(year>this.maxYear){year=this.maxYear;date.setFullYear(year);}this.firstDayOfWeek=firstDayOfWeek;this.date=new Date(date);var month=date.getMonth();var mday=date.getDate();var no_days=date.getMonthDays();date.setDate(1);var day1=(date.getDay()-this.firstDayOfWeek)%7;if(day1<0)day1+=7;date.setDate(-day1);date.setDate(date.getDate()+1);var row=this.tbody.firstChild;var MN=Calendar._SMN[month];var ar_days=this.ar_days=new Array();var weekend=Calendar._TT["WEEKEND"];var dates=this.multiple?(this.datesCells={}):null;for(var i=0;i<6;++i,row=row.nextSibling){var cell=row.firstChild;if(this.weekNumbers){cell.className="day wn";cell.innerHTML=date.getWeekNumber();cell=cell.nextSibling;}row.className="daysrow";var hasdays=false,iday,dpos=ar_days[i]=[];for(var j=0;j<7;++j,cell=cell.nextSibling,date.setDate(iday+1)){iday=date.getDate();var wday=date.getDay();cell.className="day";cell.pos=i<<4|j;dpos[j]=cell;var current_month=(date.getMonth()==month);if(!current_month){if(this.showsOtherMonths){cell.className+=" othermonth";cell.otherMonth=true;}else{cell.className="emptycell";cell.innerHTML="&nbsp;";cell.disabled=true;continue;}}else{cell.otherMonth=false;hasdays=true;}cell.disabled=false;cell.innerHTML=this.getDateText?this.getDateText(date,iday):iday;if(dates)dates[date.print("%Y%m%d")]=cell;if(this.getDateStatus){var status=this.getDateStatus(date,year,month,iday);if(this.getDateToolTip){var toolTip=this.getDateToolTip(date,year,month,iday);if(toolTip)cell.title=toolTip;}if(status===true){cell.className+=" disabled";cell.disabled=true;}else{if(/disabled/i.test(status))cell.disabled=true;cell.className+=" "+status;}}if(!cell.disabled){cell.caldate=new Date(date);cell.ttip="_";if(!this.multiple&&current_month&&iday==mday&&this.hiliteToday){cell.className+=" selected";this.currentDateEl=cell;}if(date.getFullYear()==TY&&date.getMonth()==TM&&iday==TD){cell.className+=" today";cell.ttip+=Calendar._TT["PART_TODAY"];}if(weekend.indexOf(wday.toString())!=-1)cell.className+=cell.otherMonth?" oweekend":" weekend";}}if(!(hasdays||this.showsOtherMonths))row.className="emptyrow";}this.title.innerHTML=Calendar._MN[month]+", "+year;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates();};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var i in this.multiple){var cell=this.datesCells[i];var d=this.multiple[i];if(!d)continue;if(cell)cell.className+=" selected";}}};Calendar.prototype._toggleMultipleDate=function(date){if(this.multiple){var ds=date.print("%Y%m%d");var cell=this.datesCells[ds];if(cell){var d=this.multiple[ds];if(!d){Calendar.addClass(cell,"selected");this.multiple[ds]=date;}else{Calendar.removeClass(cell,"selected");delete this.multiple[ds];}}}};Calendar.prototype.setDateToolTipHandler=function(unaryFunction){this.getDateToolTip=unaryFunction;};Calendar.prototype.setDate=function(date){if(!date.equalsTo(this.date)){this._init(this.firstDayOfWeek,date);}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date);};Calendar.prototype.setFirstDayOfWeek=function(firstDayOfWeek){this._init(firstDayOfWeek,this.date);this._displayWeekdays();};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(unaryFunction){this.getDateStatus=unaryFunction;};Calendar.prototype.setRange=function(a,z){this.minYear=a;this.maxYear=z;};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat));}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this);}this.hideShowCovered();};Calendar.prototype.destroy=function(){var el=this.element.parentNode;el.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null;};Calendar.prototype.reparent=function(new_parent){var el=this.element;el.parentNode.removeChild(el);new_parent.appendChild(el);};Calendar._checkCalendar=function(ev){var calendar=window._dynarch_popupCalendar;if(!calendar){return false;}var el=Calendar.is_ie?Calendar.getElement(ev):Calendar.getTargetElement(ev);for(;el!=null&&el!=calendar.element;el=el.parentNode);if(el==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(ev);}};Calendar.prototype.show=function(){var rows=this.table.getElementsByTagName("tr");for(var i=rows.length;i>0;){var row=rows[--i];Calendar.removeClass(row,"rowhilite");var cells=row.getElementsByTagName("td");for(var j=cells.length;j>0;){var cell=cells[--j];Calendar.removeClass(cell,"hilite");Calendar.removeClass(cell,"active");}}this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar);}this.hideShowCovered();};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar);}this.element.style.display="none";this.hidden=true;this.hideShowCovered();};Calendar.prototype.showAt=function(x,y){var s=this.element.style;s.left=x+"px";s.top=y+"px";this.show();};Calendar.prototype.showAtElement=function(el,opts){var self=this;var p=Calendar.getAbsolutePos(el);if(!opts||typeof opts!="string"){this.showAt(p.x,p.y+el.offsetHeight);return true;}function fixPosition(box){if(box.x<0)box.x=0;if(box.y<0)box.y=0;var cp=document.createElement("div");var s=cp.style;s.position="absolute";s.right=s.bottom=s.width=s.height="0px";document.body.appendChild(cp);var br=Calendar.getAbsolutePos(cp);document.body.removeChild(cp);if(Calendar.is_ie){br.y+=document.body.scrollTop;br.x+=document.body.scrollLeft;}else{br.y+=window.scrollY;br.x+=window.scrollX;}var tmp=box.x+box.width-br.x;if(tmp>0)box.x-=tmp;tmp=box.y+box.height-br.y;if(tmp>0)box.y-=tmp;};this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var w=self.element.offsetWidth;var h=self.element.offsetHeight;self.element.style.display="none";var valign=opts.substr(0,1);var halign="l";if(opts.length>1){halign=opts.substr(1,1);}switch(valign){case "T":p.y-=h;break;case "B":p.y+=el.offsetHeight;break;case "C":p.y+=(el.offsetHeight-h)/2;break;case "t":p.y+=el.offsetHeight-h;break;case "b":break;}switch(halign){case "L":p.x-=w;break;case "R":p.x+=el.offsetWidth;break;case "C":p.x+=(el.offsetWidth-w)/2;break;case "l":p.x+=el.offsetWidth-w;break;case "r":break;}p.width=w;p.height=h+40;self.monthsCombo.style.display="none";fixPosition(p);self.showAt(p.x,p.y);};if(Calendar.is_khtml)setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10);else Calendar.continuation_for_the_fucking_khtml_browser();};Calendar.prototype.setDateFormat=function(str){this.dateFormat=str;};Calendar.prototype.setTtDateFormat=function(str){this.ttDateFormat=str;};Calendar.prototype.parseDate=function(str,fmt){if(!fmt)fmt=this.dateFormat;this.setDate(Date.parseDate(str,fmt));};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera)return;function getVisib(obj){var value=obj.style.visibility;if(!value){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml)value=document.defaultView. getComputedStyle(obj,"").getPropertyValue("visibility");else value='';}else if(obj.currentStyle){value=obj.currentStyle.visibility;}else value='';}return value;};var tags=new Array("applet","iframe","select");var el=this.element;var p=Calendar.getAbsolutePos(el);var EX1=p.x;var EX2=el.offsetWidth+EX1;var EY1=p.y;var EY2=el.offsetHeight+EY1;for(var k=tags.length;k>0;){var ar=document.getElementsByTagName(tags[--k]);var cc=null;for(var i=ar.length;i>0;){cc=ar[--i];p=Calendar.getAbsolutePos(cc);var CX1=p.x;var CX2=cc.offsetWidth+CX1;var CY1=p.y;var CY2=cc.offsetHeight+CY1;if(this.hidden||(CX1>EX2)||(CX2<EX1)||(CY1>EY2)||(CY2<EY1)){if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}cc.style.visibility=cc.__msh_save_visibility;}else{if(!cc.__msh_save_visibility){cc.__msh_save_visibility=getVisib(cc);}cc.style.visibility="hidden";}}}};Calendar.prototype._displayWeekdays=function(){var fdow=this.firstDayOfWeek;var cell=this.firstdayname;var weekend=Calendar._TT["WEEKEND"];for(var i=0;i<7;++i){cell.className="day name";var realday=(i+fdow)%7;if(i){cell.ttip=Calendar._TT["DAY_FIRST"].replace("%s",Calendar._DN[realday]);cell.navtype=100;cell.calendar=this;cell.fdow=realday;Calendar._add_evs(cell);}if(weekend.indexOf(realday.toString())!=-1){Calendar.addClass(cell,"weekend");}cell.innerHTML=Calendar._SDN[(i+fdow)%7];cell=cell.nextSibling;}};Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none";};Calendar.prototype._dragStart=function(ev){if(this.dragging){return;}this.dragging=true;var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft;}else{posY=ev.clientY+window.scrollY;posX=ev.clientX+window.scrollX;}var st=this.element.style;this.xOffs=posX-parseInt(st.left);this.yOffs=posY-parseInt(st.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd);}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;Date.parseDate=function(str,fmt){var today=new Date();var y=0;var m=-1;var d=0;var a=str.split(/\W+/);var b=fmt.match(/%./g);var i=0,j=0;var hr=0;var min=0;for(i=0;i<a.length;++i){if(!a[i])continue;switch(b[i]){case "%d":case "%e":d=parseInt(a[i],10);break;case "%m":m=parseInt(a[i],10)-1;break;case "%Y":case "%y":y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);break;case "%b":case "%B":for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){m=j;break;}}break;case "%H":case "%I":case "%k":case "%l":hr=parseInt(a[i],10);break;case "%P":case "%p":if(/pm/i.test(a[i])&&hr<12)hr+=12;else if(/am/i.test(a[i])&&hr>=12)hr-=12;break;case "%M":min=parseInt(a[i],10);break;}}if(isNaN(y))y=today.getFullYear();if(isNaN(m))m=today.getMonth();if(isNaN(d))d=today.getDate();if(isNaN(hr))hr=today.getHours();if(isNaN(min))min=today.getMinutes();if(y!=0&&m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);y=0;m=-1;d=0;for(i=0;i<a.length;++i){if(a[i].search(/[a-zA-Z]+/)!=-1){var t=-1;for(j=0;j<12;++j){if(Calendar._MN[j].substr(0,a[i].length).toLowerCase()==a[i].toLowerCase()){t=j;break;}}if(t!=-1){if(m!=-1){d=m+1;}m=t;}}else if(parseInt(a[i],10)<=12&&m==-1){m=a[i]-1;}else if(parseInt(a[i],10)>31&&y==0){y=parseInt(a[i],10);(y<100)&&(y+=(y>29)?1900:2000);}else if(d==0){d=a[i];}}if(y==0)y=today.getFullYear();if(m!=-1&&d!=0)return new Date(y,m,d,hr,min,0);return today;};Date.prototype.getMonthDays=function(month){var year=this.getFullYear();if(typeof month=="undefined"){month=this.getMonth();}if(((0==(year%4))&&((0!=(year%100))||(0==(year%400))))&&month==1){return 29;}else{return Date._MD[month];}};Date.prototype.getDayOfYear=function(){var now=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var then=new Date(this.getFullYear(),0,0,0,0,0);var time=now-then;return Math.floor(time/Date.DAY);};Date.prototype.getWeekNumber=function(){var d=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var DoW=d.getDay();d.setDate(d.getDate()-(DoW+6)%7+3);var ms=d.valueOf();d.setMonth(0);d.setDate(4);return Math.round((ms-d.valueOf())/(7*864e5))+1;};Date.prototype.equalsTo=function(date){return((this.getFullYear()==date.getFullYear())&&(this.getMonth()==date.getMonth())&&(this.getDate()==date.getDate())&&(this.getHours()==date.getHours())&&(this.getMinutes()==date.getMinutes()));};Date.prototype.setDateOnly=function(date){var tmp=new Date(date);this.setDate(1);this.setFullYear(tmp.getFullYear());this.setMonth(tmp.getMonth());this.setDate(tmp.getDate());};Date.prototype.print=function(str){var m=this.getMonth();var d=this.getDate();var y=this.getFullYear();var wn=this.getWeekNumber();var w=this.getDay();var s={};var hr=this.getHours();var pm=(hr>=12);var ir=(pm)?(hr-12):hr;var dy=this.getDayOfYear();if(ir==0)ir=12;var min=this.getMinutes();var sec=this.getSeconds();s["%a"]=Calendar._SDN[w];s["%A"]=Calendar._DN[w];s["%b"]=Calendar._SMN[m];s["%B"]=Calendar._MN[m];s["%C"]=1+Math.floor(y/100);s["%d"]=(d<10)?("0"+d):d;s["%e"]=d;s["%H"]=(hr<10)?("0"+hr):hr;s["%I"]=(ir<10)?("0"+ir):ir;s["%j"]=(dy<100)?((dy<10)?("00"+dy):("0"+dy)):dy;s["%k"]=hr;s["%l"]=ir;s["%m"]=(m<9)?("0"+(1+m)):(1+m);s["%M"]=(min<10)?("0"+min):min;s["%n"]="\n";s["%p"]=pm?"PM":"AM";s["%P"]=pm?"pm":"am";s["%s"]=Math.floor(this.getTime()/1000);s["%S"]=(sec<10)?("0"+sec):sec;s["%t"]="\t";s["%U"]=s["%W"]=s["%V"]=(wn<10)?("0"+wn):wn;s["%u"]=w+1;s["%w"]=w;s["%y"]=(''+y).substr(2,2);s["%Y"]=y;s["%%"]="%";var re=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml)return str.replace(re,function(par){return s[par]||par;});var a=str.match(re);for(var i=0;i<a.length;i++){var tmp=s[a[i]];if(tmp){re=new RegExp(a[i],'g');str=str.replace(re,tmp);}}return str;};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(y){var d=new Date(this);d.__msh_oldSetFullYear(y);if(d.getMonth()!=this.getMonth())this.setDate(28);this.__msh_oldSetFullYear(y);};window._dynarch_popupCalendar=null;
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/scripts/ext/readme	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,3 @@
+curl "http://www.extjs.com/deploy/ext-2.3.0.zip" > ext-2.3.0.zip
+unzip ext-2.3.0.zip
+rm ext-2.3.0.zip
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/scripts/geoext/readme	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,4 @@
+curl "http://trac.geoext.org/attachment/wiki/Download/GeoExt-release-0.6.zip?format=raw" > GeoExt-release-0.6.zip
+unzip GeoExt-release-0.6.zip
+mv GeoExt geoext-0.6
+rm GeoExt-release-0.6.zip
\ No newline at end of file
--- a/gnv/src/main/webapp/scripts/gnviewer.js	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/scripts/gnviewer.js	Fri Sep 28 12:15:18 2012 +0200
@@ -14,4 +14,4 @@
 function showDiv(pName) {
     var el = document.getElementById(pName);
     el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
-}
\ No newline at end of file
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/scripts/layers.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,62 @@
+
+<%@page import="java.util.Iterator"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.map.Layer"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModel"%>/**
+ * This function is called while initializing the application. You are allowed
+ * to change/add/remove layers. But be are of the comments inline this code!
+ */
+function initLayers() {
+    /**
+     * XXX This application needs a layer that is stored in a variable called 
+     * 'layer'. So do not change the name of this variable. Just change the WMS
+     * layer itself.
+     */
+    layer = new OpenLayers.Layer.WMS(
+            "Background1",
+            "http://gdisrv.bsh.de/arcgis/services/Background/Background/MapServer/WMSServer?",
+            {
+                layers: '0',
+                format: 'image/png',
+                transparent: false
+            },
+            {
+                isBaseLayer: true,
+                singleTile: true
+            }
+
+    );
+     /**
+     * XXX This application needs an ARRAY that stores some layers (or a single
+     * layer). Do not change the name of the following variable 'layers'.
+     */    
+    layers = [];
+    layers[0] = layer;
+    
+    <%
+    SessionModel sm = SessionModelFactory.getInstance().getSessionModel(request);
+    MapService localMapService = sm.getLocalMapService();
+    Iterator<Layer> it = localMapService.getLayer().iterator();
+    int i = 1;
+    while (it.hasNext()){
+        Layer layer = it.next();
+    %>
+    layer<%=i%> = new OpenLayers.Layer.WMS(
+            "<%=layer.getID() %>",
+            "<%=localMapService.getURL() %>",
+            {
+                layers: '<%=layer.getName()%>',
+                format: 'image/png',
+                transparent: true
+            },
+            {
+                isBaseLayer: false,
+                singleTile: true
+            }
+
+    );
+    layers[<%=i%>] = layer<%=i++%>;
+    <%}%>
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/scripts/olutils.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,238 @@
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+function handleMeasurements(event) {
+    var geometry = event.geometry;
+    var units    = event.units;
+    var order    = event.order;
+    var measure  = event.measure;
+    var element  = document.getElementById('measurements');
+    
+    var out = "";
+    if(order == 1) {
+        out += "L\u00e4nge: " + measure.toFixed(3) + " " + units;
+    } else {
+        out += "Fl\u00e4che: " + measure.toFixed(3) + " " + units + "<sup>2</sup>";
+    }
+
+    element.innerHTML=out;
+};
+
+
+
+function readWMC(merge) {
+    var layers = mapPanel.layers;
+    map    = mapPanel.map;
+
+    var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
+    var text = document.getElementById("wmc").value;
+
+    merge = true;
+    if(merge) {
+        try {
+            map = format.read(text, {map: map});
+        } catch(err) {
+            document.getElementById("wmc").value = err;
+        }
+    } else {
+        map.destroy();
+        try {
+            var jsonFormat = new OpenLayers.Format.JSON();
+            var mapOptions = jsonFormat.read();
+            map = format.read(text, {map: mapOptions});
+        } catch(err) {
+            document.getElementById("wmc").value = err;
+        }
+    }
+
+    // create MapPanel
+    mapPanel = new GeoExt.MapPanel({
+        border: true,
+        title: "Karte",
+        region: "center",
+        map: map,
+        zoom: 1,
+        layers: map.layers
+    });
+}
+
+
+function writeWMC(merge) {
+    var format = new OpenLayers.Format.WMC({'layerOptions': {buffer: 0}});
+
+    try {
+        var text = format.write(map);
+        document.getElementById("wmc").value = text;
+    } catch(err) {
+        document.getElementById("wmc").value = err;
+    }
+}
+
+
+
+function toggleGetFeatureInfo(evt) {
+    if (infoActive) {
+        infoControls.click.deactivate();
+        infoActive = false;
+    }
+    else {
+        infoControls.click.activate();
+        infoActive = true;
+    }
+}
+
+
+function showInfo(evt) {
+}
+
+
+function addLayer() {
+    var records = grid.getSelectionModel().getSelections();
+    for (rec in records){
+       
+        var record = records[rec];
+        // TODO: Look for something better than object
+        if (typeof record == "object"){ 
+        var copy = record.copy();
+        copy.set("layer", record.get("layer"));
+        copy.get("layer").mergeNewParams({
+            format: "image/png",
+            transparent: true
+        });
+        mapPanel.layers.add(copy);
+        }
+     }
+
+}
+
+
+// this is just copied from OpenLayers.Util
+function urlAppend(url, paramStr) {
+    var newUrl = url;
+    if(paramStr) {
+        var parts = (url + " ").split(/[?&]/);
+        newUrl += (parts.pop() === " " ?
+            paramStr :
+            parts.length ? "&" + paramStr : "?" + paramStr);
+    }
+    return newUrl;
+}
+
+function showWarning(){
+    if (store.data.length == 0){
+        Ext.MessageBox.alert("<bean:message key="gnviewer.mapclient.wms.load.grid.error.title"/>", '<bean:message key="gnviewer.mapclient.wms.load.grid.error.message"/>', grid);
+        return;
+    }
+}
+
+
+function updateCapabilities() {
+
+    var url     = capfield.getValue();
+    var service = "SERVICE=WMS";
+    var request = "REQUEST=GetCapabilities";
+    var version = "VERSION=1.1.1";
+    url = urlAppend(url, service);
+    url = urlAppend(url, request);
+    url = urlAppend(url, version);
+
+    store = new GeoExt.data.WMSCapabilitiesStore({
+        url: url,
+        layerOptions: {singleTile: true}
+    });
+    store.load({
+        callback: showWarning
+    });
+    
+    grid.destroy();
+    grid = new Ext.grid.GridPanel({
+        id: 'wmsgrid',
+        collapsible: false,
+        split: false,
+        border: true,
+        // TODO: autoHeight might cause trouble
+        autoHeight: true,
+        overflow: 'auto',
+        store: store,
+        cm: new Ext.grid.ColumnModel([
+        {
+            header: '<bean:message key="gnviewer.mapclient.wms.load.grid.name"/>',
+            dataIndex: 'name',
+            sortable: true
+        },
+        {
+            id: 'title',
+            header: '<bean:message key="gnviewer.mapclient.wms.load.grid.title"/>',
+            dataIndex: 'title',
+            sortable: true
+        }]),
+        renderTo: 'capgrid',
+        bbar: [{
+            text: '<bean:message key="gnviewer.mapclient.wms.load.addlayer"/>',
+            handler: addLayer
+        }]
+    });
+}
+
+
+function editFeature(e) {
+    var feature = e.feature;
+
+    // TODO SET FEATURE ATTRIBUTES
+    //feature.attributes['lawa'] = 999;
+    //feature.attributes['lawa_id'] = 999;
+    //feature.attributes['w_gwk_lawa'] = 999;
+    //feature.attributes['w_wrrl'] = 999;
+    //feature.attributes['length_fee'] = 999;
+}
+
+function updateControls() {
+    var controls = panel.controls;
+
+    controls.remove(drawPointControl);
+    controls.remove(drawPathControl);
+    controls.remove(drawPolygonControl);
+
+    panel.destroy();
+    panel = new OpenLayers.Control.Panel();
+    panel.addControls(controls);
+
+    if (points.getVisibility())
+        panel.addControls(drawPointControl);
+    if (lines.getVisibility())
+        panel.addControls(drawPathControl);
+    if (polygons.getVisibility())
+        panel.addControls(drawPolygonControl);
+
+    map.addControl(panel);
+}
+function parseGetFeatureInfoData(event) {
+   var contentHTML = "<div>";
+   var features = event.features;
+   var first = true;
+   for (feat in features){
+      if (feat != 'remove'){
+          var feature = features[feat];
+          var attributes = feature.attributes;
+          if (first){
+            first = false;
+          }else{
+            contentHTML += "<br/>";
+          }
+          contentHTML += "<table>";
+          for (att in attributes){
+             contentHTML += "<tr><td><b>"+att+":</b></td><td>" + attributes[att] + "</td></tr>";
+          }
+          contentHTML += "</table>";
+      }
+    
+   }
+   contentHTML += "</div>";
+   
+    mapPanel.map.addPopup(new OpenLayers.Popup.FramedCloud(
+                    "chicken", 
+                    mapPanel.map.getLonLatFromPixel(event.xy),
+                    null,
+                    contentHTML,
+                    null,
+                    true
+                ));
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/scripts/openlayers/readme	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,3 @@
+curl "http://www.openlayers.org/download/OpenLayers-2.9.zip" > OpenLayers.zip
+unzip OpenLayers.zip
+rm OpenLayers.zip
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/scripts/viewport.jsp	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,301 @@
+<%@page import="de.intevation.gnv.action.sessionmodel.SessionModelFactory"%>
+<%@page import="de.intevation.gnv.action.MapClientStandaloneAction"%>
+<%@page import="de.intevation.gnv.artifactdatabase.objects.map.MapService"%>
+<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
+<%
+boolean standalone = request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY) != null &&
+request.getParameter(MapClientStandaloneAction.MAPCLIENTSTANDALONE_KEY).equals("true");
+MapService mapService = SessionModelFactory.getInstance().getSessionModel(request).getLocalMapService();
+%>
+OpenLayers.ImgPath = "images/ol/";
+OpenLayers.ProxyHost= "/cgi-bin/proxy.cgi?url=";
+OpenLayers.Lang.setCode('<%=SessionModelFactory.getInstance().getSessionModel(request).getCurrentLocale().getLanguage() %>');
+Ext.BLANK_IMAGE_URL = "scripts/openlayers/OpenLayers-2.9/theme/default/img/blank.gif";
+
+/**
+ * XXX
+ * Change specific attributes for map, wfs-t, etc here. Do not change these
+ * settings inline the code!
+ */
+PROJECTION     = "EPSG:4326";
+MAX_EXTENT     = new OpenLayers.Bounds(-90,-180,90,180);
+CURRENT_EXTENT = new OpenLayers.Bounds(<%=mapService.getBBoxValue().replace(' ',',')%>);
+INITIAL_CENTER = new OpenLayers.LonLat(5, 55);
+GETFEATUREINFO_URL = "<%=mapService.getURL()%>";
+
+Ext.onReady(function() {
+
+    /* this function call initialized the layers that are defined by the user.
+     * The variable 'layer' and 'layers' are initialized in this function as
+     * well, that are used in the following code! So do not remove this function
+     * call.
+     */
+    initLayers();
+
+    var options = {
+        maxExtent: MAX_EXTENT,
+        projection: PROJECTION,
+        controls: [],
+        units: 'm'
+    };
+
+
+/* ------------------------ Create map and add controls ---------------------*/
+    // create map
+    map      = new OpenLayers.Map(options);
+    map.displayProjection = new OpenLayers.Projection(PROJECTION);
+
+    // add controls
+    
+
+    var nav   = new OpenLayers.Control.NavigationHistory();
+    nav.previous.title = "<bean:message key="gnviewer.mapclient.controls.nav.previous.title"/>";
+    nav.next.title = "<bean:message key="gnviewer.mapclient.controls.nav.next.title"/>";
+    map.addControl(nav);
+
+    panel = new OpenLayers.Control.Panel();
+    controls = {
+        previous: nav.previous,
+        next    : nav.next,
+        navigate: new OpenLayers.Control.Navigation(
+            {
+                displayClass: 'olControlPan',
+                autoActivate: 'false',
+                title:'<bean:message key="gnviewer.mapclient.controls.navigate.title"/>'
+            }
+        ),
+        zoombox: new OpenLayers.Control.ZoomBox(
+            {
+                displayClass: 'olControlZoomBox',
+                title: '<bean:message key="gnviewer.mapclient.controls.zoombox.title"/>'
+            }
+        ),
+        info : new OpenLayers.Control.WMSGetFeatureInfo({
+            displayClass: "olControlFeatureInfo",
+            url: GETFEATUREINFO_URL, 
+            title: '<bean:message key="gnviewer.mapclient.controls.info.title"/>',
+            queryVisible: true,
+            infoFormat: 'application/vnd.ogc.gml',
+            eventListeners: {
+                getfeatureinfo: parseGetFeatureInfoData
+            }
+        })
+    };
+    
+    for (var key in controls) {
+        panel.addControls([controls[key]]);
+    }
+
+    map.addControl(panel);
+    map.addControl(new OpenLayers.Control.PanZoomBar({zoomWorldIcon: 'true'}));
+    // Displaying the mouse postion 
+    mousePosition = new OpenLayers.Control.MousePosition();
+    map.addControl(mousePosition);
+
+/* --------------------------------------------------------------------------- */
+
+    // create MapPanel
+    mapPanel = new GeoExt.MapPanel({
+        border: true,
+        region: "center",
+        map: map,
+        layers: layers
+    });
+
+    //map.setCenter(INITIAL_CENTER);
+
+
+    store = new GeoExt.data.WMSCapabilitiesStore({
+    });
+
+    grid = new Ext.grid.GridPanel({
+        id: 'wmsgrid',
+        collapsible: false,
+        split: false,
+        border: true,
+        //height: 400,
+        autoHeight: true,
+        store: store,
+        cm: new Ext.grid.ColumnModel([
+        {
+            header: '<bean:message key="gnviewer.mapclient.wms.load.grid.name"/>',
+            dataIndex: 'name',
+            sortable: true
+        },
+        {
+            id: 'title',
+            header: '<bean:message key="gnviewer.mapclient.wms.load.grid.title"/>',
+            dataIndex: 'title',
+            sortable: true
+        }]),
+        renderTo: 'capgrid',
+        bbar: [{
+            text: '<bean:message key="gnviewer.mapclient.wms.load.addlayer"/>',
+            handler: addLayer
+        }]
+    });
+    var cap = new Ext.Panel({
+        id: 'wmspanel',
+        border: true,
+        region: 'east',
+        title: '<bean:message key="gnviewer.mapclient.wms.load.title"/>',
+        collapsible: false,
+        split: false,
+        height: 400,
+        contentEl: 'cap'
+        
+    });
+    
+    var capstore = new Ext.data.SimpleStore({
+        fields: ['name','url'],
+        data : [['<bean:message key="gnviewer.mapclient.wms.local.service.name"/>','<%=mapService.getURL()%>'],<jsp:include page="/WEB-INF/config/reachable-servers.conf" />]
+    });
+    capfield = new Ext.form.ComboBox({
+        id: 'capfield',
+        store: capstore,
+        displayField:'name',
+        width: 245,
+        valueField: 'url',
+        mode: 'local',
+        triggerAction: 'all',
+        selectOnFocus: true,
+        renderTo: 'urlinput',
+        editable: false,
+        value: '<%=mapService.getURL()%>'
+        
+    });
+    
+
+
+    var capbutton = new Ext.Button({
+        id: 'capbutton',
+        region: 'west',
+        handler: updateCapabilities,
+        text: '<bean:message key="gnviewer.mapclient.wms.load.bt.text"/>',
+        tooltip: '<bean:message key="gnviewer.mapclient.wms.load.bt.tooltip"/>',
+        renderTo: 'urlbutton'
+    });
+
+
+
+
+/* --------------------------- Layer Tree ----------------------------------- */
+
+
+    // LayerTree
+    var tree = new Ext.tree.TreePanel({
+        border: true,
+        enableDD: true,
+        region: "east",
+        title: "<bean:message key="gnviewer.mapclient.layercontrol"/>",
+        width: 200,
+        split: true,
+        collapsible: false,
+        collapseMode: "mini",
+        autoScroll: true,
+        loader: new Ext.tree.TreeLoader({
+            applyLoader: false,
+        }),
+        root: {
+            nodeType: "async",
+            children: [{
+                nodeType: "gx_baselayercontainer",
+                text: "<bean:message key="gnviewer.mapclient.layercontrol.baselayer"/>",
+                expanded: true
+            }, {
+                nodeType: "gx_overlaylayercontainer",
+                text: "<bean:message key="gnviewer.mapclient.layercontrol.overlay"/>",
+                expanded: true,
+                loader: {
+                    filter: function(record) {
+                        var layer = record.get("layer");
+                        return layer.displayInLayerSwitcher === true &&
+                               layer.isBaseLayer === false;
+                    }
+                }
+            }]
+        },
+        rootVisible: false,
+        lines: false
+    });
+
+/*-------------------------------- Feature grid -------------------------------*/
+
+    // create legend paneclass="headerLineLinksl
+    legendPanel = new GeoExt.LegendPanel({
+        id: 'legendpanel',
+        dynamic: true,
+        border: true,
+        title: '<bean:message key="gnviewer.mapclient.legend"/>',
+        collapsible: false,
+        split: false,
+        defaults: {
+            labelCls: 'legend',
+            style: 'padding: 5px'
+        },
+        bodyStyle: 'padding:5px',
+        width: 250,
+        autoScroll: true,
+        region: 'east',
+    }); 
+
+
+// use separate panels
+    // Create GUI
+       
+    var mylegend = new Ext.Panel(
+        {
+            region: "west",
+            title: '',
+            split: true,
+            width: 250,
+            minSize: 225,
+            maxSize: 400,
+            collapsible: false,
+            overflow: 'auto',
+            margins: '0 0 0 5',
+            layout: 'accordion',
+            layoutConfig: {
+                animate: true,
+                activeOnTop: false
+            },
+            items: [
+                tree,
+                legendPanel,
+                cap
+            ]
+        }
+        );
+    <%if (!standalone){%>
+    // The main panel
+    new Ext.Panel({
+        renderTo: "mapcontainer",
+        layout: "border",
+        height: 400,
+        items: [mapPanel, mylegend]
+    });
+    <%}else{ %>
+    // Create GUI
+    new Ext.Viewport({
+        layout: "border",
+        items: [
+          {
+            region: "north",
+            contentEl: "headline",
+            cls: 'title',
+            height: 40
+          },
+          mylegend,
+          mapPanel
+        ]
+    });
+    <%}%>
+    map.zoomToExtent(CURRENT_EXTENT);
+
+    // some code for automatically resizing the map panel if the window size
+    // changes
+    window.onresize=function() {
+        var mapcontainer = Ext.get('mapcontainer');
+        mapPanel.setSize(mapcontainer.getSize());
+    }
+});
--- a/gnv/src/main/webapp/styles/calendar-blue.css	Fri Sep 28 12:13:47 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,232 +0,0 @@
-/* The main calendar widget.  DIV containing a table. */
-
-div.calendar { position: relative; }
-
-.calendar, .calendar table {
-  border: 1px solid #556;
-  font-size: 11px;
-  color: #000;
-  cursor: default;
-  background: #eef;
-  font-family: tahoma,verdana,sans-serif;
-}
-
-/* Header part -- contains navigation buttons and day names. */
-
-.calendar .button { /* "<<", "<", ">", ">>" buttons have this class */
-  text-align: center;    /* They are the navigation buttons */
-  padding: 2px;          /* Make the buttons seem like they're pressing */
-}
-
-.calendar .nav {
-  background: #778 url(menuarrow.gif) no-repeat 100% 100%;
-}
-
-.calendar thead .title { /* This holds the current "month, year" */
-  font-weight: bold;      /* Pressing it will take you to the current date */
-  text-align: center;
-  background: #fff;
-  color: #000;
-  padding: 2px;
-}
-
-.calendar thead .headrow { /* Row <TR> containing navigation buttons */
-  background: #778;
-  color: #fff;
-}
-
-.calendar thead .daynames { /* Row <TR> containing the day names */
-  background: #bdf;
-}
-
-.calendar thead .name { /* Cells <TD> containing the day names */
-  border-bottom: 1px solid #556;
-  padding: 2px;
-  text-align: center;
-  color: #000;
-}
-
-.calendar thead .weekend { /* How a weekend day name shows in header */
-  color: #a66;
-}
-
-.calendar thead .hilite { /* How do the buttons in header appear when hover */
-  background-color: #aaf;
-  color: #000;
-  border: 1px solid #04f;
-  padding: 1px;
-}
-
-.calendar thead .active { /* Active (pressed) buttons in header */
-  background-color: #77c;
-  padding: 2px 0px 0px 2px;
-}
-
-/* The body part -- contains all the days in month. */
-
-.calendar tbody .day { /* Cells <TD> containing month days dates */
-  width: 2em;
-  color: #456;
-  text-align: right;
-  padding: 2px 4px 2px 2px;
-}
-.calendar tbody .day.othermonth {
-  font-size: 80%;
-  color: #bbb;
-}
-.calendar tbody .day.othermonth.oweekend {
-  color: #fbb;
-}
-
-.calendar table .wn {
-  padding: 2px 3px 2px 2px;
-  border-right: 1px solid #000;
-  background: #bdf;
-}
-
-.calendar tbody .rowhilite td {
-  background: #def;
-}
-
-.calendar tbody .rowhilite td.wn {
-  background: #eef;
-}
-
-.calendar tbody td.hilite { /* Hovered cells <TD> */
-  background: #def;
-  padding: 1px 3px 1px 1px;
-  border: 1px solid #bbb;
-}
-
-.calendar tbody td.active { /* Active (pressed) cells <TD> */
-  background: #cde;
-  padding: 2px 2px 0px 2px;
-}
-
-.calendar tbody td.selected { /* Cell showing today date */
-  font-weight: bold;
-  border: 1px solid #000;
-  padding: 1px 3px 1px 1px;
-  background: #fff;
-  color: #000;
-}
-
-.calendar tbody td.weekend { /* Cells showing weekend days */
-  color: #a66;
-}
-
-.calendar tbody td.today { /* Cell showing selected date */
-  font-weight: bold;
-  color: #00f;
-}
-
-.calendar tbody .disabled { color: #999; }
-
-.calendar tbody .emptycell { /* Empty cells (the best is to hide them) */
-  visibility: hidden;
-}
-
-.calendar tbody .emptyrow { /* Empty row (some months need less than 6 rows) */
-  display: none;
-}
-
-/* The footer part -- status bar and "Close" button */
-
-.calendar tfoot .footrow { /* The <TR> in footer (only one right now) */
-  text-align: center;
-  background: #556;
-  color: #fff;
-}
-
-.calendar tfoot .ttip { /* Tooltip (status bar) cell <TD> */
-  background: #fff;
-  color: #445;
-  border-top: 1px solid #556;
-  padding: 1px;
-}
-
-.calendar tfoot .hilite { /* Hover style for buttons in footer */
-  background: #aaf;
-  border: 1px solid #04f;
-  color: #000;
-  padding: 1px;
-}
-
-.calendar tfoot .active { /* Active (pressed) style for buttons in footer */
-  background: #77c;
-  padding: 2px 0px 0px 2px;
-}
-
-/* Combo boxes (menus that display months/years for direct selection) */
-
-.calendar .combo {
-  position: absolute;
-  display: none;
-  top: 0px;
-  left: 0px;
-  width: 4em;
-  cursor: default;
-  border: 1px solid #655;
-  background: #def;
-  color: #000;
-  font-size: 90%;
-  z-index: 100;
-}
-
-.calendar .combo .label,
-.calendar .combo .label-IEfix {
-  text-align: center;
-  padding: 1px;
-}
-
-.calendar .combo .label-IEfix {
-  width: 4em;
-}
-
-.calendar .combo .hilite {
-  background: #acf;
-}
-
-.calendar .combo .active {
-  border-top: 1px solid #46a;
-  border-bottom: 1px solid #46a;
-  background: #eef;
-  font-weight: bold;
-}
-
-.calendar td.time {
-  border-top: 1px solid #000;
-  padding: 1px 0px;
-  text-align: center;
-  background-color: #f4f0e8;
-}
-
-.calendar td.time .hour,
-.calendar td.time .minute,
-.calendar td.time .ampm {
-  padding: 0px 3px 0px 4px;
-  border: 1px solid #889;
-  font-weight: bold;
-  background-color: #fff;
-}
-
-.calendar td.time .ampm {
-  text-align: center;
-}
-
-.calendar td.time .colon {
-  padding: 0px 2px 0px 3px;
-  font-weight: bold;
-}
-
-.calendar td.time span.hilite {
-  border-color: #000;
-  background-color: #667;
-  color: #fff;
-}
-
-.calendar td.time span.active {
-  border-color: #f00;
-  background-color: #000;
-  color: #0f0;
-}
--- a/gnv/src/main/webapp/styles/default.css	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/main/webapp/styles/default.css	Fri Sep 28 12:15:18 2012 +0200
@@ -36,17 +36,17 @@
 }
 
 a {
-    color: #00416B;
-    text-decoration: none;
+    color: #FF6600;
+    text-decoration: underline;
 }
 
 legend {
-    border: 1px solid #CCD5DE;
+    border: 1px solid #003A66;
     padding: 4px 5px;
     margin: 0 0 0 0;
     background-color: white;
     font-weight: bolder;
-    color: #00416B;
+    color: #003A66;
     clear: both;
 }
 
@@ -54,22 +54,28 @@
     margin: 5px 0 0 10px;
     padding-left: 10px;
     padding-right: 10px;
-    border: 1px solid #CCD5DE;
-    background-image: url( ../images/bg_fieldset_ie6.gif );
+    border: 1px solid #003A66;
+    background-color: #F2F1F5;
     background-repeat: repeat-x;
     background-position: top left;
     display: block;
 }
 
-html > body fieldset {
-    background-image: url( ../images/bg_fieldset.gif );
-}
-
 div {
     margin: 0;
     padding: 0;
 }
 
+#browseDiv {
+    float:      left;
+    margin-top: 1px;
+}
+
+#loadDiv {
+    float:       right;
+    margin-left: 5px;
+}
+
 p, li, dl, input, select, address, legend, label, fieldset span {
     font-size: 0.7em;
 }
@@ -82,6 +88,10 @@
     width: 250px;
 }
 
+textarea.mapviewer {
+    width: 450px;
+}
+
 input.textinput {
     width: 250px;
 }
@@ -92,11 +102,145 @@
     font-size: 0.7em;
 }
 
+table.dynamic {
+    font-size: 1.2em;
+}
+
+table.static {
+    margin:        0 0 0 0;
+    width:         293px;
+}
+
+table.wms {
+    font-size: 0.8em;
+    margin: 0 0 0 0;
+}
+
 table, th, td {
     margin: 0;
     padding: 0;
     font-size: 0.8em;
 }
+
+img {
+    border: 0px;
+}
+
+/* styles used in footer.jsp */
+.footerTable {
+    width:            100%; 
+    background-color: white;
+}
+
+.footerLine {
+    color:          #003A66;
+    font-family:    Arial,Helvetica,sans-serif;
+    font-size:      0.95em;
+    line-height:    1.1em;
+    padding-left:   1px;
+}
+
+.footerTableLinks {
+    width: 100%;
+    background-color: #003a66;
+}
+
+.footerLineLinks {
+    color:          #FFFFFF;
+    font-family:    Arial,Helvetica,sans-serif;
+    font-size:      1.5em;
+    text-decoration:none;
+}
+
+.headerTableLinks {
+    width: 100%;
+    background-color: #003a66;
+}
+
+.headerLineLinks {
+    color:          #FFFFFF;
+    font-family:    Arial,Helvetica,sans-serif;
+    font-size:      1em;
+    text-decoration:none;
+}
+
+/* styles used content */
+#contentElement {
+    height: 80%;
+    position: absolute;
+    top: 85px;
+    width: 100%;
+    margin: 0px 0px 10px 0px;
+    overflow: auto;
+}
+
+.bgblue2 {
+    background-color: #F7F7F9;
+}
+
+#footerElement {
+    position: absolute;
+    bottom: 0px;
+    margin-top: 10px;
+    width: 100%;
+    height: 20px;
+}
+
+.down {
+    padding-top: 15px;
+    width: 315px;
+}
+
+.historyback {
+    padding-left:   10px;
+    vertical-align: top;
+    text-align: right;
+}
+
+#parameterPanel {
+    position: absolute;
+    float: left;
+    left: 0px;
+    top: 5%;
+    width: 400px;
+    height: 95%;
+}
+
+td.parameter {
+    font-size:      0.6em;
+}
+
+.parameter {
+    color:          #003A66;
+    font-size:      0.8em;
+    font-weight:    bold;
+    padding-left:   5px;
+    text-align:     left;
+    vertical-align: top;
+    width:          110px;
+}
+
+.matrixHeader {
+    padding-left: 5px;
+    text-align: center;
+}
+
+.matrixSelectableHeader {
+    padding-left: 5px;
+    text-align: left;
+}
+
+.matrixContent {
+    text-align: center;
+}
+
+.wmsvalue {
+}
+
+.value {
+    font-size: 1.2em;
+}
+
 .submitbutton{
 	cursor:pointer;
 	border:outset 1px #ccc;
@@ -111,24 +255,60 @@
     color: #CD3426;
     font-size: 10px;
     font-weight: bold;
-    margin: 2px 2px;
+    margin-bottom:  2px;
+    border:         2px solid red;
+    padding:        2px;
 }
 
 .errormsg {
-
 	color: red;
 	font-weight: bold;
 }
 
+.chartException {
+    color:       red;
+    font-size:   10px;
+    font-weight: bold;
+    margin-bottom:  2px;
+    border:         2px solid red;
+    padding:        2px;
+}
+
+.inputException {
+    color:          red;
+    font-size:      10px;
+    font-weight:    bold;
+    margin-bottom:  2px;
+    border:         2px solid red;
+    padding:        2px;
+}
+
 /*  ====================== Header ============================= */
-#head {
-	
+#head {	
     height: 25px;
     margin: 0;
     padding: 0;
     background-color: #103D64;
 }
 
+#headline {
+    color: #4C7594;
+    font-family: "Arial Black",Arial,Helvetica,sans-serif;
+    font-weight: bold;
+    line-height: 1.1em;
+    padding-left: 5px;
+    width: 533px;
+}
+
+.headline {
+    border-top: 2px solid #CCe0f4;
+    border-bottom: 2px solid #CCe0f4;
+    color: #4C7594;
+    /*font-weight: bold;*/
+    font-size: 1.2em;
+    padding: 10px;
+}
+
 #logo {	
 	float:right;
     background-image: url( ../images/bsh_logo.gif );
@@ -141,21 +321,48 @@
 }
 #head a {
 	clear:left;
-	
 }
+
+.reload {
+    margin-top: 10px;
+}
+
 #project {
-	position:absolute;
-	top:27px;	
-	left:10px;
-	width: 400px;
+    padding: 0px;
 	text-align: left;
-	
+    font-size: 1.2em;
+    background-color: #e9e8f0;
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    width: 100%;
+    height: 5%;
+}
+
+#projectload {
+    float: left;
+    padding-left: 5px;
+    visibility: hidden;
+}
+
+.devide {
+    width: 100%;
+    height: 2px;
+}
+
+.projectException {
+    color:       red;
+    font-size:   10px;
+    font-weight: bold;
+    margin-bottom:  2px;
+    border:         2px solid red;
+    padding:        2px;
 }
 
 #load_error {
     position:absolute;
-    top:27px;   
-    left:425px;
+    top:175px;   
+    left:375px;
     width: 400px;
     text-align: left;
     
@@ -182,6 +389,12 @@
     
 }
 
+div#headerElement {
+    height: 85px;
+    position: absolute;
+    width: 100%;
+}
+
 div#header {
     background-color: #143B62;
     margin: 0;
@@ -200,7 +413,7 @@
     top: 0;
     left: 0;
     width: 100%;
-
+    height: 100%;
 }
 
 .showContent {
@@ -218,15 +431,48 @@
 }
 
 div#diagram {
-/*POSITION DEFINIEREN*/
-/* border: 1px solid crimson;*/
+    float: left;
+    position: absolute;
+    top: 10%;
+    left: 330px;
+}
+
+div.outerMap {
+    position: absolute;
+    top: 12%;
+    left: 350px;
+    width: 555px;
+    height: 436px;
+    margin: 0 0 0 0;
+    padding: 0 0 0 0;
+}
+
+div.wms {
+    position: absolute;
+    top: 10%;
+    left: 0px;
+    height: 30px;
+    border: 1px solid red;
+}
+
+div#map {
     position: absolute;
     top: 65px;
-    left: 350px;
+    left: 0px;
+    width: 555px;
+    height: 381px;
+    border: 1px solid #CCD5DE;
+}
+
+div.histogram {
+    float: left;
+    position: absolute;
+    top: 10%;
+    left: 330px;
 }
 
 div#export {
-	padding-left: 7px;	
+    width:        325px;
 }
 
 /* this is a wrapper for diagramoptions and statistics*/
@@ -237,21 +483,20 @@
 }
 
 div#diagramoptions {
-/*POSITION DEFINIEREN*/
-/*border: 1px solid blue;*/
     position: relative;
-    width: 600px;
+    width:    325px;
 }
 
 div#diagramOptionsContent {
-/*display: none;*/
+    width : 325px;
 }
 
-div#statistics {
-/*POSITION DEFINIEREN*/
-/*border: 1px solid Red;*/
-    position: relative;
-    width: 600px;
+div.statistics {
+    float: left;
+    position: absolute;
+    top: 10%;
+    left: 330px;
+    width   : 325px;
 }
 
 div#statisticValues {
@@ -305,7 +550,7 @@
 }
 
 div#basefilter {
-    margin-top: 30px;
+    margin-top: 50px;
     width: 325px;
 }
 
@@ -352,4 +597,4 @@
 
 }
 
-/* ----------------------------------- */
\ No newline at end of file
+/* ----------------------------------- */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/styles/extjs-override.css	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,35 @@
+.x-panel-header {
+    background: #F2F1F5;
+	border:1px solid #003A66;
+	color:#003A66;
+}
+
+.x-border-layout-ct {
+    background:#F2F1F5;
+}
+
+.x-panel-body {
+    border:1px solid #003A66;
+}
+
+.x-toolbar{
+    background:#F2F1F5;
+}
+
+.x-panel-bbar .x-toolbar {
+    border:1px solid #003A66;
+}
+
+.x-tool {
+    background:transparent url(../images/ol/tool-sprites.gif) no-repeat;
+}
+
+.x-tree-node-expanded .x-tree-node-icon{
+    background-image:url(../images/ol/folder-open.gif);
+}
+.x-tree-node-leaf .x-tree-node-icon{
+    background-image:url(../images/ol/leaf.gif);
+}
+.x-tree-node-collapsed .x-tree-node-icon{
+    background-image:url(../images/ol/folder.gif);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/styles/gnv.css	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,301 @@
+body {
+    background-color: #FFFFFF;
+    font-family:      verdana, arial, Helvetica, sans-serif;
+    font-size:        0.7em;
+    height:           100%;
+    margin:           0;
+    padding:          0;
+}
+
+fieldset {
+    margin: 5px 0 0 10px;
+    padding-left:   10px;
+    padding-right:  10px;
+    padding-bottom: 5px;
+    padding-top:    5px;
+    border: 1px solid #003A66;
+    background-color: #F2F1F5;
+    background-repeat: repeat-x;
+    background-position: top left;
+    display: block;
+}
+
+legend {
+    border: 1px solid #003A66;
+    padding: 4px 5px;
+    margin: 0 0 0 0;
+    background-color: white;
+    font-weight: bolder;
+    color: #003A66;
+    clear: both;
+}
+
+input {
+    font-family: verdana, arial, Helvetica, sans-serif;
+    font-size:   0.9em;
+}
+
+select, textarea {
+    font-size: 0.9em;
+    width:     250px;
+}
+
+img {
+    border: 0px;
+}
+
+a {
+    color:           #FF6600;
+    font-size:       1.2em;
+    text-decoration: underline;
+}
+
+/* Some classes for the header */
+#headerElement {
+    float:    left;
+    top:      0px;
+    width:    100%;
+}
+
+#header {
+    background-color: #143B62;
+    margin: 0;
+    padding: 0;
+    height: 50px;
+}
+
+#headline {
+    color: #4C7594;
+    font-family: "Arial Black",Arial,Helvetica,sans-serif;
+    font-weight: bold;
+    line-height: 1.1em;
+    padding-left: 5px;
+    width: 533px;
+}
+
+.headline {
+    border-top: 2px solid #CCe0f4;
+    border-bottom: 2px solid #CCe0f4;
+    color: #4C7594;
+    padding: 10px;
+}
+
+.infoheadline {
+    border: 0;
+    color: #4C7594;
+    font-family: "Arial Black",Arial,Helvetica,sans-serif;
+    padding: 0;
+}
+
+.headerTableLinks {
+    width: 100%;
+    background-color: #003a66;
+}
+
+.headerLineLinks {
+    color:          #FFFFFF;
+    font-family:    Arial,Helvetica,sans-serif;
+    font-size:      0.9em;
+    text-decoration:none;
+}
+
+/* Some classes for the project load/save bar */
+#project {
+    background-color: #e9e8f0;
+    height:           5%;
+    left:             0px;
+    padding:          0px;
+    text-align:       left;
+    top:              0px;
+    width:            100%;
+}
+
+#projectload {
+    visibility: hidden;
+}
+
+#browseDiv {
+    float: left;
+}
+
+#loadDiv {
+    float:       left;
+    margin-left: 5px;
+}
+
+/* Some classes for the content */
+#contentElement {
+    float:  left;
+    height: 90%;
+    width:  100%;
+    margin: 0px 0px 10px 0px;
+}
+
+#contentRow {
+    vertical-align: top;
+}
+
+.info-content {
+    padding-left : 15px;
+    padding-right: 15px;
+}
+
+#parameterColumn {
+    width: 400px;
+}
+
+#parameterPanel {
+    float:  left;
+    width:  350px;
+}
+
+.static {
+    background-color: #F2F1F5;
+    width: 300px;
+}
+
+.parameter {
+    color:          #003A66;
+    font-weight:    bold;
+    padding-left:   5px;
+    text-align:     left;
+    vertical-align: top;
+    width:          110px;
+}
+
+.historyback {
+    padding-left:   10px;
+    vertical-align: top;
+    text-align: right;
+}
+
+.statistics {
+    width: 350px;
+}
+
+div.outerMap {
+    float:  left;
+    width:  555px;
+    height: 436px;
+}
+
+div.wms {
+    top: 10%;
+    left: 0px;
+    height: 30px;
+    border: 1px solid red;
+}
+
+div#map {
+    top: 65px;
+    left: 0px;
+    width: 555px;
+    height: 381px;
+    border: 1px solid #CCD5DE;
+}
+
+
+/* Some classes for the footer */
+#footerElement {
+    clear:    left;
+    bottom:   20px;
+    width:    100%;
+    height:   20px;
+}
+
+.footerTable {
+    width:            100%; 
+    background-color: white;
+}
+
+.footerLine {
+    color:          #003A66;
+    font-family:    Arial,Helvetica,sans-serif;
+    line-height:    1.1em;
+    padding-left:   1px;
+}
+
+.footerTableLinks {
+    width: 100%;
+    background-color: #003a66;
+}
+
+.footerLineLinks {
+    color:          #FFFFFF;
+    font-family:    Arial,Helvetica,sans-serif;
+    font-size:      0.9em;
+    text-decoration:none;
+}
+
+
+/* ---------- OVERLAY ------------------------- */
+#overlay {
+    visibility: hidden;
+    position: absolute;
+    left: 0;
+    top: 0;
+    width: 100%;
+    height: 100%;
+    text-align: center;
+    z-index: 100;
+    background-color: white;
+    -moz-opacity: 0.5;
+    opacity: 0.5;
+}
+
+#overlayContent {
+    visibility: hidden;
+    position: relative;
+    z-index: 101;
+    width: 300px;
+    margin: 150px auto;
+    background-color: #fff;
+    border: 1px solid #000;
+    padding: 75px;
+    text-align: right;
+    background-image: url( ../images/bsh_logo.gif );
+    background-repeat: no-repeat;
+}
+
+
+/* warnings and errors */
+.projectException {
+    color:       red;
+    font-size:   10px;
+    font-weight: bold;
+    margin-bottom:  2px;
+    border:         2px solid red;
+    padding:        2px;
+}
+
+.chartException {
+    color:       red;
+    font-size:   10px;
+    font-weight: bold;
+    margin-bottom:  2px;
+    border:         2px solid red;
+    padding:        2px;
+}
+
+.inputException {
+    color:          red;
+    font-size:      10px;
+    font-weight:    bold;
+    margin-bottom:  2px;
+    border:         2px solid red;
+    padding:        2px;
+}
+
+.error {
+    color: #CD3426;
+    font-size: 10px;
+    font-weight: bold;
+    margin-bottom:  2px;
+    border:         2px solid red;
+    padding:        2px;
+}
+
+.errormsg {
+    color: red;
+    font-weight: bold;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/main/webapp/styles/ol_style.css	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,69 @@
+.wmcbox {
+  width: 100%;
+  height: 480px;
+}
+
+.olControlPanel div { 
+  background-color: white;
+  float: left;
+  display: block;
+  position: relative;
+  left: 80px;
+  margin: 5px;
+  width:  24px;
+  height: 24px;
+}
+
+.olControlPanel .olControlFeatureInfoItemActive { 
+  width:  22px;  
+  height: 22px;
+  background-image: url("../images/ol/feature_info_on.png");
+}
+.olControlPanel .olControlFeatureInfoItemInactive { 
+  width:  22px;  
+  height: 22px;
+  background-image: url("../images/ol/feature_info_off.png");
+}
+
+
+.olControlNavigationHistory {
+   background-image: url("../images/ol/navigation_history.png");
+   background-repeat: no-repeat;
+   width:  22px;
+   height: 22px;
+
+}
+
+.olControlPanel .olControlPanItemActive { 
+  width:  22px;  
+  height: 22px;
+  background-image: url("../images/ol/pan_on.png");
+}
+.olControlPanel .olControlPanItemInactive { 
+  width:  22px;  
+  height: 22px;
+  background-image: url("../images/ol/pan_off.png");
+}
+
+.olControlPanel .olControlZoomBoxItemActive { 
+  width:  22px;  
+  height: 22px;
+  background-image: url("../images/ol/zoom_box_on.png");
+}
+.olControlPanel .olControlZoomBoxItemInactive { 
+  width:  22px;  
+  height: 22px;
+  background-image: url("../images/ol/zoom_box_off.png");
+}
+
+div.olControlMousePosition {
+    color:#003A66;
+    background-color: #F2F1F5;
+    filter: alpha(opacity=75);
+    opacity: 0.75
+}
+
+.olHandlerBoxZoomBox {
+    border: 2px solid #003A66;
+    background-color: #F2F1F5;;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/test/java/de/intevation/gnv/action/mapviewer/parser/ExternalCallParserTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2010 by Intevation GmbH
+ *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
+ */
+
+package de.intevation.gnv.action.mapviewer.parser;
+
+import de.intevation.gnv.artifactdatabase.objects.map.Layer;
+import de.intevation.gnv.artifactdatabase.objects.map.MapService;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Logger;
+
+public class ExternalCallParserTestCase extends TestCase {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = null;
+
+    static {
+        BasicConfigurator.configure();
+        log = Logger.getLogger(ExternalCallParserTestCase.class);
+    }
+
+    public ExternalCallParserTestCase() {
+        super();
+    }
+
+    public ExternalCallParserTestCase(String name) {
+        super(name);
+    }
+
+    public void testParseExternalCall() {
+        log.debug("Execute testParseExternalCall");
+        try {
+            InputStream inputStream = new FileInputStream(
+                    new File("src/test/ressources/externalinterfacecall.xml"));
+           ExternalCallParser ecp = new XMLExternalCallParser(inputStream);
+           ecp.parse();
+           String geometry = ecp.getGeometry();
+           assertNotNull(geometry);
+           log.debug("Parsed Geometry: "+geometry);
+           String srs = ecp.getSRS();
+           assertNotNull(srs);
+           log.debug("Parsed SRS: "+srs);
+           Collection<MapService> mapServices = ecp.getMapServices();
+           assertNotNull(mapServices);
+           log.debug(mapServices.size()+"Mapservices parsed");
+           assertEquals(2, mapServices.size());
+           Iterator<MapService> it = mapServices.iterator();
+           MapService mapService1 = it.next();
+           MapService mapService2 = it.next();
+
+           log.debug("MapService 1");
+           log.debug("ID: "+mapService1.getID());
+           log.debug("URL: "+mapService1.getURL());
+           log.debug("TYPE: "+mapService1.getType());
+           Collection<Layer> layer1 = mapService1.getLayer();
+           log.debug("Layer parsed: "+layer1.size());
+           assertEquals(5, layer1.size());
+           Iterator<Layer> layerIt1 = layer1.iterator();
+           while(layerIt1.hasNext()){
+               log.debug(layerIt1.next().toString());
+           }
+
+           log.debug("MapService 2");
+           log.debug("ID: "+mapService2.getID());
+           log.debug("URL: "+mapService2.getURL());
+           log.debug("TYPE: "+mapService2.getType());
+           Collection<Layer> layer2 = mapService2.getLayer();
+           log.debug("Layer parsed: "+layer2.size());
+           assertEquals(2, layer2.size());
+           Iterator<Layer> layerIt2 = layer2.iterator();
+           while(layerIt2.hasNext()){
+               log.debug(layerIt2.next().toString());
+           }
+
+        } catch (Exception e) {
+            log.error(e,e);
+            fail();
+        }
+
+    }
+
+}
--- a/gnv/src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/test/java/de/intevation/gnv/artifactdatabase/client/ArtifactDatabaseClientTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,8 +1,20 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.artifactdatabase.client;
 
+import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
+import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
+import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter;
+import de.intevation.gnv.artifactdatabase.objects.InputParameter;
+
+import de.intevation.gnv.util.XSLTransformer;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -13,16 +25,9 @@
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Logger;
 
-import de.intevation.gnv.artifactdatabase.client.exception.ArtifactDatabaseClientException;
-import de.intevation.gnv.artifactdatabase.objects.ArtifactDescription;
-import de.intevation.gnv.artifactdatabase.objects.ArtifactObject;
-import de.intevation.gnv.artifactdatabase.objects.DefaultInputParameter;
-import de.intevation.gnv.artifactdatabase.objects.InputParameter;
-import de.intevation.gnv.util.XSLTransformer;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class ArtifactDatabaseClientTestCase extends TestCase {
 
@@ -38,7 +43,7 @@
 
     /**
      * Constructor
-     * 
+     *
      * @param namemessage
      */
     public ArtifactDatabaseClientTestCase(String name) {
@@ -93,7 +98,7 @@
                 }
             }
 
-        } catch (ArtifactDatabaseClientException e) {
+        } catch (Exception e) {
             log.error(e, e);
             fail();
         }
--- a/gnv/src/test/java/de/intevation/gnv/util/XSLTransformerTestCase.java	Fri Sep 28 12:13:47 2012 +0200
+++ b/gnv/src/test/java/de/intevation/gnv/util/XSLTransformerTestCase.java	Fri Sep 28 12:15:18 2012 +0200
@@ -1,8 +1,15 @@
-/**
+/*
+ * Copyright (c) 2010 by Intevation GmbH
  *
+ * This program is free software under the LGPL (>=v2.1)
+ * Read the file LGPL.txt coming with the software for details
+ * or visit http://www.gnu.org/licenses/ if it does not exist.
  */
+
 package de.intevation.gnv.util;
 
+import de.intevation.gnv.artifactdatabase.client.DefaultArtifactDatabaseClient;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -11,13 +18,12 @@
 
 import org.apache.log4j.BasicConfigurator;
 import org.apache.log4j.Logger;
+
 import org.w3c.dom.Document;
 
-import de.intevation.gnv.artifactdatabase.client.DefaultArtifactDatabaseClient;
-
 /**
- * @author Tim Englich <tim.englich@intevation.de>
- * 
+ * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
+ *
  */
 public class XSLTransformerTestCase extends TestCase {
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/test/ressources/externalinterfacecall.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gnviewer>
+    <mapservices>
+        <mapservice id="foo" type="arcims" url="http://foo.bar.de">
+            <layer id="layer0" name="Layer 0"/>
+            <layer id="layer1" name="Layer 1">
+                 <layer id="layer2" name="Layer 2"/>
+                 <layer id="layer3" name="Layer 3"/>
+             </layer>
+            <layer id="layern" name="Layer N"/>
+        </mapservice>
+        <mapservice id="foo1" type="wms" url="http://foo1.bar.de">
+             <layer id="layer0" name="Layer 0"/>
+             <layer id="layer1" name="Layer 1"/>
+        </mapservice>
+    </mapservices> 
+    <location>
+        <srs>EPSG:4324</srs>
+        <data>POINT(8.6 56.0)</data>
+    </location>
+</gnviewer>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/test/ressources/externalinterfacecall_curl.xml	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,37 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<gnviewer>
+    <mapservices>
+        <mapservice id='BSH_IMS_Prediction_Model_Current' type='arcims'
+            url='http://foo.bar.de'>
+            <Modeldata />
+            <layer id='3' name='Speed Today 00:00 (Surface)' />
+            <layer id='146' name='Surface Current Day After Tomorrow'>
+                <layer id='207' name='Day After Tomorrow 20:00 (Surface)'>
+                    <layer id='208' name='Speed Day After Tomorrow 21:00 (Surface)' />
+                    <layer id='209' name='Speed Day After Tomorrow 20:00 (Surface)' />
+                </layer>
+            </layer>
+        </mapservice>
+        <mapservice id='BSH_IMS_Marine_Environmental_Monitoring_Network'
+            type='wms' url='http://foo1.bar.de'>
+            <MARNET />
+            <layer id='26' name='Air'>
+                <layer id='27' name='Temperature' />
+            </layer>
+            <layer id='9' name='Salinity'>
+                <layer id='10' name='depth: (0m- -6m)' />
+            </layer>
+            <layer id='13' name='OxygenSaturation'>
+                <layer id='14' name='depth: (0m- -6m)' />
+                <layer id='15' name='depth: (-6m- -20m)' />
+                <layer id='16' name='depth: (-20m- -50m)' />
+            </layer>
+        </mapservice>
+        <mapservice id='BSH_IMS_Sea_Surface_Temperature_Analysis'
+            type='arcims' url='http://foo.bar.de' />
+    </mapservices>
+    <location>
+        <srs>EPSG:4324</srs>
+        <data>POINT(8.6 56.0)</data>
+    </location>
+</gnviewer>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gnv/src/test/ressources/samplecall.txt	Fri Sep 28 12:15:18 2012 +0200
@@ -0,0 +1,1 @@
+curl -v -X POST -H "Content-type: text/xml" http://localhost:8080/gnv/extcall.do -d @externalinterfacecall_curl.xml
\ No newline at end of file

http://dive4elements.wald.intevation.org