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
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.bc.ceres.swing.figure.Figure
Figure.Rank
-
Field Summary
Fields inherited from class com.bc.ceres.swing.figure.AbstractFigure
NO_FIGURES, NO_HANDLES
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
addFigureImpl
(int index, Figure figure) The default implementation throws an [@code IllegalStateException}.protected boolean
addFigureImpl
(Figure figure) clone()
protected Rectangle2D
boolean
The default implementation returnsfalse
.Handle[]
createHandles
(int selectionStage) The default implementation returns an empty array.The default implementation returns [@code null}.void
dispose()
Disposes this figure.void
Draws this figure using the given rendering.getFigure
(int index) The default implementation throws an [@code IllegalStateException}.getFigure
(Point2D p, AffineTransform m2v) The default implementation returnsnull
.int
The default implementation returns0
.int
getFigureIndex
(Figure figure) The default implementation returns0
.Figure[]
The default implementation returns an empty array.Figure[]
getFigures
(Shape shape) The default implementation returns an empty array.int
The default implementation returns zero.getRank()
boolean
isCloseTo
(Point2D point, AffineTransform m2v) Tests if the given point is "close to" this figure.boolean
Tests if this figure is a figure collection.boolean
The default implementation returnsfalse
.boolean
Tests if the figure is selected.void
move
(double dx, double dy) Moves the figure by the given delta in model coordinates.protected boolean
removeFigureImpl
(Figure figure) The default implementation throws an [@code IllegalStateException}.protected Figure[]
void
Rotates the figure by the given angle.void
Scales the figure by the given scale factors.void
setMemento
(Object memento) The default implementation does nothing.void
setSelected
(boolean selected) Sets the selected state.Methods inherited from class com.bc.ceres.swing.figure.AbstractFigure
addChangeListener, addFigure, addFigure, addFigures, addFiguresImpl, addSegment, createScaleHandles, fireFigureChanged, fireFigureChanged, fireFiguresAdded, fireFiguresRemoved, getChangeListeners, getEffectiveStyle, getHandleStyle, getNormalStyle, getSegment, getSelectedHandleStyle, getSelectedStyle, removeAllFigures, removeChangeListener, removeFigure, removeFigures, removeFiguresImpl, removeSegment, setNormalStyle, setSegment, setSelectable, setSelectedStyle
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.bc.ceres.swing.figure.Figure
addChangeListener, addFigure, addFigure, addFigures, addSegment, getChangeListeners, getEffectiveStyle, getNormalStyle, getSegment, getSelectedStyle, removeAllFigures, removeChangeListener, removeFigure, removeFigures, removeSegment, setNormalStyle, setSegment, setSelectedStyle
-
Constructor Details
-
DefaultFigureCollection
public DefaultFigureCollection() -
DefaultFigureCollection
-
-
Method Details
-
isSelectable
public boolean isSelectable()Description copied from class:AbstractFigure
The default implementation returnsfalse
.- Specified by:
isSelectable
in interfaceFigure
- Overrides:
isSelectable
in classAbstractFigure
- Returns:
- Always
false
.
-
isSelected
public boolean isSelected()Description copied from interface:Figure
Tests if the figure is selected.- Specified by:
isSelected
in interfaceFigure
- Overrides:
isSelected
in classAbstractFigure
- Returns:
true
, if so.
-
setSelected
public void setSelected(boolean selected) Description copied from interface:Figure
Sets the selected state.- Specified by:
setSelected
in interfaceFigure
- Overrides:
setSelected
in classAbstractFigure
- 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 interfaceFigure
- Returns:
true
, if so.
-
getRank
-
dispose
public void dispose()Description copied from interface:Figure
Disposes this figure. Indicates that it will no longer be used.- Specified by:
dispose
in interfaceFigure
- Overrides:
dispose
in classAbstractFigure
-
clone
- Specified by:
clone
in interfaceFigure
- Overrides:
clone
in classAbstractFigure
- Returns:
- A clone of this figure.
-
getMaxSelectionStage
public int getMaxSelectionStage()Description copied from class:AbstractFigure
The default implementation returns zero.- Specified by:
getMaxSelectionStage
in interfaceFigure
- Overrides:
getMaxSelectionStage
in classAbstractFigure
- Returns:
- Always
0
.
-
createHandles
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 interfaceFigure
- Overrides:
createHandles
in classAbstractFigure
- Parameters:
selectionStage
- The selection stage.1 <= selectionLevel <=
AbstractFigure.getMaxSelectionStage()
- Returns:
- The array of handles.
-
isCloseTo
Description copied from interface:Figure
Tests if the given point is "close to" this figure. -
contains
Description copied from class:AbstractFigure
The default implementation returnsfalse
.- Specified by:
contains
in interfaceFigure
- Overrides:
contains
in classAbstractFigure
- Parameters:
figure
- A figure.- Returns:
- Always
false
.
-
getFigureCount
public int getFigureCount()Description copied from class:AbstractFigure
The default implementation returns0
.- Specified by:
getFigureCount
in interfaceFigure
- Overrides:
getFigureCount
in classAbstractFigure
- Returns:
- Always
0
.
-
getFigureIndex
Description copied from class:AbstractFigure
The default implementation returns0
.- Specified by:
getFigureIndex
in interfaceFigure
- Overrides:
getFigureIndex
in classAbstractFigure
- Parameters:
figure
- The child figure to look up.- Returns:
- Always
0
.
-
getFigure
Description copied from class:AbstractFigure
The default implementation throws an [@code IllegalStateException}.- Specified by:
getFigure
in interfaceFigure
- Overrides:
getFigure
in classAbstractFigure
- Parameters:
index
- The child index.- Returns:
- Does never return normally.
-
getFigure
Description copied from class:AbstractFigure
The default implementation returnsnull
.- Specified by:
getFigure
in interfaceFigure
- Overrides:
getFigure
in classAbstractFigure
- Parameters:
p
- Point in model coordinates.m2v
- Current model-to-view transformation.- Returns:
- Always
null
.
-
getFigures
Description copied from class:AbstractFigure
The default implementation returns an empty array.- Specified by:
getFigures
in interfaceFigure
- Overrides:
getFigures
in classAbstractFigure
- Parameters:
shape
- The shape defining the area in which the figures must be contained.- Returns:
- Always an empty array.
-
getFigures
Description copied from class:AbstractFigure
The default implementation returns an empty array.- Specified by:
getFigures
in interfaceFigure
- Overrides:
getFigures
in classAbstractFigure
- Returns:
- Always an empty array.
-
addFigureImpl
- Overrides:
addFigureImpl
in classAbstractFigure
-
addFigureImpl
Description copied from class:AbstractFigure
The default implementation throws an [@code IllegalStateException}.- Overrides:
addFigureImpl
in classAbstractFigure
- Parameters:
index
- The index.figure
- The figure.- Returns:
- Does never return normally.
-
removeFigureImpl
Description copied from class:AbstractFigure
The default implementation throws an [@code IllegalStateException}.- Overrides:
removeFigureImpl
in classAbstractFigure
- Parameters:
figure
- The figure.- Returns:
- Does never return normally.
-
removeFiguresImpl
- Overrides:
removeFiguresImpl
in classAbstractFigure
-
getBounds
-
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 interfaceFigure
- Overrides:
move
in classAbstractFigure
- Parameters:
dx
- Delta X in model coordinates.dy
- Delta Y in model coordinates.
-
scale
Description copied from interface:Figure
Scales the figure by the given scale factors.- Specified by:
scale
in interfaceFigure
- Overrides:
scale
in classAbstractFigure
- Parameters:
refPoint
- The reference point in model coordinates.sx
- Scale X factor.sy
- Scale Y factor.
-
rotate
Description copied from interface:Figure
Rotates the figure by the given angle.- Specified by:
rotate
in interfaceFigure
- Overrides:
rotate
in classAbstractFigure
- Parameters:
point
- The reference point in model coordinates.theta
- The rotation angle in degree.
-
draw
Description copied from interface:Figure
Draws this figure using the given rendering. -
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 interfaceRestorable
- Overrides:
createMemento
in classAbstractFigure
- Returns:
- Always
null
.
-
setMemento
Description copied from class:AbstractFigure
The default implementation does nothing. Clients should override in order to evaluate the passed inmemento
. object.- Specified by:
setMemento
in interfaceRestorable
- Overrides:
setMemento
in classAbstractFigure
- Parameters:
memento
- A memento object.
-
computeBounds
-