Package org.ka2ddo.yaac.gui.drawlayer
Class AbstractDrawable
java.lang.Object
org.ka2ddo.yaac.gui.drawlayer.AbstractDrawable
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Polyline
This abstract class defines common attributes and methods for a drawable object in the
DrawLayer.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract float
distance
(int x, int y, com.bbn.openmap.proj.Projection proj) This computes the nearest distance from this drawable to the specified pixel coordinates.Get the color for rendering lines in this drawable.getName()
Get the name associated with this object (usually used for tooltips).Get the Stroke used to draw lines in this drawable.Get the name of the generic stroke type in this drawable.abstract void
paintDrawable
(Graphics2D g, com.bbn.openmap.proj.Projection proj) Render this drawable upon a canvas using the specified Graphics and Projection.protected String
Return description of this object for including in a toString() method's answer.void
setLineColor
(Color lineColor) Set the color for rendering lines in this drawable.void
Set the name associated with this object (usually used for tooltips).void
setStroke
(BasicStroke stroke, String strokeType) Set the Stroke used to draw lines in this drawable.
-
Constructor Details
-
AbstractDrawable
protected AbstractDrawable()Create an AbstractDrawable. This constructor does nothing; all the work is expected to be provided by subclass constructors.
-
-
Method Details
-
getLineColor
Get the color for rendering lines in this drawable.- Returns:
- Color of this object
-
setLineColor
Set the color for rendering lines in this drawable.- Parameters:
lineColor
- Color for rendering this object
-
getName
Get the name associated with this object (usually used for tooltips).- Returns:
- String name of this object
-
setName
Set the name associated with this object (usually used for tooltips).- Parameters:
name
- String name for this drawable
-
getStroke
Get the Stroke used to draw lines in this drawable.- Returns:
- BasicStroke of this drawable
-
getStrokeType
Get the name of the generic stroke type in this drawable.- Returns:
- name of stroke type
-
setStroke
Set the Stroke used to draw lines in this drawable.- Parameters:
stroke
- BasicStroke for this drawablestrokeType
- name of this kind of stroke, regardless of scaling
-
paintDrawable
Render this drawable upon a canvas using the specified Graphics and Projection.- Parameters:
g
- Graphics2D object for rendering the drawableproj
- Projection for translating geographic coordinates of the drawable
-
distance
public abstract float distance(int x, int y, com.bbn.openmap.proj.Projection proj) This computes the nearest distance from this drawable to the specified pixel coordinates.- Parameters:
x
- int pixel X-coordinatey
- int pixel Y-coordinateproj
- Projection to translate drawable into screen space- Returns:
- distance in pixels
-
paramString
Return description of this object for including in a toString() method's answer.- Returns:
- descriptive String
-