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 allHandle
implementations.- 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
AbstractHandle(Figure figure, FigureStyle normalStyle, FigureStyle selectedStyle)
Constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
dispose()
Disposes this figure.void
draw(Rendering rendering)
Draws this figure using the given rendering.protected void
drawHandle(Graphics2D g)
Rectangle2D
getBounds()
The bounds of the handle.Cursor
getCursor()
Figure
getFigure()
Point2D
getLocation()
Figure.Rank
getRank()
Shape
getShape()
Gets the shape (geometry) for this figure.double
getX()
double
getY()
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.boolean
isSelectable()
The default implementation returnstrue
.abstract void
move(double dx, double dy)
Moves the figure by the given delta in model coordinates.void
setLocation(double x, double y)
void
setLocation(Point2D location)
void
setShape(Shape shape)
Sets the shape (geometry) for this figure.abstract void
updateLocation()
-
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: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 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:Handle
Gets the shape (geometry) for this figure.- Specified by:
getShape
in interfaceHandle
- Specified by:
getShape
in interfaceShapeFigure
- Returns:
- The shape in view coordinates.
-
setShape
public void setShape(Shape shape)
Description copied from interface:Handle
Sets the shape (geometry) for this figure.- Specified by:
setShape
in interfaceHandle
- Specified by:
setShape
in interfaceShapeFigure
- Parameters:
shape
- The shape in view coordinates.
-
getBounds
public Rectangle2D getBounds()
Description copied from interface:Handle
The bounds of the handle.
-
isSelectable
public boolean isSelectable()
The default implementation returnstrue
.- Specified by:
isSelectable
in interfaceFigure
- Overrides:
isSelectable
in classAbstractFigure
- Returns:
- Always
true
.
-
isCloseTo
public boolean isCloseTo(Point2D point, AffineTransform m2v)
Description copied from interface:Figure
Tests if the given point is "close to" this figure.
-
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
-
getCursor
public Cursor getCursor()
-
move
public abstract 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.
-
draw
public final void draw(Rendering rendering)
Description copied from interface:Figure
Draws this figure using the given rendering.
-
drawHandle
protected void drawHandle(Graphics2D g)
-
-