diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java @ 3272:31168ac9c7e7

Partial fix for issue694 (heightmarks snap to nearest cross section). flys-artifacts/trunk@4916 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 10 Jul 2012 15:31:56 +0000
parents ed07dd55f487
children 6153c50f78cf
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java	Tue Jul 10 13:26:13 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java	Tue Jul 10 15:31:56 2012 +0000
@@ -24,7 +24,9 @@
 extends      BlackboardDataFacet
 implements   FacetTypes {
 
-    private static Logger logger = Logger.getLogger(CrossSectionWaterLineFacet.class);
+    /** Private logger to use. */
+    private static Logger logger =
+        Logger.getLogger(CrossSectionWaterLineFacet.class);
 
 
     /** Trivial constructor, set (maybe localized) description. */
@@ -33,13 +35,17 @@
     }
 
 
-    /** Trivial constructor, set (maybe localized) description. */
+    /**
+     * Trivial constructor, set (maybe localized) description.
+     * @param idx Index of this facet.
+     * @param name 'type' of this facet.
+     * @param description (maybe) localized user-visible description.
+     */
     public CrossSectionWaterLineFacet(int idx, String name, String description) {
         super(idx, name, description);
     }
 
 
-
     /**
      * Gets waterline (crossed with cross section) of waterlevel.
      */
@@ -54,13 +60,22 @@
         }
 
         Object crossSection = providers.get(0)
-            .provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA, null, context);
+            .provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA,
+                null, context);
+        Object nextKm = providers.get(0).
+            provideData(CrossSectionFacet.BLACKBOARD_CS_NEXT_KM, null, context);
+        Object prevKm = providers.get(0).
+            provideData(CrossSectionFacet.BLACKBOARD_CS_PREV_KM, null, context);
+        if (prevKm == null)
+            prevKm = new Double(-1d);
+        if (nextKm == null)
+            nextKm = new Double(-1d);
 
-        WaterLineArtifact winfo = (WaterLineArtifact)artifact;
+        WaterLineArtifact lineArtifact = (WaterLineArtifact) artifact;
 
         if (crossSection != null) {
-            return winfo.getWaterLines(this.getIndex(),
-                (FastCrossSectionLine) crossSection);
+            return lineArtifact.getWaterLines(this.getIndex(),
+                (FastCrossSectionLine) crossSection, (Double) nextKm, (Double) prevKm);
         }
         else {
             return new Lines.LineData(new double[][] {}, 0d,0d);

http://dive4elements.wald.intevation.org