Mercurial > dive4elements > river
view artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java @ 7105:ab57b6eee71c generator-refactoring
Add refactored LongitudinalSectionGenerator2 that inherits DiagramGenerator
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 23 Sep 2013 16:41:12 +0200 |
parents | |
children | 564033adf9c6 |
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(); } /** * Create Axis for given index. * @return axis with according internationalized label. */ @Override protected NumberAxis createYAxis(int index) { // TODO decide what to do with this. return super.createYAxis(index); /* NumberAxis axis = super.createYAxis(index); // "Q" Axis shall include 0. if (index == YAXIS.Q.idx) { axis.setAutoRangeIncludesZero(true); } else { axis.setAutoRangeIncludesZero(false); } return axis;*/ } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :