diff gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java @ 767:79401c871da4

Added and repaired javadoc in de.intevation.gnv.chart package. gnv-artifacts/trunk@823 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 24 Mar 2010 14:48:55 +0000
parents b98d1adee7a6
children 9a828e5a2390
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java	Tue Mar 23 14:11:51 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/chart/HorizontalProfileChart.java	Wed Mar 24 14:48:55 2010 +0000
@@ -20,16 +20,45 @@
 
 
 /**
- * @author Ingo Weinzierl <ingo.weinzierl@intevation.de>
+ * This class is used to create xy-charts of horizontal profiles.
+ *
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
 public class HorizontalProfileChart
 extends      VerticalProfileChart
 {
+    /**
+     * Logger used for logging with log4j.
+     */
     private static Logger log = Logger.getLogger(HorizontalProfileChart.class);
 
+    /**
+     * <code>WKTReader</code> used to turn wkt strings into geometries.
+     */
     private static WKTReader wktReader = new WKTReader();
+
+    /**
+     * The first point in a HorizontalProfileChart. It is used to calculate the
+     * distance between the currently processed point an the start.
+     */
     private        Point     firstPoint;
 
+    /**
+     * Constructor used to create horizontal profile charts.
+     *
+     * @param labels Labels used to be displayed in title, subtitle and so on.
+     * @param theme ChartTheme used to adjust the rendering of this chart.
+     * @param parameters Collection containing a bunch of parameters.
+     * @param measurements Collection containing a bunch of measurements.
+     * @param dates Collection containing a bunch of date objects.
+     * @param result Collection containing a bunch of <code>Result</code>
+     * objects which contain the actual data items to be displayed.
+     * @param timeGaps Collection with timegap definitions.
+     * @param locale Locale used to specify the format of labels, numbers, ...
+     * @param linesVisible Render lines between data points if true, otherwise
+     * not.
+     * @param shapesVisible Render vertices as points if true, otherwise not.
+     */
     public HorizontalProfileChart(
         ChartLabels labels,
         ChartTheme  theme,
@@ -58,6 +87,9 @@
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.VerticalProfileChart#getValue(Result)
+     */
     @Override
     protected Object getValue(Result row) {
         try {
@@ -70,6 +102,11 @@
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.VerticalProfileChart#gapDetection(Result,
+     * Series, int, int)
+     */
+    @Override
     protected void gapDetection(
         Result[] results,
         Series   series,
@@ -103,6 +140,10 @@
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.AbstractXYLineChart(Result, Series)
+     */
+    @Override
     protected void addValue(Result row, Series series) {
         double distance = 0;
 
@@ -128,6 +169,12 @@
     }
 
 
+
+    /**
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#addSeries(Series,
+     * String, int)
+     */
+    @Override
     protected void addSeries(Series series, String label, int idx) {
         super.addSeries(series, label, idx);
 
@@ -136,6 +183,10 @@
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.VerticalProfileChart#prepareRangeAxis(String,
+     * int)
+     */
     @Override
     protected void prepareRangeAxis(String seriesKey, int idx) {
         return;
@@ -143,6 +194,10 @@
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.VerticalProfileChart#storeMaxValue(Map,
+     * Object, String)
+     */
     @Override
     protected void storeMaxValue(Map values, Object value, String parameter) {
         return;
@@ -150,6 +205,11 @@
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.AbstractXYLineChart#createSeriesName(String,
+     * String, String)
+     */
+    @Override
     protected String createSeriesName(
         String breakPoint1,
         String breakPoint2,
@@ -165,6 +225,11 @@
     }
 
 
+    /**
+     * @see de.intevation.gnv.chart.VerticalProfileChart#addGapsOnGrid(Result[],
+     * Series, int, int)
+     */
+    @Override
     protected void addGapsOnGrid(
         Result[] results,
         Series   series,
@@ -226,6 +291,17 @@
     }
 
 
+    /**
+     * Method to add gaps between two data points. The real detection is done by
+     * {@link #simpleDetection} and {@link #specialDetection}.
+     *
+     * @param results All data points in this dataset.
+     * @param series Series to be processed.
+     * @param startValue <code>Point</code> where the scan for gaps should begin.
+     * @param endValue <code>Point</code> where the scan should end.
+     * @param startPos Start position of this series in <code>results</code>.
+     * @param endPos End position of a series in <code>results</code>
+     */
     protected void addGaps(
         Result[] results,
         Series   series,
@@ -276,6 +352,21 @@
     }
 
 
+    /**
+     * Simple method to detect gaps. A gap is detected if the delta between two 
+     * data points (current, last) is bigger than <code>PERCENTAGE</code> percent 
+     * of delta of start and end. 
+     * <br>
+     * (smallDelta &gt; delta / 100 * PERCENTAGE)
+     *
+     * @param start First data point in a series
+     * @param end Last data point in a series
+     * @param last Left point
+     * @param current Right point
+     *
+     * @return true, if a gap is detected between last and current - otherwise
+     * false.
+     */
     protected boolean simpleDetection(
         Point start,
         Point end,
@@ -289,6 +380,22 @@
     }
 
 
+    /**
+     * Method to detect gaps between two data points. Following formula is used
+     * for detection:<br>
+     * smallDelta &gt; (3.0 / (count - 1) * delta)<br>
+     * smallDelta = distance between <code>current</code> and <code>last</code>
+     * <br>
+     * delta = distance between <code>start</code> and <code>end</code>
+     *
+     * @param start First data point in a series
+     * @param end Last data point in a series
+     * @param last Left point
+     * @param current Right point
+     *
+     * @return true, if a gap is detected between last and current - otherwise
+     * false.
+     */
     protected boolean specialDetection(
         Point start,
         Point end,
@@ -306,6 +413,10 @@
         return (smallDelta > (3.0 / (count - 1) * delta));
     }
 
+    /**
+     * @see de.intevation.gnv.chart.VerticalProfileChart#getDependendAxisName(Result,
+     * Result)
+     */
     @Override
     protected String getDependendAxisName(Result first, Result second) {
         if (first.getInteger("IPOSITION") == second.getInteger("IPOSITION"))
@@ -314,6 +425,15 @@
         return "IPOSITION";
     }
 
+    /**
+     * This method returns a point from a given wkt string stored in
+     * <code>result</code>.
+     *
+     * @param result <code>Result</code> object which contains the wkt string.
+     * The wkt string needs to be available under the key SHAPE.
+     *
+     * @return Point representation of wkt string.
+     */
     private Point getPoint(Result result)
     throws ParseException
     {

http://dive4elements.wald.intevation.org