[PATCH 2 of 2] merged

Wald Commits scm-commit at wald.intevation.org
Tue Sep 16 14:57:59 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1410872275 -7200
# Node ID 7e54b27f478011f8df842cec61d967d0f04b18f9
# Parent  97e148487186872faeeb445b1f2d5db1ea3316d5
# Parent  b0d7b0d79d6e5e97ee0bc1f7fcc29a1814f61653
merged.

diff -r 97e148487186 -r 7e54b27f4780 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java	Tue Sep 16 14:57:14 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffCalculation.java	Tue Sep 16 14:57:55 2014 +0200
@@ -44,7 +44,7 @@
             if (pair[0].getYear() == null || pair[1].getYear() == null) {
                 addProblem("beddiff.missing.year");
             }
-            results[i] = calculateYearDifference(pair);
+            results[i] = calculateYearDifference(pair, heightIds[i]);
         }
 
         return new CalculationResult(results, this);
@@ -59,7 +59,8 @@
     }
 
     private BedDiffYearResult calculateYearDifference(
-            BedHeightSingleData[] pair
+        BedHeightSingleData[] pair,
+        int[] ids
         ) {
         log.debug("BedDiffCalculation.calculateYearDifference");
         BedHeightSingleData s1 = pair[0];
@@ -125,7 +126,9 @@
             s1.getYear(),
             s2.getYear(),
             s1.getName(),
-            s2.getName());
+            s2.getName(),
+            ids[0],
+            ids[1]);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r 97e148487186 -r 7e54b27f4780 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFacet.java	Tue Sep 16 14:57:14 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFacet.java	Tue Sep 16 14:57:55 2014 +0200
@@ -4,7 +4,12 @@
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.CallContext;
+
+import org.dive4elements.river.model.BedHeightSingle;
+
 import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.DataFacet;
 import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -40,6 +45,22 @@
 
         if (resultData != null && resultData.length > index) {
             BedDiffYearResult data = resultData[index];
+
+            BedHeightSingle first = BedHeightSingle.getBedHeightSingleById(
+                data.getIdFirst());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.cur.elevation"),
+                first.getCurElevationModel().getName());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.old.elevation"),
+                first.getOldElevationModel().getName());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.river.elevation"),
+                new RiverAccess(flys).getRiver().getWstUnit().getName());
+
             return data.getHeights1Data();
         }
         return null;
diff -r 97e148487186 -r 7e54b27f4780 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFilterFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFilterFacet.java	Tue Sep 16 14:57:14 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightMinFilterFacet.java	Tue Sep 16 14:57:55 2014 +0200
@@ -13,6 +13,9 @@
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.CallContext;
+
+import org.dive4elements.river.model.BedHeightSingle;
+
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.access.RiverAccess;
 import org.dive4elements.river.artifacts.context.RiverContext;
@@ -64,6 +67,22 @@
             this.metaData.put(
                 Resources.getMsg(context.getMeta(),
                     "chart.subtitle.radius", new Object[] { radius }), "");
+
+            BedHeightSingle first = BedHeightSingle.getBedHeightSingleById(
+                oldData.getIdFirst());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.cur.elevation"),
+                first.getCurElevationModel().getName());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.old.elevation"),
+                first.getOldElevationModel().getName());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.river.elevation"),
+                access.getRiver().getWstUnit().getName());
+
             return heights;
         }
         return null;
diff -r 97e148487186 -r 7e54b27f4780 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFacet.java	Tue Sep 16 14:57:14 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFacet.java	Tue Sep 16 14:57:55 2014 +0200
@@ -4,7 +4,12 @@
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.CallContext;
+
+import org.dive4elements.river.model.BedHeightSingle;
+
 import org.dive4elements.river.artifacts.D4EArtifact;
+import org.dive4elements.river.artifacts.access.RiverAccess;
+import org.dive4elements.river.artifacts.resources.Resources;
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.DataFacet;
 import org.dive4elements.river.artifacts.model.FacetTypes;
@@ -40,6 +45,22 @@
 
         if (resultData != null && resultData.length > index) {
             BedDiffYearResult data = resultData[index];
+
+            BedHeightSingle second = BedHeightSingle.getBedHeightSingleById(
+                data.getIdSecond());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.cur.elevation"),
+                second.getCurElevationModel().getName());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.old.elevation"),
+                second.getOldElevationModel().getName());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.river.elevation"),
+                new RiverAccess(flys).getRiver().getWstUnit().getName());
+
             return data.getHeights2Data();
         }
         return null;
diff -r 97e148487186 -r 7e54b27f4780 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFilterFacet.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFilterFacet.java	Tue Sep 16 14:57:14 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffHeightSubFilterFacet.java	Tue Sep 16 14:57:55 2014 +0200
@@ -13,6 +13,9 @@
 import org.dive4elements.artifactdatabase.state.Facet;
 import org.dive4elements.artifacts.Artifact;
 import org.dive4elements.artifacts.CallContext;
+
+import org.dive4elements.river.model.BedHeightSingle;
+
 import org.dive4elements.river.artifacts.D4EArtifact;
 import org.dive4elements.river.artifacts.access.RiverAccess;
 import org.dive4elements.river.artifacts.context.RiverContext;
@@ -64,6 +67,22 @@
             this.metaData.put(
                 Resources.getMsg(context.getMeta(),
                     "chart.subtitle.radius", new Object[] { radius }), "");
+
+            BedHeightSingle second = BedHeightSingle.getBedHeightSingleById(
+                oldData.getIdSecond());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.cur.elevation"),
+                second.getCurElevationModel().getName());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.old.elevation"),
+                second.getOldElevationModel().getName());
+            this.addMetaData(Resources.getMsg(
+                    context.getMeta(),
+                    "meta.bedheight.river.elevation"),
+                access.getRiver().getWstUnit().getName());
+
             return heights;
         }
         return null;
diff -r 97e148487186 -r 7e54b27f4780 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java	Tue Sep 16 14:57:14 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/BedDiffYearResult.java	Tue Sep 16 14:57:55 2014 +0200
@@ -24,6 +24,8 @@
     protected Integer end;
     protected String nameFirst;
     protected String nameSecond;
+    protected int idFirst;
+    protected int idSecond;
 
     public BedDiffYearResult () {
         super();
@@ -54,7 +56,9 @@
         Integer start,
         Integer end,
         String nameFirst,
-        String nameSecond
+        String nameSecond,
+        int idFirst,
+        int idSecond
     ) {
         super(kms, differences, heights1, heights2);
         this.diffsPerYear = diffsPerYear;
@@ -66,6 +70,8 @@
         this.end = end;
         this.nameFirst = nameFirst;
         this.nameSecond = nameSecond;
+        this.idFirst = idFirst;
+        this.idSecond = idSecond;
     }
 
     public TDoubleArrayList getBedHeights() {
@@ -114,6 +120,16 @@
         return this.nameSecond;
     }
 
+    /** Get id of the first BedHeight (minuend). */
+    public int getIdFirst() {
+        return this.idFirst;
+    }
+
+    /** Get id of the second BedHeight (subtrahend). */
+    public int getIdSecond() {
+        return this.idSecond;
+    }
+
     public void addMorphWidth1(double value) {
         this.morphWidth1.add(value);
     }
diff -r 97e148487186 -r 7e54b27f4780 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	Tue Sep 16 14:57:14 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityState.java	Tue Sep 16 14:57:55 2014 +0200
@@ -84,9 +84,14 @@
                         name.equals(BEDLOAD_DIAMETER_DATA)){
                         return Boolean.FALSE;
                     }
-                    else {
-                        return null;
+                    if (name.equals(BED_QUALITY_POROSITY_TOPLAYER) ||
+                        name.equals(BED_QUALITY_POROSITY_SUBLAYER) ||
+                        name.equals(BED_QUALITY_BED_DIAMETER_TOPLAYER) ||
+                        name.equals(BED_QUALITY_BED_DIAMETER_SUBLAYER) ||
+                        name.equals(BED_QUALITY_BEDLOAD_DIAMETER)) {
+                        return Boolean.TRUE;
                     }
+                    return null;
                 }
             });
     }
diff -r 97e148487186 -r 7e54b27f4780 artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java	Tue Sep 16 14:57:14 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java	Tue Sep 16 14:57:55 2014 +0200
@@ -226,7 +226,7 @@
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-                 newFacets.add(new BedDiffHeightSubFilterFacet(
+                newFacets.add(new BedDiffHeightSubFilterFacet(
                     idx,
                     BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED,
                     createBedDiffHeightDescription(


More information about the Dive4Elements-commits mailing list