|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jfig.commands.Command jfig.commands.MoveObjectCommand
move jfig objects.
MoveCommand allows the user to move objects in the jfig editor.
Use the "middle" mouse button (or "alt"+"left") for x/y-restricted moves.
Field Summary | |
protected int |
dx
|
protected int |
dy
|
protected java.awt.Point |
endPoint
|
protected int |
n_points
|
protected FigObject |
object
|
protected boolean |
restricted
|
static int |
SMART_LINKS_MOVE
|
static int |
SMART_LINKS_MOVEALL
|
static int |
SMART_LINKS_OFF
|
static int |
SMART_LINKS_SLIDE
|
protected int |
smartLinksMode
|
protected java.awt.Point |
startPoint
|
Fields inherited from class jfig.commands.Command |
editor, objectCanvas, ready |
Constructor Summary | |
MoveObjectCommand(FigBasicEditor editor,
FigCanvas objectCanvas)
a command object to encapsulate "move object" commands. |
Method Summary | |
boolean |
checkMovePoint(FigBbox bbox,
java.awt.Point p,
int dx,
int dy)
|
void |
checkSmartLinksMove(FigObject object,
int dx,
int dy)
check the value of the "smart links modus" variable. |
void |
execute()
execute the current editor command |
java.lang.String |
getDescription()
one-line description of this command |
FigObject[] |
getModifiedObjects()
return an array-wrapped reference to the FigObject moved (modified) by this command. |
java.util.Vector |
getSmartMoveAnchorCandidates(FigObject object)
Determine the potential 'anchor' points for an object. |
void |
mousePressed(FigCanvasEvent evt)
select the object to move (at position startPoint) and its new position (endPoint). |
java.lang.String |
toString()
return a (possibly verbose) description of this Command object |
void |
undo()
undo this command |
Methods inherited from class jfig.commands.Command |
cancel, isReady, message, notifyEditor, statusMessage |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int n_points
protected FigObject object
protected java.awt.Point startPoint
protected java.awt.Point endPoint
protected int dx
protected int dy
protected boolean restricted
public static final int SMART_LINKS_OFF
public static final int SMART_LINKS_MOVE
public static final int SMART_LINKS_SLIDE
public static final int SMART_LINKS_MOVEALL
protected int smartLinksMode
Constructor Detail |
public MoveObjectCommand(FigBasicEditor editor, FigCanvas objectCanvas)
Method Detail |
public FigObject[] getModifiedObjects()
getModifiedObjects
in class Command
public void execute()
Command
This method is empty for class Command.
execute
in class Command
public void checkSmartLinksMove(FigObject object, int dx, int dy)
Currently, an 'anchor candidate' is the bbox of a rectangle, or the bbox of any rectangles in a compound object. (Is this how xfig works?)
Note that, unlike xfig, we also "smart move" all text objects which are wholly inside the moved rectangle, because this is a function I always missed in xfig :-)
Note that smart links support is currently experimental.
public java.util.Vector getSmartMoveAnchorCandidates(FigObject object)
REFACTOR 1: this should be a polymorphic method on FigObject (instead of a FigObject being passed as a paramater and using an if statement, as we do).
REFACTOR 2: concerning checkMovePoint(). This should also be a polymorphic method on FigObject, and possibly merged with this method. For Example, both methods would become:
class FigObject { ... // looks at point p and "smart moves" by (dx,dy) if // it is somehow 'anchored' to this object. // returns true if it was changed public boolean checkSmartMovePoint(Point p, int dx, int dy); }This would mean that each object type could determine its 'anchors'
public boolean checkMovePoint(FigBbox bbox, java.awt.Point p, int dx, int dy)
public void undo()
Command
Try to undo this command as far as possible. Don't try to undo() a command that has never been execute()d before. This method is empty for class Command.
undo
in class Command
public void mousePressed(FigCanvasEvent evt)
To allow for selection of stacked objects at/near startPoint, we use the following algorithm: First, we simply use editor.findObjectAt() to find the topmost object (if any) at or near startPoint. If an object is found, its corners are highlighted, while all other object markers are removed.
If the user clicks again on/near startPoint - and with the SHIFT-key hold down, the editor.findNextObjectAt() method is called repeatedly, to find the next objects.
The selected object is moved as soon as the users clicks on a position different from the startPoint.
mousePressed
in class Command
public java.lang.String getDescription()
Command
return a one-line desription of this command, e.g. to label the undo/redo buttons, if any
getDescription
in class Command
public java.lang.String toString()
Command
toString
in class Command
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |