changeset 3766:d29cebf371ba

Use data of bed quality facets to fill the chart. flys-artifacts/trunk@5468 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 14 Sep 2012 12:20:57 +0000
parents d8f2ab5b61c3
children b4ad8dafe584
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/minfo.xml flys-artifacts/doc/conf/default-themes.xml flys-artifacts/doc/conf/second-themes.xml flys-artifacts/doc/conf/themes.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedBedQualityResult.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java
diffstat 10 files changed, 182 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Sep 14 12:17:14 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Sep 14 12:20:57 2012 +0000
@@ -1,3 +1,28 @@
+2012-09-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/artifacts/minfo.xml: Splitted facets for diameter of bed into
+	  two facets: diameter for sublayer and toplayer.
+
+	* doc/conf/themes.xml,
+	  doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml: Splitted themes for diameter of bed into
+	  two themes.
+
+	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java:
+	  Splitted facets for diameter of bed into two facets.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java:
+	  New method to retrieve the diameter data.
+
+	* src/main/java/de/intevation/flys/artifacts/model/minfo/BedBedQualityResult.java:
+	  New methods to retrieve the porosity, density and diameter data.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Create two facets for bed diameter instead of a single one.
+
+	* src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java:
+	  Insert data supported by facets into chart.
+
 2012-09-14  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/jfree/JFreeUtil.java: Added function to
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml	Fri Sep 14 12:17:14 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml	Fri Sep 14 12:20:57 2012 +0000
@@ -286,8 +286,9 @@
                     	<facet name="bed_longitudinal_section.porosity_sublayer"/>
                     	<facet name="bed_longitudinal_section.sediment_density_toplayer"/>
                     	<facet name="bed_longitudinal_section.sediment_density_sublayer"/>
+                    	<facet name="bed_longitudinal_section.bed_diameter_toplayer"/>
+                    	<facet name="bed_longitudinal_section.bed_diameter_sublayer"/>
                     	<facet name="bed_longitudinal_section.bedload_diameter"/>
-                    	<facet name="bed_longitudinal_section.bed_diameter"/>
                     </facets>
                 </outputmode>
             </outputmodes>
--- a/flys-artifacts/doc/conf/default-themes.xml	Fri Sep 14 12:17:14 2012 +0000
+++ b/flys-artifacts/doc/conf/default-themes.xml	Fri Sep 14 12:20:57 2012 +0000
@@ -1091,7 +1091,14 @@
     	</inherits>
     </theme>
     
-    <theme name="BedDiameter">
+    <theme name="BedDiameterTopLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+    </theme>
+    
+    <theme name="BedDiameterSubLayer">
     	<inherits>
     		<inherit from="HiddenColorLines" />
     		<inherit from="MinMaxPoints" />
--- a/flys-artifacts/doc/conf/second-themes.xml	Fri Sep 14 12:17:14 2012 +0000
+++ b/flys-artifacts/doc/conf/second-themes.xml	Fri Sep 14 12:20:57 2012 +0000
@@ -1092,7 +1092,14 @@
     	</inherits>
     </theme>
     
-    <theme name="BedDiameter">
+    <theme name="BedDiameterTopLayer">
+    	<inherits>
+    		<inherit from="HiddenColorLines" />
+    		<inherit from="MinMaxPoints" />
+    	</inherits>
+    </theme>
+    
+    <theme name="BedDiameterSubLayer">
     	<inherits>
     		<inherit from="HiddenColorLines" />
     		<inherit from="MinMaxPoints" />
--- a/flys-artifacts/doc/conf/themes.xml	Fri Sep 14 12:17:14 2012 +0000
+++ b/flys-artifacts/doc/conf/themes.xml	Fri Sep 14 12:20:57 2012 +0000
@@ -193,8 +193,9 @@
 		<mapping from="bed_longitudinal_section.porosity_sublayer" to="PorositySubLayer" />
 		<mapping from="bed_longitudinal_section.sediment_density_toplayer" to="DensityTopLayer" />
 		<mapping from="bed_longitudinal_section.sediment_density_sublayer" to="DensitySublayer" />
+		<mapping from="bed_longitudinal_section.bed_diameter_toplayer" to="BedDiameterTopLayer" />
+		<mapping from="bed_longitudinal_section.bed_diameter_sublayer" to="BedDiameterSubLayer" />
 		<mapping from="bed_longitudinal_section.bedload_diameter" to="BedLoadDiameter" />
-		<mapping from="bed_longitudinal_section.bed_diameter" to="BedDiameter" />
 		<mapping from="relativepoint" to="RelativePoint" />
 		<mapping from="sq_a_measurement" to="SQMeasurements" />
 		<mapping from="sq_a_outlier" to="SQOutliers" />
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Sep 14 12:17:14 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Fri Sep 14 12:20:57 2012 +0000
@@ -215,12 +215,13 @@
     String MIDDLE_BED_HEIGHT_EPOCH      = "bedheight_middle.epoch";
     String MIDDLE_BED_HEIGHT_ANNOTATION = "bedheight_middle.annotation";
 
-    String BED_QUALITY_POROSITY_TOPLAYER = "bed_longitudinal_section.porosity_toplayer";
-    String BED_QUALITY_POROSITY_SUBLAYER = "bed_longitudinal_section.porosity_sublayer";
-    String BED_QUALITY_BED_DIAMETER      = "bed_longitudinal_section.bed_diameter";
-    String BED_QUALITY_BEDLOAD_DIAMETER  = "bed_longitudinal_section.bedload_diameter";
+    String BED_QUALITY_POROSITY_TOPLAYER         = "bed_longitudinal_section.porosity_toplayer";
+    String BED_QUALITY_POROSITY_SUBLAYER         = "bed_longitudinal_section.porosity_sublayer";
+    String BED_QUALITY_BED_DIAMETER_TOPLAYER     = "bed_longitudinal_section.bed_diameter_toplayer";
+    String BED_QUALITY_BED_DIAMETER_SUBLAYER     = "bed_longitudinal_section.bed_diameter_sublayer";
     String BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER = "bed_longitudinal_section.sediment_density_toplayer";
     String BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER = "bed_longitudinal_section.sediment_density_sublayer";
+    String BED_QUALITY_BEDLOAD_DIAMETER          = "bed_longitudinal_section.bedload_diameter";
 
     String SQ_OVERVIEW       = "sq_overview";
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedBedQualityResult.java	Fri Sep 14 12:17:14 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedBedQualityResult.java	Fri Sep 14 12:20:57 2012 +0000
@@ -2,6 +2,8 @@
 
 import org.apache.poi.hssf.record.formula.functions.T;
 
+import com.vividsolutions.jts.densify.Densifier;
+
 import gnu.trove.TDoubleArrayList;
 import de.intevation.flys.artifacts.model.DateRange;
 
@@ -59,4 +61,46 @@
     public double getDiameterSub(int ndx) {
         return diameterSub.get(ndx);
     }
+    
+    public double[][] getDiameterCapData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            diameterCap.toNativeArray()
+        };
+    }
+    
+    public double[][] getDiameterSubData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            diameterSub.toNativeArray()
+        };
+    }
+    
+    public double[][] getPorosityTopLayerData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            porosityCap.toNativeArray()
+        };
+    }
+    
+    public double[][] getPorositySubLayerData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            porositySub.toNativeArray()
+        };
+    }
+    
+    public double[][] getDensityTopLayerData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            loadDensityCap.toNativeArray()
+        };
+    }
+    
+    public double[][] getDensitySubLayerData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            loadDensitySub.toNativeArray()
+        };
+    }
 }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java	Fri Sep 14 12:17:14 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedQualityResult.java	Fri Sep 14 12:20:57 2012 +0000
@@ -77,4 +77,11 @@
     public boolean isEmpty() {
         return empty;
     }
+    
+    public double[][] getDiameterData() {
+        return new double[][] {
+            kms.toNativeArray(),
+            diameter.toNativeArray()
+        };
+    }
 }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Fri Sep 14 12:17:14 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Fri Sep 14 12:20:57 2012 +0000
@@ -90,12 +90,17 @@
 
                 // TODO I18N for Facet description
                 newFacets.add(new BedloadDiameterFacet(idx,
-                    BED_QUALITY_BEDLOAD_DIAMETER, "bed diameter",
+                    BED_QUALITY_BED_DIAMETER_TOPLAYER, "bed diameter_toplayer",
+                    ComputeType.ADVANCE, stateId, hash));
+                
+                // TODO I18N for Facet description
+                newFacets.add(new BedloadDiameterFacet(idx,
+                    BED_QUALITY_BED_DIAMETER_SUBLAYER, "bed diameter_sublayer",
                     ComputeType.ADVANCE, stateId, hash));
             }
             else if (result instanceof BedLoadBedQualityResult) {
-                // TODO CREATE FACETS DEPENDING ON THE CALCULATION RESULT
-                newFacets.add(new BedDiameterFacet(idx, BED_QUALITY_BED_DIAMETER,
+                // TODO I18N for Facet description
+                newFacets.add(new BedDiameterFacet(idx, BED_QUALITY_BEDLOAD_DIAMETER,
                     "bedload diameter", ComputeType.ADVANCE, stateId, hash));
             }
             else {
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java	Fri Sep 14 12:17:14 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedQualityGenerator.java	Fri Sep 14 12:20:57 2012 +0000
@@ -9,6 +9,8 @@
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.minfo.BedBedQualityResult;
 import de.intevation.flys.artifacts.model.minfo.BedLoadBedQualityResult;
+import de.intevation.flys.artifacts.model.minfo.BedQualityResult;
+import de.intevation.flys.exports.StyledSeriesBuilder;
 import de.intevation.flys.exports.XYChartGenerator;
 import de.intevation.flys.jfree.StyledXYSeries;
 
@@ -143,25 +145,40 @@
             return;
         }
 
-        if (name.equals(BED_QUALITY_BED_DIAMETER)) {
-            doBedDiameterOut(
+        // TODO BED_QUALITY_BED_DIAMETER_TOPLAYER
+        if (name.equals(BED_QUALITY_BED_DIAMETER_TOPLAYER)) {
+            doBedDiameterTopLayerOut(
                 (BedBedQualityResult) artifactAndFacet.getData(context),
                 artifactAndFacet, attr, visible);
         }
+        else if (name.equals(BED_QUALITY_BED_DIAMETER_SUBLAYER)) {
+            doBedDiameterSubLayerOut(
+                (BedBedQualityResult) artifactAndFacet.getData(context),
+                artifactAndFacet, attr, visible);
+        }
+        // TODO BED_QUALITY_BED_DIAMETER_SUBLAYER
         else if (name.equals(BED_QUALITY_BEDLOAD_DIAMETER)) {
-            doBedloadDiameterOut(
+            doBedLoadDiameterOut(
                 (BedLoadBedQualityResult) artifactAndFacet.getData(context),
                 artifactAndFacet, attr, visible);
         }
-        else if (name.equals(BED_QUALITY_POROSITY_TOPLAYER)
-            || name.equals(BED_QUALITY_POROSITY_SUBLAYER)) {
-            doPorosityOut(
+        else if (name.equals(BED_QUALITY_POROSITY_TOPLAYER)) {
+            doPorosityTopLayerOut(
                 (BedBedQualityResult) artifactAndFacet.getData(context),
                 artifactAndFacet, attr, visible);
         }
-        else if (name.equals(BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER)
-            || name.equals(BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER)) {
-            doDensityOut(
+        else if (name.equals(BED_QUALITY_POROSITY_SUBLAYER)) {
+            doPorositySubLayerOut(
+                (BedBedQualityResult) artifactAndFacet.getData(context),
+                artifactAndFacet, attr, visible);
+        }
+        else if (name.equals(BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER)) {
+            doDensityTopLayerOut(
+                (BedBedQualityResult) artifactAndFacet.getData(context),
+                artifactAndFacet, attr, visible);
+        }
+        else if (name.equals(BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER)) {
+            doDensitySubLayerOut(
                 (BedBedQualityResult) artifactAndFacet.getData(context),
                 artifactAndFacet, attr, visible);
         }
@@ -175,50 +192,80 @@
         }
     }
 
-    protected void doBedDiameterOut(BedBedQualityResult data,
+    protected void doBedDiameterTopLayerOut(BedBedQualityResult data,
         ArtifactAndFacet aandf, Document theme, boolean visible) {
-        logger.debug("BedQuality.doBedDiameterOut");
+        logger.debug("BedQuality.doBedDiameterTopLayerOut");
 
         XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-
-        // StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(),
-        // true);
+        StyledSeriesBuilder.addPoints(series, data.getDiameterCapData(), true);
 
         addAxisSeries(series, YAXIS.W.idx, visible);
     }
 
-    protected void doBedloadDiameterOut(BedLoadBedQualityResult data,
+    protected void doBedDiameterSubLayerOut(BedBedQualityResult data,
         ArtifactAndFacet aandf, Document theme, boolean visible) {
-        logger.debug("BedQuality.doBedloadDiameterOut");
+        logger.debug("BedQuality.doBedDiameterSubLayerOut");
 
         XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
-
-        // StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(),
-        // true);
+        StyledSeriesBuilder.addPoints(series, data.getDiameterSubData(), true);
 
         addAxisSeries(series, YAXIS.W.idx, visible);
     }
 
-    protected void doPorosityOut(BedBedQualityResult data,
+    protected void doBedLoadDiameterOut(BedQualityResult data,
         ArtifactAndFacet aandf, Document theme, boolean visible) {
-        logger.debug("BedQuality.doPorosityOut");
+        logger.debug("BedQuality.doBedLoadDiameterOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+        StyledSeriesBuilder.addPoints(series, data.getDiameterData(), true);
+
+        addAxisSeries(series, YAXIS.W.idx, visible);
+    }
+
+    protected void doPorosityTopLayerOut(BedBedQualityResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("BedQuality.doPorosityTopLayerOut");
 
         XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
 
-        // StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(),
-        // true);
+        StyledSeriesBuilder.addPoints(series, data.getPorosityTopLayerData(),
+            true);
 
         addAxisSeries(series, YAXIS.P.idx, visible);
     }
 
-    protected void doDensityOut(BedBedQualityResult data,
+    protected void doPorositySubLayerOut(BedBedQualityResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("BedQuality.doPorositySubLayerOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+
+        StyledSeriesBuilder.addPoints(series, data.getPorositySubLayerData(),
+            true);
+
+        addAxisSeries(series, YAXIS.P.idx, visible);
+    }
+
+    protected void doDensityTopLayerOut(BedBedQualityResult data,
         ArtifactAndFacet aandf, Document theme, boolean visible) {
         logger.debug("BedQuality.doDensityOut");
 
         XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
 
-        // StyledSeriesBuilder.addPoints(series, data.getMiddleHeightsPoints(),
-        // true);
+        StyledSeriesBuilder.addPoints(series, data.getDensityTopLayerData(),
+            true);
+
+        addAxisSeries(series, YAXIS.D.idx, visible);
+    }
+
+    protected void doDensitySubLayerOut(BedBedQualityResult data,
+        ArtifactAndFacet aandf, Document theme, boolean visible) {
+        logger.debug("BedQuality.doDensityOut");
+
+        XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme);
+
+        StyledSeriesBuilder.addPoints(series, data.getDensitySubLayerData(),
+            true);
 
         addAxisSeries(series, YAXIS.D.idx, visible);
     }

http://dive4elements.wald.intevation.org