changeset 3074:6502b17931b9

FixA: W/Q facet code cleanup. flys-artifacts/trunk@4665 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Thu, 14 Jun 2012 14:09:02 +0000
parents 0ace00c0c12a
children db9e2bb34707
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixWQCurveFacet.java
diffstat 2 files changed, 18 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Jun 14 14:03:16 2012 +0000
+++ b/flys-artifacts/ChangeLog	Thu Jun 14 14:09:02 2012 +0000
@@ -1,3 +1,8 @@
+2012-06-14	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixWQCurveFacet.java:
+	  Some code cleanup.
+
 2012-06-14	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/fixings/Fitting.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixWQCurveFacet.java	Thu Jun 14 14:03:16 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/fixings/FixWQCurveFacet.java	Thu Jun 14 14:09:02 2012 +0000
@@ -1,24 +1,22 @@
 package de.intevation.flys.artifacts.model.fixings;
 
-import org.apache.log4j.Logger;
-
 import de.intevation.artifacts.Artifact;
 import de.intevation.artifacts.CallContext;
 
-import de.intevation.flys.utils.KMIndex;
-
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.FixationArtifactAccess;
 
+import de.intevation.flys.artifacts.math.fitting.Function;
+import de.intevation.flys.artifacts.math.fitting.FunctionFactory;
+
+import de.intevation.flys.artifacts.model.CalculationResult;
+import de.intevation.flys.artifacts.model.DataFacet;
 import de.intevation.flys.artifacts.model.FacetTypes;
-import de.intevation.flys.artifacts.model.DataFacet;
-import de.intevation.flys.artifacts.model.CalculationResult;
 import de.intevation.flys.artifacts.model.Parameters;
 
-import de.intevation.flys.artifacts.math.fitting.FunctionFactory;
-import de.intevation.flys.artifacts.math.fitting.Function;
+import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
 
-import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
+import org.apache.log4j.Logger;
 
 /**
  * Facet to show the W|Q values.
@@ -73,9 +71,11 @@
             String function = access.getFunction();
             Function ff = FunctionFactory.getInstance().getFunction(function);
 
+            if (ff == null) {
+                return null;
+            }
+
             Parameters params = result.getParameters();
-            String[] columnNames = params.getColumnNames();
-
             String[] paramNames = ff.getParameterNames();
 
             double [] coeffs = params.interpolate("km", km, paramNames);
@@ -88,6 +88,7 @@
                 ff.instantiate(coeffs);
 
             double maxQ = getMaxQ(params, km);
+
             logger.debug("getData: maxQ = " + maxQ);
 
             FixFunction fix = new FixFunction(
@@ -105,7 +106,7 @@
     }
 
 
-    protected double getMaxQ(Parameters params, double km) {
+    public static double getMaxQ(Parameters params, double km) {
         double [] maxQ = params.interpolate("km", km, new String[] { "max_q" });
         if (maxQ == null) {
             return 1000;

http://dive4elements.wald.intevation.org