view artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesCrossSectionFacet.java @ 9506:8b7bf26b8782

Predefined artifact for standard vegetation zones. Some minor adaptions.
author gernotbelger
date Fri, 28 Sep 2018 13:44:12 +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.uinfo.vegetationzones;

import org.dive4elements.artifacts.Artifact;
import org.dive4elements.artifacts.CallContext;
import org.dive4elements.river.artifacts.D4EArtifact;
import org.dive4elements.river.artifacts.model.BlackboardDataFacet;
import org.dive4elements.river.artifacts.model.FacetTypes;
import org.dive4elements.river.exports.CrossSectionGenerator;

/**
 * @author Gernot Belger
 *
 */
public final class VegetationZonesCrossSectionFacet extends BlackboardDataFacet implements FacetTypes {

    private static final long serialVersionUID = 1L;

    public VegetationZonesCrossSectionFacet(final String name, final String description) {
        super(0, name, description);

        this.metaData.put("X", CrossSectionGenerator.I18N_XAXIS_LABEL);
        this.metaData.put("Y", CrossSectionGenerator.I18N_YAXIS_LABEL);
    }

    /**
     * Returns the data this facet requires.
     *
     * @param artifact
     *            the owner artifact.
     * @param context
     *            the CallContext (ignored).
     *
     * @return
     *         the data as PredefinedChannelQueryCalculationResult
     */
    @Override
    public Object getData(final Artifact artifact, final CallContext context) {

        final VegetationzonesAccess vAccess = new VegetationzonesAccess((D4EArtifact) artifact);
        return VegetationZoneServerClientXChange.parse(vAccess.getVegZones());
    }

    /**
     * Create a deep copy of this Facet.
     *
     * @return a deep copy.
     */
    @Override
    public VegetationZonesCrossSectionFacet deepCopy() {
        final VegetationZonesCrossSectionFacet copy = new VegetationZonesCrossSectionFacet(this.name, this.description);
        copy.set(this);
        return copy;
    }
}

http://dive4elements.wald.intevation.org