Class AbstractDrawable

java.lang.Object
org.ka2ddo.yaac.gui.drawlayer.AbstractDrawable
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Polyline

public abstract class AbstractDrawable extends Object implements Serializable
This abstract class defines common attributes and methods for a drawable object in the DrawLayer.
Author:
Andrew Pavlin, KA2DDO
See Also:
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Create an AbstractDrawable.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    Get the color for rendering lines in this drawable.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public Color getLineColor()
      Get the color for rendering lines in this drawable.
      Returns:
      Color of this object
    • setLineColor

      public void setLineColor(Color lineColor)
      Set the color for rendering lines in this drawable.
      Parameters:
      lineColor - Color for rendering this object
    • getName

      public String getName()
      Get the name associated with this object (usually used for tooltips).
      Returns:
      String name of this object
    • setName

      public void setName(String name)
      Set the name associated with this object (usually used for tooltips).
      Parameters:
      name - String name for this drawable
    • getStroke

      public BasicStroke getStroke()
      Get the Stroke used to draw lines in this drawable.
      Returns:
      BasicStroke of this drawable
    • getStrokeType

      public String getStrokeType()
      Get the name of the generic stroke type in this drawable.
      Returns:
      name of stroke type
    • setStroke

      public void setStroke(BasicStroke stroke, 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(Graphics2D g, com.bbn.openmap.proj.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, com.bbn.openmap.proj.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 String paramString()
      Return description of this object for including in a toString() method's answer.
      Returns:
      descriptive String