diff artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.java @ 9425:3f49835a00c3

Extended CrossSectionFacet so it may fetch different data from within the artifact result. Also allows to have acces to the potentially already computed artifact result via its normal computation cache.
author gernotbelger
date Fri, 17 Aug 2018 15:31:02 +0200
parents 5e38e2924c07
children
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.java	Fri Aug 17 14:29:05 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelState.java	Fri Aug 17 15:31:02 2018 +0200
@@ -51,11 +51,13 @@
 
     /**
      * Compute result or returned object from cache, create facets.
+     * @param feed 
      * @param old Object that was cached.
      */
-    protected Object compute(
+    private Object compute(
         WINFOArtifact winfo,
         CallContext   cc,
+        ComputeType type, 
         String        hash,
         List<Facet>   facets,
         Object        old
@@ -97,7 +99,7 @@
             Facet q = new WaterlevelFacet(
                 i, LONGITUDINAL_Q, nameQ, ComputeType.ADVANCE, id, hash);
 
-            facets.add(new CrossSectionWaterLineFacet(i, nameW));
+            facets.add(new CrossSectionWaterLineFacet(i, nameW, type, hash, getID(), Integer.valueOf(i)));
 
             facets.add(w);
             facets.add(q);
@@ -163,7 +165,7 @@
             facets.add(new EmptyFacet());
             return null;
         }
-        return compute((WINFOArtifact) artifact, context, hash, facets, old);
+        return compute((WINFOArtifact) artifact, context, ComputeType.FEED,  hash, facets, old);
     }
 
 
@@ -182,7 +184,7 @@
             facets.add(new EmptyFacet());
             return null;
         }
-        return compute((WINFOArtifact) artifact, context, hash, facets, old);
+        return compute((WINFOArtifact) artifact, context, ComputeType.ADVANCE, hash, facets, old);
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org