Class AbstractPointListShape

java.lang.Object
org.eclipse.draw2d.Figure
org.eclipse.draw2d.Shape
org.eclipse.draw2d.AbstractPointListShape
All Implemented Interfaces:
IFigure
Direct Known Subclasses:
PolygonShape, Polyline, PolylineShape, ScalablePolygonShape

public abstract class AbstractPointListShape extends Shape
Base superclass for all polylines/polygons
Since:
3.5
  • Constructor Details

    • AbstractPointListShape

      public AbstractPointListShape()
  • Method Details

    • containsPoint

      public boolean containsPoint(int x, int y)
      Description copied from interface: IFigure
      Returns true if the point (x, y) is contained within this IFigure's bounds.
      Specified by:
      containsPoint in interface IFigure
      Overrides:
      containsPoint in class Figure
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      Returns:
      true if the point (x,y) is contained in this IFigure's bounds
      See Also:
    • childrenContainsPoint

      protected boolean childrenContainsPoint(int x, int y)
      Returns true if the point (x, y) is contained within one of the child figures.
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      Returns:
      true if the point (x,y) is contained in one of the child figures
    • shapeContainsPoint

      protected abstract boolean shapeContainsPoint(int x, int y)
      Returns true if the point (x, y) is contained within this figure.
      Parameters:
      x - The X coordinate
      y - The Y coordinate
      Returns:
      true if the point (x,y) is contained in this figure
    • addPoint

      public void addPoint(Point pt)
      Adds the passed point to this figure.
      Parameters:
      pt - the Point to be added to this figure
    • getStart

      public Point getStart()
      Returns:
      the first point in this figure
    • getEnd

      public Point getEnd()
      Returns the last point in this Figure.
      Returns:
      the last point
    • getPoints

      public PointList getPoints()
      Returns the points in this figure by reference. If the returned list is modified, this figure must be informed by calling setPoints(PointList). Failure to do so will result in layout and paint problems.
      Returns:
      this Polyline's points
    • insertPoint

      public void insertPoint(Point pt, int index)
      Inserts a given point at a specified index in this figure.
      Parameters:
      pt - the point to be added
      index - the position in this figure where the point is to be added
    • removeAllPoints

      public void removeAllPoints()
      Erases this figure and removes all of its Points.
    • removePoint

      public void removePoint(int index)
      Removes a point from this figure.
      Parameters:
      index - the position of the point to be removed
    • setStart

      public void setStart(Point start)
      Sets the start point of this figure
      Parameters:
      start - the point that will become the first point in this figure
    • setEnd

      public void setEnd(Point end)
      Sets the end point of this figure
      Parameters:
      end - the point that will become the last point in this figure
    • setEndpoints

      public void setEndpoints(Point start, Point end)
      Sets the points at both extremes of this figure
      Parameters:
      start - the point to become the first point in this figure
      end - the point to become the last point in this figure
    • setPoint

      public void setPoint(Point pt, int index)
      Sets the point at index to the Point pt. If you're going to set multiple Points, use setPoints(PointList).
      Parameters:
      pt - the point
      index - the index
    • setPoints

      public void setPoints(PointList points)
      Sets the list of points to be used by this figure. Removes any previously existing points. This figure will hold onto the given list by reference.
      Parameters:
      points - new set of points