[PATCH 1 of 3] (issue1755) Add interpolated facets and update themes accordingly

Wald Commits scm-commit at wald.intevation.org
Thu Mar 19 14:04:11 CET 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1426768598 -3600
# Node ID 36faef4f8acb7d0f29a2c9527829d0413c143ba2
# Parent  9fa5c66073e77452fadffadc2ed0649a1f251b2a
(issue1755) Add interpolated facets and update themes accordingly

diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/doc/conf/artifacts/minfo.xml
--- a/artifacts/doc/conf/artifacts/minfo.xml	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/doc/conf/artifacts/minfo.xml	Thu Mar 19 13:36:38 2015 +0100
@@ -463,6 +463,14 @@
             <outputmodes>
                 <outputmode name="bed_longitudinal_section" description="output.bed_longitudinal_section" mime-type="image/png" type="chart">
                     <facets>
+                        <facet name="bed_longitudinal_section.porosity.toplayer.interpol"/>
+                        <facet name="bed_longitudinal_section.porosity.toplayer.interpol"/>
+                        <facet name="bed_longitudinal_section.density.toplayer.interpol"/>
+                        <facet name="bed_longitudinal_section.density.sublayer.interpol"/>
+                        <facet name="bed_longitudinal_section.diameter.toplayer.interpol"/>
+                        <facet name="bed_longitudinal_section.diameter.sublayer.interpol"/>
+                        <facet name="bed_longitudinal_section.diameter.bedload.interpol"/>
+                        <facet name="bed_longitudinal_section.diameter.bedload"/>
                         <facet name="bed_longitudinal_section.porosity.toplayer"/>
                         <facet name="bed_longitudinal_section.porosity.toplayer"/>
                         <facet name="bed_longitudinal_section.density.toplayer"/>
@@ -473,7 +481,6 @@
                         <facet name="bed_longitudinal_section.diameter.sublayer.data"/>
                         <facet name="bed_longitudinal_section.diameter.bedload.data"/>
                         <facet name="bed_longitudinal_section.manualpoints" />
-                        <facet name="bed_longitudinal_section.diameter.bedload"/>
                         <facet name="longitudinal_section.annotations" description="facet.longitudinal_section.annotations"/>
                         <facet name="porosity" description="facet.porosity"/>
                     </facets>
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/doc/conf/meta-data.xml	Thu Mar 19 13:36:38 2015 +0100
@@ -830,13 +830,7 @@
 
     <dc:macro name="bedquality">
       <dc:filter expr="$out_name = 'bed_longitudinal_section' and
-        ($facet_name = 'bed_longitudinal_section.diameter.toplayer' or
-        $facet_name = 'bed_longitudinal_section.diameter.sublayer' or
-        $facet_name = 'bed_longitudinal_section.diameter.bedload' or
-        $facet_name = 'bed_longitudinal_section.density.toplayer' or
-        $facet_name = 'bed_longitudinal_section.density.sublayer' or
-        $facet_name = 'bed_longitudinal_section.porosity.toplayer' or
-        $facet_name = 'bed_longitudinal_section.porosity.toplayer')">
+        starts-with($facet_name, 'bed_longitudinal_section')">
         <dc:if test="dc:has-result()">
           <bed_quality>
             <dc:call-macro name="collection-group">
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/doc/conf/themes.xml
--- a/artifacts/doc/conf/themes.xml	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/doc/conf/themes.xml	Thu Mar 19 13:36:38 2015 +0100
@@ -213,13 +213,20 @@
         <mapping from="flow_velocity.measurement" to="FlowVelocityDischarge" />
         <mapping from="bedheight_middle.single" to="MiddleBedHeightSingle" />
         <mapping from="bedheight_middle.manualpoints" to="ManualPoints" />
-        <mapping from="bed_longitudinal_section.porosity.toplayer" to="PorosityTopLayer" />
-        <mapping from="bed_longitudinal_section.porosity.toplayer" to="PorositySubLayer" />
-        <mapping from="bed_longitudinal_section.density.toplayer" to="DensityTopLayer" />
-        <mapping from="bed_longitudinal_section.density.sublayer" to="DensitySublayer" />
-        <mapping from="bed_longitudinal_section.diameter.toplayer" to="BedDiameterTopLayer" />
-        <mapping from="bed_longitudinal_section.diameter.sublayer" to="BedDiameterSubLayer" />
-        <mapping from="bed_longitudinal_section.diameter.bedload" to="BedLoadDiameter" />
+        <mapping from="bed_longitudinal_section.porosity.toplayer.interpol" to="PorosityTopLines" />
+        <mapping from="bed_longitudinal_section.porosity.toplayer.interpol" to="PorositySubLines" />
+        <mapping from="bed_longitudinal_section.density.toplayer.interpol" to="DensityTopLines" />
+        <mapping from="bed_longitudinal_section.density.sublayer.interpol" to="DensitySubLines" />
+        <mapping from="bed_longitudinal_section.diameter.toplayer.interpol" to="BedDiameterTopLines" />
+        <mapping from="bed_longitudinal_section.diameter.sublayer.interpol" to="BedDiameterSubLines" />
+        <mapping from="bed_longitudinal_section.diameter.bedload.interpol" to="BedLoadDiameterLines" />
+        <mapping from="bed_longitudinal_section.porosity.toplayer" to="PorosityTopPoints" />
+        <mapping from="bed_longitudinal_section.porosity.toplayer" to="PorositySubPoints" />
+        <mapping from="bed_longitudinal_section.density.toplayer" to="DensityTopPoints" />
+        <mapping from="bed_longitudinal_section.density.sublayer" to="DensitySubPoints" />
+        <mapping from="bed_longitudinal_section.diameter.toplayer" to="BedDiameterTopPoints" />
+        <mapping from="bed_longitudinal_section.diameter.sublayer" to="BedDiameterSubPoints" />
+        <mapping from="bed_longitudinal_section.diameter.bedload" to="BedLoadDiameterPoints" />
         <mapping from="bed_longitudinal_section.diameter.toplayer.data" to="BedDiameterDataTop"/>
         <mapping from="bed_longitudinal_section.diameter.sublayer.data" to="BedDiameterDataSub"/>
         <mapping from="bed_longitudinal_section.diameter.bedload.data" to="BedloadDiameterData"/>
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/doc/conf/themes/default.xml
--- a/artifacts/doc/conf/themes/default.xml	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/doc/conf/themes/default.xml	Thu Mar 19 13:36:38 2015 +0100
@@ -859,7 +859,105 @@
     </theme>
 
     <!-- Bed Quality -->
-    <theme name="PorosityTopLayer">
+    <theme name="PorosityTopPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 0, 0" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="0, 0, 0" />
+        </fields>
+    </theme>
+
+    <theme name="PorositySubPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 0, 0" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="0, 0, 0" />
+        </fields>
+    </theme>
+
+    <theme name="DensityTopPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="153, 99, 102" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="153, 99, 102" />
+        </fields>
+    </theme>
+
+    <theme name="DensitySubPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="153, 99, 102" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="153, 99, 102" />
+        </fields>
+    </theme>
+
+    <theme name="BedDiameterTopPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="255, 0, 0" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="255, 0, 0" />
+        </fields>
+    </theme>
+
+    <theme name="BedDiameterSubPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="255, 0, 0" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="255, 0, 0" />
+        </fields>
+    </theme>
+
+    <theme name="BedLoadDiameterPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 255, 0" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="0, 255, 0" />
+        </fields>
+    </theme>
+
+    <theme name="PorosityTopLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -869,7 +967,7 @@
         </fields>
     </theme>
 
-    <theme name="PorositySubLayer">
+    <theme name="PorositySubLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -879,7 +977,7 @@
         </fields>
     </theme>
 
-    <theme name="DensityTopLayer">
+    <theme name="DensityTopLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -889,7 +987,7 @@
         </fields>
     </theme>
 
-    <theme name="DensitySubLayer">
+    <theme name="DensitySubLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -899,7 +997,7 @@
         </fields>
     </theme>
 
-    <theme name="BedDiameterTopLayer">
+    <theme name="BedDiameterTopLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -909,7 +1007,7 @@
         </fields>
     </theme>
 
-    <theme name="BedDiameterSubLayer">
+    <theme name="BedDiameterSubLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -919,7 +1017,7 @@
         </fields>
     </theme>
 
-    <theme name="BedLoadDiameter">
+    <theme name="BedLoadDiameterLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/doc/conf/themes/second.xml
--- a/artifacts/doc/conf/themes/second.xml	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/doc/conf/themes/second.xml	Thu Mar 19 13:36:38 2015 +0100
@@ -859,7 +859,104 @@
     </theme>
 
     <!-- Bed Quality -->
-    <theme name="PorosityTopLayer">
+    <theme name="PorosityTopPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 0, 0" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="0, 0, 0" />
+        </fields>
+    </theme>
+
+    <theme name="PorositySubPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 0, 0" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="0, 0, 0" />
+        </fields>
+    </theme>
+
+    <theme name="DensityTopPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="153, 99, 102" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="153, 99, 102" />
+        </fields>
+    </theme>
+
+    <theme name="DensitySubPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="153, 99, 102" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="153, 99, 102" />
+        </fields>
+    </theme>
+
+    <theme name="BedDiameterTopPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="255, 0, 0" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="255, 0, 0" />
+        </fields>
+    </theme>
+
+    <theme name="BedDiameterSubPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="255, 0, 0" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="255, 0, 0" />
+        </fields>
+    </theme>
+
+    <theme name="BedLoadDiameterPoints">
+        <inherits>
+            <inherit from="LongitudinalSection" />
+        </inherits>
+        <fields>
+            <field name="linecolor" type="Color" display="Linienfarbe"
+                default="0, 255, 0" />
+            <field name="showlines" type="boolean" display="Linie anzeigen" default="false"/>
+            <field name="showpoints" type="boolean" display="Punkte anzeigen" default="true"/>
+            <field name="pointsize" type="int" display="Punktdicke" default="3" />
+            <field name="pointcolor" type="Color" display="Punktfarbe" default="0, 255, 0" />
+        </fields>
+    </theme>
+    <theme name="PorosityTopLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -869,7 +966,7 @@
         </fields>
     </theme>
 
-    <theme name="PorositySubLayer">
+    <theme name="PorositySubLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -879,7 +976,7 @@
         </fields>
     </theme>
 
-    <theme name="DensityTopLayer">
+    <theme name="DensityTopLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -889,7 +986,7 @@
         </fields>
     </theme>
 
-    <theme name="DensitySubLayer">
+    <theme name="DensitySubLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -899,7 +996,7 @@
         </fields>
     </theme>
 
-    <theme name="BedDiameterTopLayer">
+    <theme name="BedDiameterTopLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -909,7 +1006,7 @@
         </fields>
     </theme>
 
-    <theme name="BedDiameterSubLayer">
+    <theme name="BedDiameterSubLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
@@ -919,7 +1016,7 @@
         </fields>
     </theme>
 
-    <theme name="BedLoadDiameter">
+    <theme name="BedLoadDiameterLines">
         <inherits>
             <inherit from="LongitudinalSection" />
         </inherits>
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityCalculation.java	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityCalculation.java	Thu Mar 19 13:36:38 2015 +0100
@@ -109,13 +109,14 @@
                     dr.getTo());
             BedQualityResult result = new BedQualityResult();
             result.setDateRange(dr);
-            if (bedDiameter != null) {
+            if (!bedDiameter.isEmpty()) {
+                log.debug("Bed diameter is not empty + " + bedDiameter);
                 result.add(calculateBedParameter(bedMeasurements));
                 for (String bd : bedDiameter) {
                     result.add (calculateBed(bedMeasurements, bd));
                 }
             }
-            if (bedloadDiameter != null) {
+            if (!bedloadDiameter.isEmpty()) {
                 for (String bld : bedloadDiameter) {
                     result.add(calculateBedload(loadMeasurements, bld));
                 }
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityInterpolFacet.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedQualityInterpolFacet.java	Thu Mar 19 13:36:38 2015 +0100
@@ -0,0 +1,82 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.artifacts.model.minfo;
+
+import org.apache.log4j.Logger;
+
+import org.dive4elements.artifactdatabase.state.Facet;
+import org.dive4elements.artifacts.Artifact;
+import org.dive4elements.artifacts.CallContext;
+import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.model.CalculationResult;
+import org.dive4elements.river.artifacts.model.DataFacet;
+import org.dive4elements.river.artifacts.states.DefaultState.ComputeType;
+import org.dive4elements.river.artifacts.access.RangeAccess;
+
+
+/**
+ * Facet for serving interpolated BedQualityResults
+ */
+public class BedQualityInterpolFacet extends DataFacet {
+
+    private static final long serialVersionUID = 1L;
+
+    private static Logger log = Logger.getLogger(BedQualityInterpolFacet.class);
+
+    private String valueName; /* Name of the ResultValue underlying this facet */
+    private String valueType; /* Type of the ResultValue underlying this facet */
+
+    public BedQualityInterpolFacet() {
+        // required for clone operation deepCopy()
+    }
+
+    public BedQualityInterpolFacet(int idx, String name, String description,
+        ComputeType type, String stateId, String hash, String valueName, String valueType) {
+        super(idx, name, description, type, hash, stateId);
+        this.valueName = valueName;
+        this.valueType = valueType;
+        this.metaData.put("X", "chart.longitudinal.section.xaxis.label");
+        this.metaData.put("Y", ""); /* check if those <^ be removed? */
+    }
+
+    @Override
+    public Object getData(Artifact artifact, CallContext context) {
+        log.debug("Get bedquality data: " + valueName + " - " + valueType);
+
+        D4EArtifact flys = (D4EArtifact) artifact;
+        double[] kms = new RangeAccess(flys).getKmSteps();
+
+        CalculationResult res = (CalculationResult) flys.compute(context, hash,
+            stateId, type, false);
+
+        int ndx = index >> 8;
+
+        BedQualityResultValue value =
+            ((BedQualityResult[]) res.getData())[ndx].getValue(valueName, valueType);
+
+        if (value == null) {
+            /* Other facets check this so we do too */
+            return null;
+        }
+        return value.getDataInterpolated(kms);
+    }
+
+    /** Copy deeply. */
+    @Override
+    public Facet deepCopy() {
+        BedQualityInterpolFacet copy = new BedQualityInterpolFacet();
+        copy.set(this);
+        copy.type = type;
+        copy.hash = hash;
+        copy.stateId = stateId;
+        copy.valueName = valueName;
+        copy.valueType = valueType;
+        return copy;
+    }
+}
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java	Thu Mar 19 13:36:38 2015 +0100
@@ -26,6 +26,7 @@
 import org.dive4elements.river.artifacts.model.DateRange;
 import org.dive4elements.river.artifacts.model.FacetTypes;
 import org.dive4elements.river.artifacts.model.minfo.BedQualityDataFacet;
+import org.dive4elements.river.artifacts.model.minfo.BedQualityInterpolFacet;
 import org.dive4elements.river.artifacts.model.minfo.BedDiameterDataFacet;
 import org.dive4elements.river.artifacts.model.minfo.BedloadDiameterDataFacet;
 import org.dive4elements.river.artifacts.model.minfo.BedQualityCalculation;
@@ -68,7 +69,7 @@
                     Facet    facet,
                     String   output
                 ) {
-                    String name = facet.getName();
+                    String name = facet.getName().replace(".interpol","");
                     if (name.equals(BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER) ||
                         name.equals(BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER) ||
                         name.equals(BED_DIAMETER_DATA_TOP) ||
@@ -270,10 +271,27 @@
                     getFacetDescription(meta, range, value),
                     ComputeType.ADVANCE,
                     stateId, hash, value.getName(), value.getType()));
+                newFacets.add(new BedQualityInterpolFacet((idx << 8) + i++,
+                    getFacetName(value) + ".interpol",
+                    getFacetInterpolDescription(meta, range, value),
+                    ComputeType.ADVANCE,
+                    stateId, hash, value.getName(), value.getType()));
             }
         }
     }
 
+    protected String getFacetInterpolDescription(CallMeta meta,
+                                                 DateRange range,
+                                                 BedQualityResultValue value) {
+        String part1 = getFacetDescription(meta, range, value);
+        /* We could add a step description here */
+        return part1 + " " + Resources.getMsg(meta,
+                                              I18N_INTERPOL_SUFFIX,
+                                              I18N_INTERPOL_SUFFIX,
+                                              new Object[] {});
+    }
+
+
     protected String getFacetDescription(CallMeta meta,
                                          DateRange range,
                                          BedQualityResultValue value) {
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDensityProcessor.java	Thu Mar 19 13:36:38 2015 +0100
@@ -61,8 +61,9 @@
 
     @Override
     public boolean canHandle(String facettype) {
-        return facettype.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER) ||
-            facettype.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER);
+        String name = facettype.replace(".interpol","");
+        return name.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_SUBLAYER) ||
+            name.equals(FacetTypes.BED_QUALITY_SEDIMENT_DENSITY_TOPLAYER);
     }
 
     @Override
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityDiameterProcessor.java	Thu Mar 19 13:36:38 2015 +0100
@@ -59,12 +59,13 @@
 
     @Override
     public boolean canHandle(String facettype) {
-        return facettype.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_TOPLAYER) ||
-            facettype.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_SUBLAYER) ||
-            facettype.equals(FacetTypes.BED_QUALITY_BEDLOAD_DIAMETER) ||
-            facettype.equals(FacetTypes.BED_DIAMETER_DATA_TOP) ||
-            facettype.equals(FacetTypes.BED_DIAMETER_DATA_SUB) ||
-            facettype.equals(FacetTypes.BEDLOAD_DIAMETER_DATA);
+        String name = facettype.replace(".interpol","");
+        return name.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_TOPLAYER) ||
+            name.equals(FacetTypes.BED_QUALITY_BED_DIAMETER_SUBLAYER) ||
+            name.equals(FacetTypes.BED_QUALITY_BEDLOAD_DIAMETER) ||
+            name.equals(FacetTypes.BED_DIAMETER_DATA_TOP) ||
+            name.equals(FacetTypes.BED_DIAMETER_DATA_SUB) ||
+            name.equals(FacetTypes.BEDLOAD_DIAMETER_DATA);
     }
 
     @Override
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedQualityPorosityProcessor.java	Thu Mar 19 13:36:38 2015 +0100
@@ -61,9 +61,10 @@
 
     @Override
     public boolean canHandle(String facettype) {
-        return facettype.equals(FacetTypes.BED_QUALITY_POROSITY_TOPLAYER) ||
-            facettype.equals(FacetTypes.BED_QUALITY_POROSITY_SUBLAYER) ||
-            facettype.equals(FacetTypes.POROSITY);
+        String name = facettype.replace(".interpol","");
+        return name.equals(FacetTypes.BED_QUALITY_POROSITY_TOPLAYER) ||
+            name.equals(FacetTypes.BED_QUALITY_POROSITY_SUBLAYER) ||
+            name.equals(FacetTypes.POROSITY);
     }
 
     @Override
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/src/main/resources/messages.properties	Thu Mar 19 13:36:38 2015 +0100
@@ -325,7 +325,7 @@
 facet.bedquality.bed.diameter.sublayer.data = {0} Bed ({1,date} - {2,date}) ({3}) - measurements
 facet.bedquality.bed.diameter.bedload.data = {0} Bedload - measurements
 facet.bedquality.bed.diameter.bedload = {0}_Bedload
-facet.bedquality.interpol.suffix = " - interpolated"
+facet.bedquality.interpol.suffix = - interpolated
 bedquality.toplayer = 0.0m - 0.3m
 bedquality.sublayer = 0.1m - 0.5m
 facet.bedheight.diff.year = Bedheight Difference {0}
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/src/main/resources/messages_de.properties	Thu Mar 19 13:36:38 2015 +0100
@@ -326,7 +326,7 @@
 facet.bedquality.bed.diameter.sublayer.data = {0} Sohle ({1,date} - {2,date}) ({3}) - Messungen
 facet.bedquality.bed.diameter.bedload.data = {0} Geschiebe - Messungen
 facet.bedquality.bed.diameter.bedload = {0}_Geschiebe
-facet.bedquality.interpol.suffix = " - interpoliert"
+facet.bedquality.interpol.suffix = - interpoliert
 bedquality.toplayer = 0,0m - 0,3m
 bedquality.sublayer = 0,1m - 0,5m
 facet.bedheight.diff.year = Sohlh\u00f6hendifferenz {0}
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/src/main/resources/messages_de_DE.properties
--- a/artifacts/src/main/resources/messages_de_DE.properties	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/src/main/resources/messages_de_DE.properties	Thu Mar 19 13:36:38 2015 +0100
@@ -323,7 +323,7 @@
 facet.bedquality.bed.diameter.sublayer.data = {0} Sohle ({1,date} - {2,date}) ({3}) - Messungen
 facet.bedquality.bed.diameter.bedload.data = {0} Geschiebe - Messungen
 facet.bedquality.bed.diameter.bedload = {0}_Geschiebe
-facet.bedquality.interpol.suffix = " - interpoliert"
+facet.bedquality.interpol.suffix = - interpoliert
 bedquality.toplayer = 0,0m - 0,3m
 bedquality.sublayer = 0,1m - 0,5m
 facet.bedheight.diff.year = Sohlh\u00f6hendifferenz {0}
diff -r 9fa5c66073e7 -r 36faef4f8acb artifacts/src/main/resources/messages_en.properties
--- a/artifacts/src/main/resources/messages_en.properties	Thu Mar 19 10:38:12 2015 +0100
+++ b/artifacts/src/main/resources/messages_en.properties	Thu Mar 19 13:36:38 2015 +0100
@@ -327,7 +327,7 @@
 facet.bedquality.bed.diameter.sublayer.data = {0} Bed ({1,date} - {2,date}) ({3}) - measurements
 facet.bedquality.bed.diameter.bedload.data = {0} Bedload - measurements
 facet.bedquality.bed.diameter.bedload = {0}_Bedload
-facet.bedquality.interpol.suffix = " - interpolated"
+facet.bedquality.interpol.suffix = - interpolated
 bedquality.toplayer = 0.0m - 0.3m
 bedquality.sublayer = 0.1m - 0.5m
 facet.bedheight.diff.year = Bedheight Difference {0}


More information about the Dive4Elements-commits mailing list