Package edu.cnu.mdi.item
Class PointItem
java.lang.Object
edu.cnu.mdi.item.AItem
edu.cnu.mdi.item.PointItem
- All Implemented Interfaces:
IFeedbackProvider,IDrawable,EventListener
- Direct Known Subclasses:
DeviceItem
Basic point item
- Author:
- heddle
-
Field Summary
FieldsFields inherited from class edu.cnu.mdi.item.AItem
_connectable, _deletable, _dirty, _displayName, _doubleClickable, _draggable, _enabled, _focus, _FOCUSFILL, _lastDrawnPolygon, _layer, _line, _locked, _modification, _path, _popupMenu, _resizable, _resizePolicy, _rightClickable, _rotatable, _selectable, _selected, _style, _styleEditable, _visible, rotateIcon, RPSIZE, RPSIZE2, SPSIZE, SPSIZE2 -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for a basic point item.PointItem(Layer layer, Point2D.Double location) Constructor for a basic point item.PointItem(Layer layer, Point2D.Double location, Object... keyVals) Constructor for a basic point item.Constructor for a basic point item. -
Method Summary
Modifier and TypeMethodDescriptionvoiddrawItem(Graphics2D g2, IContainer container) Custom drawer for the item.intGet the horizontal alignment for the image iconintGet the vertical alignment for the image icongetBounds(IContainer container) get the bounding rect in pixels.Get the world bounding rectangle of the item.voidmodify()A modification such as a drag, resize or rotate is continuing.voidsetAlignmentH(int xAlignment) Set the horizontal alignment for the image iconvoidsetAlignmentV(int yAlignment) Set the vertical alignment for the image iconvoidsetFocus(Point2D.Double currentLocation) Set the current location.booleanshouldDraw(Graphics2D g2, IContainer container) Checks whether the item should be drawn.voidA modification (can only be a drag for a point item) has occurred.voidtranslateWorld(double dx, double dy) Translate this item by(dx, dy)in world coordinates.Methods inherited from class edu.cnu.mdi.item.AItem
acceptModification, applyGeometryProperties, applyProperties, applyStyleProperties, contains, createPopupMenu, doubleClicked, draw, drawSelections, enclosed, equals, focusFill, geometryChanged, getAzimuth, getContainer, getDisplayName, getFeedbackStrings, getFocus, getFocusPoint, getItemModification, getLastDrawnPolygon, getLayer, getLine, getPath, getPopupMenu, getResizePolicy, getRotatePoint, getSelectionPoints, getStyle, getStyleSafe, getView, hashCode, inASelectRect, inRotatePoint, inSelectPoint, isConnectable, isDeletable, isDirty, isDoubleClickable, isDraggable, isEnabled, isLocked, isResizable, isRightClickable, isRotatable, isSelectable, isSelected, isStyleEditable, isTrackable, isVisible, modificationRejected, prepareForPopup, prepareForRemoval, setAzimuth, setConnectable, setDeletable, setDirty, setDisplayName, setDoubleClickable, setDraggable, setEnabled, setFillFocus, setLocked, setModification, setResizable, setResizePolicy, setRightClickable, setRotatable, setSelectable, setSelected, setStyle, setStyleEditable, setVisible, stopModification, translateLocal, updateFocus
-
Field Details
-
icon
-
-
Constructor Details
-
PointItem
Constructor for a basic point item.- Parameters:
layer- the layer this item is on.
-
PointItem
Constructor for a basic point item.- Parameters:
layer- the layer this item is on.icon- an icon to draw at the point
-
PointItem
Constructor for a basic point item.- Parameters:
layer- the layer this item is on.location- the location for the point.
-
PointItem
Constructor for a basic point item.- Parameters:
layer- the layer this item is on.location- the location for the point.keyVals- optional key-value pairs to set on the item. For example, you could use this to set the display name, style, or other properties at construction time. The keys should be from the set of standard keys defined in PropertyUtils, or any custom keys recognized by this item or its style.
-
-
Method Details
-
drawItem
Custom drawer for the item. -
shouldDraw
Checks whether the item should be drawn. This is an additional check, beyond the simple visibility flag check. For example, it might check whether the item intersects the area being drawn.- Specified by:
shouldDrawin classAItem- Parameters:
g2- the graphics context.container- the graphical container being rendered.- Returns:
trueif the item passes any and all tests, and should be drwan.
-
getBounds
get the bounding rect in pixels. -
startModification
public void startModification()A modification (can only be a drag for a point item) has occurred.Preserves
AItem.startModification()'s no-op-if-null contract, even though this override doesn't need the rotate/resize handle classification it performs.- Overrides:
startModificationin classAItem
-
modify
public void modify()A modification such as a drag, resize or rotate is continuing. -
setFocus
Set the current location. -
getWorldBounds
Get the world bounding rectangle of the item.- Specified by:
getWorldBoundsin classAItem- Returns:
- the world box containing the item. For a point item, which has no
extent, this is
null.
-
getAlignmentH
public int getAlignmentH()Get the horizontal alignment for the image icon- Returns:
- the horizontal alignment for the image icon
-
setAlignmentH
public void setAlignmentH(int xAlignment) Set the horizontal alignment for the image icon- Parameters:
xAlignment- the xAlignment to set
-
getAlignmentV
public int getAlignmentV()Get the vertical alignment for the image icon- Returns:
- the vertical alignment for the image icon
-
setAlignmentV
public void setAlignmentV(int yAlignment) Set the vertical alignment for the image icon- Parameters:
yAlignment- the yAlignment to set
-
translateWorld
public void translateWorld(double dx, double dy) Description copied from class:AItemTranslate this item by(dx, dy)in world coordinates.- Specified by:
translateWorldin classAItem- Parameters:
dx- the world-coordinate offset along the X axisdy- the world-coordinate offset along the Y axis
-