teichmann@5863: /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde teichmann@5863: * Software engineering by Intevation GmbH teichmann@5863: * teichmann@5994: * This file is Free Software under the GNU AGPL (>=v3) teichmann@5863: * and comes with ABSOLUTELY NO WARRANTY! Check out the teichmann@5994: * documentation coming with Dive4Elements River for details. teichmann@5863: */ teichmann@5863: teichmann@5831: package org.dive4elements.river.artifacts.model.minfo; raimund@3614: teichmann@5831: import org.dive4elements.artifacts.Artifact; teichmann@5831: import org.dive4elements.artifacts.CallContext; teichmann@5867: import org.dive4elements.river.artifacts.D4EArtifact; teichmann@5831: import org.dive4elements.river.artifacts.access.BedHeightAccess; teichmann@5831: import org.dive4elements.river.artifacts.model.BlackboardDataFacet; teichmann@5831: import org.dive4elements.river.artifacts.model.FacetTypes; felix@7357: import org.dive4elements.river.model.BedHeightSingle; felix@7357: import org.dive4elements.river.model.BedHeightSingleValue; raimund@3614: raimund@3614: public class BedHeightFacet raimund@3614: extends BlackboardDataFacet raimund@3614: implements FacetTypes { raimund@3614: bjoern@4534: private String type; sascha@3633: bjoern@4534: public BedHeightFacet(String name, String description, String type) { raimund@3614: this.name = name; raimund@3614: this.description = description; bjoern@4534: this.type = type; raimund@3614: this.index = 0; raimund@3614: } raimund@3614: raimund@3614: /** raimund@3614: * Returns the data this facet requires. raimund@3614: * raimund@3614: * @param artifact the owner artifact. raimund@3614: * @param context the CallContext (ignored). raimund@3614: * raimund@3614: * @return the data. raimund@3614: */ raimund@3614: @Override raimund@3614: public Object getData(Artifact artifact, CallContext context) { teichmann@6101: BedHeightAccess access = new BedHeightAccess((D4EArtifact)artifact); bjoern@4534: if (type.equals("singlevalues")) { felix@7357: /* Former doc (from BedHeightAccess): felix@7357: * Return a {@link List} of {@link BedHeightSingleValue}s felix@7357: * at the range of the artifact felix@7357: * @return List of {@link BedHeightSingleValue}s felix@7357: */ felix@7357: BedHeightSingle single = BedHeightSingle.getBedHeightSingleById( felix@7357: access.getHeightId()); felix@7357: return BedHeightSingleValue.getBedHeightSingleValues(single, felix@7357: access.getFrom(), felix@7357: access.getTo()); bjoern@4534: } felix@7357: else { felix@7357: /* Former doc (from BedHeightAccess): felix@7357: * Return the {@link BedHeight} at the height_id and time of the artifact felix@7357: * @return {@link BedHeight} felix@7357: */ felix@7357: return BedHeightFactory.getHeight( felix@7357: access.getType(), felix@7357: access.getHeightId(), felix@7357: access.getTime()); felix@7357: } raimund@3614: } felix@7357: raimund@3614: /** raimund@3614: * Create a deep copy of this Facet. raimund@3614: * @return a deep copy. raimund@3614: */ raimund@3614: @Override raimund@3614: public BedHeightFacet deepCopy() { bjoern@4534: BedHeightFacet copy = new BedHeightFacet(name, description, type); raimund@3614: copy.set(this); raimund@3614: return copy; raimund@3614: } raimund@3614: } raimund@3614: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :