Class DefaultFigureCollection

java.lang.Object
com.bc.ceres.swing.figure.AbstractFigure
com.bc.ceres.swing.figure.support.DefaultFigureCollection
All Implemented Interfaces:
Figure, FigureCollection, Restorable, Cloneable
Direct Known Subclasses:
DefaultFigureSelection

public class DefaultFigureCollection extends AbstractFigure implements FigureCollection
  • Constructor Details

    • DefaultFigureCollection

      public DefaultFigureCollection()
    • DefaultFigureCollection

      public DefaultFigureCollection(Figure[] figures)
  • Method Details

    • isSelectable

      public boolean isSelectable()
      Description copied from class: AbstractFigure
      The default implementation returns false.
      Specified by:
      isSelectable in interface Figure
      Overrides:
      isSelectable in class AbstractFigure
      Returns:
      Always false.
    • isSelected

      public boolean isSelected()
      Description copied from interface: Figure
      Tests if the figure is selected.
      Specified by:
      isSelected in interface Figure
      Overrides:
      isSelected in class AbstractFigure
      Returns:
      true, if so.
    • setSelected

      public void setSelected(boolean selected)
      Description copied from interface: Figure
      Sets the selected state.
      Specified by:
      setSelected in interface Figure
      Overrides:
      setSelected in class AbstractFigure
      Parameters:
      selected - The selected state.
    • 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.
    • getRank

      public Figure.Rank getRank()
      Specified by:
      getRank in interface Figure
      Returns:
      The figure's rank.
    • 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
    • clone

      public Object clone()
      Specified by:
      clone in interface Figure
      Overrides:
      clone in class AbstractFigure
      Returns:
      A clone of this figure.
    • getMaxSelectionStage

      public int getMaxSelectionStage()
      Description copied from class: AbstractFigure
      The default implementation returns zero.
      Specified by:
      getMaxSelectionStage in interface Figure
      Overrides:
      getMaxSelectionStage in class AbstractFigure
      Returns:
      Always 0.
    • createHandles

      public Handle[] createHandles(int selectionStage)
      Description copied from class: AbstractFigure
      The default implementation returns an empty array. Clients should override in order to create an array of handles suitable for the given selection stage.
      Specified by:
      createHandles in interface Figure
      Overrides:
      createHandles in class AbstractFigure
      Parameters:
      selectionStage - The selection stage. 1 <= selectionLevel <= AbstractFigure.getMaxSelectionStage()
      Returns:
      The array of handles.
    • 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.
    • contains

      public boolean contains(Figure figure)
      Description copied from class: AbstractFigure
      The default implementation returns false.
      Specified by:
      contains in interface Figure
      Overrides:
      contains in class AbstractFigure
      Parameters:
      figure - A figure.
      Returns:
      Always false.
    • getFigureCount

      public int getFigureCount()
      Description copied from class: AbstractFigure
      The default implementation returns 0.
      Specified by:
      getFigureCount in interface Figure
      Overrides:
      getFigureCount in class AbstractFigure
      Returns:
      Always 0.
    • getFigureIndex

      public int getFigureIndex(Figure figure)
      Description copied from class: AbstractFigure
      The default implementation returns 0.
      Specified by:
      getFigureIndex in interface Figure
      Overrides:
      getFigureIndex in class AbstractFigure
      Parameters:
      figure - The child figure to look up.
      Returns:
      Always 0.
    • getFigure

      public Figure getFigure(int index)
      Description copied from class: AbstractFigure
      The default implementation throws an [@code IllegalStateException}.
      Specified by:
      getFigure in interface Figure
      Overrides:
      getFigure in class AbstractFigure
      Parameters:
      index - The child index.
      Returns:
      Does never return normally.
    • getFigure

      public Figure getFigure(Point2D p, AffineTransform m2v)
      Description copied from class: AbstractFigure
      The default implementation returns null.
      Specified by:
      getFigure in interface Figure
      Overrides:
      getFigure in class AbstractFigure
      Parameters:
      p - Point in model coordinates.
      m2v - Current model-to-view transformation.
      Returns:
      Always null.
    • getFigures

      public Figure[] getFigures(Shape shape)
      Description copied from class: AbstractFigure
      The default implementation returns an empty array.
      Specified by:
      getFigures in interface Figure
      Overrides:
      getFigures in class AbstractFigure
      Parameters:
      shape - The shape defining the area in which the figures must be contained.
      Returns:
      Always an empty array.
    • getFigures

      public Figure[] getFigures()
      Description copied from class: AbstractFigure
      The default implementation returns an empty array.
      Specified by:
      getFigures in interface Figure
      Overrides:
      getFigures in class AbstractFigure
      Returns:
      Always an empty array.
    • addFigureImpl

      protected boolean addFigureImpl(Figure figure)
      Overrides:
      addFigureImpl in class AbstractFigure
    • addFigureImpl

      protected boolean addFigureImpl(int index, Figure figure)
      Description copied from class: AbstractFigure
      The default implementation throws an [@code IllegalStateException}.
      Overrides:
      addFigureImpl in class AbstractFigure
      Parameters:
      index - The index.
      figure - The figure.
      Returns:
      Does never return normally.
    • removeFigureImpl

      protected boolean removeFigureImpl(Figure figure)
      Description copied from class: AbstractFigure
      The default implementation throws an [@code IllegalStateException}.
      Overrides:
      removeFigureImpl in class AbstractFigure
      Parameters:
      figure - The figure.
      Returns:
      Does never return normally.
    • removeFiguresImpl

      protected Figure[] removeFiguresImpl()
      Overrides:
      removeFiguresImpl in class AbstractFigure
    • getBounds

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

      public void scale(Point2D refPoint, 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:
      refPoint - 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.
    • draw

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

      public Object createMemento()
      Description copied from class: AbstractFigure
      The default implementation returns [@code null}. Clients should override in order to produce something more meaningful.
      Specified by:
      createMemento in interface Restorable
      Overrides:
      createMemento in class AbstractFigure
      Returns:
      Always null.
    • setMemento

      public void setMemento(Object memento)
      Description copied from class: AbstractFigure
      The default implementation does nothing. Clients should override in order to evaluate the passed in memento. object.
      Specified by:
      setMemento in interface Restorable
      Overrides:
      setMemento in class AbstractFigure
      Parameters:
      memento - A memento object.
    • computeBounds

      protected Rectangle2D computeBounds()