view artifacts/src/main/java/org/dive4elements/river/artifacts/model/CrossSectionFacetUtils.java @ 9499:853f2dafc16e

VegetationZones in CrossSectionsDiagram
author gernotbelger
date Thu, 27 Sep 2018 18:06:26 +0200
parents
children
line wrap: on
line source
/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
 * Software engineering by
 *  Björnsen Beratende Ingenieure GmbH
 *  Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
 *
 * This file is Free Software under the GNU AGPL (>=v3)
 * and comes with ABSOLUTELY NO WARRANTY! Check out the
 * documentation coming with Dive4Elements River for details.
 */
package org.dive4elements.river.artifacts.model;

import java.util.List;

import org.apache.log4j.Logger;
import org.dive4elements.artifacts.CallContext;
import org.dive4elements.artifacts.DataProvider;
import org.dive4elements.river.model.FastCrossSectionLine;

/**
 * @author Domenico Nardi Tironi
 */
public final class CrossSectionFacetUtils {

    private static Logger log = Logger.getLogger(CrossSectionFacetUtils.class);

    private CrossSectionFacetUtils() {
        throw new UnsupportedOperationException();
    }

    public static DataProvider getDataProvider(final CallContext context) {

        final List<DataProvider> providers = context.getDataProvider(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA);
        if (providers.size() < 1) {
            log.warn("Could not find Cross-Section data provider.");
            return null;
        }

        return providers.get(0);
    }

    public static FastCrossSectionLine getCrossSection(final DataProvider provider, final CallContext context) {

        if (provider == null)
            return null;

        return (FastCrossSectionLine) provider.provideData(CrossSectionFacet.BLACKBOARD_CS_MASTER_DATA, null, context);
    }
}

http://dive4elements.wald.intevation.org