rrenkert@7995: package org.dive4elements.river.artifacts.model.minfo; rrenkert@7995: rrenkert@7995: import java.util.List; rrenkert@7995: rrenkert@7995: import org.dive4elements.artifacts.Artifact; rrenkert@7995: import org.dive4elements.artifacts.CallContext; rrenkert@7995: import org.dive4elements.river.artifacts.D4EArtifact; rrenkert@7995: import org.dive4elements.river.artifacts.access.BedHeightAccess; rrenkert@7995: import org.dive4elements.river.artifacts.model.BlackboardDataFacet; rrenkert@7995: import org.dive4elements.river.artifacts.model.FacetTypes; tom@8559: import org.dive4elements.river.model.BedHeight; tom@8559: import org.dive4elements.river.model.BedHeightValue; rrenkert@7995: rrenkert@7995: rrenkert@7995: public class BedHeightSoundingWidthFacet rrenkert@7995: extends BlackboardDataFacet rrenkert@7995: implements FacetTypes rrenkert@7995: { rrenkert@7995: public BedHeightSoundingWidthFacet(String name, String description) { rrenkert@7995: this.name = name; rrenkert@7995: this.description = description; rrenkert@7995: this.index = 0; rrenkert@7995: this.metaData.put("X", "chart.longitudinal.section.xaxis.label"); tom@8267: this.metaData.put("Y", "chart.bedheight_middle.section.yaxis.label"); rrenkert@7995: } rrenkert@7995: rrenkert@7995: /** rrenkert@7995: * Returns the data this facet requires. rrenkert@7995: * rrenkert@7995: * @param artifact the owner artifact. rrenkert@7995: * @param context the CallContext (ignored). rrenkert@7995: * rrenkert@7995: * @return the data. rrenkert@7995: */ rrenkert@7995: @Override rrenkert@7995: public Object getData(Artifact artifact, CallContext context) { rrenkert@7995: BedHeightAccess access = new BedHeightAccess((D4EArtifact)artifact); rrenkert@7995: /* Former doc (from BedHeightAccess): tom@8559: * Return a {@link List} of {@link BedHeightValue}s rrenkert@7995: * at the range of the artifact tom@8559: * @return List of {@link BedHeightValue}s */ tom@8559: BedHeight single = BedHeight.getBedHeightById( rrenkert@7995: access.getHeightId()); tom@8559: List bedheightValues = tom@8559: BedHeightValue.getBedHeightValues( rrenkert@7995: single, andre@8648: access.getFrom(true), andre@8648: access.getTo(true)); rrenkert@7995: double[][] values = new double[2][bedheightValues.size()]; rrenkert@7995: int i = 0; tom@8559: for (BedHeightValue bedheightValue : bedheightValues) { rrenkert@7995: values[0][i] = bedheightValue.getStation(); tom@8427: values[1][i] = bedheightValue.getSoundingWidth() != null tom@8427: ? bedheightValue.getSoundingWidth() : Double.NaN; rrenkert@7995: i++; rrenkert@7995: } rrenkert@7995: return values; rrenkert@7995: } rrenkert@7995: rrenkert@7995: /** rrenkert@7995: * Create a deep copy of this Facet. rrenkert@7995: * @return a deep copy. rrenkert@7995: */ rrenkert@7995: @Override rrenkert@7995: public BedHeightSoundingWidthFacet deepCopy() { rrenkert@7995: BedHeightSoundingWidthFacet copy = rrenkert@7995: new BedHeightSoundingWidthFacet(name, description); rrenkert@7995: copy.set(this); rrenkert@7995: return copy; rrenkert@7995: } rrenkert@7995: }