org.tigris.gef.base
Class LayerPolar

java.lang.Object
  extended by org.tigris.gef.base.Layer
      extended by org.tigris.gef.base.LayerPolar
All Implemented Interfaces:
java.io.Serializable

public class LayerPolar
extends Layer

This class is an example of the power of the Layer-based approach. This is a kind of background drawing guide (like LayerGrid) that emphasizes polar coordinates (instead of rectangular coordinates).

See Also:
Serialized Form

Field Summary
protected  java.awt.Color _bgColor
          The color of the space between the lines.
protected  java.awt.Color _lineColor
          The color of the grid lines
 
Fields inherited from class org.tigris.gef.base.Layer
_editors, _onMenu
 
Constructor Summary
LayerPolar()
          Construct a new LayerPolar and name it "Grid".
LayerPolar(int x, int y, int s)
          Make a new LayerPolar with the given origin and spacing
 
Method Summary
 void adjust()
          Change the appearance of this layer: vary the spacing and origin.
 java.awt.Color bgColor()
           
 void bgColor(java.awt.Color c)
           
 int dist(int x, int y)
          return the integer distance between a given point and the origin
 java.util.Collection getContents(java.util.Collection c)
          Get the figs that make up this layer.
 java.awt.Color lineColor()
           
 void lineColor(java.awt.Color c)
           
 void origin(int x, int y)
          Set the origin
 void paintContents(java.awt.Graphics g)
          Paint concentric circles around the origin with each circle a certain spacing from the previous one
 Fig presentationFor(java.lang.Object obj)
          Given an object from the net-level model (e.g., NetNode or NetPort), reply the graphical depiction of that object in this layer, if there is one.
 void spacing(int s)
          Set the spacing between lines
 
Methods inherited from class org.tigris.gef.base.Layer
add, addEditor, bringForward, bringInFrontOf, bringToFront, calcDrawingArea, clone, damageAll, deleted, elements, elementsIn, getContents, getContentsEdgesOnly, getContentsNoEdges, getEditors, getGrayed, getHidden, getLocked, getName, getOnMenu, getPerspectiveType, getScale, hit, isAlwaysOnTop, nodesIn, paint, paint, paintContents, paintGrayContents, postLoad, postSave, preSave, print, refreshEditors, remove, removeAll, removeEditor, reorder, sendBackward, sendToBack, setAlwaysOnTop, setGrayed, setHidden, setLocked, setName, setOnMenu, setPerspectiveType, setScale, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_lineColor

protected java.awt.Color _lineColor
The color of the grid lines


_bgColor

protected java.awt.Color _bgColor
The color of the space between the lines.

Needs-More-Work: null should mean the space between the lines is transparent. But that does not work with image stamps.

Constructor Detail

LayerPolar

public LayerPolar()
Construct a new LayerPolar and name it "Grid". Needs-More-Work: maybe the 'grid' should be named 'drawing guide' instead of 'grid' since 'grid' implies rectilinearity.


LayerPolar

public LayerPolar(int x,
                  int y,
                  int s)
Make a new LayerPolar with the given origin and spacing

Method Detail

origin

public void origin(int x,
                   int y)
Set the origin


spacing

public void spacing(int s)
Set the spacing between lines


dist

public int dist(int x,
                int y)
return the integer distance between a given point and the origin


lineColor

public void lineColor(java.awt.Color c)

lineColor

public java.awt.Color lineColor()

bgColor

public void bgColor(java.awt.Color c)

bgColor

public java.awt.Color bgColor()

getContents

public java.util.Collection getContents(java.util.Collection c)
Description copied from class: Layer
Get the figs that make up this layer.

Specified by:
getContents in class Layer
Parameters:
c - the collection in which to place the edges or null if a new collection should be created
Returns:
the figs

presentationFor

public Fig presentationFor(java.lang.Object obj)
Description copied from class: Layer
Given an object from the net-level model (e.g., NetNode or NetPort), reply the graphical depiction of that object in this layer, if there is one. Otherwise reply null.

Specified by:
presentationFor in class Layer

paintContents

public void paintContents(java.awt.Graphics g)
Paint concentric circles around the origin with each circle a certain spacing from the previous one

Specified by:
paintContents in class Layer

adjust

public void adjust()
Change the appearance of this layer: vary the spacing and origin. Needs-More-Work: should put up a dialog to ask the user to specify some parameters

Overrides:
adjust in class Layer
See Also:
LayerGrid