canvas
Class DrawingGrid

java.lang.Object
  |
  +--canvas.DrawingGrid

public class DrawingGrid
extends Object

Represents a grid coordinate for usage with a DrawingPane.


Constructor Summary
DrawingGrid(int gridWidth, int gridHeight, canvas.DrawingPane dp)
          Creates a new DrawingGrid for usage in a DrawingPane.
 
Method Summary
 double convertG2Px(double x)
          Convert the Grid x coordinate to a pixel coordinate.
 double convertG2Px(int x)
          Convert the Grid x coordinate to a pixel coordinate.
 double convertG2Py(double y)
          Convert the Grid y coordinate to a pixel coordinate.
 double convertG2Py(int y)
          Convert the Grid y coordinate to a pixel coordinate.
 canvas.DrawingPane getDrawingPane()
          Return the DrawingPane associated with this DrawingGrid.
 double getGBoxHeight()
          Returns the number of pixels representing the height of a Grid box.
 double getGBoxWidth()
          Returns the number of pixels representing the width of a Grid box.
 int getGridHeight()
          Return the number of rows in the grid.
 int getGridWidth()
          Return the number of columns in the grid.
 double getMiddleX()
          Returns the middle x coordinate of the DrawingGrid in GridBox terms.
 double getMiddleY()
          Returns the middle y coordinate of the DrawingGrid in GridBox terms.
 void removeGrid()
          Remove the Grid from the DrawingPane.
 void removeGridLabels()
          Remove the Grid labels from the DrawingPane.
 void setGridDim(int x, int y)
          Reset the number of columns and rows in the grid.
 void showGrid()
          Display the Grid on the DrawingPane.
 void showGridLabels()
          Display the Grid labels on the DrawingPane.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DrawingGrid

public DrawingGrid(int gridWidth,
                   int gridHeight,
                   canvas.DrawingPane dp)
Creates a new DrawingGrid for usage in a DrawingPane.

Parameters:
gridWidth - The number of columns in the Grid.
gridHeight - The number of rows in the Grid.
dp - The DrawingPane to be associated with this DrawingGrid
Method Detail

getGridWidth

public int getGridWidth()
Return the number of columns in the grid.


getGridHeight

public int getGridHeight()
Return the number of rows in the grid.


getDrawingPane

public canvas.DrawingPane getDrawingPane()
Return the DrawingPane associated with this DrawingGrid.


convertG2Px

public double convertG2Px(double x)
Convert the Grid x coordinate to a pixel coordinate.


convertG2Px

public double convertG2Px(int x)
Convert the Grid x coordinate to a pixel coordinate.


convertG2Py

public double convertG2Py(double y)
Convert the Grid y coordinate to a pixel coordinate.


convertG2Py

public double convertG2Py(int y)
Convert the Grid y coordinate to a pixel coordinate.


setGridDim

public void setGridDim(int x,
                       int y)
Reset the number of columns and rows in the grid.


showGrid

public void showGrid()
Display the Grid on the DrawingPane.


removeGrid

public void removeGrid()
Remove the Grid from the DrawingPane.


showGridLabels

public void showGridLabels()
Display the Grid labels on the DrawingPane.


removeGridLabels

public void removeGridLabels()
Remove the Grid labels from the DrawingPane.


getGBoxWidth

public double getGBoxWidth()
Returns the number of pixels representing the width of a Grid box.


getGBoxHeight

public double getGBoxHeight()
Returns the number of pixels representing the height of a Grid box.


getMiddleX

public double getMiddleX()
Returns the middle x coordinate of the DrawingGrid in GridBox terms.


getMiddleY

public double getMiddleY()
Returns the middle y coordinate of the DrawingGrid in GridBox terms.