Package com.bc.ceres.swing.figure
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
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
-
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
ConstructorsModifierConstructorDescriptionprotected
AbstractPointFigure
(FigureStyle normalStyle, FigureStyle selectedStyle) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Draws this figure using the given rendering.protected void
Draws thesymbol
and other items that are used to graphically represent the figure, for example labels.abstract double
final Figure.Rank
getRank()
Gets the symbol used for the current state of the figure.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.void
move
(double dx, double dy) Moves the figure by the given delta in model coordinates.void
Rotates the figure by the given angle.void
Scales the figure by the given scale factors.abstract void
setLocation
(double x, double y) void
setLocation
(Point2D location) Methods inherited from class com.bc.ceres.swing.figure.AbstractFigure
addChangeListener, addFigure, addFigure, addFigureImpl, addFigureImpl, addFigures, addFiguresImpl, addSegment, clone, contains, createHandles, createMemento, createScaleHandles, dispose, fireFigureChanged, fireFigureChanged, fireFiguresAdded, fireFiguresRemoved, getChangeListeners, getFigure, getFigure, getFigureCount, getFigureIndex, getFigures, getFigures, getHandleStyle, getMaxSelectionStage, getNormalStyle, getSegment, getSelectedHandleStyle, getSelectedStyle, isSelectable, isSelected, removeAllFigures, removeChangeListener, removeFigure, removeFigureImpl, removeFigures, removeFiguresImpl, removeFiguresImpl, removeSegment, setMemento, setNormalStyle, setSegment, setSelectable, setSelected, 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, clone, contains, createHandles, dispose, getChangeListeners, getFigure, getFigure, getFigureCount, getFigureIndex, getFigures, getFigures, getMaxSelectionStage, getNormalStyle, getSegment, getSelectedStyle, isSelectable, isSelected, removeAllFigures, removeChangeListener, removeFigure, removeFigures, removeSegment, setNormalStyle, setSegment, setSelected, setSelectedStyle
Methods inherited from interface com.bc.ceres.swing.figure.PointFigure
getX, getY
Methods inherited from interface com.bc.ceres.swing.undo.Restorable
createMemento, setMemento
-
Constructor Details
-
AbstractPointFigure
Constructor. The rank will always beFigure.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
Gets the symbol used for the current state of the figure.- Specified by:
getSymbol
in interfacePointFigure
- 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 interfaceFigure
- Returns:
true
, if so.
-
getLocation
- Specified by:
getLocation
in interfacePointFigure
- Returns:
- The current location in model coordinates.
-
setLocation
- Specified by:
setLocation
in interfacePointFigure
- 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
-
scale
Description copied from interface:Figure
Scales the figure by the given scale factors.- Specified by:
scale
in interfaceFigure
- Overrides:
scale
in classAbstractFigure
- Parameters:
point
- 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.
-
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.
-
getBounds
-
isCloseTo
Description copied from interface:Figure
Tests if the given point is "close to" this figure. -
getEffectiveStyle
- Specified by:
getEffectiveStyle
in interfaceFigure
- Overrides:
getEffectiveStyle
in classAbstractFigure
- Returns:
- The effective style used for the current state of the figure.
-
draw
Description copied from interface:Figure
Draws this figure using the given rendering. -
drawPoint
Draws thesymbol
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.
-