org.dmonix.util.image.imageobjects
Class BaseImageObject

java.lang.Object
  extended byorg.dmonix.util.image.imageobjects.BaseImageObject
All Implemented Interfaces:
ImageObject
Direct Known Subclasses:
ColumnChartImageObject, GraphImageObject

public abstract class BaseImageObject
extends java.lang.Object
implements ImageObject

The base class for all types of image objects.

Copyright: Copyright (c) 2003

Company: dmonix.org

Version:
1.0
Author:
Peter Nerg

Field Summary
protected static java.awt.Color bg
          The background color.
protected static float[] dash1
           
protected static java.awt.Color fg
          The foreground color.
protected  int HEIGHT
          The height of the image.
protected  int NOTCH_LENGTH
          The size/length of the notch used on either axis.
protected static java.awt.BasicStroke stroke
           
protected static java.awt.BasicStroke STROKE_DASHED_LINE
           
protected static java.awt.BasicStroke STROKE_DOTTED_LINE
           
protected static java.awt.BasicStroke STROKE_LINE
           
protected static java.awt.BasicStroke STROKE_LINE_THICKER
           
protected static java.awt.BasicStroke STROKE_POINT
           
protected static java.awt.BasicStroke wideStroke
           
protected  int WIDTH
          The width of the image.
protected  int X_AXIS_ABSOLUTE_LENGTH
          The absolute length of the X-axis.
protected  int X_AXIS_HORIZONTAL_END_OFFSET
          The distance from the X-axis line to the right of the image.
protected  int X_AXIS_HORIZONTAL_START_OFFSET
          The distance from the X-axis line to the left of the image.
protected  int X_AXIS_NOTCH_COUNT
          The number of notches on the x-axis.
protected  double X_AXIS_NOTCH_DISTANCE
          The distance between the notches on the x-axis.
protected  double X_AXIS_SCALE_FACTOR
          The scale factor for the X-axis.
protected  int X_AXIS_SCALE_STEP
          The step size for the X-axis .
protected  int X_AXIS_VERTICAL_OFFSET
          The distance from the X-axis line to the bottom of the image.
protected  int Y_AXIS_ABSOLUTE_LENGTH
          The absolute length of the Y-axis .
protected  int Y_AXIS_HORIZONTAL_OFFSET
          The distance from the Y-axis line to the left of the image.
protected  int Y_AXIS_NOTCH_COUNT
          The number of notches on the y-axis.
protected  double Y_AXIS_NOTCH_DISTANCE
          The distance between the notches on the y-axis.
protected  double Y_AXIS_SCALE_FACTOR
          The scale factor for the Y-axis.
protected  int Y_AXIS_SCALE_STEP
          The step size for the Y-axis .
protected  int Y_AXIS_VERTICAL_END_OFFSET
          The distance from the Y-axis line to the bottom of the image.
protected  int Y_AXIS_VERTICAL_START_OFFSET
          The distance from the Y-axis line to the top of the image.
 
Constructor Summary
BaseImageObject(int width, int height)
          Constructor [obviously].
 
Method Summary
protected  void calculateXAxisNotchDistanceBasedOnObjects(int objects)
          Calculate and set the distance between the X-axis notches.
protected  void calculateXAxisNotchDistanceBasedOnValue(int maxHeight)
           
protected  void calculateYAxisNotchDistanceBasedOnObjects(int objects)
           
protected  void calculateYAxisNotchDistanceBasedOnValue(int maxHeight)
          Calculate and set the distance between the Y-axis notches.
protected  void drawXAxis(java.awt.Graphics2D g2, boolean notches, boolean numbering, boolean scale)
          Draw the X-axis line.
protected  void drawYAxis(java.awt.Graphics2D g2, boolean notches, boolean numbering, boolean scale)
          Draw the Y-axis line.
 java.awt.Rectangle getBounds()
          Get the rectangle for this image.
abstract  void paint(java.awt.Graphics2D g2)
          Paint the image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X_AXIS_HORIZONTAL_START_OFFSET

protected int X_AXIS_HORIZONTAL_START_OFFSET
The distance from the X-axis line to the left of the image.


X_AXIS_HORIZONTAL_END_OFFSET

protected int X_AXIS_HORIZONTAL_END_OFFSET
The distance from the X-axis line to the right of the image.


X_AXIS_VERTICAL_OFFSET

protected int X_AXIS_VERTICAL_OFFSET
The distance from the X-axis line to the bottom of the image.


X_AXIS_ABSOLUTE_LENGTH

protected int X_AXIS_ABSOLUTE_LENGTH
The absolute length of the X-axis.


X_AXIS_SCALE_FACTOR

protected double X_AXIS_SCALE_FACTOR
The scale factor for the X-axis. It depends on the size of the image and the largest value for a dot/column.


X_AXIS_SCALE_STEP

protected final int X_AXIS_SCALE_STEP
The step size for the X-axis .

See Also:
Constant Field Values

Y_AXIS_HORIZONTAL_OFFSET

protected int Y_AXIS_HORIZONTAL_OFFSET
The distance from the Y-axis line to the left of the image.


Y_AXIS_VERTICAL_START_OFFSET

protected final int Y_AXIS_VERTICAL_START_OFFSET
The distance from the Y-axis line to the top of the image.

See Also:
Constant Field Values

Y_AXIS_VERTICAL_END_OFFSET

protected final int Y_AXIS_VERTICAL_END_OFFSET
The distance from the Y-axis line to the bottom of the image.

See Also:
Constant Field Values

Y_AXIS_SCALE_STEP

protected final int Y_AXIS_SCALE_STEP
The step size for the Y-axis .

See Also:
Constant Field Values

Y_AXIS_ABSOLUTE_LENGTH

protected int Y_AXIS_ABSOLUTE_LENGTH
The absolute length of the Y-axis .


NOTCH_LENGTH

protected final int NOTCH_LENGTH
The size/length of the notch used on either axis.

See Also:
Constant Field Values

bg

protected static final java.awt.Color bg
The background color.


fg

protected static final java.awt.Color fg
The foreground color.


stroke

protected static final java.awt.BasicStroke stroke

STROKE_POINT

protected static final java.awt.BasicStroke STROKE_POINT

STROKE_DOTTED_LINE

protected static final java.awt.BasicStroke STROKE_DOTTED_LINE

STROKE_LINE

protected static final java.awt.BasicStroke STROKE_LINE

STROKE_LINE_THICKER

protected static final java.awt.BasicStroke STROKE_LINE_THICKER

wideStroke

protected static final java.awt.BasicStroke wideStroke

dash1

protected static final float[] dash1

STROKE_DASHED_LINE

protected static final java.awt.BasicStroke STROKE_DASHED_LINE

WIDTH

protected int WIDTH
The width of the image.


HEIGHT

protected int HEIGHT
The height of the image.


X_AXIS_NOTCH_DISTANCE

protected double X_AXIS_NOTCH_DISTANCE
The distance between the notches on the x-axis.


Y_AXIS_NOTCH_DISTANCE

protected double Y_AXIS_NOTCH_DISTANCE
The distance between the notches on the y-axis.


X_AXIS_NOTCH_COUNT

protected int X_AXIS_NOTCH_COUNT
The number of notches on the x-axis.


Y_AXIS_NOTCH_COUNT

protected int Y_AXIS_NOTCH_COUNT
The number of notches on the y-axis.


Y_AXIS_SCALE_FACTOR

protected double Y_AXIS_SCALE_FACTOR
The scale factor for the Y-axis. It depends on the size of the image and the largest value for a dot/column.

Constructor Detail

BaseImageObject

public BaseImageObject(int width,
                       int height)
Constructor [obviously].

Parameters:
width - The width of the image
height - The height of the image
Method Detail

getBounds

public java.awt.Rectangle getBounds()
Get the rectangle for this image.

Specified by:
getBounds in interface ImageObject
Returns:
The rectangle.

paint

public abstract void paint(java.awt.Graphics2D g2)
Paint the image.

Specified by:
paint in interface ImageObject
Parameters:
g2 - The graphics object.

calculateXAxisNotchDistanceBasedOnObjects

protected void calculateXAxisNotchDistanceBasedOnObjects(int objects)
Calculate and set the distance between the X-axis notches.

Parameters:
objects - The number of objects to fit on the axis.

calculateXAxisNotchDistanceBasedOnValue

protected void calculateXAxisNotchDistanceBasedOnValue(int maxHeight)

calculateYAxisNotchDistanceBasedOnObjects

protected void calculateYAxisNotchDistanceBasedOnObjects(int objects)

calculateYAxisNotchDistanceBasedOnValue

protected void calculateYAxisNotchDistanceBasedOnValue(int maxHeight)
Calculate and set the distance between the Y-axis notches.

Parameters:
maxHeight - The maximum height of the axis.

drawXAxis

protected void drawXAxis(java.awt.Graphics2D g2,
                         boolean notches,
                         boolean numbering,
                         boolean scale)
Draw the X-axis line.

Parameters:
g2 - The graphics object
notches - Should nothces been drawn
numbering - Should numbering be added
scale - Should a scale be added

drawYAxis

protected void drawYAxis(java.awt.Graphics2D g2,
                         boolean notches,
                         boolean numbering,
                         boolean scale)
Draw the Y-axis line.

Parameters:
g2 - The graphics object
notches - Should notches been drawn
numbering - Should numbering be added
scale - Should a scale be added


Copyright © 1998-2005 dmonix.org Peter Nerg, All Rights Reserved.