changeset 3749:3dcc4feff243

Created the initial structure for MINFO bed quality chart generation. flys-artifacts/trunk@5439 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 12 Sep 2012 13:37:58 +0000
parents 99f80469ba2b
children e560a9a10eb1
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/minfo.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/BedQualityCalculation.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java
diffstat 6 files changed, 98 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Tue Sep 11 14:46:09 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Sep 12 13:37:58 2012 +0000
@@ -1,3 +1,20 @@
+2012-09-12  Ingo Weinzierl <ingo@intevation.de>
+
+	* doc/conf/artifacts/minfo.xml: Defined facets for bed quality chart.
+
+	* src/main/java/de/intevation/flys/artifacts/model/BedQualityCalculation.java:
+	  Calculation stub for bed quality.
+
+	* src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java:
+	  Access stub for bed quality data.
+
+	* src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java: Added
+	  facets defined in minfo.xml.
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Override computeAdvance; no calculation and facet creation takes place
+	  yet.
+
 2012-09-11	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java:
--- a/flys-artifacts/doc/conf/artifacts/minfo.xml	Tue Sep 11 14:46:09 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/minfo.xml	Wed Sep 12 13:37:58 2012 +0000
@@ -285,6 +285,10 @@
             <outputmodes>
                 <outputmode name="bed_longitudinal_section" description="output.bed_longitudinal_section" mime-type="image/png" type="chart">
                     <facets>
+                    	<facet name="bed_longitudinal_section.porosity"/>
+                    	<facet name="bed_longitudinal_section.bedload_diameter"/>
+                    	<facet name="bed_longitudinal_section.bed_diameter"/>
+                    	<facet name="bed_longitudinal_section.sediment_density"/>
                     </facets>
                 </outputmode>
             </outputmodes>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java	Wed Sep 12 13:37:58 2012 +0000
@@ -0,0 +1,11 @@
+package de.intevation.flys.artifacts.access;
+
+import de.intevation.flys.artifacts.FLYSArtifact;
+
+public class BedQualityAccess extends Access {
+    
+    public BedQualityAccess(FLYSArtifact artifact) {
+        super(artifact);
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/BedQualityCalculation.java	Wed Sep 12 13:37:58 2012 +0000
@@ -0,0 +1,19 @@
+package de.intevation.flys.artifacts.model;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.flys.artifacts.access.BedQualityAccess;
+
+public class BedQualityCalculation extends Calculation {
+    
+    private static final Logger logger = Logger.getLogger(BedQualityCalculation.class);
+
+    public CalculationResult calculate(BedQualityAccess access) {
+        logger.info("BedQualityCalculation.calculate");
+        
+        // TODO calculate
+        Object result = null;
+        
+        return new CalculationResult(result, this);
+    }
+}
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Tue Sep 11 14:46:09 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Wed Sep 12 13:37:58 2012 +0000
@@ -214,6 +214,11 @@
     String MIDDLE_BED_HEIGHT_SINGLE     = "bedheight_middle.single";
     String MIDDLE_BED_HEIGHT_EPOCH      = "bedheight_middle.epoch";
     String MIDDLE_BED_HEIGHT_ANNOTATION = "bedheight_middle.annotation";
+    
+    String BED_QUALITY_POROSITY         = "bed_longitudinal_section.porosity";
+    String BED_QUALITY_BED_DIAMETER     = "bed_longitudinal_section.bed_diameter";
+    String BED_QUALITY_BEDLOAD_DIAMETER = "bed_longitudinal_section.bedload_diameter";
+    String BED_QUALITY_SEDIMENT_DENSITY = "bed_longitudinal_section.sediment_density"; 
 
     String SQ_OVERVIEW       = "sq_overview";
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Tue Sep 11 14:46:09 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Wed Sep 12 13:37:58 2012 +0000
@@ -1,7 +1,49 @@
 package de.intevation.flys.artifacts.states.minfo;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.artifactdatabase.state.Facet;
+import de.intevation.artifacts.CallContext;
+import de.intevation.flys.artifacts.FLYSArtifact;
+import de.intevation.flys.artifacts.access.BedQualityAccess;
+import de.intevation.flys.artifacts.model.BedQualityCalculation;
+import de.intevation.flys.artifacts.model.CalculationResult;
 import de.intevation.flys.artifacts.states.DefaultState;
 
 public class BedQualityState extends DefaultState {
+    
+    private static final Logger logger = Logger.getLogger(BedQualityState.class);
+    
+    @Override
+    public Object computeAdvance(
+        FLYSArtifact artifact,
+        String       hash,
+        CallContext  context,
+        List<Facet>  facets,
+        Object       old
+    ) {
+        logger.debug("BedQualityState.computeAdvance");
 
+        List<Facet> newFacets = new ArrayList<Facet>();
+
+        BedQualityAccess access = new BedQualityAccess(artifact);
+
+        CalculationResult res = old instanceof CalculationResult
+            ? (CalculationResult) old
+            : new BedQualityCalculation().calculate(access);
+
+        if (facets == null || res == null) {
+            return res;
+        }
+
+        logger.debug("Created " + newFacets.size() + " new Facets.");
+
+        facets.addAll(newFacets);
+
+        return res;
+    }
 }
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
\ No newline at end of file

http://dive4elements.wald.intevation.org