Class Trail

All Implemented Interfaces:
Drawable, LogMeasurable, Measurable

public class Trail extends AbstractTrail implements LogMeasurable
Title: Trail Description: A trail of pixels on the screen. This object is often used to show the path of a moving object.
Version:
1.0
Author:
Wolfgang Christian
  • Field Details

  • Constructor Details

    • Trail

      public Trail()
  • Method Details

    • addPoint

      public void addPoint(double x, double y)
      Adds a point to the trail.
      Specified by:
      addPoint in class AbstractTrail
      Parameters:
      x - double
      y - double
    • moveToPoint

      public void moveToPoint(double x, double y)
      Starts a new trail segment by moving to a new point without drawing.
      Parameters:
      x - double
      y - double
    • closeTrail

      public void closeTrail()
      Closes the path by connecting the first point to the last point. Points cannot be added to a closed path;
      Specified by:
      closeTrail in class AbstractTrail
    • setConnected

      public void setConnected(boolean connected)
      Sets the connectd flag. Successive points are connetected by straight lines. Each point is marked as a colored pixel if the trail is not connected.
      Parameters:
      connected - boolean
    • isConnected

      public boolean isConnected()
      Gets the connected flag.
      Parameters:
      connected - boolean
    • clear

      public void clear()
      Clears all points from the trail.
      Specified by:
      clear in class AbstractTrail
    • draw

      public void draw(DrawingPanel panel, Graphics g)
      Draws the trail on the panel.
      Specified by:
      draw in interface Drawable
      Parameters:
      g -
    • getLoader

      public static XML.ObjectLoader getLoader()
      Returns the XML.ObjectLoader for this class.
      Returns:
      the object loader