changeset 4831:0f3649285a0c

merge
author Bettina Gruenbauer <bettina@intevation.de>
date Tue, 22 Jan 2013 09:56:03 +0100
parents fbc14d687885 (current diff) 92ba5ffb8ba8 (diff)
children 9e705ff48322
files
diffstat 19 files changed, 107 insertions(+), 140 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedHeightAccess.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedHeightAccess.java	Tue Jan 22 09:56:03 2013 +0100
@@ -2,6 +2,8 @@
 
 import java.util.List;
 
+import de.intevation.artifacts.CallContext;
+
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.model.minfo.BedHeight;
 import de.intevation.flys.artifacts.model.minfo.BedHeightFactory;
@@ -14,38 +16,31 @@
 import org.apache.log4j.Logger;
 
 
-public class BedHeightAccess extends Access {
+public class BedHeightAccess
+extends      RangeAccess
+{
 
     private static final Logger logger = Logger.getLogger(BedHeightAccess.class);
 
     private int[] singleIDs;
     private int[] epochIDs;
 
-    private Double lowerKM;
-    private Double upperKM;
-
     private String time;
 
-    public BedHeightAccess(FLYSArtifact artifact) {
-        super(artifact);
+    public BedHeightAccess(FLYSArtifact artifact, CallContext context) {
+        super(artifact, context);
     }
 
 
     public Double getLowerKM() {
-        if (lowerKM == null) {
-            lowerKM = getDouble("ld_from");
-        }
-
-        return lowerKM;
+        // TODO update callers
+        return getFrom();
     }
 
 
     public Double getUpperKM() {
-        if (upperKM == null) {
-            upperKM = getDouble("ld_to");
-        }
-
-        return upperKM;
+        // TODO update callers
+        return getTo();
     }
 
 
@@ -150,8 +145,8 @@
         BedHeightSingle single = BedHeightSingle.getBedHeightSingleById(
                 artifact.getDataAsInteger("height_id"));
         return BedHeightSingleValue.getBedHeightSingleValues(single,
-                artifact.getDataAsDouble("ld_from"),
-                artifact.getDataAsDouble("ld_to"));
+                getFrom(),
+                getTo());
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedQualityAccess.java	Tue Jan 22 09:56:03 2013 +0100
@@ -6,37 +6,24 @@
 
 import org.apache.log4j.Logger;
 
+import de.intevation.artifacts.CallContext;
+
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.model.DateRange;
 
 
-public class BedQualityAccess extends RiverAccess {
+public class BedQualityAccess extends RangeAccess {
 
     private static final Logger logger = Logger
         .getLogger(BedQualityAccess.class);
 
-    private Double from;
-    private Double to;
     private List<String> bedDiameter;
     private List<String> bedloadDiameter;
     private List<DateRange> ranges;
 
-    public BedQualityAccess(FLYSArtifact artifact) {
-        super(artifact);
-    }
 
-    public double getFrom() {
-        if (from == null) {
-            from = getDouble("ld_from");
-        }
-        return from.doubleValue();
-    }
-
-    public double getTo() {
-        if (to == null) {
-            to = getDouble("ld_to");
-        }
-        return to.doubleValue();
+    public BedQualityAccess(FLYSArtifact artifact, CallContext context) {
+        super(artifact, context);
     }
 
     public List<DateRange> getDateRanges() {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/ExtremeAccess.java	Tue Jan 22 09:56:03 2013 +0100
@@ -1,5 +1,7 @@
 package de.intevation.flys.artifacts.access;
 
+import de.intevation.artifacts.CallContext;
+
 import de.intevation.flys.artifacts.FLYSArtifact;
 
 import de.intevation.flys.artifacts.model.RangeWithValues;
@@ -13,15 +15,11 @@
 
 /** Access data used for extreme value analysis. */
 public class ExtremeAccess
-extends      RiverAccess
+extends      RangeAccess
 {
     /** Our private logger. */
     private static Logger logger = Logger.getLogger(ExtremeAccess.class);
 
-    protected Double from;
-    protected Double to;
-    protected Double step;
-
     protected Long start;
     protected Long end;
 
@@ -32,57 +30,8 @@
     protected List<RangeWithValues> ranges;
 
 
-    public ExtremeAccess() {
-    }
-
-
-    public ExtremeAccess(FLYSArtifact artifact) {
-        super(artifact);
-    }
-
-
-    /** From (km) for calculation. */
-    public Double getFrom() {
-
-        if (from == null) {
-            from = getDouble("ld_from");
-        }
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("from: '" + from + "'");
-        }
-
-        return from;
-    }
-
-
-    /** To (km) for calculation. */
-    public Double getTo() {
-
-        if (to == null) {
-            to = getDouble("ld_to");
-        }
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("to: '" + to + "'");
-        }
-
-        return to;
-    }
-
-
-    /** Step width for calculation. */
-    public Double getStep() {
-
-        if (step == null) {
-            step = getDouble("ld_step");
-        }
-
-        if (logger.isDebugEnabled()) {
-            logger.debug("step: '" + step + "'");
-        }
-
-        return step;
+    public ExtremeAccess(FLYSArtifact artifact, CallContext context) {
+        super(artifact, context);
     }
 
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FlowVelocityAccess.java	Tue Jan 22 09:56:03 2013 +0100
@@ -1,20 +1,20 @@
 package de.intevation.flys.artifacts.access;
 
+import de.intevation.artifacts.CallContext;
+
 import de.intevation.flys.artifacts.FLYSArtifact;
 
 
 /** Access to data that deals with flow velocity stuff. */
-public class FlowVelocityAccess extends RiverAccess {
+public class FlowVelocityAccess
+extends      RangeAccess
+{
 
     private int[] mainChannels;
     private int[] totalChannels;
 
-    private Double lowerKM;
-    private Double upperKM;
-
-
-    public FlowVelocityAccess(FLYSArtifact artifact) {
-        super(artifact);
+    public FlowVelocityAccess(FLYSArtifact artifact, CallContext context) {
+        super(artifact, context);
     }
 
 
@@ -37,20 +37,14 @@
 
 
     public Double getLowerKM() {
-        if (lowerKM == null) {
-            lowerKM = getDouble("ld_from");
-        }
-
-        return lowerKM;
+        // TODO update callers to getFrom
+        return getFrom();
     }
 
 
     public Double getUpperKM() {
-        if (upperKM == null) {
-            upperKM = getDouble("ld_to");
-        }
-
-        return upperKM;
+        // TODO update callers to getTo
+        return getTo();
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RangeAccess.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RangeAccess.java	Tue Jan 22 09:56:03 2013 +0100
@@ -15,6 +15,12 @@
 
     private CallContext context;
 
+    Double from;
+
+    Double to;
+
+    Double step;
+
 
     public RangeAccess(FLYSArtifact artifact, CallContext context) {
         super(artifact);
@@ -22,6 +28,49 @@
     }
 
 
+    /** Return ld_from data (in km). */
+    public double getFrom() {
+        if (from == null) {
+            from = getDouble("ld_from");
+        }
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("from: '" + from + "'");
+        }
+
+        return from.doubleValue();
+    }
+
+
+    /** Return ld_to data (in km). */
+    public double getTo() {
+        if (to == null) {
+            to = getDouble("ld_to");
+        }
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("to: '" + to + "'");
+        }
+
+        return to.doubleValue();
+    }
+
+
+    /** Step width for calculation. */
+    public Double getStep() {
+
+        if (step == null) {
+            step = getDouble("ld_step");
+        }
+
+        if (logger.isDebugEnabled()) {
+            logger.debug("step: '" + step + "'");
+        }
+
+        return step;
+    }
+
+
     /**
      * Get min and max kilometer, independent of parametization
      * (ld_from/to vs ld_locations).
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/SedimentLoadAccess.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/SedimentLoadAccess.java	Tue Jan 22 09:56:03 2013 +0100
@@ -4,41 +4,34 @@
 
 import org.apache.log4j.Logger;
 
+import de.intevation.artifacts.CallContext;
+
 import de.intevation.flys.artifacts.FLYSArtifact;
 
 
 public class SedimentLoadAccess
-extends RiverAccess
+extends      RangeAccess
 {
     private static final Logger logger = Logger.getLogger(BedHeightAccess.class);
 
     private int[] singleIDs;
     private int[] epochIDs;
 
-    private Double lowerKM;
-    private Double upperKM;
-
     private String time;
     private String unit;
 
-    public SedimentLoadAccess(FLYSArtifact artifact) {
-        super(artifact);
+    public SedimentLoadAccess(FLYSArtifact artifact, CallContext context) {
+        super(artifact, context);
     }
 
     public Double getLowerKM() {
-        if (lowerKM == null) {
-            lowerKM = getDouble("ld_from");
-        }
-
-        return lowerKM;
+        // TODO update callers
+        return getFrom();
     }
 
     public Double getUpperKM() {
-        if (upperKM == null) {
-            upperKM = getDouble("ld_to");
-        }
-
-        return upperKM;
+        // TODO update callers
+        return getTo();
     }
 
     public String getYearEpoch() {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCurveFacet.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/extreme/ExtremeCurveFacet.java	Tue Jan 22 09:56:03 2013 +0100
@@ -87,7 +87,7 @@
                 logger.debug("A curve at km = " + currentKm);
                 Curve c = curveEntry.getValue();
                 // Find segment in which the curr. km is located.
-                ExtremeAccess access = new ExtremeAccess(flys);
+                ExtremeAccess access = new ExtremeAccess(flys, context);
 
                 double[] ds = access.getValuesForRange(currentKm);
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFacet.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/BedHeightFacet.java	Tue Jan 22 09:56:03 2013 +0100
@@ -30,7 +30,7 @@
      */
     @Override
     public Object getData(Artifact artifact, CallContext context) {
-        BedHeightAccess access = new BedHeightAccess((FLYSArtifact)artifact);
+        BedHeightAccess access = new BedHeightAccess((FLYSArtifact)artifact, context);
         if (type.equals("singlevalues")) {
             return access.getSingleValues();
         }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/FlowVelocityState.java	Tue Jan 22 09:56:03 2013 +0100
@@ -62,7 +62,7 @@
 
         List<Facet> newFacets = new ArrayList<Facet>();
 
-        FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+        FlowVelocityAccess access = new FlowVelocityAccess(artifact, context);
 
         CalculationResult res = old instanceof CalculationResult
             ? (CalculationResult) old
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MiddleBedHeight.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/MiddleBedHeight.java	Tue Jan 22 09:56:03 2013 +0100
@@ -38,7 +38,7 @@
 
         List<Facet> newFacets = new ArrayList<Facet>();
 
-        BedHeightAccess access = new BedHeightAccess(artifact);
+        BedHeightAccess access = new BedHeightAccess(artifact, context);
 
         CalculationResult res = old instanceof CalculationResult
             ? (CalculationResult) old
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeCompute.java	Tue Jan 22 09:56:03 2013 +0100
@@ -53,7 +53,7 @@
 
         CalculationResult res;
 
-        ExtremeAccess access = new ExtremeAccess(artifact);
+        ExtremeAccess access = new ExtremeAccess(artifact, context);
 
         if (old instanceof CalculationResult) {
             res = (CalculationResult)old;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeQInput.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeQInput.java	Tue Jan 22 09:56:03 2013 +0100
@@ -78,7 +78,7 @@
 
         FLYSArtifact flysArtifact = (FLYSArtifact) artifact;
 
-        ExtremeAccess access = new ExtremeAccess(flysArtifact);
+        ExtremeAccess access = new ExtremeAccess(flysArtifact, context);
         River river = RiverFactory.getRiver(access.getRiver());
         WstValueTable wstValueTable = WstValueTableFactory.getTable(river);
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/BedQualityState.java	Tue Jan 22 09:56:03 2013 +0100
@@ -54,7 +54,7 @@
 
         List<Facet> newFacets = new ArrayList<Facet>();
 
-        BedQualityAccess access = new BedQualityAccess(artifact);
+        BedQualityAccess access = new BedQualityAccess(artifact, context);
 
         CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old
             : new BedQualityCalculation().calculate(access);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferenceSelect.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/DifferenceSelect.java	Tue Jan 22 09:56:03 2013 +0100
@@ -55,7 +55,7 @@
         CallContext             context)
     {
         Element[] elements = new Element[1];
-        BedHeightAccess bha = new BedHeightAccess((FLYSArtifact)artifact);
+        BedHeightAccess bha = new BedHeightAccess((FLYSArtifact)artifact, context);
         String time = bha.getYearEpoch();
         elements[0] = createItem(
             ec,
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadCalculate.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/minfo/SedimentLoadCalculate.java	Tue Jan 22 09:56:03 2013 +0100
@@ -47,7 +47,7 @@
 
         List<Facet> newFacets = new ArrayList<Facet>();
 
-        SedimentLoadAccess access = new SedimentLoadAccess(artifact);
+        SedimentLoadAccess access = new SedimentLoadAccess(artifact, context);
 
         CalculationResult res = old instanceof CalculationResult ? (CalculationResult) old
             : new SedimentLoadCalculation().calculate(access);
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/FlowVelocityGenerator.java	Tue Jan 22 09:56:03 2013 +0100
@@ -219,13 +219,13 @@
         }
         else if (getXBounds(0) == null && getDomainAxisRange() == null) {
             FLYSArtifact artifact = (FLYSArtifact)artifactAndFacet.getArtifact();
-            FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+            FlowVelocityAccess access = new FlowVelocityAccess(artifact, context);
             context.putContextValue("startkm", access.getLowerKM());
             context.putContextValue("endkm", access.getUpperKM());
         }
         else if (getXBounds(0) == null && getDomainAxisRange() != null){
             FLYSArtifact artifact = (FLYSArtifact)artifactAndFacet.getArtifact();
-            FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+            FlowVelocityAccess access = new FlowVelocityAccess(artifact, context);
             Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM());
             Bounds bounds =
                 calculateZoom(b, getDomainAxisRange());
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/BedDifferenceEpochGenerator.java	Tue Jan 22 09:56:03 2013 +0100
@@ -98,13 +98,13 @@
         }
         else if (getXBounds(0) == null && getDomainAxisRange() == null) {
             FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact();
-            FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+            FlowVelocityAccess access = new FlowVelocityAccess(artifact, context);
             context.putContextValue("startkm", access.getLowerKM());
             context.putContextValue("endkm", access.getUpperKM());
         }
         else if (getXBounds(0) == null && getDomainAxisRange() != null){
             FLYSArtifact artifact = (FLYSArtifact)bundle.getArtifact();
-            FlowVelocityAccess access = new FlowVelocityAccess(artifact);
+            FlowVelocityAccess access = new FlowVelocityAccess(artifact, context);
             Bounds b = new DoubleBounds(access.getLowerKM(), access.getUpperKM());
             Bounds bounds =
                 calculateZoom(b, getDomainAxisRange());
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/minfo/SedimentLoadLSGenerator.java	Tue Jan 22 09:56:03 2013 +0100
@@ -166,7 +166,7 @@
     protected String getDefaultYAxisLabel(int pos) {
         String label = "default";
         if (pos == YAXIS.L.idx) {
-            SedimentLoadAccess access = new SedimentLoadAccess(artifact);
+            SedimentLoadAccess access = new SedimentLoadAccess(artifact, context);
             if (access.getUnit().equals("m3_per_a")) {
                 label = msg(I18N_YAXIS_LABEL_2, I18N_YAXIS_LABEL_DEFAULT_2);
             }
--- a/flys-backend/doc/annotation-types.xml	Tue Jan 22 09:55:22 2013 +0100
+++ b/flys-backend/doc/annotation-types.xml	Tue Jan 22 09:56:03 2013 +0100
@@ -39,7 +39,7 @@
         <line pattern="^Brücke[:\s].*$" type="Brücke"/>
         <line pattern="^Bundesland[:\s].*$" type="Bundesland"/>
         <line pattern="^Einmündung[:\s].*$" type="Einmündung"/>
-        <line pattern="^Fähre[:\s].*$" type="Abzweig"/>
+        <line pattern="^Fähre[:\s].*$" type="Abzweigung"/>
         <line pattern="^Gemeinde[:\s].*$" type="Gemeinde"/>
         <line pattern="^Grenze[:\s].*$" type="Grenze"/>
         <line pattern="^Hafen[:\s].*$" type="Hafen"/>

http://dive4elements.wald.intevation.org