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 allPointFigureimplementations.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 protectedAbstractPointFigure(FigureStyle normalStyle, FigureStyle selectedStyle)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddraw(Rendering rendering)Draws this figure using the given rendering.protected voiddrawPoint(Rendering rendering)Draws thesymboland other items that are used to graphically represent the figure, for example labels.Rectangle2DgetBounds()FigureStylegetEffectiveStyle()Point2DgetLocation()abstract doublegetRadius()Figure.RankgetRank()SymbolgetSymbol()Gets the symbol used for the current state of the figure.booleanisCloseTo(Point2D point, AffineTransform m2v)Tests if the given point is "close to" this figure.booleanisCollection()Tests if this figure is a figure collection.voidmove(double dx, double dy)Moves the figure by the given delta in model coordinates.voidrotate(Point2D point, double theta)Rotates the figure by the given angle.voidscale(Point2D point, double sx, double sy)Scales the figure by the given scale factors.abstract voidsetLocation(double x, double y)voidsetLocation(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:
getSymbolin interfacePointFigure- Returns:
- The symbol used to display the point.
-
isCollection
public boolean isCollection()
Description copied from interface:FigureTests if this figure is a figure collection.- Specified by:
isCollectionin interfaceFigure- Returns:
true, if so.
-
getLocation
public Point2D getLocation()
- Specified by:
getLocationin interfacePointFigure- Returns:
- The current location in model coordinates.
-
setLocation
public void setLocation(Point2D location)
- Specified by:
setLocationin 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:FigureScales the figure by the given scale factors.- Specified by:
scalein interfaceFigure- Overrides:
scalein 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:FigureRotates the figure by the given angle.- Specified by:
rotatein interfaceFigure- Overrides:
rotatein 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:FigureMoves the figure by the given delta in model coordinates.- Specified by:
movein interfaceFigure- Overrides:
movein 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:FigureTests if the given point is "close to" this figure.
-
getEffectiveStyle
public FigureStyle getEffectiveStyle()
- Specified by:
getEffectiveStylein interfaceFigure- Overrides:
getEffectiveStylein classAbstractFigure- Returns:
- The effective style used for the current state of the figure.
-
draw
public final void draw(Rendering rendering)
Description copied from interface:FigureDraws this figure using the given rendering.
-
drawPoint
protected void drawPoint(Rendering rendering)
Draws thesymboland 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.
-
-