felix@1122: package de.intevation.flys.artifacts.model; felix@1122: felix@1122: import org.apache.log4j.Logger; felix@1122: felix@1975: import java.util.List; felix@1975: felix@1122: import de.intevation.artifacts.Artifact; felix@1122: import de.intevation.artifacts.CallContext; felix@2141: import de.intevation.artifacts.DataProvider; felix@1122: felix@1122: import de.intevation.artifactdatabase.state.Facet; felix@1122: felix@1981: import de.intevation.flys.artifacts.WaterLineArtifact; felix@1122: sascha@2126: import de.intevation.flys.model.FastCrossSectionLine; felix@1122: felix@2652: import de.intevation.flys.geom.Lines; felix@2652: felix@1122: /** felix@1122: * Facet for Waterlines in Cross Sections. felix@1122: */ felix@1122: public class CrossSectionWaterLineFacet felix@2028: extends BlackboardDataFacet felix@1122: implements FacetTypes { felix@1122: felix@1122: private static Logger logger = Logger.getLogger(CrossSectionWaterLineFacet.class); felix@1122: felix@1122: felix@1122: /** Trivial constructor, set (maybe localized) description. */ felix@1802: public CrossSectionWaterLineFacet(int idx, String description) { felix@1802: super(idx, CROSS_SECTION_WATER_LINE, description); felix@1122: } felix@1122: felix@1122: felix@1122: /** felix@1975: * Gets waterline (crossed with cross section) of waterlevel. felix@1122: */ felix@1122: public Object getData(Artifact artifact, CallContext context) { felix@1122: logger.debug("Get data for cross section water line"); felix@1122: felix@1975: List providers = context. felix@1975: getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA); felix@1975: if (providers.size() < 1) { felix@1975: logger.warn("Could not find Cross-Section data provider."); felix@2673: return new Lines.LineData(new double[][] {}, 0d, 0d); felix@1975: } felix@1975: felix@1975: Object crossSection = providers.get(0) felix@1975: .provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA, null, context); felix@1975: felix@1981: WaterLineArtifact winfo = (WaterLineArtifact)artifact; felix@1122: sascha@2120: return winfo.getWaterLines(this.getIndex(), (FastCrossSectionLine) crossSection); felix@1122: } felix@1122: felix@1136: felix@1136: /** Do a deep copy. */ felix@1122: @Override felix@1122: public Facet deepCopy() { felix@1975: CrossSectionWaterLineFacet copy = new CrossSectionWaterLineFacet( felix@1975: this.getIndex(), felix@1975: this.description); felix@1122: copy.set(this); felix@1122: return copy; felix@1122: } felix@1122: } felix@1122: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :