lt.monarch.chart.chart2D.series
Class SplineStrategy<ChartProjector extends Projector>

java.lang.Object
  extended by lt.monarch.chart.chart2D.series.AbstractLineStrategy<ChartProjector>
      extended by lt.monarch.chart.chart2D.series.LineStrategy<ChartProjector>
          extended by lt.monarch.chart.chart2D.series.SplineStrategy<ChartProjector>
All Implemented Interfaces:
java.io.Serializable, AbstractStrategy
Direct Known Subclasses:
NullSplineStrategy

public class SplineStrategy<ChartProjector extends Projector>
extends LineStrategy<ChartProjector>

In this strategy all null point values are skipped and cannot be displayed in any way.

See Also:
Serialized Form

Nested Class Summary
Modifier and Type Class and Description
protected static class SplineStrategy.SplinePolygon
           
 
Field Summary
Modifier and Type Field and Description
protected  java.lang.Double end
           
protected  AbstractSpline splineStrategy
           
protected  java.lang.Double start
           
protected  int step
          Step count
 
Fields inherited from class lt.monarch.chart.chart2D.series.LineStrategy
bottomPolygon, firstX, isSortedSeries, lastX, lineOrientation, polygon, pseudoModel
 
Fields inherited from class lt.monarch.chart.chart2D.series.AbstractLineStrategy
baseValue, cachingEnabled, dirty, isConnected, mapper, metaModel, minMaxValues, model, paintMode, planePoint, projector, showNullValues, style, tempPoint, xMapper, yMapper, zoomMultiplier
 
Constructor Summary
Constructor and Description
SplineStrategy()
          Default spline strategy constructor
 
Method Summary
Modifier and Type Method and Description
protected  void addPoint(Projector projector, GeneralPoint tempPoint, Point2D planePoint, Polygon2D polygon, double x, double y)
          Adds points to the polygon
protected  java.util.List<SplineStrategy.SplinePolygon> calculatePoints(AbstractGraphics g, AbstractSpline splineStrategy, ArrayDataModel model, PseudoArrayDataModel pseudoModel)
          Paints the spline series in the specified Graphics context.
 void dispose()
          Disposes the object
protected  void drawLine(AbstractGraphics g, AbstractLineSeries<ChartProjector> series)
          Paints the connected series line in the specified Graphics context.
protected  void drawLineAndFill(AbstractGraphics g, Projector projector, SplineStrategy.SplinePolygon spline, SplineStrategy.SplinePolygon bottomSpline, AbstractLineSeries<ChartProjector> series)
          Draws the polyline and toFill polygon
protected  void finalize()
           
 Point2D getLinePointByX(double x)
          Calculates line Point2D value for a given x coordinate.
 AbstractSpline getSplineStrategy()
          Gets spline implementation strategy
 int getStep()
          Gets spline step number
 java.lang.Object getYValue(java.lang.Object x)
          Calculates spline Y value for a given X value.
 java.lang.Object[] getYValues(java.lang.Object x)
          Calculates spline Y values for a given X value.
 void setSplineStrategy(AbstractSpline splineStrategy)
          Sets spline implementation strategy, which defines the points of the spline.
 void setStep(int step)
          Sets the spline step number, i.e.
protected  boolean showNullPoints()
          Checks and returns if user has set nullLineColor or nullFillColor objects.
 
Methods inherited from class lt.monarch.chart.chart2D.series.LineStrategy
binarySearch, cacheLines, determineLineDirection, draw, formNewPolygon, getDataValueMappingHeight, getEndIndex, getPointPosition, getStartIndex, getValue, initDrawing, isDataInverted, isStacked
 
Methods inherited from class lt.monarch.chart.chart2D.series.AbstractLineStrategy
calculateSelection, getMinMaxValues, getModel, getX, getY, projectPoint
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

splineStrategy

protected AbstractSpline splineStrategy

step

protected int step
Step count


start

protected java.lang.Double start

end

protected java.lang.Double end
Constructor Detail

SplineStrategy

public SplineStrategy()
Default spline strategy constructor

Method Detail

drawLine

protected void drawLine(AbstractGraphics g,
                        AbstractLineSeries<ChartProjector> series)
Description copied from class: LineStrategy
Paints the connected series line in the specified Graphics context.

Overrides:
drawLine in class LineStrategy<ChartProjector extends Projector>
Parameters:
g - the Graphics context in which to paint the series line. NOTE: setShowNullValues(boolean) works a little different here. When set to true, the line is broken and started from the next non-null point value. When set to false, the null values are simply ignored: the line connects all non-null value points.
series - Chart series to which this strategy belongs
See Also:
AbstractChartSeries.setShowNullValues(boolean)

calculatePoints

protected java.util.List<SplineStrategy.SplinePolygon> calculatePoints(AbstractGraphics g,
                                                                       AbstractSpline splineStrategy,
                                                                       ArrayDataModel model,
                                                                       PseudoArrayDataModel pseudoModel)
Paints the spline series in the specified Graphics context.

Parameters:
g - the Graphics context in which to paint the series
splineStrategy - spline drawing strategy (i.e. the AbstractSpline implementation)
model - data model of the spline
pseudoModel - pseudo data model of the spline, for null determination
Returns:
returns array of polygons and specifies if the polygon is null

addPoint

protected void addPoint(Projector projector,
                        GeneralPoint tempPoint,
                        Point2D planePoint,
                        Polygon2D polygon,
                        double x,
                        double y)
Adds points to the polygon

Parameters:
projector - Projector
tempPoint - Normalized point
planePoint - Point
polygon - Polygon which will be drawn
x - X coordinate
y - Y coordinate

drawLineAndFill

protected void drawLineAndFill(AbstractGraphics g,
                               Projector projector,
                               SplineStrategy.SplinePolygon spline,
                               SplineStrategy.SplinePolygon bottomSpline,
                               AbstractLineSeries<ChartProjector> series)
Draws the polyline and toFill polygon

Parameters:
g - Graphics
projector - Projector
area - Polygon points
bottomPolygon - bottom polygon
first - First x point
last - Last x point
series - Chart series to which this strategy belongs

getYValue

public java.lang.Object getYValue(java.lang.Object x)
Calculates spline Y value for a given X value.

Parameters:
x - value for which the corresponding y value must be calculated.
Returns:
y calculated spline value

getLinePointByX

public Point2D getLinePointByX(double x)
Description copied from class: AbstractLineStrategy
Calculates line Point2D value for a given x coordinate.

Overrides:
getLinePointByX in class LineStrategy<ChartProjector extends Projector>
Parameters:
x - coordinate for which the corresponding line point must be calculated.
Returns:
y calculated line value

getYValues

public java.lang.Object[] getYValues(java.lang.Object x)
Calculates spline Y values for a given X value.

Parameters:
x - value for which the corresponding y value must be calculated.
Returns:
y calculated spline values (an array)

showNullPoints

protected boolean showNullPoints()
Description copied from class: LineStrategy
Checks and returns if user has set nullLineColor or nullFillColor objects. This means that user would like to see the probable values instead of nulls (if it is possible).

Overrides:
showNullPoints in class LineStrategy<ChartProjector extends Projector>
Returns:
boolean showing that null values should be drawn.

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

dispose

public void dispose()
Description copied from class: AbstractLineStrategy
Disposes the object

Overrides:
dispose in class LineStrategy<ChartProjector extends Projector>

getSplineStrategy

public AbstractSpline getSplineStrategy()
Gets spline implementation strategy

Returns:
the spline implementation strategy

setSplineStrategy

public void setSplineStrategy(AbstractSpline splineStrategy)
Sets spline implementation strategy, which defines the points of the spline.

Parameters:
splineStrategy - the spline implementation strategy

getStep

public int getStep()
Gets spline step number

Returns:
the step number

setStep

public void setStep(int step)
Sets the spline step number, i.e. how much lines should consist the line between two points.

Parameters:
step - line number between two data points