felix@1896: package de.intevation.flys.artifacts.model;
felix@1896: 
felix@1896: import de.intevation.artifacts.Artifact;
felix@1896: import de.intevation.artifacts.CallContext;
felix@1896: 
felix@1896: import de.intevation.artifactdatabase.state.DefaultFacet;
felix@1896: 
felix@1896: import de.intevation.flys.artifacts.WQKmsInterpolArtifact;
felix@1896: 
felix@1896: /**
felix@1896:  * Facet to show W|Q Values.
felix@1896:  */
felix@1896: public class WQFacet
felix@1896: extends      DefaultFacet
felix@1896: implements   FacetTypes {
felix@1896: 
felix@1896:     /** Trivial Constructor. */
felix@1896:     public WQFacet(String description) {
felix@1896:         this(STATIC_WQ, description);
felix@1896:     }
felix@1896: 
felix@1896: 
felix@1896:     /**
felix@1896:      * A Facet with WQ data.
felix@1896:      */
felix@1896:     public WQFacet(String name, String description) {
felix@1896:         this.name        = name;
felix@1896:         this.description = description;
felix@1896:         this.index       = 0;
felix@1896:     }
felix@1896: 
felix@1896: 
felix@1896:     /**
felix@4311:      * Returns the data this facet provides at km given in context.
felix@1896:      *
felix@1896:      * @param artifact the owner artifact.
felix@4311:      * @param context  the CallContext.
felix@1896:      *
felix@1896:      * @return the data.
felix@1896:      */
felix@1896:     @Override
felix@1896:     public Object getData(Artifact artifact, CallContext context) {
felix@1896:         WQKmsInterpolArtifact interpolData =
felix@1896:             (WQKmsInterpolArtifact) artifact;
felix@3585:         Double currentKm = (Double)context.getContextValue("currentKm");
felix@3585:         return interpolData.getWQAtKm(currentKm);
felix@1896:     }
felix@1896: 
felix@1896: 
felix@1896:     /**
felix@1896:      * Create a deep copy of this Facet.
felix@1896:      * @return a deep copy.
felix@1896:      */
felix@1896:     @Override
felix@1896:     public WQKmsFacet deepCopy() {
felix@1896:         WQKmsFacet copy = new WQKmsFacet(description);
felix@1896:         copy.set(this);
felix@1896:         return copy;
felix@1896:     }
felix@1896: }
felix@1896: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :