changeset 7116:3c7471b929d1

Merge branch generator-refectoring into default.
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 24 Sep 2013 12:29:44 +0200
parents bdadffad35b1 (diff) a0b00cfe1799 (current diff)
children 4605d6ca4ee9
files artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionInfoGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionInfoGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesCurveGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesCurveInfoGenerator.java artifacts/src/main/java/org/dive4elements/river/exports/XYChartGenerator.java
diffstat 13 files changed, 158 insertions(+), 114 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/doc/conf/floodmap.xml	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/doc/conf/floodmap.xml	Tue Sep 24 12:29:44 2013 +0200
@@ -14,127 +14,106 @@
 
     <river name="Saar">
         <srid value="31467"/>
-        <dgm-srid value="31466"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Saar"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Mosel">
         <srid value="31467"/>
-        <dgm-srid value="31466"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Mosel"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Elbe">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Elbe"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Donau">
         <srid value="31467"/>
-        <dgm-srid value="25833"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Donau"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Donau (Regensburg Nordarm)">
         <srid value="31467"/>
-        <dgm-srid value="25833"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Donau (Regensburg Nordarm)"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Donau (Schleusenkanäle)">
         <srid value="31467"/>
-        <dgm-srid value="25833"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Donau (Schleusenkanäle)"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Fulda (Winter)">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Fulda (Winter)"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Fulda (Sommer)">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Fulda (Sommer)"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Lahn">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Lahn"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Main">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Main"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Main (Wehrarm Limbach)">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Main (Wehrarm Limbach)"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Main (Wehrarm Volkach)">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Main (Wehrarm Volkach)"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Neckar">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Neckar"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Neckar (über Wehrarme)">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Neckar (über Wehrarme)"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Rhein">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Rhein"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Saale">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Saale"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Saale-Thüringen">
         <srid value="31467"/>
-        <dgm-srid value="31468"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Saale-Thüringen"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Saar (Wiltinger Bogen)">
         <srid value="31467"/>
-        <dgm-srid value="31466"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Saar (Wiltinger Bogen)"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Werra (Winter)">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Werra (Winter)"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Werra (Sommer)">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Werra (Sommer)"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
     <river name="Weser">
         <srid value="31467"/>
-        <dgm-srid value="31467"/>
         <river-wms url="http://example.com/cgi-bin/river-wms" layers="Weser"/>
         <background-wms url="http://osm.intevation.de/mapcache/?" layers="OSM-WMS-Dienst"/>
     </river>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/DGMAccess.java	Tue Sep 24 12:29:44 2013 +0200
@@ -0,0 +1,35 @@
+package org.dive4elements.river.artifacts.access;
+
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.model.DGM;
+
+public class DGMAccess
+extends      RangeAccess
+{
+    private DGM dgm;
+
+    private String geoJSON;
+
+    public DGMAccess() {
+    }
+
+    public DGMAccess(D4EArtifact artifact) {
+        super(artifact);
+    }
+
+    public DGM getDGM() {
+        if (dgm == null) {
+            Integer sridId = getInteger("dgm");
+            dgm = DGM.getDGM(sridId);
+        }
+        return dgm;
+    }
+
+    public String getGeoJSON() {
+        if (geoJSON == null) {
+            geoJSON = getString("uesk.barriers");
+        }
+        return geoJSON;
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/RangeAccess.java	Tue Sep 24 12:29:44 2013 +0200
@@ -37,6 +37,8 @@
 
     private KM_MODE mode;
 
+    public RangeAccess() {
+    }
 
     public RangeAccess(D4EArtifact artifact) {
         super(artifact);
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadCalculation.java	Tue Sep 24 12:29:44 2013 +0200
@@ -127,6 +127,14 @@
         return null;
     }
 
+
+    /** Returns val if not NaN, 0d otherwise. */
+    private static double makeNaN0(double val) {
+        return Double.isNaN(val)
+            ? 0d
+            : val;
+    }
+
     /**
      * Take Loads and build average of all fractions at given km.
      * The average fractions value is set in resLoad.
@@ -149,32 +157,32 @@
         for (SedimentLoad load : epochLoads) {
             SedimentLoadFraction f = load.getFraction(km);
             if (f.getCoarse() > 0d) {
-                double c = resLoad.getFraction(km).getCoarse();
+                double c = makeNaN0(resLoad.getFraction(km).getCoarse());
                 resLoad.setCoarse(km, c + f.getCoarse(), f.getCoarseRange());
                 cSum++;
             }
             if (f.getFineMiddle() > 0d) {
-                double fm = resLoad.getFraction(km).getFineMiddle();
+                double fm = makeNaN0(resLoad.getFraction(km).getFineMiddle());
                 resLoad.setFineMiddle(km, fm + f.getFineMiddle(), f.getFineMiddleRange());
                 fmSum++;
             }
             if (f.getSand() > 0d) {
-                double s = resLoad.getFraction(km).getSand();
+                double s = makeNaN0(resLoad.getFraction(km).getSand());
                 resLoad.setSand(km, s + f.getSand(), f.getSandRange());
                 sSum++;
             }
             if (f.getSuspSand() > 0d) {
-                double s = resLoad.getFraction(km).getSuspSand();
+                double s = makeNaN0(resLoad.getFraction(km).getSuspSand());
                 resLoad.setSuspSand(km, s + f.getSuspSand(), f.getSuspSandRange());
                 ssSum++;
             }
             if (f.getSuspSandBed() > 0d) {
-                double s = resLoad.getFraction(km).getSuspSandBed();
+                double s = makeNaN0(resLoad.getFraction(km).getSuspSandBed());
                 resLoad.setSuspSandBed(km, s + f.getSuspSandBed(), f.getSuspSandBedRange());
                 ssbSum++;
             }
             if (f.getSuspSediment() > 0d) {
-                double s = resLoad.getFraction(km).getSuspSediment();
+                double s = makeNaN0(resLoad.getFraction(km).getSuspSediment());
                 resLoad.setSuspSediment(km, s + f.getSuspSediment(), f.getSuspSedimentRange());
                 sseSum++;
             }
@@ -205,6 +213,7 @@
         }
     }
 
+    /** Calculate result for an epoch. */
     private SedimentLoadResult calculateEpoch(int i) {
         List<SedimentLoad> epochLoads = new ArrayList<SedimentLoad>();
         for (int j = epoch[i][0]; j < epoch[i][1]; j++) {
@@ -213,8 +222,8 @@
                 this.yearEpoch,
                 this.kmLow,
                 this.kmUp,
-                j,
-                j));
+                j, //syear
+                j)); //eyear
         }
 
         SedimentLoad resLoad = new SedimentLoad();
@@ -234,23 +243,16 @@
         resLoad.setDescription("");
         resLoad.setEpoch(true);
 
-        SedimentLoadResult result;
         SedimentLoad sl = calculateTotalLoad(resLoad, this.epoch[i][0]);
+
         if (this.unit.equals("m3_per_a")) {
-            SedimentLoad slu = calculateUnit(sl, this.epoch[i][0]);
-            result = new SedimentLoadResult(
-                this.epoch[i][0],
-                this.epoch[i][1],
-                slu);
-        }
-        else {
-            result = new SedimentLoadResult(
-                this.epoch[i][0],
-                this.epoch[i][1],
-                sl);
+            sl = calculateUnit(sl, this.epoch[i][0]);
         }
 
-        return result;
+        return new SedimentLoadResult(
+            this.epoch[i][0],
+            this.epoch[i][1],
+            sl);
     }
 
     /**
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java	Tue Sep 24 12:29:44 2013 +0200
@@ -249,7 +249,7 @@
             eyear);
 
         if (values != null && key != null) {
-            log.debug("Store static bed height values in cache.");
+            log.debug("Store sediment loads in cache.");
             element = new Element(key, values);
             cache.put(element);
         }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java	Tue Sep 24 12:29:44 2013 +0200
@@ -30,6 +30,7 @@
 import org.dive4elements.artifacts.GlobalContext;
 import org.dive4elements.artifacts.common.utils.FileTools;
 import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.DGMAccess;
 import org.dive4elements.river.artifacts.access.RangeAccess;
 import org.dive4elements.river.artifacts.context.RiverContext;
 import org.dive4elements.river.artifacts.model.CalculationMessage;
@@ -412,7 +413,7 @@
                 MapfileGenerator.MS_LAYER_PREFIX + HWS_LINES,
                 HWS_LINES_SHAPE,
                 "LINE",
-                "31467",
+                "31467", // XXX: This should be dynamically fetched from database.
                 "hws");
             job.addLin(artifactDir + "/" + HWS_LINES_SHAPE);
             facetCreator.createShapeFacet(I18N_HWS_LINES_OFFICIAL,
@@ -536,16 +537,18 @@
         File         dir,
         WSPLGENJob   job
     ) {
-        String river   = artifact.getDataAsString("river");
-        String geoJSON = artifact.getDataAsString("uesk.barriers");
-        String srid    = RiverUtils.getRiverDGMSrid(river);
-        String srs     = "EPSG:" + srid;
+        DGMAccess access = new DGMAccess(artifact);
+        String geoJSON   = access.getGeoJSON();
 
         if (geoJSON == null || geoJSON.length() == 0) {
             logger.debug("No barrier features in parameterization existing.");
             return;
         }
 
+        String srid = String.valueOf(access.getDGM().getSrid());
+
+        String srs = "EPSG:" + srid;
+
         SimpleFeatureType ft = getBarriersFeatureType(
             "barriers", srs, Geometry.class);
 
@@ -748,9 +751,10 @@
 
 
     protected void setAxis(D4EArtifact artifact, File dir, WSPLGENJob job) {
-        String river = artifact.getDataAsString("river");
-        String srid    = RiverUtils.getRiverDGMSrid(river);
-        String srs     = "EPSG:" + srid;
+        DGMAccess access = new DGMAccess(artifact);
+        String river = access.getRiver();
+        String srid  = String.valueOf(access.getDGM().getSrid());
+        String srs   = "EPSG:" + srid;
 
         List<RiverAxis> axes = null;
         try {
@@ -794,9 +798,10 @@
 
 
     protected void setPro(D4EArtifact artifact, File dir, WSPLGENJob job) {
-        String river = artifact.getDataAsString("river");
-        String srid    = RiverUtils.getRiverDGMSrid(river);
-        String srs     = "EPSG:" + srid;
+        DGMAccess access = new DGMAccess(artifact);
+        String river = access.getRiver();
+        String srid  = String.valueOf(access.getDGM().getSrid());
+        String srs   = "EPSG:" + srid;
 
         List<CrossSectionTrack> cst =
             CrossSectionTrack.getCrossSectionTrack(river, WSPLGEN_QPS_NAME);
@@ -838,33 +843,25 @@
 
     protected void setDgm(
         D4EArtifact artifact,
-        WSPLGENJob job,
+        WSPLGENJob  job,
         CallContext context
     ) {
-        String dgm_id = artifact.getDataAsString("dgm");
-
-        int id = -1;
-        try {
-            id = Integer.parseInt(dgm_id);
-        }
-        catch (NumberFormatException nfe) { /* do nothing */ }
-
-        DGM dgm = DGM.getDGM(id);
+        DGMAccess access = new DGMAccess(artifact);
+        DGM dgm = access.getDGM();
 
         if (dgm == null) {
             logger.warn("Could not find specified DGM.");
-
             return;
         }
 
-        File dgmPath = new File (dgm.getPath());
+        File dgmPath = new File(dgm.getPath());
         if (dgmPath.isAbsolute()) {
             job.setDgm(dgm.getPath());
         }
         else {
             RiverContext fc = (RiverContext)context.globalContext();
-            String prefix = (String) fc.get("dgm-path");
-            job.setDgm(prefix.trim() + dgm.getPath().trim());
+            File prefix = new File((String)fc.get("dgm-path"));
+            job.setDgm(new File(prefix, dgm.getPath()).getAbsolutePath());
         }
     }
 
@@ -876,8 +873,9 @@
             return;
         }
 
-        String river = artifact.getDataAsString("river");
-        String srid  = RiverUtils.getRiverDGMSrid(river);
+        DGMAccess access = new DGMAccess(artifact);
+        String river = access.getRiver();
+        String srid  = String.valueOf(access.getDGM().getSrid());
         String srs   = "EPSG:" + srid;
 
         Floodplain plain = Floodplain.getFloodplain(river);
@@ -1013,8 +1011,5 @@
             }
         }
     }
-
-
-
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/StaticWQKmsState.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/StaticWQKmsState.java	Tue Sep 24 12:29:44 2013 +0200
@@ -10,6 +10,8 @@
 
 import java.util.List;
 
+import gnu.trove.TDoubleArrayList;
+
 import org.apache.log4j.Logger;
 
 import org.dive4elements.artifacts.CallContext;
@@ -79,18 +81,30 @@
                name = STATIC_WQKMS;
            }
         */
+        // Spawn Q Facet only if at least one discharge value
+        // is != -1
+        boolean qEmpty = true;
+        TDoubleArrayList qs = wqkms.allQs();
+        for (int i = 0; i < qs.size(); i++) {
+            if (qs.getQuick(i) != -1d) {
+                qEmpty = false;
+                break;
+            }
+        }
 
         String wkmsName = wqkms.getName();
-        Facet qfacet = new WQKmsFacet(
-            STATIC_WQKMS_Q,
-            wkmsName
-            // TODO re-enable translations.
-            /*
-            Resources.getMsg(
-                metaLocale,
-                wkmsName,
-                wkmsName)*/);
-        facets.add(qfacet);
+        if (!qEmpty) {
+            Facet qfacet = new WQKmsFacet(
+                STATIC_WQKMS_Q,
+                wkmsName
+                // TODO re-enable translations.
+                /*
+                Resources.getMsg(
+                    metaLocale,
+                    wkmsName,
+                    wkmsName)*/);
+            facets.add(qfacet);
+        }
 
         Facet rpFacet = new RelativePointFacet(wkmsName);
         facets.add(rpFacet);
--- a/artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java	Tue Sep 24 12:29:44 2013 +0200
@@ -60,7 +60,7 @@
     public static final String DEFAULT_CSV_CHARSET = "UTF-8";
 
     /** The default separator for the CSV export. */
-    public static final char DEFAULT_CSV_SEPARATOR = ',';
+    public static final char DEFAULT_CSV_SEPARATOR = ';';
 
     /** XPath that points to the desired export facet. */
     public static final String XPATH_FACET = "/art:action/@art:type";
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartExportHelper.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartExportHelper.java	Tue Sep 24 12:29:44 2013 +0200
@@ -28,6 +28,9 @@
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
+
+import java.text.NumberFormat;
+
 import org.jfree.chart.ChartRenderingInfo;
 
 import javax.imageio.ImageIO;
@@ -47,6 +50,8 @@
 
 import org.dive4elements.artifacts.common.utils.XMLUtils;
 
+import org.dive4elements.river.utils.Formatter;
+
 
 /**
  * This class is a helper class which supports some methods to export charts
@@ -75,7 +80,7 @@
     public static final String  DEFAULT_ENCODING  = "UTF-8";
 
     /** The default separator for the CSV export. */
-    public static final char DEFAULT_CSV_SEPARATOR = ',';
+    public static final char DEFAULT_CSV_SEPARATOR = ';';
 
 
     /**
@@ -300,6 +305,9 @@
             log.warn("Wrong encoding for CSV export.");
             return;
         }
+
+        NumberFormat format = Formatter.getCSVFormatter(context);
+
         XYPlot plot = chart.getXYPlot();
         int count = plot.getDatasetCount();
         for (int i = 0; i < count; i++) {
@@ -309,7 +317,7 @@
                 Comparable seriesKey = data.getSeriesKey(j);
                 log.debug("series key: " + seriesKey.toString());
                 writeCSVHeader(writer, seriesKey.toString());
-                writeCSVData(writer, data);
+                writeCSVData(writer, data, format);
             }
         }
         try {
@@ -329,15 +337,29 @@
     }
 
 
-    protected static void writeCSVData(CSVWriter writer, XYDataset data) {
+    /** Get x/y data from axis set and write it, on pair per line. */
+    protected static void writeCSVData(
+        CSVWriter writer, XYDataset data, NumberFormat format) {
         int series = data.getSeriesCount();
         for (int i = 0; i < series; i++) {
             int items = data.getItemCount(i);
             for (int j = 0; j < items; j++) {
                 log.debug("write data: " + data.getX(i, j) + ", " + data.getY(i, j));
+                String xString;
+                String yString;
+                try {
+                    xString = format.format(data.getX(i, j));
+                    yString = java.lang.Double.isNaN(data.getYValue(i, j))
+                        ? ""
+                        : format.format(data.getY(i, j));
+                }
+                catch (NumberFormatException nfe) {
+                    xString = data.getX(i, j).toString();
+                    yString = data.getY(i, j).toString();
+                }
                 writer.writeNext(new String[] {
-                    data.getX(i, j).toString(),
-                    data.getY(i, j).toString()});
+                    xString,
+                    yString});
             }
         }
     }
--- a/artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/ArtifactMapfileGenerator.java	Tue Sep 24 12:29:44 2013 +0200
@@ -10,7 +10,7 @@
 
 import org.dive4elements.artifacts.CallContext;
 import org.dive4elements.river.artifacts.D4EArtifact;
-import org.dive4elements.river.artifacts.access.RangeAccess;
+import org.dive4elements.river.artifacts.access.DGMAccess;
 import org.dive4elements.river.artifacts.model.LayerInfo;
 import org.dive4elements.river.artifacts.model.map.WMSDBLayerFacet;
 import org.dive4elements.river.artifacts.model.map.WMSLayerFacet;
@@ -86,7 +86,7 @@
 
         String identifier = flys.identifier();
 
-        RangeAccess access = new RangeAccess(flys);
+        DGMAccess access = new DGMAccess(flys);
 
         LayerInfo layerinfo = new LayerInfo();
         layerinfo.setName(MS_WSPLGEN_PREFIX + identifier);
@@ -110,7 +110,7 @@
         layerinfo.setTitle(title);
 
         layerinfo.setStyle(style);
-        layerinfo.setSrid(RiverUtils.getRiverDGMSrid(river));
+        layerinfo.setSrid(String.valueOf(access.getDGM().getSrid()));
 
         String name = MS_LAYER_PREFIX + wms.getName();
 
--- a/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/Formatter.java	Tue Sep 24 12:29:44 2013 +0200
@@ -99,6 +99,10 @@
     public static final int SQ_RELATION_B_MAX_DIGITS  = 3;
     public static final int SQ_RELATION_B_MIN_DIGITS  = 3;
 
+    // OTHER
+    public static final int CSV_DIAGRAM_DATA_MAX_DIGITS  = 3;
+    public static final int CSV_DIAGRAM_DATA_MIN_DIGITS  = 3;
+
     /**
      * Creates a localized NumberFormatter with given range of decimal digits.
      * @param m CallMeta to find the locale.
@@ -191,6 +195,18 @@
                 WATERLEVEL_KM_MAX_DIGITS);
     }
 
+    /**
+     * Returns the number formatter for data exported from diagram (not from
+     * calculation.
+     *
+     * @return the number formatter for csv data from diagra.
+     */
+    public static NumberFormat getCSVFormatter(CallContext context) {
+        return getFormatter(
+                context,
+                CSV_DIAGRAM_DATA_MIN_DIGITS,
+                CSV_DIAGRAM_DATA_MAX_DIGITS);
+    }
 
     public static NumberFormat getWaterlevelW(CallMeta meta) {
         return getFormatter(
--- a/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java	Tue Sep 24 12:29:44 2013 +0200
@@ -80,9 +80,6 @@
     public static final String XPATH_FLOODMAP_RIVER_PROJECTION =
         "/artifact-database/floodmap/river[@name=$name]/srid/@value";
 
-    public static final String XPATH_FLOODMAP_DGM_PROJECTION =
-        "/artifact-database/floodmap/river[@name=$name]/dgm-srid/@value";
-
     public static final String XPATH_FLOODMAP_SHAPEFILE_DIR =
         "/artifact-database/floodmap/shapefile-path/@value";
 
@@ -427,24 +424,6 @@
             variables);
     }
 
-    public static String getRiverDGMSrid(String rivername) {
-        Map<String, String> variables = new HashMap<String, String>(1);
-        variables.put("name", rivername);
-
-        Document cfg = Config.getConfig();
-
-        String dgm = (String) XMLUtils.xpath(
-            cfg,
-            XPATH_FLOODMAP_DGM_PROJECTION,
-            XPathConstants.STRING,
-            null,
-            variables);
-        if (logger.isDebugEnabled()) {
-            logger.debug("Use EPSG:" + dgm + " for DGM");
-        }
-        return dgm;
-    }
-
     /**
      * Return the (first) Gauge corresponding to the given location(s) of
      * the artifact.
--- a/gwt-client/src/main/java/org/dive4elements/river/client/server/CSVExportServiceImpl.java	Tue Sep 24 12:25:36 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/server/CSVExportServiceImpl.java	Tue Sep 24 12:29:44 2013 +0200
@@ -77,7 +77,7 @@
         try {
             InputStream in = client.collectionOut(requestDoc, uuid, "export");
             Reader reader       = new InputStreamReader (in, "UTF-8");
-            CSVReader csvReader = new CSVReader (reader);
+            CSVReader csvReader = new CSVReader (reader, ';');
 
             List<String[]> lines = new ArrayList<String[]>();
             String[]       line  = null;

http://dive4elements.wald.intevation.org