org.ka2ddo.yaac.gui.drawlayer
Class AbstractDrawable

java.lang.Object
  extended by org.ka2ddo.yaac.gui.drawlayer.AbstractDrawable
Direct Known Subclasses:
Polyline

public abstract class AbstractDrawable
extends java.lang.Object

This class defines common attributes and methods for a drawable object in the DrawLayer.


Constructor Summary
protected AbstractDrawable()
           
 
Method Summary
abstract  float distance(int x, int y, Projection proj)
          This computes the nearest distance from this drawable to the specified pixel coordinates.
 java.awt.Color getLineColor()
          Get the color for rendering lines in this drawable.
 java.lang.String getName()
          Get the name associated with this object (usually used for tooltips).
 java.awt.BasicStroke getStroke()
          Get the Stroke used to draw lines in this drawable.
 java.lang.String getStrokeType()
          Get the name of the generic stroke type in this drawable.
abstract  void paintDrawable(java.awt.Graphics2D g, Projection proj)
          Render this drawable upon a canvas using the specified Graphics and Projection.
protected  java.lang.String paramString()
          Return description of this object for including in a toString() method's answer.
 void setLineColor(java.awt.Color lineColor)
          Set the color for rendering lines in this drawable.
 void setName(java.lang.String name)
          Set the name associated with this object (usually used for tooltips).
 void setStroke(java.awt.BasicStroke stroke, java.lang.String strokeType)
          Set the Stroke used to draw lines in this drawable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDrawable

protected AbstractDrawable()
Method Detail

getLineColor

public java.awt.Color getLineColor()
Get the color for rendering lines in this drawable.

Returns:
Color of this object

setLineColor

public void setLineColor(java.awt.Color lineColor)
Set the color for rendering lines in this drawable.

Parameters:
lineColor - Color for rendering this object

getName

public java.lang.String getName()
Get the name associated with this object (usually used for tooltips).

Returns:
String name of this object

setName

public void setName(java.lang.String name)
Set the name associated with this object (usually used for tooltips).

Parameters:
name - String name for this drawable

getStroke

public java.awt.BasicStroke getStroke()
Get the Stroke used to draw lines in this drawable.

Returns:
BasicStroke of this drawable

getStrokeType

public java.lang.String getStrokeType()
Get the name of the generic stroke type in this drawable.

Returns:
name of stroke type

setStroke

public void setStroke(java.awt.BasicStroke stroke,
                      java.lang.String strokeType)
Set the Stroke used to draw lines in this drawable.

Parameters:
stroke - BasicStroke for this drawable
strokeType - name of this kind of stroke, regardless of scaling

paintDrawable

public abstract void paintDrawable(java.awt.Graphics2D g,
                                   Projection proj)
Render this drawable upon a canvas using the specified Graphics and Projection.

Parameters:
g - Graphics2D object for rendering the drawable
proj - Projection for translating geographic coordinates of the drawable

distance

public abstract float distance(int x,
                               int y,
                               Projection proj)
This computes the nearest distance from this drawable to the specified pixel coordinates.

Parameters:
x - int pixel X-coordinate
y - int pixel Y-coordinate
proj - Projection to translate drawable into screen space
Returns:
distance in pixels

paramString

protected java.lang.String paramString()
Return description of this object for including in a toString() method's answer.

Returns:
descriptive String