view flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/HistoricalDischargeAccess.java @ 4232:b3aa91e45010

Implemented the Q evaluation mode for historical discharge calculations. Added the calculation itself, created new facets, added themes and improved the chart generator to support the new facets.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 24 Oct 2012 07:25:35 +0200
parents 5ff3b2f5fb1c
children d952372e7083
line wrap: on
line source
package de.intevation.flys.artifacts.access;

import java.util.Date;

import de.intevation.flys.artifacts.FLYSArtifact;
import de.intevation.flys.artifacts.model.Timerange;


public class HistoricalDischargeAccess extends RiverAccess {

    public static enum EvaluationMode {
        W, Q
    }

    public static final String DATA_EVALUATION_TIME = "year_range";

    private Timerange evaluationTimerange;
    private EvaluationMode evaluationMode;

    public HistoricalDischargeAccess(FLYSArtifact artifact) {
        super(artifact);
    }

    public EvaluationMode getEvaluationMode() {
        if (evaluationMode == null) {
            int mode = getInteger("historical_mode");
            evaluationMode = mode == 0 ? EvaluationMode.W : EvaluationMode.Q;
        }

        return evaluationMode;
    }

    public Timerange getEvaluationTimerange() {
        if (evaluationTimerange == null) {
            long[] startend = getLongArray(DATA_EVALUATION_TIME);

            if (startend != null && startend.length > 1) {
                Date start = new Date(startend[0]);
                Date end = new Date(startend[1]);

                evaluationTimerange = new Timerange(start, end);
            }
        }

        return evaluationTimerange;
    }
}

http://dive4elements.wald.intevation.org