changeset 4673:32f90baf4afa

Generate and draw new facets.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 13 Dec 2012 17:19:38 +0100
parents 12e3da5724e6
children 381d93d0be20
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java
diffstat 4 files changed, 173 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java	Thu Dec 13 17:18:53 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferencesState.java	Thu Dec 13 17:19:38 2012 +0100
@@ -36,11 +36,16 @@
     public static final String I18N_DIFF_EPOCH = "beddifference.epoch";
 
     public static final String I18N_FACET_BED_DIFF_YEAR = "facet.bedheight.diff.year";
+    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_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";
+    public static final String I18N_FACET_BED_DIFF_HEIGHT1_RAW = "facet.bedheight.diff.height1.raw";
     public static final String I18N_FACET_BED_DIFF_HEIGHT2 = "facet.bedheight.diff.height2";
+    public static final String I18N_FACET_BED_DIFF_HEIGHT2_RAW = "facet.bedheight.diff.height2.raw";
 
     public DifferencesState() {
     }
@@ -90,7 +95,8 @@
                     BED_DIFFERENCE_YEAR,
                     createBedDiffYearDescription(
                         meta,
-                        (BedDiffYearResult)results[idx]),
+                        (BedDiffYearResult)results[idx],
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -109,7 +115,8 @@
                     createBedDiffHeightDescription(
                         meta,
                         (BedDiffYearResult)results[idx],
-                        0),
+                        0,
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -119,7 +126,8 @@
                     createBedDiffHeightDescription(
                         meta,
                         (BedDiffYearResult)results[idx],
-                        1),
+                        1,
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -128,7 +136,50 @@
                     BED_DIFFERENCE_HEIGHT_YEAR,
                     createBedDiffAbsoluteDescription(
                         meta,
-                        (BedDiffYearResult)results[idx]),
+                        (BedDiffYearResult)results[idx],
+                        false),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_YEAR_FILTERED,
+                    createBedDiffYearDescription(
+                        meta,
+                        (BedDiffYearResult)results[idx],
+                        true),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED,
+                    createBedDiffHeightDescription(
+                        meta,
+                        (BedDiffYearResult)results[idx],
+                        0,
+                        true),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                 newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED,
+                    createBedDiffHeightDescription(
+                        meta,
+                        (BedDiffYearResult)results[idx],
+                        1,
+                        true),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffYearFacet(
+                    idx,
+                    BED_DIFFERENCE_HEIGHT_YEAR_FILTERED,
+                    createBedDiffAbsoluteDescription(
+                        meta,
+                        (BedDiffYearResult)results[idx],
+                        true),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -139,7 +190,8 @@
                     BED_DIFFERENCE_EPOCH,
                     createBedDiffEpochDescription(
                         meta,
-                        (BedDiffEpochResult)results[idx]),
+                        (BedDiffEpochResult)results[idx],
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -149,7 +201,8 @@
                     createBedDiffHeightEpochDescription(
                         meta,
                         (BedDiffEpochResult)results[idx],
-                        0),
+                        0,
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
@@ -159,11 +212,43 @@
                     createBedDiffHeightEpochDescription(
                         meta,
                         (BedDiffEpochResult)results[idx],
-                        1),
+                        1,
+                        false),
                     ComputeType.ADVANCE,
                     stateId,
                     hash));
-
+                newFacets.add(new BedDiffEpochFacet(
+                    idx,
+                    BED_DIFFERENCE_EPOCH_FILTERED,
+                    createBedDiffEpochDescription(
+                        meta,
+                        (BedDiffEpochResult)results[idx],
+                        true),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffEpochFacet(
+                    idx,
+                    BED_DIFFERENCE_EPOCH_HEIGHT1_FILTERED,
+                    createBedDiffHeightEpochDescription(
+                        meta,
+                        (BedDiffEpochResult)results[idx],
+                        0,
+                        true),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
+                newFacets.add(new BedDiffEpochFacet(
+                    idx,
+                    BED_DIFFERENCE_EPOCH_HEIGHT2_FILTERED,
+                    createBedDiffHeightEpochDescription(
+                        meta,
+                        (BedDiffEpochResult)results[idx],
+                        1,
+                        true),
+                    ComputeType.ADVANCE,
+                    stateId,
+                    hash));
             }
         }
     }
@@ -171,24 +256,32 @@
     private String createBedDiffHeightDescription(
         CallMeta meta,
         BedDiffYearResult result,
-        int ndx
+        int ndx,
+        boolean raw
     ) {
         String range = result.getStart() + " - " + result.getEnd();
 
+        String i18nHeight1 = I18N_FACET_BED_DIFF_HEIGHT1;
+        String i18nHeight2 = I18N_FACET_BED_DIFF_HEIGHT2;
+        if (raw) {
+            i18nHeight1 = I18N_FACET_BED_DIFF_HEIGHT1_RAW;
+            i18nHeight2 = I18N_FACET_BED_DIFF_HEIGHT2_RAW;
+        }
         if (ndx == 0) {
-            return Resources.getMsg(meta, I18N_FACET_BED_DIFF_HEIGHT1,
-                I18N_FACET_BED_DIFF_HEIGHT1, new Object[] { range });
+            return Resources.getMsg(meta, i18nHeight1,
+                i18nHeight2, new Object[] { range });
         }
         else {
-            return Resources.getMsg(meta, I18N_FACET_BED_DIFF_HEIGHT2,
-                I18N_FACET_BED_DIFF_HEIGHT2, new Object[] {range});
+            return Resources.getMsg(meta, i18nHeight1,
+                i18nHeight2, new Object[] {range});
         }
     }
 
     private String createBedDiffHeightEpochDescription(
         CallMeta meta,
         BedDiffEpochResult result,
-        int ndx
+        int ndx,
+        boolean raw
     ) {
         DateFormat df = Formatter.getDateFormatter(meta, "yyyy");
         String range =
@@ -196,23 +289,34 @@
             + " - " +
             df.format(result.getEnd());
 
+        String i18nHeight1 = I18N_FACET_BED_DIFF_HEIGHT1;
+        String i18nHeight2 = I18N_FACET_BED_DIFF_HEIGHT2;
+        if (raw) {
+            i18nHeight1 = I18N_FACET_BED_DIFF_HEIGHT1_RAW;
+            i18nHeight2 = I18N_FACET_BED_DIFF_HEIGHT2_RAW;
+        }
         if (ndx == 0) {
-            return Resources.getMsg(meta, I18N_FACET_BED_DIFF_HEIGHT1,
-                I18N_FACET_BED_DIFF_HEIGHT1, new Object[] { range });
+            return Resources.getMsg(meta, i18nHeight1,
+                i18nHeight1, new Object[] { range });
         }
         else {
-            return Resources.getMsg(meta, I18N_FACET_BED_DIFF_HEIGHT2,
-                I18N_FACET_BED_DIFF_HEIGHT2, new Object[] {range});
+            return Resources.getMsg(meta, i18nHeight2,
+                i18nHeight2, new Object[] {range});
         }
     }
 
     protected String createBedDiffYearDescription(
         CallMeta meta,
-        BedDiffYearResult result) {
+        BedDiffYearResult result,
+        boolean raw
+    ) {
         String range = result.getStart() + " - " + result.getEnd();
 
-        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_YEAR,
-            I18N_FACET_BED_DIFF_YEAR, new Object[] { range });
+        String i18n = I18N_FACET_BED_DIFF_YEAR;
+        if (raw) {
+            i18n = I18N_FACET_BED_DIFF_YEAR_RAW;
+        }
+        return Resources.getMsg(meta, i18n, i18n, new Object[] { range });
     }
 
     protected String createBedDiffMorphDescription(
@@ -226,23 +330,32 @@
 
     protected String createBedDiffAbsoluteDescription(
         CallMeta meta,
-        BedDiffYearResult result) {
+        BedDiffYearResult result,
+        boolean raw
+    ) {
         String range = result.getStart() + " - " + result.getEnd();
 
-        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_ABSOLUTE,
-            I18N_FACET_BED_DIFF_ABSOLUTE, new Object[] { range });
+        String i18n = I18N_FACET_BED_DIFF_ABSOLUTE;
+        if (raw) {
+            i18n = I18N_FACET_BED_DIFF_ABSOLUTE_RAW;
+        }
+        return Resources.getMsg(meta, i18n, i18n, new Object[] { range });
     }
 
     protected String createBedDiffEpochDescription(
         CallMeta meta,
-        BedDiffEpochResult result) {
+        BedDiffEpochResult result,
+        boolean raw) {
         DateFormat df = Formatter.getDateFormatter(meta, "yyyy");
         String range =
             df.format(result.getStart())
             + " - " +
             df.format(result.getEnd());
 
-        return Resources.getMsg(meta, I18N_FACET_BED_DIFF_EPOCH,
-            I18N_FACET_BED_DIFF_EPOCH, new Object[] { range });
+        String i18n = I18N_FACET_BED_DIFF_EPOCH;
+        if (raw) {
+            i18n = I18N_FACET_BED_DIFF_EPOCH_RAW;
+        }
+        return Resources.getMsg(meta, i18n, i18n, new Object[] { range });
     }
 }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java	Thu Dec 13 17:18:53 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDiffHeightYearGenerator.java	Thu Dec 13 17:19:38 2012 +0100
@@ -111,6 +111,11 @@
                 (BedDiffYearResult) bundle.getData(context),
                 bundle, attr, visible);
         }
+        else if (name.equals(BED_DIFFERENCE_HEIGHT_YEAR_FILTERED)) {
+            doBedDifferenceYearOut(
+                (BedDiffYearResult) bundle.getData(context),
+                bundle, attr, visible);
+        }
         else if (name.equals(LONGITUDINAL_ANNOTATION)) {
             doAnnotations(
                 (FLYSAnnotation) bundle.getData(context),
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java	Thu Dec 13 17:18:53 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java	Thu Dec 13 17:19:38 2012 +0100
@@ -125,6 +125,19 @@
             doBedDifferenceHeightsOut((BedDiffEpochResult)bundle.getData(context),
                 bundle, attr, visible, 1);
         }
+        else if (name.equals(BED_DIFFERENCE_EPOCH_FILTERED)) {
+            doBedDifferenceEpochOut(
+                (BedDiffEpochResult) bundle.getData(context),
+                bundle, attr, visible);
+        }
+        else if (name.equals(BED_DIFFERENCE_EPOCH_HEIGHT1_FILTERED)) {
+            doBedDifferenceHeightsOut((BedDiffEpochResult)bundle.getData(context),
+                bundle, attr, visible, 0);
+        }
+        else if (name.equals(BED_DIFFERENCE_EPOCH_HEIGHT2_FILTERED)) {
+            doBedDifferenceHeightsOut((BedDiffEpochResult)bundle.getData(context),
+                bundle, attr, visible, 1);
+        }
         else if (processor.canHandle(name)) {
             processor.doOut(this, bundle, attr, visible, YAXIS.dW.idx);
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java	Thu Dec 13 17:18:53 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceYearGenerator.java	Thu Dec 13 17:19:38 2012 +0100
@@ -132,6 +132,21 @@
             doBedDifferenceHeightsOut(
                 (BedDiffYearResult)bundle.getData(context),
                 bundle, attr, visible, 1);
+        }
+        else if (name.equals(BED_DIFFERENCE_YEAR_FILTERED)) {
+            doBedDifferenceYearOut(
+                (BedDiffYearResult) bundle.getData(context),
+                bundle, attr, visible);
+        }
+        else if (name.equals(BED_DIFFERENCE_YEAR_HEIGHT1_FILTERED)) {
+            doBedDifferenceHeightsOut(
+                (BedDiffYearResult)bundle.getData(context),
+                bundle, attr, visible, 0);
+        }
+        else if (name.equals(BED_DIFFERENCE_YEAR_HEIGHT2_FILTERED)) {
+            doBedDifferenceHeightsOut(
+                (BedDiffYearResult)bundle.getData(context),
+                bundle, attr, visible, 1);
         } 
         else if (processor.canHandle(name)) {
             processor.doOut(this, bundle, attr, visible, YAXIS.dW.idx);

http://dive4elements.wald.intevation.org