changeset 2154:ce9b15673f3f

Use waterlevel state and longitudinal section generator for longitudinal section chart. flys-artifacts/trunk@3736 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 20 Jan 2012 09:18:56 +0000 (2012-01-20)
parents 734d5f5e55c0
children 8c9c40459d8f
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java
diffstat 3 files changed, 33 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jan 20 09:14:53 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jan 20 09:18:56 2012 +0000
@@ -1,3 +1,11 @@
+2012-01-20  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java:
+	  Add an empty facet to this state if the artifact is a Chartartifact.
+
+	* src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java:
+	  Do not add the range to subtitle if no range exists.
+
 2012-01-20  Raimund Renkert <raimund.renkert@intevation.de>
 
 	'New chart' for cross sections.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java	Fri Jan 20 09:14:53 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java	Fri Jan 20 09:18:56 2012 +0000
@@ -10,7 +10,11 @@
 
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.WINFOArtifact;
+import de.intevation.flys.artifacts.ChartArtifact;
+
 import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.model.EmptyFacet;
+
 import de.intevation.flys.artifacts.model.CrossSectionWaterLineFacet;
 import de.intevation.flys.artifacts.model.CalculationResult;
 import de.intevation.flys.artifacts.model.FacetTypes;
@@ -109,6 +113,11 @@
         List<Facet>  facets,
         Object       old
     ) {
+        if (artifact instanceof ChartArtifact) {
+            ChartArtifact chart = (ChartArtifact)artifact;
+            facets.add(new EmptyFacet());
+            return null;
+        }
         return compute((WINFOArtifact) artifact, context, hash, facets, old);
     }
 
@@ -124,6 +133,11 @@
         List<Facet>  facets,
         Object       old
     ) {
+        if (artifact instanceof ChartArtifact) {
+            ChartArtifact chart = (ChartArtifact)artifact;
+            facets.add(new EmptyFacet());
+            return null;
+        }
         return compute((WINFOArtifact) artifact, context, hash, facets, old);
     }
 }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Fri Jan 20 09:14:53 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java	Fri Jan 20 09:18:56 2012 +0000
@@ -146,14 +146,17 @@
     protected String getDefaultChartSubtitle() {
         double[] dist = getRange();
 
-        Object[] args = new Object[] {
-            getRiverName(),
-
-            dist[0],
-
-            dist[1]
-        };
-
+        Object[] args = null;
+        if (dist == null) {
+            args = new Object[] {getRiverName()};
+        }
+        else {
+            args = new Object[] {
+                getRiverName(),
+                dist[0],
+                dist[1]
+            };
+        }
         return msg(getChartSubtitleKey(), "", args);
     }
 

http://dive4elements.wald.intevation.org