Package com.bc.ceres.swing.figure
Class AbstractHandle
- java.lang.Object
-
- com.bc.ceres.swing.figure.AbstractFigure
-
- com.bc.ceres.swing.figure.AbstractHandle
-
- All Implemented Interfaces:
Figure,Handle,ShapeFigure,Restorable,Cloneable
- Direct Known Subclasses:
PointHandle,RotateHandle,ScaleHandle,VertexHandle
public abstract class AbstractHandle extends AbstractFigure implements Handle
The base class for allHandleimplementations.- 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 protectedAbstractHandle(Figure figure, FigureStyle normalStyle, FigureStyle selectedStyle)Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voiddispose()Disposes this figure.voiddraw(Rendering rendering)Draws this figure using the given rendering.protected voiddrawHandle(Graphics2D g)Rectangle2DgetBounds()The bounds of the handle.CursorgetCursor()FiguregetFigure()Point2DgetLocation()Figure.RankgetRank()ShapegetShape()Gets the shape (geometry) for this figure.doublegetX()doublegetY()booleanisCloseTo(Point2D point, AffineTransform m2v)Tests if the given point is "close to" this figure.booleanisCollection()Tests if this figure is a figure collection.booleanisSelectable()The default implementation returnstrue.abstract voidmove(double dx, double dy)Moves the figure by the given delta in model coordinates.voidsetLocation(double x, double y)voidsetLocation(Point2D location)voidsetShape(Shape shape)Sets the shape (geometry) for this figure.abstract voidupdateLocation()-
Methods inherited from class com.bc.ceres.swing.figure.AbstractFigure
addChangeListener, addFigure, addFigure, addFigureImpl, addFigureImpl, addFigures, addFiguresImpl, addSegment, clone, contains, createHandles, createMemento, createScaleHandles, fireFigureChanged, fireFigureChanged, fireFiguresAdded, fireFiguresRemoved, getChangeListeners, getEffectiveStyle, getFigure, getFigure, getFigureCount, getFigureIndex, getFigures, getFigures, getHandleStyle, getMaxSelectionStage, getNormalStyle, getSegment, getSelectedHandleStyle, getSelectedStyle, isSelected, removeAllFigures, removeChangeListener, removeFigure, removeFigureImpl, removeFigures, removeFiguresImpl, removeFiguresImpl, removeSegment, rotate, scale, 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, getChangeListeners, getEffectiveStyle, getFigure, getFigure, getFigureCount, getFigureIndex, getFigures, getFigures, getMaxSelectionStage, getNormalStyle, getSegment, getSelectedStyle, isSelected, removeAllFigures, removeChangeListener, removeFigure, removeFigures, removeSegment, rotate, scale, setNormalStyle, setSegment, setSelected, setSelectedStyle
-
Methods inherited from interface com.bc.ceres.swing.undo.Restorable
createMemento, setMemento
-
-
-
-
Constructor Detail
-
AbstractHandle
protected AbstractHandle(Figure figure, FigureStyle normalStyle, FigureStyle selectedStyle)
Constructor.- Parameters:
figure- The figure to which this handle belongs.normalStyle- The handle's normal style.selectedStyle- The handle's selected style.
-
-
Method Detail
-
getX
public double getX()
-
getY
public double getY()
-
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 interfaceHandle- Returns:
- The current location in model coordinates.
-
setLocation
public void setLocation(Point2D location)
-
setLocation
public void setLocation(double x, double y)
-
updateLocation
public abstract void updateLocation()
-
getFigure
public Figure getFigure()
- Returns:
- The figure to which this handle belongs.
-
getRank
public Figure.Rank getRank()
-
getShape
public Shape getShape()
Description copied from interface:HandleGets the shape (geometry) for this figure.- Specified by:
getShapein interfaceHandle- Specified by:
getShapein interfaceShapeFigure- Returns:
- The shape in view coordinates.
-
setShape
public void setShape(Shape shape)
Description copied from interface:HandleSets the shape (geometry) for this figure.- Specified by:
setShapein interfaceHandle- Specified by:
setShapein interfaceShapeFigure- Parameters:
shape- The shape in view coordinates.
-
getBounds
public Rectangle2D getBounds()
Description copied from interface:HandleThe bounds of the handle.
-
isSelectable
public boolean isSelectable()
The default implementation returnstrue.- Specified by:
isSelectablein interfaceFigure- Overrides:
isSelectablein classAbstractFigure- Returns:
- Always
true.
-
isCloseTo
public boolean isCloseTo(Point2D point, AffineTransform m2v)
Description copied from interface:FigureTests if the given point is "close to" this figure.
-
dispose
public void dispose()
Description copied from interface:FigureDisposes this figure. Indicates that it will no longer be used.- Specified by:
disposein interfaceFigure- Overrides:
disposein classAbstractFigure
-
getCursor
public Cursor getCursor()
-
move
public abstract 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.
-
draw
public final void draw(Rendering rendering)
Description copied from interface:FigureDraws this figure using the given rendering.
-
drawHandle
protected void drawHandle(Graphics2D g)
-
-