Mercurial > dive4elements > river
view flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReferenceCurveFacet.java @ 2310:ecb76933362f
Added PDF export to reference curve calculation.
flys-artifacts/trunk@3988 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 09 Feb 2012 10:21:16 +0000 |
parents | d4330439be3a |
children | c5e4a2d67631 |
line wrap: on
line source
package de.intevation.flys.artifacts.model; import java.util.List; import java.util.Arrays; import de.intevation.artifactdatabase.state.Facet; import de.intevation.artifacts.Artifact; import de.intevation.artifacts.CallContext; import de.intevation.flys.artifacts.FLYSArtifact; import de.intevation.flys.artifacts.states.DefaultState.ComputeType; import org.apache.log4j.Logger; /** Facet for W-over-Ws. */ public class ReferenceCurveFacet extends DataFacet { public static final String BLACK_BOARD_KEY = "reference.curve.axis.scale"; public static final List BLACK_BOARD_KEY_LIST = Arrays.asList(new String [] { BLACK_BOARD_KEY }); private static Logger log = Logger.getLogger(ReferenceCurveFacet.class); public ReferenceCurveFacet() { } public ReferenceCurveFacet(int index, String name, String description) { super(index, name, description, ComputeType.ADVANCE, null, null); } public ReferenceCurveFacet( int index, String name, String description, ComputeType type, String stateID, String hash ) { super(index, name, description, type, hash, stateID); } public Object getData(Artifact artifact, CallContext context) { if (log.isDebugEnabled()) { log.debug("Get data for reference curve at index: " + index + " /stateId: " + stateId); } return getWWQQ(artifact, context); } protected WWQQ getWWQQ(Artifact artifact, CallContext context) { FLYSArtifact winfo = (FLYSArtifact)artifact; CalculationResult res = (CalculationResult) winfo.compute(context, hash, stateId, type, false); return ((WWQQ [])res.getData())[index]; } @Override public void set(Facet other) { super.set(other); ReferenceCurveFacet o= (ReferenceCurveFacet)other; type = o.type; hash = o.hash; stateId = o.stateId; } /** Copy deeply. */ @Override public Facet deepCopy() { ReferenceCurveFacet copy = new ReferenceCurveFacet(); copy.set(this); return copy; } @Override public List getDataProviderKeys(Artifact art) { return BLACK_BOARD_KEY_LIST; } @Override public Object provideBlackboardData( Artifact artifact, Object key, Object param, CallContext context ) { if (!key.equals(BLACK_BOARD_KEY)) { return null; } Object obj = context.getContextValue("reference.curve.axis.scale"); if (!(obj instanceof WWAxisTypes)) { obj = new WWAxisTypes(getWWQQ(artifact, context)); } else { ((WWAxisTypes)obj).classify(getWWQQ(artifact, context)); } return obj; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :