annotate flys-artifacts/src/main/java/de/intevation/flys/exports/ChartArea.java @ 5713:f5d966428703

Fix class cast error in flow velocity importer (might by S. Teichmann)
author Tom Gottfried <tom.gottfried@intevation.de>
date Mon, 15 Apr 2013 18:27:14 +0200
parents 9422b559b2d5
children
rev   line source
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.exports;
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
2
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
3 import org.jfree.chart.axis.ValueAxis;
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
4
3257
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
5 import org.jfree.data.Range;
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
6
3257
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
7 /** Two Ranges that span a rectangular area. */
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
8 public class ChartArea {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
9 protected Range xRange;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
10 protected Range yRange;
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
11
3257
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
12 public ChartArea(Range rangeX, Range rangeY) {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
13 this.xRange = rangeX;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
14 this.yRange = rangeY;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
15 }
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
16
3257
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
17 public ChartArea(ValueAxis axisX, ValueAxis axisY) {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
18 this.xRange = axisX.getRange();
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
19 this.yRange = axisY.getRange();
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
20 }
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
21
3257
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
22 public double ofLeft(double percent) {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
23 return xRange.getLowerBound()
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
24 + xRange.getLength() * percent;
3242
1dca41dba135 Move annotation code to base class ChartGenerator
Christian Lins <christian.lins@intevation.de>
parents:
diff changeset
25 }
3257
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
26
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
27 public double ofRight(double percent) {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
28 return xRange.getUpperBound()
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
29 - xRange.getLength() * percent;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
30 }
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
31
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
32 public double ofGround(double percent) {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
33 return yRange.getLowerBound()
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
34 + yRange.getLength() * percent;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
35 }
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
36
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
37 public double atTop() {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
38 return yRange.getUpperBound();
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
39 }
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
40
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
41 public double atGround() {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
42 return yRange.getLowerBound();
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
43 }
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
44
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
45 public double atRight() {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
46 return xRange.getUpperBound();
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
47 }
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
48
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
49 public double atLeft() {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
50 return xRange.getLowerBound();
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
51 }
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
52
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
53 public double above(double percent, double base) {
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
54 return base + yRange.getLength() * percent;
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
55 }
2aca387333d6 Removed superfluous imports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3242
diff changeset
56 }
3259
9422b559b2d5 Added vim lines.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3257
diff changeset
57 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org