diff artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java @ 6905:1b35b2ddfc28

Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 22 Aug 2013 23:31:38 +0200
parents af13ceeba52a
children 7a9cbb3a3d5a
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java	Thu Aug 22 15:38:57 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java	Thu Aug 22 23:31:38 2013 +0200
@@ -21,7 +21,6 @@
 import org.jfree.chart.annotations.XYTextAnnotation;
 import org.jfree.chart.plot.XYPlot;
 import org.jfree.data.xy.XYSeries;
-import org.w3c.dom.Document;
 
 import org.dive4elements.artifactdatabase.state.ArtifactAndFacet;
 import org.dive4elements.artifacts.DataProvider;
@@ -36,10 +35,9 @@
 import org.dive4elements.river.model.FastCrossSectionLine;
 import org.dive4elements.river.themes.LineStyle;
 import org.dive4elements.river.themes.TextStyle;
-import org.dive4elements.river.themes.ThemeAccess;
+import org.dive4elements.river.themes.ThemeDocument;
 import org.dive4elements.river.utils.RiverUtils;
 import org.dive4elements.river.utils.Formatter;
-import org.dive4elements.river.utils.ThemeUtil;
 
 
 /**
@@ -185,14 +183,13 @@
         for(RiverAnnotation fa : this.annotations) {
 
             // Access text styling, if any.
-            Document theme = fa.getTheme();
+            ThemeDocument theme = fa.getTheme();
             TextStyle textStyle = null;
             // XXX: DEAD CODE // LineStyle lineStyle = null;
 
             // Get Themeing information and add legend item.
             if (theme != null) {
-                ThemeAccess themeAccess = new ThemeAccess(theme);
-                textStyle = themeAccess.parseTextStyle();
+                textStyle = theme.parseTextStyle();
                 // XXX: DEAD CODE // lineStyle = themeAccess.parseLineStyle();
                 if (fa.getLabel() != null) {
                     LegendItemCollection lic = new LegendItemCollection();
@@ -258,7 +255,7 @@
     @Override
     public void doOut(
             ArtifactAndFacet artifactFacet,
-            Document         attr,
+            ThemeDocument    attr,
             boolean          visible
             ) {
         String name = artifactFacet.getFacetName();
@@ -332,7 +329,7 @@
     protected void doCrossSectionWaterLineOut(
             Object   o,
             String   seriesName,
-            Document theme,
+            ThemeDocument theme,
             boolean  visible
             ) {
         logger.debug("CrossSectionGenerator.doCrossSectionWaterLineOut");
@@ -341,10 +338,10 @@
         // DO NOT SORT DATA! This destroys the gaps indicated by NaNs.
         StyledXYSeries series = new StyledXYSeries(seriesName, false, theme);
 
-        if (!ThemeUtil.parseShowLineLabel(theme)) {
+        if (!theme.parseShowLineLabel()) {
             series.setLabel("");
         }
-        if (ThemeUtil.parseShowWidth(theme)) {
+        if (theme.parseShowWidth()) {
             NumberFormat nf = Formatter.getMeterFormat(this.context);
             String labelAdd = "b=" + nf.format(lines.width) + "m";
             if (series.getLabel().length() == 0) {
@@ -354,7 +351,7 @@
                 series.setLabel(series.getLabel() + ", " + labelAdd);
             }
         }
-        if (ThemeUtil.parseShowLevel(theme) && lines.points.length > 1
+        if (theme.parseShowLevel() && lines.points.length > 1
                 && lines.points[1].length > 0) {
             NumberFormat nf = Formatter.getMeterFormat(this.context);
             D4EArtifact flys = (D4EArtifact) master;
@@ -369,7 +366,7 @@
                 series.setLabel(series.getLabel() + ", " + labelAdd);
             }
         }
-        if (ThemeUtil.parseShowMiddleHeight(theme) && lines.width != 0) {
+        if (theme.parseShowMiddleHeight() && lines.width != 0) {
             NumberFormat nf = Formatter.getMeterFormat(this.context);
             String labelAdd = "T=" + nf.format(lines.area / lines.width) + "m";
             // : " + lines.area + "/" + lines.width);
@@ -391,7 +388,7 @@
     protected void doHyk(
             Object   o,
             String   seriesName,
-            Document theme,
+            ThemeDocument theme,
             boolean  visible
             ) {
         logger.debug("CrossSectionGenerator.doHyk");
@@ -419,7 +416,7 @@
     protected void doCrossSectionOut(
             Object   o,
             String   seriesName,
-            Document theme,
+            ThemeDocument theme,
             boolean  visible
             ) {
         logger.debug("CrossSectionGenerator.doCrossSectionOut");

http://dive4elements.wald.intevation.org