Package edu.cnu.mdi.item
Class ItemModification
java.lang.Object
edu.cnu.mdi.item.ItemModification
Mutable state for one interactive item operation.
The object captures the item's original geometry and initial mouse position, then tracks the current mouse position in both local and world coordinates while a drag, resize, or rotation is in progress.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumThe kind of interactive operation being performed. -
Constructor Summary
ConstructorsConstructorDescriptionItemModification(AItem item, IContainer container, Point startMousePoint, Point currentMousePoint, boolean shift, boolean control) Create an ItemModification. -
Method Summary
Modifier and TypeMethodDescriptionGet the container that holds the item on one of its layers.Get the current location of the mouse.getItem()Get the item being modified.intThe selectIndex can be used by the item to cache the index of the selectRect that started the modification.doubleThe focus is the world reference point for the item.The focus is the screen (pixel) version of reference point for the item.Get the point where the grab was initiated.getType()Get the type of modification.booleanbooleanisShift()voidsetCurrentMousePoint(Point currentMousePoint) Set the current mouse location.voidsetSelectIndex(int selectIndex) The selectIndex can be used by the item to cache the index of the selectRect that started the modification.voidsetStartFocus(Point2D.Double startFocus) The focus is the world reference point for the item.voidsetStartFocusPoint(Point startFocusPoint) The focus is the screen (pixel) version reference point for the item.voidsetStartLocation(Point startLocation) voidSet the type of modification.voidsetUserObject(Object userObject)
-
Constructor Details
-
ItemModification
public ItemModification(AItem item, IContainer container, Point startMousePoint, Point currentMousePoint, boolean shift, boolean control) Create an ItemModification. The type is the default: DRAG. It can be changed via setType.- Parameters:
item- the item being modified.container- the item's container.startMousePoint- the mouse point where the item was grabbed.currentMousePoint- the current mouse point.shift- was shift pressed when modification begancontrol- was control pressed when modification began- Throws:
NullPointerException- ifitemorcontainerisnull
-
-
Method Details
-
getType
Get the type of modification.- Returns:
- the type of modification
-
setType
Set the type of modification.- Parameters:
type- the type to set
-
getCurrentMousePoint
Get the current location of the mouse.- Returns:
- the currentMousePoint
-
setCurrentMousePoint
Set the current mouse location. This will be done by the PointerButton.- Parameters:
currentMousePoint- the currentMousePoint to set
-
getStartFocus
The focus is the world reference point for the item. It might be its location or its centroid. It has to be set by the item when- Returns:
- the startFocus
-
setStartFocus
The focus is the world reference point for the item. It might be its location or its centroid. It has to be set by the item when the modification starts.- Parameters:
startFocus- the startFocus to set
-
getStartFocusPoint
The focus is the screen (pixel) version of reference point for the item. It might be its location or its centroid. It has to be set by the item when the modification starts.- Returns:
- the startFocusPoint
-
setStartFocusPoint
The focus is the screen (pixel) version reference point for the item. It might be its location or its centroid. It has to be set by the item when the modification starts.- Parameters:
startFocusPoint- the startFocusPoint to set
-
getSelectIndex
public int getSelectIndex()The selectIndex can be used by the item to cache the index of the selectRect that started the modification. This is often needed for resizing and rotating.- Returns:
- the selectIndex
-
setSelectIndex
public void setSelectIndex(int selectIndex) The selectIndex can be used by the item to cache the index of the selectRect that started the modification. This is often needed for resizing and rotating.- Parameters:
selectIndex- the selectIndex to set
-
getItem
Get the item being modified.- Returns:
- the item being modified.
-
getContainer
Get the container that holds the item on one of its layers.- Returns:
- the container holding the item.
-
getStartMousePoint
Get the point where the grab was initiated.- Returns:
- the startMousePoint the point where the grab was initiated.
-
getStartPath
- Returns:
- the startPath
-
getStartLine
- Returns:
- the startLine
-
getStartWorldPoint
- Returns:
- the startWorldPoint
-
getCurrentWorldPoint
- Returns:
- the currentWorldPoint
-
isShift
public boolean isShift()- Returns:
- the shift flag
-
isControl
public boolean isControl()- Returns:
- the control falg
-
getStartAzimuth
public double getStartAzimuth()- Returns:
- the startAzimuth
-
getStartLocation
- Returns:
- the startLocation
-
setStartLocation
- Parameters:
startLocation- the startLocation to set
-
getUserObject
- Returns:
- the userObject
-
setUserObject
- Parameters:
userObject- the userObject to set
-