christian@3242: package de.intevation.flys.exports; christian@3242: christian@3242: import org.jfree.chart.axis.ValueAxis; christian@3242: sascha@3257: import org.jfree.data.Range; christian@3242: sascha@3257: /** Two Ranges that span a rectangular area. */ sascha@3257: public class ChartArea { sascha@3257: protected Range xRange; sascha@3257: protected Range yRange; christian@3242: sascha@3257: public ChartArea(Range rangeX, Range rangeY) { sascha@3257: this.xRange = rangeX; sascha@3257: this.yRange = rangeY; sascha@3257: } christian@3242: sascha@3257: public ChartArea(ValueAxis axisX, ValueAxis axisY) { sascha@3257: this.xRange = axisX.getRange(); sascha@3257: this.yRange = axisY.getRange(); sascha@3257: } christian@3242: sascha@3257: public double ofLeft(double percent) { sascha@3257: return xRange.getLowerBound() sascha@3257: + xRange.getLength() * percent; christian@3242: } sascha@3257: sascha@3257: public double ofRight(double percent) { sascha@3257: return xRange.getUpperBound() sascha@3257: - xRange.getLength() * percent; sascha@3257: } sascha@3257: sascha@3257: public double ofGround(double percent) { sascha@3257: return yRange.getLowerBound() sascha@3257: + yRange.getLength() * percent; sascha@3257: } sascha@3257: sascha@3257: public double atTop() { sascha@3257: return yRange.getUpperBound(); sascha@3257: } sascha@3257: sascha@3257: public double atGround() { sascha@3257: return yRange.getLowerBound(); sascha@3257: } sascha@3257: sascha@3257: public double atRight() { sascha@3257: return xRange.getUpperBound(); sascha@3257: } sascha@3257: sascha@3257: public double atLeft() { sascha@3257: return xRange.getLowerBound(); sascha@3257: } sascha@3257: sascha@3257: public double above(double percent, double base) { sascha@3257: return base + yRange.getLength() * percent; sascha@3257: } sascha@3257: } sascha@3259: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :