changeset 3761:066e2b4d69ca

Fix missing import flys-artifacts/trunk@5462 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Thu, 13 Sep 2012 20:58:24 +0000
parents 312870fded7e
children 0c978a80726a
files flys-artifacts/ChangeLog flys-artifacts/doc/conf/artifacts/fixanalysis.xml flys-artifacts/doc/conf/themes.xml flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java
diffstat 6 files changed, 70 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Sep 13 13:51:00 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Sep 13 20:58:24 2012 +0000
@@ -1,3 +1,14 @@
+2012-09-13	Christian Lins	<christian.lins@intevation.de>
+
+	* doc/conf/artifacts/fixanalysis.xml,
+	  doc/conf/themes.xml,
+	  src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java,
+	  src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java:
+	  Work on ManualPoints integration in fix analysis charts (wip).
+
+	* src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java:
+	  Fix missing import.
+
 2012-09-13  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java:
--- a/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Thu Sep 13 13:51:00 2012 +0000
+++ b/flys-artifacts/doc/conf/artifacts/fixanalysis.xml	Thu Sep 13 20:58:24 2012 +0000
@@ -191,6 +191,7 @@
                 <outputmode name="fix_derivate_curve" description="output.fix_derivate_curve" mine-type="image/png" type="chart">
                     <facets>
                         <facet name="fix_derivate" description="Derivate curve"/>
+                        <facet name="fix_derivate.manualpoints" description="Manual points"/>
                     </facets>
                 </outputmode>
                 <outputmode name="fix_report" description="output.fix_report.report" mime-type="text/plain" type="report">
--- a/flys-artifacts/doc/conf/themes.xml	Thu Sep 13 13:51:00 2012 +0000
+++ b/flys-artifacts/doc/conf/themes.xml	Thu Sep 13 20:58:24 2012 +0000
@@ -195,6 +195,7 @@
         <mapping from="fix_analysis_events_ls" to="FixLSAnalysis"/>
         <mapping from="fix_reference_events_ls" to="FixLSReference"/>
         <mapping from="fix_derivate" to="FixingDerivedCurve"/>
+        <mapping from="fix_derivate.manualpoints" to="ManualPoints"/>
         <mapping from="qsectors" to="QSectors"/>
     </mappings>
 </themes>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java	Thu Sep 13 13:51:00 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/ManualPointsArtifact.java	Thu Sep 13 20:58:24 2012 +0000
@@ -1,31 +1,23 @@
 package de.intevation.flys.artifacts;
 
+import java.awt.geom.Point2D;
 import java.util.ArrayList;
 import java.util.List;
 
-import java.awt.geom.Point2D;
-
 import org.apache.log4j.Logger;
-
+import org.json.JSONArray;
+import org.json.JSONException;
 import org.w3c.dom.Document;
 
-import org.json.JSONArray;
-import org.json.JSONException;
-
 import de.intevation.artifactdatabase.state.Facet;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.ArtifactFactory;
 import de.intevation.artifacts.CallMeta;
-
+import de.intevation.flys.artifacts.geom.Lines;
 import de.intevation.flys.artifacts.model.FacetTypes;
-
 import de.intevation.flys.artifacts.states.DefaultState;
-
 import de.intevation.flys.model.FastCrossSectionLine;
 
-import de.intevation.flys.artifacts.geom.Lines;
-
 
 /**
  * Artifact to store user-added points and water lines.
@@ -34,6 +26,8 @@
 extends      StaticFLYSArtifact
 implements   FacetTypes, WaterLineArtifact
 {
+    private static final long serialVersionUID = 7096025125474986011L;
+
     /** The logger for this class. */
     private static Logger logger = Logger.getLogger(ManualPointsArtifact.class);
 
@@ -41,24 +35,21 @@
     public static final String ARTIFACT_NAME = "manualpoints";
 
 
-    /**
-     * Trivial Constructor.
-     */
     public ManualPointsArtifact() {
         logger.debug("ManualPointsArtifact.ManualPointsArtifact()");
     }
 
 
     /**
-     * Gets called from factory, to set things up.
+     * Gets called from factory to set things up.
      */
     @Override
     public void setup(
-        String          identifier,
-        ArtifactFactory factory,
-        Object          context,
-        CallMeta        callMeta,
-        Document        data)
+            String          identifier,
+            ArtifactFactory factory,
+            Object          context,
+            CallMeta        callMeta,
+            Document        data)
     {
         logger.debug("ManualPointsArtifact.setup");
         super.setup(identifier, factory, context, callMeta, data);
@@ -67,6 +58,7 @@
 
 
     /** Return the name of this artifact. */
+    @Override
     public String getName() {
         return ARTIFACT_NAME;
     }
@@ -106,7 +98,7 @@
         }
         else {
             logger.debug("No facets to add in ManualPointsArtifact.initialize ("
-                + state.getID() + ").");
+                    + state.getID() + ").");
         }
     }
 
@@ -118,7 +110,7 @@
      */
     protected double getLine(int index) {
         try {
-            JSONArray lines = new JSONArray((String) getLinesData(null));
+            JSONArray lines = new JSONArray(getLinesData(null));
             JSONArray array = lines.getJSONArray(index);
 
             return array.getDouble(0);
@@ -139,10 +131,10 @@
      */
     @Override
     public Lines.LineData getWaterLines(
-        int                  index,
-        FastCrossSectionLine csl,
-        double a, double b
-    ) {
+            int                  index,
+            FastCrossSectionLine csl,
+            double a, double b
+            ) {
         List<Point2D> points = csl.getPoints();
         return Lines.createWaterLines(points, getLine(index));
     }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Thu Sep 13 13:51:00 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Thu Sep 13 20:58:24 2012 +0000
@@ -9,12 +9,12 @@
 import de.intevation.artifacts.CallContext;
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.access.BedQualityAccess;
-import de.intevation.flys.artifacts.model.BedQualityCalculation;
 import de.intevation.flys.artifacts.model.CalculationResult;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.minfo.BedDensityFacet;
 import de.intevation.flys.artifacts.model.minfo.BedDiameterFacet;
 import de.intevation.flys.artifacts.model.minfo.BedPorosityFacet;
+import de.intevation.flys.artifacts.model.minfo.BedQualityCalculation;
 import de.intevation.flys.artifacts.model.minfo.BedloadDiameterFacet;
 import de.intevation.flys.artifacts.states.DefaultState;
 
@@ -63,4 +63,4 @@
         return res;
     }
 }
-// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
\ No newline at end of file
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java	Thu Sep 13 13:51:00 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixDerivedCurveGenerator.java	Thu Sep 13 20:58:24 2012 +0000
@@ -1,5 +1,8 @@
 package de.intevation.flys.exports.fixings;
 
+import org.apache.log4j.Logger;
+import org.w3c.dom.Document;
+
 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.fixings.FixDerivateFacet;
@@ -9,9 +12,6 @@
 import de.intevation.flys.jfree.JFreeUtil;
 import de.intevation.flys.jfree.StyledXYSeries;
 
-import org.apache.log4j.Logger;
-import org.w3c.dom.Document;
-
 /**
  * Generator for fixation derived function curve.
  *
@@ -22,28 +22,28 @@
 implements FacetTypes
 {
     private static Logger logger =
-        Logger.getLogger(FixDerivedCurveGenerator.class);
+            Logger.getLogger(FixDerivedCurveGenerator.class);
 
     public static final String I18N_CHART_TITLE =
-        "chart.fixings.derivedcurve.title";
+            "chart.fixings.derivedcurve.title";
 
     public static final String I18N_CHART_SUBTITLE =
-        "chart.fixings.derivedcurve.subtitle";
+            "chart.fixings.derivedcurve.subtitle";
 
     public static final String I18N_XAXIS_LABEL =
-        "chart.fixings.derivedcurve.xaxis.label";
+            "chart.fixings.derivedcurve.xaxis.label";
 
     public static final String I18N_YAXIS_LABEL =
-        "chart.fixings.derivedcurve.yaxis.label";
+            "chart.fixings.derivedcurve.yaxis.label";
 
     public static final String I18N_CHART_TITLE_DEFAULT =
-        "Ableitungskurve";
+            "Ableitungskurve";
 
     public static final String I18N_XAXIS_LABEL_DEFAULT =
-        "Q [m\u00B3/s]";
+            "Q [m\u00B3/s]";
 
     public static final String I18N_YAXIS_LABEL_DEFAULT =
-        "W [NN + m]";
+            "W [NN + m]";
 
     public static enum YAXIS {
         W(0),
@@ -59,26 +59,33 @@
     public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
         logger.debug("doOut");
 
-        FixDerivateFacet facet = (FixDerivateFacet)aaf.getFacet();
-        FixFunction func = (FixFunction)facet.getData(
-            aaf.getArtifact(), context);
-
-        if (func == null) {
-            logger.warn("doOut: Facet does not contain FixFunction");
-            return;
+        if (FacetTypes.IS.MANUALPOINTS(aaf.getFacetName())) {
+            doPoints(aaf.getData(context),
+                    aaf,
+                    doc, visible, YAXIS.W.idx);
         }
+        else {
+            FixDerivateFacet facet = (FixDerivateFacet)aaf.getFacet();
+            FixFunction func = (FixFunction)facet.getData(
+                    aaf.getArtifact(), context);
 
-        double maxQ = func.getMaxQ();
+            if (func == null) {
+                logger.warn("doOut: Facet does not contain FixFunction");
+                return;
+            }
 
-        if (maxQ > 0) {
-            StyledXYSeries series = JFreeUtil.sampleFunction2D(
-                func.getFunction(),
-                doc,
-                aaf.getFacetDescription(),
-                500,   // number of samples
-                0.0 ,  // start
-                maxQ); // end
-            addAxisSeries(series, 0, visible);
+            double maxQ = func.getMaxQ();
+
+            if (maxQ > 0) {
+                StyledXYSeries series = JFreeUtil.sampleFunction2D(
+                        func.getFunction(),
+                        doc,
+                        aaf.getFacetDescription(),
+                        500,   // number of samples
+                        0.0 ,  // start
+                        maxQ); // end
+                addAxisSeries(series, 0, visible);
+            }
         }
     }
 
@@ -120,7 +127,7 @@
             }
 
             @Override
-             public String getId(int idx) {
+            public String getId(int idx) {
                 YAXIS[] yaxes = YAXIS.values();
                 return yaxes[idx].toString();
             }

http://dive4elements.wald.intevation.org