[PATCH 3 of 5] Add new facet for morph active width to bed height difference calculation

Wald Commits scm-commit at wald.intevation.org
Fri Mar 28 11:23:07 CET 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1396002109 -3600
# Branch minfo-opt
# Node ID d9791fa3c8adf977175e76da1ddf876d2f156488
# Parent  1aba7532144155df2031842cf71ebaaf6dfd582c
Add new facet for morph active width to bed height difference calculation.

diff -r 1aba75321441 -r d9791fa3c8ad artifacts/doc/conf/artifacts/minfo.xml
--- a/artifacts/doc/conf/artifacts/minfo.xml	Fri Mar 28 11:20:49 2014 +0100
+++ b/artifacts/doc/conf/artifacts/minfo.xml	Fri Mar 28 11:21:49 2014 +0100
@@ -224,7 +224,9 @@
                         <facet name="bedheight_difference.year" description="A facet for bed height differences"/>
                         <facet name="bedheight_difference.year.filtered" description="A facet for bed height differences"/>
                         <facet name="bedheight_difference.manualpoints" />
-                        <facet name="bedheight_difference.morph_width" description="A facet for morphologic width"/>
+                        <facet name="bedheight_difference.sounding_width" description="A facet for morphologic width"/>
+                        <facet name="bedheight_difference.morph_width1" description="A facet for morphologic width"/>
+                        <facet name="bedheight_difference.morph_width2" description="A facet for morphologic width"/>
                         <facet name="bedheight_difference.year.height1" description="A facet for raw heights."/>
                         <facet name="bedheight_difference.year.height2" description="A facet for raw heights."/>
                         <facet name="bedheight_difference.year.height1.filtered" description="A facet for raw heights."/>
diff -r 1aba75321441 -r d9791fa3c8ad artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java	Fri Mar 28 11:20:49 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java	Fri Mar 28 11:21:49 2014 +0100
@@ -339,7 +339,9 @@
     String BED_DIFFERENCE_HEIGHT_YEAR_FILTERED   = "bedheight_difference.height_year.filtered";
     String BED_DIFFERENCE_EPOCH                  = "bedheight_difference.epoch";
     String BED_DIFFERENCE_EPOCH_FILTERED         = "bedheight_difference.epoch.filtered";
-    String BED_DIFFERENCE_MORPH_WIDTH            = "bedheight_difference.morph_width";
+    String BED_DIFFERENCE_MORPH_WIDTH1           = "bedheight_difference.morph_width1";
+    String BED_DIFFERENCE_MORPH_WIDTH2           = "bedheight_difference.morph_width2";
+    String BED_DIFFERENCE_SOUNDING_WIDTH         = "bedheight_difference.sounding_width";
     String BED_DIFFERENCE_YEAR_HEIGHT1           = "bedheight_difference.year.height1";
     String BED_DIFFERENCE_YEAR_HEIGHT2           = "bedheight_difference.year.height2";
     String BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED  = "bedheight_difference.year.height1.filtered";
diff -r 1aba75321441 -r d9791fa3c8ad 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	Fri Mar 28 11:20:49 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/DifferencesState.java	Fri Mar 28 11:21:49 2014 +0100
@@ -53,7 +53,9 @@
     public static final String I18N_FACET_BED_DIFF_YEAR_RAW = "facet.bedheight.diff.year.raw";
     public static final String I18N_FACET_BED_DIFF_ABSOLUTE = "facet.bedheight.diff.absolute";
     public static final String I18N_FACET_BED_DIFF_ABSOLUTE_RAW = "facet.bedheight.diff.absolute.raw";
-    public static final String I18N_FACET_BED_DIFF_MORPH = "facet.bedheight.diff.morph";
+    public static final String I18N_FACET_BED_DIFF_SOUNDING = "facet.bedheight.diff.sounding";
+    public static final String I18N_FACET_BED_DIFF_MORPH1 = "facet.bedheight.diff.morph1";
+    public static final String I18N_FACET_BED_DIFF_MORPH2 = "facet.bedheight.diff.morph2";
     public static final String I18N_FACET_BED_DIFF_EPOCH = "facet.bedheight.diff.epoch";
     public static final String I18N_FACET_BED_DIFF_EPOCH_RAW = "facet.bedheight.diff.epoch.raw";
     public static final String I18N_FACET_BED_DIFF_HEIGHT1 = "facet.bedheight.diff.height1";
@@ -128,8 +130,22 @@
                     hash));
                 newFacets.add(new BedDiffYearFacet(
                     idx,
-                    BED_DIFFERENCE_MORPH_WIDTH,
-                    createBedDiffMorphDescription(meta),
+                    BED_DIFFERENCE_SOUNDING_WIDTH,
+                    createBedDiffSoundingDescription(meta),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_MORPH_WIDTH1,
+                    createBedDiffMorph1Description(meta),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_MORPH_WIDTH2,
+                    createBedDiffMorph2Description(meta),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -341,10 +357,22 @@
         return Resources.getMsg(meta, i18n, i18n, new Object[] { range });
     }
 
-    protected String createBedDiffMorphDescription(
+    protected String createBedDiffSoundingDescription(
         CallMeta meta) {
-        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_MORPH,
-            I18N_FACET_BED_DIFF_MORPH);
+        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_SOUNDING,
+            I18N_FACET_BED_DIFF_SOUNDING);
+    }
+
+    protected String createBedDiffMorph1Description(
+        CallMeta meta) {
+        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_MORPH1,
+            I18N_FACET_BED_DIFF_MORPH1);
+    }
+
+    protected String createBedDiffMorph2Description(
+        CallMeta meta) {
+        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_MORPH2,
+            I18N_FACET_BED_DIFF_MORPH2);
     }
 
     protected String createBedDiffAbsoluteDescription(
@@ -403,7 +431,7 @@
                         name.equals(BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED)){
                         return Boolean.FALSE;
                     }
-                    else if (name.equals(BED_DIFFERENCE_MORPH_WIDTH) ||
+                    else if (name.equals(BED_DIFFERENCE_SOUNDING_WIDTH) ||
                         name.equals(BED_DIFFERENCE_EPOCH_FILTERED) ||
                         name.equals(BED_DIFFERENCE_HEIGHT_YEAR_FILTERED) ||
                         name.equals(BED_DIFFERENCE_YEAR_FILTERED)) {
diff -r 1aba75321441 -r d9791fa3c8ad artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java	Fri Mar 28 11:20:49 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedWidthProcessor.java	Fri Mar 28 11:21:49 2014 +0100
@@ -47,10 +47,20 @@
         XYSeries series = new StyledXYSeries(bundle.getFacetDescription(),
                 theme);
         Object data = bundle.getData(context);
+        String facetName = bundle.getFacetName();
 
-        if (data instanceof BedDiffYearResult) {
+        if (facetName.equals(FacetTypes.BED_DIFFERENCE_SOUNDING_WIDTH) &&
+            data instanceof BedDiffYearResult) {
             BedDiffYearResult bData = (BedDiffYearResult) data;
-            StyledSeriesBuilder.addPoints(series, bData.getMorphWidthData(), true);
+            StyledSeriesBuilder.addPoints(series, bData.getSoundingWidthData(), true);
+        } else if (facetName.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH1) &&
+            data instanceof BedDiffYearResult) {
+            BedDiffYearResult bData = (BedDiffYearResult) data;
+            StyledSeriesBuilder.addPoints(series, bData.getMorphWidth1Data(), true);
+        } else if (facetName.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH2) &&
+            data instanceof BedDiffYearResult) {
+            BedDiffYearResult bData = (BedDiffYearResult) data;
+            StyledSeriesBuilder.addPoints(series, bData.getMorphWidth2Data(), true);
         } else if (data instanceof MorphologicWidth) {
             MorphologicWidth bData = (MorphologicWidth) data;
             StyledSeriesBuilder.addPoints(series, bData.getAsArray(), true);
@@ -77,7 +87,9 @@
 
     @Override
     public boolean canHandle(String facettype) {
-        return facettype.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH) ||
+        return facettype.equals(FacetTypes.BED_DIFFERENCE_SOUNDING_WIDTH) ||
+            facettype.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH1) ||
+            facettype.equals(FacetTypes.BED_DIFFERENCE_MORPH_WIDTH2) ||
             facettype.equals(FacetTypes.MORPHOLOGIC_WIDTH) ||
             facettype.equals(FacetTypes.BEDHEIGHT_SOUNDING_WIDTH);
     }


More information about the Dive4Elements-commits mailing list