changeset 3907:9a2c38fb5f29

Add reference period facet to delta W/t chart flys-artifacts/trunk@5574 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Sat, 22 Sep 2012 23:54:28 +0000
parents fc6c6f6039df
children bd0f5a50e194
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/doc/conf/default-themes.xml flys-artifacts/doc/conf/second-themes.xml flys-artifacts/doc/conf/themes.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java
diffstat 8 files changed, 78 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Sat Sep 22 17:04:44 2012 +0000
+++ b/flys-artifacts/ChangeLog	Sat Sep 22 23:54:28 2012 +0000
@@ -1,3 +1,14 @@
+2012-09-23	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/artifacts/fixanalysis.xml,
+	  doc/conf/themes.xml,
+	  doc/conf/second-themes.xml,
+	  doc/conf/default-themes.xml,
+	  src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java,
+	  src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java:
+	  Add reference period facet to delta W/t chart (#877).
+
 2012-09-22	Christian Lins	<christian.lins@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/fixings/FixLongitudinalSectionGenerator.java,
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Sat Sep 22 17:04:44 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Sat Sep 22 23:54:28 2012 +0000
@@ -172,6 +172,7 @@
                         <facet name="fix_analysis_periods_dwt" description="Dateranges of analysis periods."/>
                         <facet name="fix_deviation_dwt" description="The standard variance"/>
                         <facet name="fix_deltawt_curve.manualpoints" description="Manual points"/>
+                        <facet name="fix_reference_period_dwt" description="Reference period"/>
                     </facets>
                 </outputmode>
                 <outputmode name="fix_longitudinal_section_curve" description="output.fix_longitudinal_section_curve" mine-type="image/png" type="chart">
--- a/flys-artifacts/doc/conf/default-themes.xml	Sat Sep 22 17:04:44 2012 +0000
+++ b/flys-artifacts/doc/conf/default-themes.xml	Sat Sep 22 23:54:28 2012 +0000
@@ -1601,6 +1601,16 @@
             <field name="backgroundcolor" type="Color" default="255, 0, 0" display="Füllfarbe" />
     	</fields>
     </theme>
+    
+    <theme name="FixingReferencePeriod">
+        <inherits>
+    		<inherit from="Areas"/>
+    	</inherits>
+    	<fields>
+    		<field name="transparency" type="int" default="80" display="Transparenz"/>
+            <field name="backgroundcolor" type="Color" default="0, 0, 255" display="Füllfarbe" />
+    	</fields>
+    </theme>
 
     <theme name="QSectors">
         <fields>
--- a/flys-artifacts/doc/conf/second-themes.xml	Sat Sep 22 17:04:44 2012 +0000
+++ b/flys-artifacts/doc/conf/second-themes.xml	Sat Sep 22 23:54:28 2012 +0000
@@ -1613,6 +1613,16 @@
     		<field name="transparency" type="int" default="90" display="Transparenz"/>
     	</fields>
     </theme>
+    
+    <theme name="FixingReferencePeriod">
+        <inherits>
+    		<inherit from="Areas"/>
+    	</inherits>
+    	<fields>
+    		<field name="transparency" type="int" default="70" display="Transparenz"/>
+            <field name="backgroundcolor" type="Color" default="0, 128, 200" display="Füllfarbe" />
+    	</fields>
+    </theme>
 
     <theme name="QSectors">
         <fields>
--- a/flys-artifacts/doc/conf/themes.xml	Sat Sep 22 17:04:44 2012 +0000
+++ b/flys-artifacts/doc/conf/themes.xml	Sat Sep 22 23:54:28 2012 +0000
@@ -250,6 +250,7 @@
 		<mapping from="fix_analysis_events_dwt" to="FixingDeltaWtAnalysis" />
 		<mapping from="fix_analysis_periods_dwt" to="FixingDeltaWtAnalysisPeriods" />
 		<mapping from="fix_reference_events_dwt" to="FixingReferenceEvents" />
+        <mapping from="fix_reference_period_dwt" to="FixingReferencePeriod" />
 		<mapping from="fix_sector_average_ls_deviation_0" to="FixingSectorDeviationLS0" />
 		<mapping from="fix_sector_average_ls_deviation_1" to="FixingSectorDeviationLS1" />
 		<mapping from="fix_sector_average_ls_deviation_2" to="FixingSectorDeviationLS2" />
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Sat Sep 22 17:04:44 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/FacetTypes.java	Sat Sep 22 23:54:28 2012 +0000
@@ -285,6 +285,7 @@
     String FIX_REFERENCE_EVENTS_DWT = "fix_reference_events_dwt";
     String FIX_REFERENCE_EVENTS_LS = "fix_reference_events_ls";
     String FIX_REFERENCE_EVENTS_WQ = "fix_reference_events_wq";
+    String FIX_REFERENCE_PERIOD_DWT = "fix_reference_period_dwt";
 
     // Note that AVERAGE_DWT will get a postfix (e.g. ..._dwt_1)
     String FIX_SECTOR_AVERAGE_DWT = "fix_sector_average_dwt";
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java	Sat Sep 22 17:04:44 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/fixation/FixAnalysisCompute.java	Sat Sep 22 23:54:28 2012 +0000
@@ -45,7 +45,7 @@
     /** The log used in this class. */
     private static Logger log = Logger.getLogger(FixAnalysisCompute.class);
 
-    private static final String I18N_REFERENCEPERIOD = "fix.reference.period.event.short";
+    private static final String I18N_REFERENCEPERIOD_SHORT = "fix.reference.period.event.short";
 
     private static final String I18N_ANALYSISPERIODS = "fix.analysis.periods";
 
@@ -59,6 +59,8 @@
 
     private static final String I18N_REFERENCEDEVIATION = "fix.reference.deviation";
 
+    private static final String I18N_REFERENCEPERIOD = "state.fix.analysis.referenceperiod";
+
     public static final String [] SECTOR_LABELS = {
         "[0 - (MNQ+MQ)/2)",
         "[(MNQ+MQ)/2 - (MQ+MHQ)/2)",
@@ -231,8 +233,8 @@
         IdGenerator idg = new IdGenerator(maxId + 1);
 
         String i18n_ref = Resources.getMsg(context.getMeta(),
-                I18N_REFERENCEPERIOD,
-                I18N_REFERENCEPERIOD);
+                I18N_REFERENCEPERIOD_SHORT,
+                I18N_REFERENCEPERIOD_SHORT);
         String i18n_dev = Resources.getMsg(context.getMeta(),
                 I18N_REFERENCEDEVIATION,
                 I18N_REFERENCEDEVIATION);
@@ -275,6 +277,13 @@
             FIX_ANALYSIS_PERIODS_WQ,
             i18n_ana));
 
+        String i18n_refp = Resources.getMsg(context.getMeta(),
+                I18N_REFERENCEPERIOD,
+                I18N_REFERENCEPERIOD);
+        facets.add(new DataFacet(idg.next(),
+            FIX_REFERENCE_PERIOD_DWT,
+            i18n_refp,
+            ComputeType.ADVANCE, null, null));
 
         facets.add(new FixWQCurveFacet(idg.next(), "W/Q"));
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Sat Sep 22 17:04:44 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDeltaWtGenerator.java	Sat Sep 22 23:54:28 2012 +0000
@@ -195,6 +195,14 @@
                     theme,
                     visible);
         }
+        else if (name.equals(FIX_REFERENCE_PERIOD_DWT)) {
+            doReferencePeriodsOut(
+                    (FLYSArtifact) artifactFacet.getArtifact(),
+                    artifactFacet.getData(context),
+                    artifactFacet.getFacetDescription(),
+                    theme,
+                    visible);
+        }
         else if (FacetTypes.IS.MANUALPOINTS(name)) {
             doPoints (artifactFacet.getData(context),
                     artifactFacet,
@@ -207,6 +215,28 @@
     }
 
 
+    protected void doReferencePeriodsOut(
+            FLYSArtifact artifact,
+            Object       data,
+            String       desc,
+            Document     theme,
+            boolean      visible)
+    {
+        logger.debug("doReferencePeriodsOut()");
+
+        FixAnalysisAccess access = new FixAnalysisAccess(artifact);
+        DateRange refRange  = access.getReferencePeriod();
+
+        RegularTimePeriod start = new Day(refRange.getFrom());
+        RegularTimePeriod end = new Day(refRange.getTo());
+        StyledDomainMarker marker = new StyledDomainMarker(
+                start.getMiddleMillisecond(),
+                end.getMiddleMillisecond(),
+                theme);
+        domainMarker.add(marker);
+    }
+
+
     protected void doSectorAverageOut(
             FLYSArtifact artifact,
             Object       data,
@@ -385,10 +415,8 @@
             Object       data,
             String       desc,
             Document     theme,
-            boolean      visible
-            ) {
-        logger.debug("doHistoricalDischargeDifferenceOut: desc = " + desc);
-
+            boolean      visible)
+    {
         DateRange[] ranges = (DateRange[]) data;
         if (ranges == null || !visible) {
             return;

http://dive4elements.wald.intevation.org