Mercurial > dive4elements > river
changeset 2756:ba15eb120a02
Expose reference curve parameters via blackboard.
flys-artifacts/trunk@4491 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 24 May 2012 04:36:53 +0000 |
parents | d972c4cf5898 |
children | 6e89147f5ca3 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReferenceCurveFacet.java |
diffstat | 2 files changed, 61 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Thu May 24 04:33:52 2012 +0000 +++ b/flys-artifacts/ChangeLog Thu May 24 04:36:53 2012 +0000 @@ -1,4 +1,9 @@ -2012-05-23 Felix Wolfsteller <felix.wolfsteller@intevation.de> +2012-05-24 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/model/ReferenceCurveFacet.java: + Expose data via blackboard. + +2012-05-24 Felix Wolfsteller <felix.wolfsteller@intevation.de> * doc/conf/meta-data.xml: Serve fixations with relative points for reference curves.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReferenceCurveFacet.java Thu May 24 04:33:52 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReferenceCurveFacet.java Thu May 24 04:36:53 2012 +0000 @@ -1,5 +1,6 @@ package de.intevation.flys.artifacts.model; +import java.util.ArrayList; import java.util.List; import java.util.Collections; @@ -9,11 +10,13 @@ import de.intevation.artifacts.CallContext; import de.intevation.flys.artifacts.FLYSArtifact; +import de.intevation.flys.artifacts.WINFOArtifact; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; import org.apache.log4j.Logger; + /** Facet for W-over-Ws. */ public class ReferenceCurveFacet extends DataFacet @@ -22,13 +25,24 @@ public static final String CONTEXT_KEY = "reference.curve.axis.scale"; + /** Blackboard data provider key for reference curves start km. */ + public static final String BB_REFERENCECURVE_STARTKM = + "reference_curve.startkm"; + + /** Blackboard data provider key for reference curves end kms. */ + public static final String BB_REFERENCECURVE_ENDKMS = + "reference_curve.endkms"; + + public ReferenceCurveFacet() { } + public ReferenceCurveFacet(int index, String name, String description) { super(index, name, description, ComputeType.ADVANCE, null, null); } + public ReferenceCurveFacet( int index, String name, @@ -40,6 +54,7 @@ super(index, name, description, type, hash, stateID); } + public Object getData(Artifact artifact, CallContext context) { if (log.isDebugEnabled()) { @@ -50,6 +65,33 @@ return getWWQQ(artifact, context); } + + /** + * Can provide parameters of reference curve + * @param key will respond on BB_REFERENCECURVE START/ENDKMS + * @param param ignored + * @param context ignored + * @return whatever parameters for reference curve + */ + @Override + public Object provideBlackboardData(Artifact artifact, + Object key, + Object param, + CallContext context + ) { + WINFOArtifact winfo = (WINFOArtifact) artifact; + if (key.equals(BB_REFERENCECURVE_STARTKM)) { + return winfo.getReferenceStartKm(); + } + else if (key.equals(BB_REFERENCECURVE_ENDKMS)) { + return winfo.getReferenceEndKms(); + } + else { + return null; + } + } + + protected WWQQ getWWQQ(Artifact artifact, CallContext context) { FLYSArtifact winfo = (FLYSArtifact)artifact; @@ -59,6 +101,7 @@ return ((WWQQ [])res.getData())[index]; } + @Override public void set(Facet other) { super.set(other); @@ -68,6 +111,7 @@ stateId = o.stateId; } + /** Copy deeply. */ @Override public Facet deepCopy() { @@ -76,6 +120,16 @@ return copy; } + + @Override + public List getStaticDataProviderKeys(Artifact art) { + List list = new ArrayList(); + list.add(BB_REFERENCECURVE_STARTKM); + list.add(BB_REFERENCECURVE_ENDKMS); + return list; + } + + @Override public List getDataProviderKeys(Artifact art, CallContext context) { @@ -90,7 +144,7 @@ ((WWAxisTypes)obj).classify(getWWQQ(art, context)); } - return Collections.emptyList(); + return getStaticDataProviderKeys(art);//Collections.emptyList(); } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :