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
public abstract class AbstractPointFigure extends AbstractFigure implements PointFigure
Base class for allPointFigure
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
Constructors Modifier Constructor Description protected
AbstractPointFigure(FigureStyle normalStyle, FigureStyle selectedStyle)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
draw(Rendering rendering)
Draws this figure using the given rendering.protected void
drawPoint(Rendering rendering)
Draws thesymbol
and other items that are used to graphically represent the figure, for example labels.Rectangle2D
getBounds()
FigureStyle
getEffectiveStyle()
Point2D
getLocation()
abstract double
getRadius()
Figure.Rank
getRank()
Symbol
getSymbol()
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
isCollection()
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
rotate(Point2D point, double theta)
Rotates the figure by the given angle.void
scale(Point2D point, double sx, double sy)
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 Detail
-
AbstractPointFigure
protected AbstractPointFigure(FigureStyle normalStyle, FigureStyle selectedStyle)
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 Detail
-
getSymbol
public Symbol 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
public Point2D getLocation()
- Specified by:
getLocation
in interfacePointFigure
- Returns:
- The current location in model coordinates.
-
setLocation
public void setLocation(Point2D location)
- 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
public final Figure.Rank getRank()
-
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 interfaceFigure
- Overrides:
scale
in classAbstractFigure
- 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 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
public Rectangle2D getBounds()
-
isCloseTo
public boolean isCloseTo(Point2D point, AffineTransform m2v)
Description copied from interface:Figure
Tests if the given point is "close to" this figure.
-
getEffectiveStyle
public FigureStyle getEffectiveStyle()
- Specified by:
getEffectiveStyle
in interfaceFigure
- Overrides:
getEffectiveStyle
in classAbstractFigure
- 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.
-
drawPoint
protected void drawPoint(Rendering rendering)
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.
-
-