edu.mines.jtk.mosaic
Class GridView

java.lang.Object
  extended by edu.mines.jtk.mosaic.TiledView
      extended by edu.mines.jtk.mosaic.GridView

public class GridView
extends TiledView

Grid lines that extend tics in tile axes into tiles. Grid lines can be painted above or below other tiled views in a tile, simply by adding a grid view before or after those other tiled views.

Version:
2005.12.29
Author:
Dave Hale, Colorado School of Mines

Nested Class Summary
static class GridView.Horizontal
          The grid horizontal type.
static class GridView.Style
          The grid style.
static class GridView.Vertical
          The grid vertical type.
 
Constructor Summary
GridView()
          Constructs a grid view with default types, style, and color.
GridView(java.awt.Color color)
          Constructs a grid view with specified color.
GridView(GridView.Horizontal horizontal, GridView.Vertical vertical)
          Constructs a grid view with specified types.
GridView(GridView.Horizontal horizontal, GridView.Vertical vertical, java.awt.Color color)
          Constructs a grid view with specified types and color.
GridView(GridView.Horizontal horizontal, GridView.Vertical vertical, java.awt.Color color, GridView.Style style)
          Constructs a grid view with specified types, style, and color.
GridView(GridView.Style style)
          Constructs a grid view with specified style.
GridView(java.lang.String parameters)
          Constructs a grid view with specified parameters string.
 
Method Summary
 void paint(java.awt.Graphics2D g2d)
          Paints this tiled view.
 void setColor(java.awt.Color color)
          Sets the grid color.
 void setHorizontal(GridView.Horizontal horizontal)
          Sets the grid horizontal type.
 void setParameters(java.lang.String parameters)
          Sets the grid types, color, and style parameters from a string.
 void setStyle(GridView.Style style)
          Sets the grid style.
 void setVertical(GridView.Vertical vertical)
          Sets the grid vertical type.
 
Methods inherited from class edu.mines.jtk.mosaic.TiledView
getBestHorizontalProjector, getBestVerticalProjector, getHorizontalProjector, getLineWidth, getTile, getTranscaler, getVerticalProjector, repaint, setBestProjectors
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridView

public GridView()
Constructs a grid view with default types, style, and color.


GridView

public GridView(GridView.Horizontal horizontal,
                GridView.Vertical vertical)
Constructs a grid view with specified types.

Parameters:
horizontal - the grid horizontal type.
vertical - the grid vertical type.

GridView

public GridView(GridView.Style style)
Constructs a grid view with specified style.

Parameters:
style - the grid style.

GridView

public GridView(java.awt.Color color)
Constructs a grid view with specified color.

Parameters:
color - the grid color.

GridView

public GridView(GridView.Horizontal horizontal,
                GridView.Vertical vertical,
                java.awt.Color color)
Constructs a grid view with specified types and color.

Parameters:
horizontal - the grid horizontal type.
vertical - the grid vertical type.
color - the grid color.

GridView

public GridView(GridView.Horizontal horizontal,
                GridView.Vertical vertical,
                java.awt.Color color,
                GridView.Style style)
Constructs a grid view with specified types, style, and color.

Parameters:
horizontal - the grid horizontal type.
vertical - the grid vertical type.
color - the grid color.
style - the grid style.

GridView

public GridView(java.lang.String parameters)
Constructs a grid view with specified parameters string. See the method setParameters(String) for the format of the parameters string.

Parameters:
parameters - the color and style of grid lines.
Method Detail

setHorizontal

public void setHorizontal(GridView.Horizontal horizontal)
Sets the grid horizontal type. The default grid horizontal type is major.

Parameters:
horizontal - the grid horizontal type

setVertical

public void setVertical(GridView.Vertical vertical)
Sets the grid vertical type. The default grid vertical type is major.

Parameters:
vertical - the grid vertical type

setColor

public void setColor(java.awt.Color color)
Sets the grid color. The default grid color is the tile foreground color. That default is used if the specified color is null.

Parameters:
color - the color; null, for default color.

setStyle

public void setStyle(GridView.Style style)
Sets the grid style. The default grid style is solid.

Parameters:
style - the style.

setParameters

public void setParameters(java.lang.String parameters)
Sets the grid types, color, and style parameters from a string. This method provides a convenient way to set the grid horizontal and vertical types, color, and style of grid lines for this view.

To specify grid horizontal type, the parameters string may contain "H0" for grid horizontal type zero, or simply "H" for grid horizontal type major. Otherwise, the grid horizontal type is none.

To specify grid vertical type, the parameters string may contain "V0" for grid vertical type zero, or simply "V" for grid vertical type major. Otherwise, the grid vertical type is none.

To specify a grid color, the parameters string may contain one of "r" for red, "g" for green, "b" for blue, "c" for cyan, "m" for magenta, "y" for yellow, "k" for black, or "w" for white. If the parameter string contains none of these colors, then the default color is used.

To specify a grid style, the parameters string may contain one of "-" for solid lines, "--" for dashed lines, "-." for dotted lines, or "--." for dash-dotted lines. If the parameters string contains none of these line styles, then no grid lines are painted.

Parameters:
parameters - the grid parameters string.

paint

public void paint(java.awt.Graphics2D g2d)
Description copied from class: TiledView
Paints this tiled view. This method is implemented by classes that extend this abstract base class. Implementations may modify the specified graphics context freely. Such modifications will not affect the paintings of other tiled views in the same tile or mosaic.

Tiled views should not replace (set) entirely the transform in the specified graphics context. This transform may already have been set by the tile or its mosaic. Therefore, tiled views should modify this transform only by specifying additional scaling, translation, etc.

Specified by:
paint in class TiledView
Parameters:
g2d - the graphics context in which to paint.