Class AbstractHandle

java.lang.Object
com.bc.ceres.swing.figure.AbstractFigure
com.bc.ceres.swing.figure.AbstractHandle
All Implemented Interfaces:
Figure, Handle, ShapeFigure, Restorable, Cloneable
Direct Known Subclasses:
PointHandle, RotateHandle, ScaleHandle, VertexHandle

public abstract class AbstractHandle extends AbstractFigure implements Handle
The base class for all Handle implementations.
Since:
Ceres 0.10
  • Constructor Details

    • AbstractHandle

      protected AbstractHandle(Figure figure, FigureStyle normalStyle, FigureStyle selectedStyle)
      Constructor.
      Parameters:
      figure - The figure to which this handle belongs.
      normalStyle - The handle's normal style.
      selectedStyle - The handle's selected style.
  • Method Details

    • getX

      public double getX()
    • getY

      public double getY()
    • isCollection

      public boolean isCollection()
      Description copied from interface: Figure
      Tests if this figure is a figure collection.
      Specified by:
      isCollection in interface Figure
      Returns:
      true, if so.
    • getLocation

      public Point2D getLocation()
      Specified by:
      getLocation in interface Handle
      Returns:
      The current location in model coordinates.
    • setLocation

      public void setLocation(Point2D location)
    • setLocation

      public void setLocation(double x, double y)
    • updateLocation

      public abstract void updateLocation()
    • getFigure

      public Figure getFigure()
      Returns:
      The figure to which this handle belongs.
    • getRank

      public Figure.Rank getRank()
      Specified by:
      getRank in interface Figure
      Returns:
      The figure's rank.
    • getShape

      public Shape getShape()
      Description copied from interface: Handle
      Gets the shape (geometry) for this figure.
      Specified by:
      getShape in interface Handle
      Specified by:
      getShape in interface ShapeFigure
      Returns:
      The shape in view coordinates.
    • setShape

      public void setShape(Shape shape)
      Description copied from interface: Handle
      Sets the shape (geometry) for this figure.
      Specified by:
      setShape in interface Handle
      Specified by:
      setShape in interface ShapeFigure
      Parameters:
      shape - The shape in view coordinates.
    • getBounds

      public Rectangle2D getBounds()
      Description copied from interface: Handle
      The bounds of the handle.
      Specified by:
      getBounds in interface Figure
      Specified by:
      getBounds in interface Handle
      Returns:
      The bounds of the handle in view units.
    • isSelectable

      public boolean isSelectable()
      The default implementation returns true.
      Specified by:
      isSelectable in interface Figure
      Overrides:
      isSelectable in class AbstractFigure
      Returns:
      Always true.
    • isCloseTo

      public boolean isCloseTo(Point2D point, AffineTransform m2v)
      Description copied from interface: Figure
      Tests if the given point is "close to" this figure.
      Specified by:
      isCloseTo in interface Figure
      Parameters:
      point - Point in model coordinates.
      m2v - Current model-to-view transformation.
      Returns:
      true, if the point is close to this figure.
    • dispose

      public void dispose()
      Description copied from interface: Figure
      Disposes this figure. Indicates that it will no longer be used.
      Specified by:
      dispose in interface Figure
      Overrides:
      dispose in class AbstractFigure
    • getCursor

      public Cursor getCursor()
      Specified by:
      getCursor in interface Handle
      Returns:
      The mouse cursor that will appear if users point the mouse over a handle.
    • move

      public abstract void move(double dx, double dy)
      Description copied from interface: Figure
      Moves the figure by the given delta in model coordinates.
      Specified by:
      move in interface Figure
      Overrides:
      move in class AbstractFigure
      Parameters:
      dx - Delta X in model coordinates.
      dy - Delta Y in model coordinates.
    • draw

      public final void draw(Rendering rendering)
      Description copied from interface: Figure
      Draws this figure using the given rendering.
      Specified by:
      draw in interface Figure
      Parameters:
      rendering - The rendering used to draw the figure.
    • drawHandle

      protected void drawHandle(Graphics2D g)