KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcckit > plot > Curve


1 /*
2  * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
3  *
4  * This library is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation; either version 2.1 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details
13  * (http://www.gnu.org/copyleft/lesser.html).
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package jcckit.plot;
20
21 import jcckit.graphic.GraphicalElement;
22 import jcckit.graphic.GraphPoint;
23
24 /**
25  * A curve is defined by a sequence of points in device-independent
26  * coordinates. The points can be decorated by symbols and/or
27  * connected by lines.{@link Hint Hints} are used to determine additional
28  * properties of the symbol. This is especially important for
29  * charts with bars.
30  * <p>
31  * In accordance with the Factory Method Pattern
32  * the symbols are created by a {@link SymbolFactory}.
33  *
34  * @author Franz-Josef Elmer
35  */

36 public interface Curve {
37   /**
38    * Returns the graphical representation of a curve.
39    * Different invocations of this method might return
40    * different instances.
41    * This is especially true after adding, inserting, removing, or
42    * repplacing a point of the curve.
43    */

44   public GraphicalElement getView();
45
46   /**
47    * Returns a symbol which can be used to create the legend for the curve.
48    * For example, it should return a horizontal line with the symbol
49    * in the middle if the curve is a line with points decorated by symbols.
50    */

51   public GraphicalElement getLegendSymbol();
52
53   /**
54    * Appends a new point to the curve.
55    * @param point Position in device-independent coordinates.
56    * @param hintFromPreviousCurve Hint which may be used to calculate
57    * the corresponding {@link GraphicalElement}.
58    * @return hint for next curve.
59    */

60   public Hint addPoint(GraphPoint point, Hint hintFromPreviousCurve);
61
62   /** Removes all points from the curve. */
63   public void removeAllPoints();
64 }
65
Popular Tags