com.jfimagine.jfgraph.shape.decorate
Class GridFormat

java.lang.Object
  |
  +--com.jfimagine.jfgraph.shape.decorate.GridFormat

public class GridFormat
extends java.lang.Object

GridFormat class. Grids for graph drawing.

Version:
$Revision: 1.1 $
Author:
CookieMaker

Field Summary
static int GRIDTYPE_CROSS
           
static int GRIDTYPE_DOT
           
static int GRIDTYPE_LINE
           
static int GRIDTYPE_NONE
          Grid types
static int SIZETYPE_CM
           
static int SIZETYPE_INCH
          size types
static int SIZETYPE_MM
           
 
Constructor Summary
GridFormat()
          Constructor for GridFormat
 
Method Summary
 void draw(java.awt.Graphics g, double zoom)
          Draw grids on current canvas.
static GridFormat getDefaultGridFormat()
          get global default grid format
 java.awt.Color getGridColor()
          Get current grid color.
 double getGridSize()
          Get the grid size.
 double getGridSizeInPixels(double zoom)
          get the grid size in pixels.
 int getGridSizeType()
          Get the grid size type.
 int getGridType()
          Get the gridType between grid.
 double getHeight()
          Get the height of entire canvas.
 JFPoint getSnapPos(double newX, double newY)
          get snap position.
 double getSnapSize()
          Get the snapSize between grid.
 double getSnapSizeInPixels(double zoom)
          get the snap size in pixels.
 int getSnapSizeType()
          Get the snap size type.
 boolean getSnapToGrid()
          Get the snapToGrid between grid.
 double getWidth()
          Get the width of entire canvas.
static void setDefaultGridFormat(GridFormat gridFormat)
          set global default grid format
 void setGridColor(java.awt.Color gridColor)
          Set current grid color.
 void setGridSize(double gridSize)
          Set the grid size.
 void setGridSizeType(int gridSizeType)
          Set the grid size type.
 void setGridType(int gridType)
          Set the gridType between grid.
 void setIsMetric(boolean isMetric)
          Set a metric or english grid formats.
 void setSize(java.awt.Dimension d)
          Set the size of entire canvas
 void setSize(double width, double height)
          Set the size of entire canvas
 void setSnapSize(double snapSize)
          Set the snapSize between grid.
 void setSnapSizeType(int snapSizeType)
          Set the snap size type.
 void setSnapToGrid(boolean snapToGrid)
          Set the snapToGrid between grid.
 void setValue(GridFormat gridFormat)
          Set new value for this gridFormat.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRIDTYPE_NONE

public static final int GRIDTYPE_NONE
Grid types

See Also:
Constant Field Values

GRIDTYPE_LINE

public static final int GRIDTYPE_LINE
See Also:
Constant Field Values

GRIDTYPE_CROSS

public static final int GRIDTYPE_CROSS
See Also:
Constant Field Values

GRIDTYPE_DOT

public static final int GRIDTYPE_DOT
See Also:
Constant Field Values

SIZETYPE_INCH

public static final int SIZETYPE_INCH
size types

See Also:
Constant Field Values

SIZETYPE_CM

public static final int SIZETYPE_CM
See Also:
Constant Field Values

SIZETYPE_MM

public static final int SIZETYPE_MM
See Also:
Constant Field Values
Constructor Detail

GridFormat

public GridFormat()
Constructor for GridFormat

Method Detail

setDefaultGridFormat

public static void setDefaultGridFormat(GridFormat gridFormat)
set global default grid format

Parameters:
gridFormat - A new grid format

getDefaultGridFormat

public static GridFormat getDefaultGridFormat()
get global default grid format

Returns:
The global default grid format

getGridColor

public java.awt.Color getGridColor()
Get current grid color.

Returns:
The grid color.

setGridColor

public void setGridColor(java.awt.Color gridColor)
Set current grid color.

Parameters:
gridColor - A new grid color.

setIsMetric

public void setIsMetric(boolean isMetric)
Set a metric or english grid formats. This operation will reset all the definition of current grid format.

Parameters:
isMetric - True if is metric, false english.

getGridSize

public double getGridSize()
Get the grid size.

Returns:
the grid size.

setGridSize

public void setGridSize(double gridSize)
Set the grid size.

Parameters:
gridSize - A new grid size.

getGridSizeType

public int getGridSizeType()
Get the grid size type.

Returns:
the grid size type.

setGridSizeType

public void setGridSizeType(int gridSizeType)
Set the grid size type.

Parameters:
gridSizeType - A new grid size type.

getGridSizeInPixels

public double getGridSizeInPixels(double zoom)
get the grid size in pixels.

Parameters:
zoom - Zoom scale,default to 1.
Returns:
grid size in pixels

getGridType

public int getGridType()
Get the gridType between grid.

Returns:
the gridType.

setGridType

public void setGridType(int gridType)
Set the gridType between grid.

Parameters:
gridType - A new gridType.

getWidth

public double getWidth()
Get the width of entire canvas.

Returns:
the width.

getHeight

public double getHeight()
Get the height of entire canvas.

Returns:
the height.

setSize

public void setSize(java.awt.Dimension d)
Set the size of entire canvas

Parameters:
d - size of canvas.

setSize

public void setSize(double width,
                    double height)
Set the size of entire canvas

Parameters:
width - Width of canvas
height - Height of canvas

getSnapToGrid

public boolean getSnapToGrid()
Get the snapToGrid between grid.

Returns:
the snapToGrid.

setSnapToGrid

public void setSnapToGrid(boolean snapToGrid)
Set the snapToGrid between grid.

Parameters:
snapToGrid - A new snapToGrid.

getSnapSize

public double getSnapSize()
Get the snapSize between grid.

Returns:
the snapSize.

setSnapSize

public void setSnapSize(double snapSize)
Set the snapSize between grid.

Parameters:
snapSize - A new snapSize.

getSnapSizeType

public int getSnapSizeType()
Get the snap size type.

Returns:
the snap size type.

setSnapSizeType

public void setSnapSizeType(int snapSizeType)
Set the snap size type.

Parameters:
snapSizeType - A new snap size type.

getSnapSizeInPixels

public double getSnapSizeInPixels(double zoom)
get the snap size in pixels.

Parameters:
zoom - Zoom scale,default to 1.
Returns:
snap size in pixels

setValue

public void setValue(GridFormat gridFormat)
Set new value for this gridFormat.

Parameters:
gridFormat - A new grid format.

draw

public void draw(java.awt.Graphics g,
                 double zoom)
Draw grids on current canvas.

Parameters:
g - A graphics context.
zoom - Zoom scale,default to 1.

getSnapPos

public JFPoint getSnapPos(double newX,
                          double newY)
get snap position.

Returns:
A snapped position


Copyright 2004 ~ 2005 JingFei International Cooperation LTD. All Rights Reserved.