|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Cursor
jview.CanvasCursor
jview.CrossCursor
jview.DragCursor
jview.ZoomCursor
jview.ShapeCursor
public class ShapeCursor
This class stores a list of shapes, that can be selected, changed in size etc. It does so by listening to clicks on the canvas, as well as drags and mouse-wheel events.
| Nested Class Summary | |
|---|---|
static class |
ShapeCursor.Test
A test class for testing the layout |
| Nested classes/interfaces inherited from class jview.CrossCursor |
|---|
CrossCursor.Draw |
| Field Summary | |
|---|---|
private List<ShapeDraw> |
active
List of normalized shapes that have been added for selection lookup. |
private boolean |
changed
The boolean that gets true if a selected shape changed. |
static Color |
DEFDRAWCOLOR
The color, a shape is drawn after adding. |
static boolean |
DEFISFILLED
If the principal shape is filled. |
static boolean |
DEFISSCREENSHAPE
If the principal shape is on-screen. |
private static double |
DEFOFFSET
The maximal offset for erasing in normalized space. |
static Color |
DEFSELECTCOLOR
The highlight color, i.e. |
static String |
DEFSHAPE
The principal shape, parsable from a string. |
private Shape |
draw
The selected shape as it is drawn (i.e. |
private Shape |
generic
The generic shape this cursor supports at the moment. |
static String |
KEY_DRAWCOLOR
The color, a shape is drawn after adding. |
static String |
KEY_ISFILLED
If the principal shape is filled. |
static String |
KEY_ISSCREENSHAPE
If this is true, the generic shape is a on-screen representation. |
static String |
KEY_OFFSET
The select distance, normalized. |
static String |
KEY_SELECTCOLOR
The highlight color, i.e. |
static String |
KEY_SHAPE
The principal shape, parsable from a string. |
private ShapeDraw |
normgen
The normalized generic shape, equal to generic if not pixelized. |
private ShapeDraw |
selected
The current active shape, normalized. |
private static String |
SHAPE
The name for cursor objects added to the underlying canvas. |
static String |
SHAPEADDED
The name of the shape-added property. |
static String |
SHAPEDELETED
The name of the shape-deleteded property. |
static String |
SHAPESELECT
The name of the shape-select property. |
| Fields inherited from class jview.ZoomCursor |
|---|
DEFCURSORNAME, KEY_ALLOWSHIFT, KEY_ALLOWWHEEL, KEY_SHIFTFACTOR, KEY_WHEELZOOM, RETRACE, REVERT |
| Fields inherited from class jview.DragCursor |
|---|
KEY_ANGLESIZE, KEY_SHOWANGLE, KEY_SHOWDELTAX, KEY_SHOWDELTAY, KEY_SHOWDISTANCE, KEY_SHOWSTART |
| Fields inherited from class jview.CrossCursor |
|---|
cursorcolor, KEY_ALLOWDRAG, KEY_PERSISTENT, KEY_SHOWCOORDINATE, KEY_SINGLEPERSIST, KEY_XSHIFT, KEY_YSHIFT, lastcenter, lastposition, xformat, yformat |
| Fields inherited from class jview.CanvasCursor |
|---|
canvas, DEFCURSORCOLOR, KEY_COORDINATES, KEY_CURSORCOLOR, KEY_CURSORNAME, KEY_CURSORSIZE, NORMALIZED, NORMALIZEDACTION, SCREEN, SCREENACTION, USER, USERACTION |
| Fields inherited from class java.awt.Cursor |
|---|
CROSSHAIR_CURSOR, CUSTOM_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, MOVE_CURSOR, N_RESIZE_CURSOR, name, NE_RESIZE_CURSOR, NW_RESIZE_CURSOR, predefined, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR |
| Constructor Summary | |
|---|---|
ShapeCursor(PropertySupplying prop)
Constructs a new shape cursor that can be assigned to JNormalizedCanvas. |
|
| Method Summary | |
|---|---|
void |
complete(Graphics g)
This method is called directly before component.update. |
private Shape |
createGenericShape(PropertySupplying info)
Returns the generic shape this cursor controls in normalized coordinates. |
void |
disableCanvas()
We remove ourselfs from the post-drawing. |
void |
enableCanvas(JNormalizedCanvas root)
Assigns the JShapeCanvas to the cursor. |
Shape |
getGenericShape()
Returns the current generic shape, as set prior to eventual normalization. |
void |
init()
Initializes the zoom cursor. |
void |
mouseClicked(MouseEvent me)
Clicking close to a shape activates this shape, otherwise a new shape is generated. |
void |
mouseMoved(MouseEvent me)
Mouse moving move also the currently selected shape, if there is one. |
void |
mouseWheelMoved(MouseWheelEvent we)
Grabs mouse wheel events. |
private void |
paintShape(Shape screen,
Graphics onto)
Draw the shape in the XOR color. |
private void |
rescaleShape(double zx,
double zy,
Graphics onto)
Rescales the current active shape after a drag or a mouse-wheel. |
void |
reset()
Clears any last draws. |
private static ShapeDraw |
scan(List<ShapeDraw> recent,
Point2D within,
double maxdist)
Scans in normalized coordinates whether we have a shape recently added. |
void |
setComposedProperties(PropertySupplying info)
Compose with a PropertySupplying as we need subclassing Cursor. |
void |
setGenericShape(Shape gen,
boolean pixel,
boolean filled)
Sets the generic shape. |
private ShapeDraw |
toNormalized(Shape screen,
boolean fill)
After shifting and scaling, we have a shape in screen coordinates that should be transferred to normalized coordinates so that we can add it to the underlying canvas. |
| Methods inherited from class jview.ZoomCursor |
|---|
dragSelect, getActions, getRetraceAction, getRevertAction, mouseDragged, mousePressed, mouseReleased, zoomFactor |
| Methods inherited from class jview.DragCursor |
|---|
clearOnRepaint, mouseEntered |
| Methods inherited from class jview.CrossCursor |
|---|
drawCross, drawPosition, getCoordinateLabel, getCoordinates, getCoordinatesPair, mouseExited, setCoordinateFormat, setCoordinateLabel |
| Methods inherited from class jview.CanvasCursor |
|---|
getComposedProperties, getCursorName, getCursorShape, getCustomized, getNormalizedAction, getScreenAction, getUserAction, isConsider, isMe, isWithin, repaintCanvas, setCursorName, setCursorShape |
| Methods inherited from class java.awt.Cursor |
|---|
getDefaultCursor, getName, getPredefinedCursor, getSystemCustomCursor, getType, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final String SHAPEDELETED
public static final String SHAPEADDED
public static final String SHAPESELECT
public static final String KEY_SELECTCOLOR
public static final String KEY_DRAWCOLOR
public static final String KEY_SHAPE
public static final String KEY_ISFILLED
public static final String KEY_OFFSET
public static final String KEY_ISSCREENSHAPE
public static final Color DEFSELECTCOLOR
public static final Color DEFDRAWCOLOR
public static final String DEFSHAPE
public static final boolean DEFISFILLED
public static final boolean DEFISSCREENSHAPE
private static final double DEFOFFSET
private Shape generic
private ShapeDraw normgen
private List<ShapeDraw> active
private ShapeDraw selected
private Shape draw
private boolean changed
private static String SHAPE
| Constructor Detail |
|---|
public ShapeCursor(PropertySupplying prop)
JNormalizedCanvas.
| Method Detail |
|---|
public void setComposedProperties(PropertySupplying info)
PropertySupplying as we need subclassing Cursor.
setComposedProperties in interface PropertyAwaresetComposedProperties in class ZoomCursorpublic void init()
init in interface Initializableinit in class ZoomCursorpublic void enableCanvas(JNormalizedCanvas root)
JShapeCanvas to the cursor. This method must always
be called prior to activation of the cursor, i.e. adding it as a
mouse listener.
enableCanvas in class CanvasCursorpublic void disableCanvas()
disableCanvas in class CanvasCursorpublic void mouseClicked(MouseEvent me)
mouseClicked in interface MouseListenermouseClicked in class ZoomCursorpublic void complete(Graphics g)
PostUpdate
complete in interface PostUpdateprivate Shape createGenericShape(PropertySupplying info)
public void setGenericShape(Shape gen,
boolean pixel,
boolean filled)
public Shape getGenericShape()
public void reset()
public void mouseMoved(MouseEvent me)
mouseMoved in interface MouseMotionListenermouseMoved in class CrossCursorpublic void mouseWheelMoved(MouseWheelEvent we)
mouseWheelMoved in interface MouseWheelListenermouseWheelMoved in class ZoomCursor
private void rescaleShape(double zx,
double zy,
Graphics onto)
private ShapeDraw toNormalized(Shape screen,
boolean fill)
private void paintShape(Shape screen,
Graphics onto)
private static ShapeDraw scan(List<ShapeDraw> recent,
Point2D within,
double maxdist)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||