view flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/BedDifferencesAccess.java @ 5645:696d710470f5

flys/issue1077: Show loads as step line, therefore transform data in SedimentLoadFacet to stretch as in the measurement stations bounds. Deal with this new kind of data in the Generator.
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 10 Apr 2013 09:35:07 +0200
parents cbd0fafcb26b
children
line wrap: on
line source
package de.intevation.flys.artifacts.access;

import java.util.Arrays;

import org.apache.log4j.Logger;

import de.intevation.artifacts.CallContext;
import de.intevation.flys.artifacts.FLYSArtifact;
import de.intevation.flys.utils.FLYSUtils;
import de.intevation.flys.utils.StringUtil;


public class BedDifferencesAccess
extends RiverAccess
{
    private static Logger logger = Logger.getLogger(BedDifferencesAccess.class);
    private String yearEpoch;
    private String[] diffs;

    private CallContext context;

    public BedDifferencesAccess(FLYSArtifact artifact, CallContext context) {
        super(artifact);
        this.context = context;
    }

    public String getYearEpoch() {
        yearEpoch = getString("ye_select");
        return yearEpoch;
    }

    public FLYSArtifact[][] getDifferenceArtifacts() {
        diffs = getString("diffids").split("#");
        logger.debug("diffs: " + Arrays.toString(diffs));
        FLYSArtifact[][] artifacts = new FLYSArtifact[diffs.length/2][2];
        for (int i = 0; i < diffs.length; i += 2) {
            String diff1 = StringUtil.unbracket(diffs[0 + 2*i]);
            String diff2 = StringUtil.unbracket(diffs[1 + 2*i]);
            String[] diff1parts = diff1.split(";");
            String[] diff2parts = diff2.split(";");
            logger.debug("creating 2 artifacts." + diff1parts[0] + "; " + diff2parts[0]);
            artifacts[i][0] = FLYSUtils.getArtifact(diff1parts[0], context);
            artifacts[i][1] = FLYSUtils.getArtifact(diff2parts[0], context);
        }
        return artifacts;
    }

    public static int getHeightId(FLYSArtifact artifact) {
        Access a = new Access(artifact);
        return a.getInteger("height_id");
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org