changeset 6537:f2722602936c

issue1157: Store parents initial km at CrossSectionArtifact.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 04 Jul 2013 11:48:33 +0200
parents c155f8f57b7e
children de62db0f2035
files artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java	Wed Jul 03 16:09:51 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/CrossSectionArtifact.java	Thu Jul 04 11:48:33 2013 +0200
@@ -53,6 +53,9 @@
     /** Name of data item keeping the position. */
     public static final String DATA_KM = "cross_section.km";
 
+    /** Name of data item keeping the 'parents' km. */
+    public static final String PARENT_KM = "cross_section.parent.km";
+
     /** Name of data item keeping the database id of this c.s.. */
     public static final String DATA_DBID = "cross_section.dbid";
 
@@ -242,6 +245,20 @@
 
 
     /**
+     * Return position (km) from parent (initial km), 0 if not found.
+     */
+    private double getParentKm() {
+        String val = getDataAsString(PARENT_KM);
+        try {
+            return Double.valueOf(val);
+        }
+        catch (NumberFormatException e) {
+            logger.warn("Could not get data " + PARENT_KM + " as double", e);
+            return 0;
+        }
+    }
+
+    /**
      * Return position (km) from data, 0 if not found.
      */
     protected double getKm() {

http://dive4elements.wald.intevation.org