/* * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details * (http://www.gnu.org/copyleft/lesser.html). * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package jcckit.plot; import java.awt.Color; import jcckit.graphic.ClippingShape; import jcckit.graphic.GraphPoint; import jcckit.graphic.GraphicalComposite; import jcckit.graphic.GraphicalElement; import jcckit.graphic.LineAttributes; import jcckit.graphic.Polygon; import jcckit.graphic.ShapeAttributes; import jcckit.util.ConfigParameters; import jcckit.util.Factory; /** * A simple curve is the basic implementation of the {@link Curve} interface. * * @author Franz-Josef Elmer */ public class SimpleCurve implements Curve { /** Configuration parameter key. */ public static final String SYMBOL_FACTORY_KEY = "symbolFactory", WITH_LINE_KEY = "withLine", SOFT_CLIPPING_KEY = "softClipping", LINE_ATTRIBUTES_KEY = "lineAttributes", INITIAL_HINT_FOR_NEXT_POINT_KEY = "initialHintForNextPoint"; private final ClippingShape _clippingShape; private final SymbolFactory _symbolFactory; private final GraphicalComposite _symbols; private final GraphicalComposite _completeCurve; private final GraphicalElement _legendSymbol; private final Hint _initialHintForNextPoint; private final Polygon _curve; private final boolean _softClipping; private Hint _hintForNextPoint; /** * Creates a new curve. The parameter config contains: *
Key & Default Value | Type | Mandatory | *Description |
---|---|---|---|
initialHintForNextPoint = null | *ConfigParameters | no | *Definition of an initial {@link Hint} for the first curve point. * |
lineAttributes = a {@link ShapeAttributes} * instances with default values and line colors based on * the formula Color.getHSBColor(curveIndex/6,1,0.8) | *ConfigParameters | no | *Configuration parameters of an instances of * {@link jcckit.graphic.GraphicAttributes} for the * {@link Polygon Polygons} connecting curve points. |
symbolFactory = null | *ConfigParameters | no | *Configuration parameters defining an instances of * {@link SymbolFactory} for the {@link Symbol Symbols} * decorating curve points. |
softClipping = true | *boolean | no | *If true no explicit clipping takes
* place but the symbol is not drawn if the corresponding curve
* point is outside the axis box. * If false the symbol is * drawn in any case but it may be clipped by the axis box. * Soft-clipping should be set to false if the * symbols are not located around the curve point (like for bars). * |
withLine = true | *boolean | no | *If true curve points are connected by a * {@link jcckit.graphic.Polygon}. |