Class AbstractPointFigure

java.lang.Object
com.bc.ceres.swing.figure.AbstractFigure
com.bc.ceres.swing.figure.AbstractPointFigure
All Implemented Interfaces:
Figure, PointFigure, Restorable, Cloneable
Direct Known Subclasses:
DefaultPointFigure

public abstract class AbstractPointFigure extends AbstractFigure implements PointFigure
Base class for all PointFigure implementations.

Sub-classes have to provide the location and radius of the point in model coordinates.

Since:
Ceres 0.10
  • Constructor Details

    • AbstractPointFigure

      protected AbstractPointFigure(FigureStyle normalStyle, FigureStyle selectedStyle)
      Constructor. The rank will always be Figure.Rank.POINT.
      Parameters:
      normalStyle - The style used for the "normal" state of the figure.
      selectedStyle - The style used for the "selected" state of the figure.
  • Method Details

    • getSymbol

      public Symbol getSymbol()
      Gets the symbol used for the current state of the figure.
      Specified by:
      getSymbol in interface PointFigure
      Returns:
      The symbol used to display the point.
    • 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 PointFigure
      Returns:
      The current location in model coordinates.
    • setLocation

      public void setLocation(Point2D location)
      Specified by:
      setLocation in interface PointFigure
      Parameters:
      location - The current location in model coordinates.
    • setLocation

      public abstract void setLocation(double x, double y)
    • getRadius

      public abstract double getRadius()
      Returns:
      The point radius in model coordinates.
    • getRank

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

      public void scale(Point2D point, double sx, double sy)
      Description copied from interface: Figure
      Scales the figure by the given scale factors.
      Specified by:
      scale in interface Figure
      Overrides:
      scale in class AbstractFigure
      Parameters:
      point - The reference point in model coordinates.
      sx - Scale X factor.
      sy - Scale Y factor.
    • rotate

      public void rotate(Point2D point, double theta)
      Description copied from interface: Figure
      Rotates the figure by the given angle.
      Specified by:
      rotate in interface Figure
      Overrides:
      rotate in class AbstractFigure
      Parameters:
      point - The reference point in model coordinates.
      theta - The rotation angle in degree.
    • move

      public 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.
    • getBounds

      public Rectangle2D getBounds()
      Specified by:
      getBounds in interface Figure
      Returns:
      The figure bounds in model coordinates.
    • 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.
    • getEffectiveStyle

      public FigureStyle getEffectiveStyle()
      Specified by:
      getEffectiveStyle in interface Figure
      Overrides:
      getEffectiveStyle in class AbstractFigure
      Returns:
      The effective style used for the current state of the figure.
    • 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.
    • drawPoint

      protected void drawPoint(Rendering rendering)
      Draws the symbol and other items that are used to graphically represent the figure, for example labels. For convenience, the rendering's drawing context is translated by the point's location, so that drawing of items can be performed in symbol coordinates using view units.
      Parameters:
      rendering - The rendering.