[PATCH 1 of 3] SQ relation overview is now a single chart containing all fractions

Wald Commits scm-commit at wald.intevation.org
Fri Sep 12 14:56:54 CEST 2014


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1410526542 -7200
# Node ID 4d99606a844e3989ceb0467f3a031321e1367a99
# Parent  9321b0cd4ad446fa49ba08d36eec7b6895304038
SQ relation overview is now a single chart containing all fractions.

* Added new facet types.
* Add new facets for the overview chart.
* Removed generator code for the old overview.

diff -r 9321b0cd4ad4 -r 4d99606a844e artifacts/doc/conf/artifacts/minfo.xml
--- a/artifacts/doc/conf/artifacts/minfo.xml	Fri Sep 12 08:42:41 2014 +0200
+++ b/artifacts/doc/conf/artifacts/minfo.xml	Fri Sep 12 14:55:42 2014 +0200
@@ -372,9 +372,44 @@
                         <facet name="sq_f_outlier_measurement" description="A facet for sq outlier measurement"/>
                     </facets>
                 </outputmode>
-                <outputmode name="sq_overview" description="output.sq_overview" type="overview">
+                <outputmode name="sq_overview" description="output.sq_overview" type="chart">
                     <facets>
-                        <facet name="sq_chart_overview" description="A facet for sq chart overview"/>
+                        <facet name="sq_a_measurement_overview" description="A facet for sq measurements"/>
+                        <facet name="sq_a_outlier_overview" description="A facet fo sq outliers"/>
+                        <facet name="sq_a_curve_overview" description="A facet for sq curve"/>
+                        <facet name="sq_a_outlier_curve_overview" description="A facet for sq outlier curve"/>
+                        <facet name="sq_relation_a.manualpoints" />
+                        <facet name="sq_a_outlier_measurement_overview" description="A facet for sq outlier measurement"/>
+                        <facet name="sq_b_measurement_overview" description="A facet for sq measurements"/>
+                        <facet name="sq_b_outlier_overview" description="A facet fo sq outliers"/>
+                        <facet name="sq_b_curve_overview" description="A facet for sq curve"/>
+                        <facet name="sq_b_outlier_curve_overview" description="A facet for sq outlier curve"/>
+                        <facet name="sq_relation_b.manualpoints" />
+                        <facet name="sq_b_outlier_measurement_overview" description="A facet for sq outlier measurement"/>
+                        <facet name="sq_c_measurement_overview" description="A facet for sq measurements"/>
+                        <facet name="sq_c_outlier_overview" description="A facet fo sq outliers"/>
+                        <facet name="sq_c_curve_overview" description="A facet for sq curve"/>
+                        <facet name="sq_c_outlier_curve_overview" description="A facet for sq outlier curve"/>
+                        <facet name="sq_relation_c.manualpoints" />
+                        <facet name="sq_c_outlier_measurement_overview" description="A facet for sq outlier measurement"/>
+                        <facet name="sq_d_measurement_overview" description="A facet for sq measurements"/>
+                        <facet name="sq_d_outlier_overview" description="A facet fo sq outliers"/>
+                        <facet name="sq_d_curve_overview" description="A facet for sq curve"/>
+                        <facet name="sq_relation_d.manualpoints" />
+                        <facet name="sq_d_outlier_curve_overview" description="A facet for sq outlier curve"/>
+                        <facet name="sq_d_outlier_measurement_overview" description="A facet for sq outlier measurement"/>
+                        <facet name="sq_e_measurement_overview" description="A facet for sq measurements"/>
+                        <facet name="sq_e_outlier_overview" description="A facet fo sq outliers"/>
+                        <facet name="sq_e_curve_overview" description="A facet for sq curve"/>
+                        <facet name="sq_e_outlier_curve_overview" description="A facet for sq outlier curve"/>
+                        <facet name="sq_relation_e.manualpoints" />
+                        <facet name="sq_e_outlier_measurement_overview" description="A facet for sq outlier measurement"/>
+                        <facet name="sq_f_measurement_overview" description="A facet for sq measurements"/>
+                        <facet name="sq_relation_f.manualpoints" />
+                        <facet name="sq_f_outlier_overview" description="A facet fo sq outliers"/>
+                        <facet name="sq_f_curve_overview" description="A facet for sq curve"/>
+                        <facet name="sq_f_outlier_curve_overview" description="A facet for sq outlier curve"/>
+                        <facet name="sq_f_outlier_measurement_overview" description="A facet for sq outlier measurement"/>
                     </facets>
                 </outputmode>
                 <outputmode name="sq_relation_export" description="output.sq_relation_export" type="export">
diff -r 9321b0cd4ad4 -r 4d99606a844e artifacts/doc/conf/generators/discharge-diagrams2.xml
--- a/artifacts/doc/conf/generators/discharge-diagrams2.xml	Fri Sep 12 08:42:41 2014 +0200
+++ b/artifacts/doc/conf/generators/discharge-diagrams2.xml	Fri Sep 12 14:55:42 2014 +0200
@@ -100,4 +100,10 @@
     <title key="chart.sq_relation_f.title" default=""/>
     &sqrelation-defaults;
   </output-generator>
+  <output-generator names="sq_overview,sq_overview_chartinfo"
+      class="org.dive4elements.river.exports.DischargeGenerator"
+      converter="org.dive4elements.river.exports.DiagramAttributes">
+    <title key="chart.sq_relation_f.title" default=""/>
+    &sqrelation-defaults;
+  </output-generator>
 </discharge-diagrams>
diff -r 9321b0cd4ad4 -r 4d99606a844e artifacts/doc/conf/generators/generators.xml
--- a/artifacts/doc/conf/generators/generators.xml	Fri Sep 12 08:42:41 2014 +0200
+++ b/artifacts/doc/conf/generators/generators.xml	Fri Sep 12 14:55:42 2014 +0200
@@ -35,7 +35,7 @@
     <output-generator names="bed_quality_export" class="org.dive4elements.river.exports.minfo.BedQualityExporter"/>
     <output-generator names="bedheight_difference_export" class="org.dive4elements.river.exports.minfo.BedDifferenceExporter"/>
     <output-generator names="sq_relation_export" class="org.dive4elements.river.exports.sq.SQRelationExporter"/>
-    <output-generator names="sq_overview" class="org.dive4elements.river.exports.sq.SQOverviewGenerator"/>
+    <!--output-generator names="sq_overview" class="org.dive4elements.river.exports.sq.SQOverviewGenerator"/-->
     <output-generator names="fix_parameters_export" class="org.dive4elements.river.exports.fixings.ParametersExporter"/>
     <output-generator names="fix_deltawt_export" class="org.dive4elements.river.exports.fixings.DeltaWtExporter"/>
     <output-generator names="fix_deltawt_curve" class="org.dive4elements.river.exports.fixings.FixDeltaWtGenerator"/>
diff -r 9321b0cd4ad4 -r 4d99606a844e artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java	Fri Sep 12 08:42:41 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/FacetTypes.java	Fri Sep 12 14:55:42 2014 +0200
@@ -71,6 +71,18 @@
                 || type.equals(SQ_D_OUTLIER_CURVE)
                 || type.equals(SQ_E_OUTLIER_CURVE)
                 || type.equals(SQ_F_OUTLIER_CURVE)
+                || type.equals(SQ_A_CURVE_OV)
+                || type.equals(SQ_B_CURVE_OV)
+                || type.equals(SQ_C_CURVE_OV)
+                || type.equals(SQ_D_CURVE_OV)
+                || type.equals(SQ_E_CURVE_OV)
+                || type.equals(SQ_F_CURVE_OV)
+                || type.equals(SQ_A_OUTLIER_CURVE_OV)
+                || type.equals(SQ_B_OUTLIER_CURVE_OV)
+                || type.equals(SQ_C_OUTLIER_CURVE_OV)
+                || type.equals(SQ_D_OUTLIER_CURVE_OV)
+                || type.equals(SQ_E_OUTLIER_CURVE_OV)
+                || type.equals(SQ_F_OUTLIER_CURVE_OV)
                 )
             {
                 return true;
@@ -91,6 +103,18 @@
                 || type.equals(SQ_D_OUTLIER_MEASUREMENT)
                 || type.equals(SQ_E_OUTLIER_MEASUREMENT)
                 || type.equals(SQ_F_OUTLIER_MEASUREMENT)
+                || type.equals(SQ_A_MEASUREMENT_OV)
+                || type.equals(SQ_B_MEASUREMENT_OV)
+                || type.equals(SQ_C_MEASUREMENT_OV)
+                || type.equals(SQ_D_MEASUREMENT_OV)
+                || type.equals(SQ_E_MEASUREMENT_OV)
+                || type.equals(SQ_F_MEASUREMENT_OV)
+                || type.equals(SQ_A_OUTLIER_MEASUREMENT_OV)
+                || type.equals(SQ_B_OUTLIER_MEASUREMENT_OV)
+                || type.equals(SQ_C_OUTLIER_MEASUREMENT_OV)
+                || type.equals(SQ_D_OUTLIER_MEASUREMENT_OV)
+                || type.equals(SQ_E_OUTLIER_MEASUREMENT_OV)
+                || type.equals(SQ_F_OUTLIER_MEASUREMENT_OV)
                 )
             {
                 return true;
@@ -104,7 +128,13 @@
                 || type.equals(SQ_C_OUTLIER)
                 || type.equals(SQ_D_OUTLIER)
                 || type.equals(SQ_E_OUTLIER)
-                || type.equals(SQ_F_OUTLIER))
+                || type.equals(SQ_F_OUTLIER)
+                || type.equals(SQ_A_OUTLIER_OV)
+                || type.equals(SQ_B_OUTLIER_OV)
+                || type.equals(SQ_C_OUTLIER_OV)
+                || type.equals(SQ_D_OUTLIER_OV)
+                || type.equals(SQ_E_OUTLIER_OV)
+                || type.equals(SQ_F_OUTLIER_OV))
             {
                 return true;
             }
@@ -342,6 +372,42 @@
     String SQ_F_OUTLIER_CURVE = "sq_f_outlier_curve";
     String SQ_F_OUTLIER_MEASUREMENT = "sq_f_outlier_measurement";
 
+    String SQ_A_CURVE_OV       = "sq_a_curve_overview";
+    String SQ_A_MEASUREMENT_OV = "sq_a_measurement_overview";
+    String SQ_A_OUTLIER_OV     = "sq_a_outlier_overview";
+    String SQ_A_OUTLIER_CURVE_OV = "sq_a_outlier_curve_overview";
+    String SQ_A_OUTLIER_MEASUREMENT_OV = "sq_a_outlier_measurement_overview";
+
+    String SQ_B_CURVE_OV       = "sq_b_curve_overview";
+    String SQ_B_MEASUREMENT_OV = "sq_b_measurement_overview";
+    String SQ_B_OUTLIER_OV     = "sq_b_outlier_overview";
+    String SQ_B_OUTLIER_CURVE_OV  = "sq_b_outlier_curve_overview";
+    String SQ_B_OUTLIER_MEASUREMENT_OV  = "sq_b_outlier_measurement_overview";
+
+    String SQ_C_CURVE_OV       = "sq_c_curve_overview";
+    String SQ_C_MEASUREMENT_OV = "sq_c_measurement_overview";
+    String SQ_C_OUTLIER_OV     = "sq_c_outlier_overview";
+    String SQ_C_OUTLIER_CURVE_OV = "sq_c_outlier_curve_overview";
+    String SQ_C_OUTLIER_MEASUREMENT_OV = "sq_c_outlier_measurement_overview";
+
+    String SQ_D_CURVE_OV       = "sq_d_curve_overview";
+    String SQ_D_MEASUREMENT_OV = "sq_d_measurement_overview";
+    String SQ_D_OUTLIER_OV     = "sq_d_outlier_overview";
+    String SQ_D_OUTLIER_CURVE_OV = "sq_d_outlier_curve_overview";
+    String SQ_D_OUTLIER_MEASUREMENT_OV = "sq_d_outlier_measurement_overview";
+
+    String SQ_E_CURVE_OV       = "sq_e_curve_overview";
+    String SQ_E_MEASUREMENT_OV = "sq_e_measurement_overview";
+    String SQ_E_OUTLIER_OV     = "sq_e_outlier_overview";
+    String SQ_E_OUTLIER_CURVE_OV = "sq_e_outlier_curve_overview";
+    String SQ_E_OUTLIER_MEASUREMENT_OV = "sq_e_outlier_curve_measurement_overview";
+
+    String SQ_F_CURVE_OV       = "sq_f_curve_overview";
+    String SQ_F_MEASUREMENT_OV = "sq_f_measurement_overview";
+    String SQ_F_OUTLIER_OV     = "sq_f_outlier_overview";
+    String SQ_F_OUTLIER_CURVE_OV = "sq_f_outlier_curve_overview";
+    String SQ_F_OUTLIER_MEASUREMENT_OV = "sq_f_outlier_measurement_overview";
+
     String RELATIVE_POINT = "relativepoint";
 
     String FIX_ANALYSIS_EVENTS_DWT = "fix_analysis_events_dwt";
diff -r 9321b0cd4ad4 -r 4d99606a844e artifacts/src/main/java/org/dive4elements/river/artifacts/states/SQRelation.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/SQRelation.java	Fri Sep 12 08:42:41 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/SQRelation.java	Fri Sep 12 14:55:42 2014 +0200
@@ -89,6 +89,25 @@
         }
     };
 
+    public static final String [][] OV_FACET_NAMES = {
+        { SQ_A_CURVE_OV, SQ_B_CURVE_OV, SQ_C_CURVE_OV,
+          SQ_D_CURVE_OV, SQ_E_CURVE_OV, SQ_F_CURVE_OV
+        },
+        { SQ_A_MEASUREMENT_OV, SQ_B_MEASUREMENT_OV, SQ_C_MEASUREMENT_OV,
+          SQ_D_MEASUREMENT_OV, SQ_E_MEASUREMENT_OV, SQ_F_MEASUREMENT_OV
+        },
+        { SQ_A_OUTLIER_OV, SQ_B_OUTLIER_OV, SQ_C_OUTLIER_OV,
+          SQ_D_OUTLIER_OV, SQ_E_OUTLIER_OV, SQ_F_OUTLIER_OV
+        },
+        { SQ_A_OUTLIER_CURVE_OV, SQ_B_OUTLIER_CURVE_OV, SQ_C_OUTLIER_CURVE_OV,
+          SQ_D_OUTLIER_CURVE_OV, SQ_E_OUTLIER_CURVE_OV, SQ_F_OUTLIER_CURVE_OV
+        },
+        { SQ_A_OUTLIER_MEASUREMENT_OV, SQ_B_OUTLIER_MEASUREMENT_OV,
+          SQ_C_OUTLIER_MEASUREMENT_OV, SQ_D_OUTLIER_MEASUREMENT_OV,
+          SQ_E_OUTLIER_MEASUREMENT_OV, SQ_F_OUTLIER_MEASUREMENT_OV
+        }
+    };
+
 
     static {
         // Active/deactivate facets.
@@ -109,6 +128,12 @@
                         name, FACET_NAMES[OUTLIER_INDEX])
                     ||  StringUtils.contains(
                         name, FACET_NAMES[MEASURREMENT_INDEX])
+                    ||  StringUtils.contains(
+                        name, OV_FACET_NAMES[CURVE_INDEX])
+                    ||  StringUtils.contains(
+                        name, OV_FACET_NAMES[OUTLIER_INDEX])
+                    ||  StringUtils.contains(
+                        name, OV_FACET_NAMES[MEASURREMENT_INDEX])
                     ) {
                         // TODO: Only the last should be active.
                         return Boolean.TRUE;
@@ -118,6 +143,10 @@
                         name, FACET_NAMES[OUTLIER_CURVE_INDEX])
                      || StringUtils.contains(
                         name, FACET_NAMES[OUTLIER_MEASUREMENT_INDEX])
+                     || StringUtils.contains(
+                         name, OV_FACET_NAMES[OUTLIER_CURVE_INDEX])
+                     || StringUtils.contains(
+                         name, OV_FACET_NAMES[OUTLIER_MEASUREMENT_INDEX])
                     ) {
                         return Boolean.FALSE;
                     }
@@ -181,20 +210,6 @@
 
         CallMeta meta    = context.getMeta();
         String   stateId = getID();
-        for (int i = 0; i < 6; i++) {
-            container.add(new SQOverviewFacet(
-                i,
-                i,
-                "sq_chart_overview",
-                Resources.getMsg(
-                    meta,
-                    I18N_FACET_CURVE,
-                    I18N_FACET_CURVE
-                ),
-                hash,
-                getID()
-            ));
-        }
         for (int res = 0, n = sqr.length; res < n; res++) {
 
             for (int i = 0; i < SQResult.NUMBER_FRACTIONS; i++) {
@@ -218,6 +233,20 @@
                     stateId
                 ));
 
+                container.add(new SQCurveFacet(
+                    res,
+                    i,
+                    getFractionOverviewFacetname(CURVE_INDEX, i),
+                    sqr[res].getFractionName(i) + " - " +
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_CURVE,
+                        I18N_FACET_CURVE
+                    ),
+                    hash,
+                    stateId
+                ));
+
                 for (int j = 0, C = result.numIterations()-1; j < C; j++) {
 
                     Object [] round = new Object [] { j + 1 };
@@ -237,6 +266,20 @@
                         index,
                         i,
                         getFractionFacetname(OUTLIER_INDEX, i),
+                            Resources.getMsg(
+                                meta,
+                                I18N_FACET_OUTLIERS,
+                                I18N_FACET_OUTLIERS,
+                                round
+                            ),
+                        hash,
+                        stateId
+                    ));
+                    container.add(new SQOutlierFacet(
+                        index,
+                        i,
+                        getFractionOverviewFacetname(OUTLIER_INDEX, i),
+                        sqr[res].getFractionName(i) + " - " +
                         Resources.getMsg(
                             meta,
                             I18N_FACET_OUTLIERS,
@@ -260,6 +303,20 @@
                         hash,
                         stateId
                     ));
+                    container.add(new SQOutlierCurveFacet(
+                        index,
+                        i,
+                        getFractionOverviewFacetname(OUTLIER_CURVE_INDEX, i),
+                        sqr[res].getFractionName(i) + " - " +
+                        Resources.getMsg(
+                            meta,
+                            I18N_FACET_OUTLIER_CURVE,
+                            I18N_FACET_OUTLIER_CURVE,
+                            round
+                        ),
+                        hash,
+                        stateId
+                    ));
 
                     container.add(new SQOutlierMeasurementFacet(
                         index,
@@ -274,6 +331,20 @@
                         hash,
                         stateId
                     ));
+                    container.add(new SQOutlierMeasurementFacet(
+                        index,
+                        i,
+                        getFractionOverviewFacetname(OUTLIER_MEASUREMENT_INDEX, i),
+                        sqr[res].getFractionName(i) + " - " +
+                        Resources.getMsg(
+                            meta,
+                            I18N_FACET_OUTLIER_MEASUREMENT,
+                            I18N_FACET_OUTLIER_MEASUREMENT,
+                            round
+                        ),
+                        hash,
+                        stateId
+                    ));
                 } // for all outliers
 
                 container.add(new SQMeasurementFacet(
@@ -288,6 +359,19 @@
                     hash,
                     stateId
                 ));
+                container.add(new SQMeasurementFacet(
+                    res,
+                    i,
+                    getFractionOverviewFacetname(MEASURREMENT_INDEX, i),
+                    sqr[res].getFractionName(i) + " - " +
+                    Resources.getMsg(
+                        meta,
+                        I18N_FACET_MEASUREMENTS,
+                        I18N_FACET_MEASUREMENTS
+                    ),
+                    hash,
+                    stateId
+                ));
             } // for all fractions
         } // for all results
     }
@@ -299,5 +383,13 @@
         type %= FACET_NAMES.length;
         return FACET_NAMES[type][idx % FACET_NAMES[type].length];
     }
+
+    protected static String getFractionOverviewFacetname(int type, int idx) {
+        if (log.isDebugEnabled()) {
+            log.debug("getFractionOverviewFacetname(): " + type + " | " + idx);
+        }
+        type %= OV_FACET_NAMES.length;
+        return OV_FACET_NAMES[type][idx % OV_FACET_NAMES[type].length];
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
diff -r 9321b0cd4ad4 -r 4d99606a844e artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java
--- a/artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java	Fri Sep 12 08:42:41 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/collections/D4EArtifactCollection.java	Fri Sep 12 14:55:42 2014 +0200
@@ -290,9 +290,6 @@
             String outName = entry.getKey();
             Output output  = entry.getValue();
 
-            if (outName.equals("sq_overview")) {
-                continue;
-            }
             Settings settings = output.getSettings();
 
             if (settings == null) {
@@ -422,9 +419,6 @@
         try {
             Document attr = getAttribute(cAttr, name);
             OutputHelper helper = new OutputHelper(identifier());
-            if (name.equals("sq_overview")) {
-                helper.doOut(generator, name, subtype, format, context, format);
-            }
             helper.doOut(generator, name, subtype, attr, context, format);
             generator.generate();
         }
diff -r 9321b0cd4ad4 -r 4d99606a844e artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java	Fri Sep 12 08:42:41 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java	Fri Sep 12 14:55:42 2014 +0200
@@ -138,24 +138,16 @@
                     }
                 }
 
-                if (outName.equals("sq_overview")) {
-                    generator.doOut(
+                generator.doOut(
                         dataProviders.get(i),
-                        themeDoc,
+                        getFacetThemeFromAttribute(
+                            art,
+                            outName,
+                            facetName,
+                            theme.getDescription(),
+                            theme.getIndex(),
+                            context),
                         theme.getActive() == 1);
-                }
-                else {
-                    generator.doOut(
-                            dataProviders.get(i),
-                            getFacetThemeFromAttribute(
-                                art,
-                                outName,
-                                facetName,
-                                theme.getDescription(),
-                                theme.getIndex(),
-                                context),
-                            theme.getActive() == 1);
-                }
             }
         }
         catch (ArtifactDatabaseException ade) {


More information about the Dive4Elements-commits mailing list