view artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java @ 7107:564033adf9c6 generator-refactoring

Handle axis include zero setting for the new processing architecture
author Andre Heinecke <aheinecke@intevation.de>
date Tue, 24 Sep 2013 11:27:28 +0200
parents ab57b6eee71c
children 4605d6ca4ee9
line wrap: on
line source
/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
 * Software engineering by Intevation GmbH
 *
 * 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.exports;

import org.apache.log4j.Logger;
import org.jfree.chart.axis.NumberAxis;


public class LongitudinalSectionGenerator2 extends DiagramGenerator
{
    public static final String I18N_CHART_SHORT_SUBTITLE =
        "chart.longitudinal.section.shortsubtitle";

    public static final String I18N_CHART_LOCATION_SUBTITLE =
        "chart.longitudinal.section.locsubtitle";

    private static Logger logger =
        Logger.getLogger(LongitudinalSectionGenerator.class);

    @Override
    public String getDefaultChartSubtitle() {
        double[] dist = getRange();

        Object[] args = null;
        if (dist == null || dist.length != 2 ||
                Double.isNaN(dist[0]) || Double.isNaN(dist[1])) {
            args = new Object[] {getRiverName()};
            return msg(I18N_CHART_SHORT_SUBTITLE, "", args);
        } else if (Math.abs(dist[0] - dist[1]) < 1E-5) {
            args = new Object[] {getRiverName(), dist[1]};
            return msg(I18N_CHART_LOCATION_SUBTITLE, "", args);
        }
        return super.getDefaultChartSubtitle();
    }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org