felix@1643: package de.intevation.flys.artifacts.model;
felix@1643: 
felix@1643: import org.apache.log4j.Logger;
felix@1643: 
felix@1643: import de.intevation.artifacts.Artifact;
felix@1643: import de.intevation.artifacts.CallContext;
felix@1643: 
felix@1643: import de.intevation.artifactdatabase.state.Facet;
felix@1643: 
felix@1643: import de.intevation.flys.artifacts.WINFOArtifact;
felix@1643: 
felix@1643: import de.intevation.flys.artifacts.states.DefaultState.ComputeType;
felix@1643: 
felix@1643: 
felix@1643: /**
felix@1643:  * Facet with the curve of a subtraction of two waterlevel-lines.
felix@2122:  * TODO inherit directly from DataFacet? Check whether this Facet is obsolete.
felix@1643:  */
felix@1643: public class DifferenceCurveFacet extends WaterlevelFacet {
felix@1643: 
felix@1643:     private static Logger logger = Logger.getLogger(DifferenceCurveFacet.class);
felix@1643: 
felix@1643: 
sascha@1886:     public DifferenceCurveFacet() {
sascha@1886:     }
felix@1643: 
felix@1643:     public DifferenceCurveFacet(
felix@1643:         int         index,
felix@1643:         String      name,
felix@1643:         String      description,
felix@1643:         ComputeType type,
felix@1643:         String      stateID,
felix@1643:         String      hash
felix@1643: 
felix@1643:     ) {
felix@1643:         super(index, name, description, type, stateID, hash);
felix@1643:     }
felix@1643: 
felix@1643:     /**
felix@1643:      * Get difference curve data.
felix@1643:      * @return a WKms at given index.
felix@1643:      */
felix@1691:     @Override
felix@1643:     public Object getData(Artifact artifact, CallContext context) {
felix@1643:         WINFOArtifact winfo = (WINFOArtifact)artifact;
felix@1643: 
felix@1643:         CalculationResult res = (CalculationResult)
felix@2122:             winfo.compute(context, hash, stateId, type, false);
felix@1643: 
felix@1643:         WKms [] wkms = (WKms [])res.getData();
felix@1643: 
felix@1643:         WKms result = wkms[index];
felix@1643:         logger.debug("Got difference curve data (" + result.getName() 
felix@1643:             + ") at index: " + index);
felix@1643: 
felix@1643:         return result;
felix@1643:     }
felix@1643: 
felix@1643: 
felix@1643:     /** Copy deeply. */
felix@1643:     @Override
felix@1643:     public Facet deepCopy() {
felix@1643:         WaterlevelFacet copy = new DifferenceCurveFacet();
felix@1643:         copy.set(this);
felix@1643:         copy.type    = type;
felix@2122:         copy.stateId = stateId;
felix@1643:         copy.hash    = hash;
felix@1643:         return copy;
felix@1643:     }
felix@1643: }
felix@1643: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :