Class RotatableTile
- java.lang.Object
-
- ca.cgjennings.apps.arkham.deck.item.AbstractItem
-
- ca.cgjennings.apps.arkham.deck.item.AbstractFlippableItem
-
- ca.cgjennings.apps.arkham.deck.item.AbstractRenderedItem
-
- ca.cgjennings.apps.arkham.deck.item.Tile
-
- ca.cgjennings.apps.arkham.deck.item.RotatableTile
-
- All Implemented Interfaces:
FlippablePageItem
,PageItem
,java.io.Serializable
,java.lang.Cloneable
public class RotatableTile extends Tile
A tile that can be rotated to an arbitrary angle.- Author:
- Chris Jennings
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ca.cgjennings.apps.arkham.deck.item.PageItem
PageItem.SnapClass, PageItem.SnapTarget
-
-
Field Summary
-
Fields inherited from class ca.cgjennings.apps.arkham.deck.item.Tile
identifier
-
Fields inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractRenderedItem
render
-
Fields inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractFlippableItem
orientation
-
Fields inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractItem
dragHandles, group, parent, selectionLock, snapClass, snapTarget, snapToClasses, xOff, yOff
-
Fields inherited from interface ca.cgjennings.apps.arkham.deck.item.PageItem
ICON_SIZE, ORIENT_MIRROR_TURN_LEFT, ORIENT_MIRROR_TURN_RIGHT, ORIENT_MIRROR_UPRIGHT, ORIENT_MIRROR_UPSIDEDOWN, ORIENT_TURN_LEFT, ORIENT_TURN_RIGHT, ORIENT_UPRIGHT, ORIENT_UPSIDEDOWN
-
-
Constructor Summary
Constructors Constructor Description RotatableTile(java.lang.String name, java.lang.String identifier, double dpi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PageItem
clone()
Returns a new page item, using this item as a template.DragHandle[]
getDragHandles()
Returns an array of the customDragHandle
s for this item.java.awt.Shape
getOutline()
Return aShape
that corresponds to the outline of this item.double
getRotation()
protected double
getUprightHeight()
Return the height of this item in its standard, upright orientation.protected double
getUprightWidth()
Return the width of this item in its standard, upright orientation.void
paint(java.awt.Graphics2D g, RenderTarget target, double renderResolutionHint)
Paint this item at its current location.protected void
readImpl(java.io.ObjectInputStream in)
void
setRotation(double angle)
protected void
writeImpl(java.io.ObjectOutputStream out)
-
Methods inherited from class ca.cgjennings.apps.arkham.deck.item.Tile
clearCachedImages, getDPI, getIdentifier, getImageFromIdentifier, getName, getResolution, isFastOutlineAllowed, isMipMapCacheEnabledByDefault, renderImage, scaleMipMapUpAtHighZoom, setDPI, setFastOutlineAllowed, setIdentifier, setName, setOrientation, setResolution
-
Methods inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractRenderedItem
clearCachedIcon, createOrientedImage, getHeight, getOrientedImage, getThumbnailIcon, getWidth, isMipMapCacheEnabled, prepareToPaint, setMipMapCacheEnabled
-
Methods inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractFlippableItem
flip, getOrientation, turnLeft, turnRight
-
Methods inherited from class ca.cgjennings.apps.arkham.deck.item.AbstractItem
customizePopupMenu, getBleedMargin, getClassesSnappedTo, getClientProperty, getFoldMarks, getGroup, getLocation, getPage, getRectangle, getSnapClass, getSnapTarget, getX, getY, hasExteriorHandles, hitTest, isBleedMarginMarked, isHorizontal, isMirrored, isSelectionLocked, isTurned0DegreesFrom, isTurned180DegreesFrom, isTurned90DegreesFrom, isVertical, itemChanged, itemChanging, putClientProperty, setClassesSnappedTo, setGroup, setLocation, setLocation, setPage, setSelectionLocked, setSnapClass, setSnapTarget, setX, setY, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface ca.cgjennings.apps.arkham.deck.item.PageItem
customizePopupMenu, getBleedMargin, getClassesSnappedTo, getClientProperty, getFoldMarks, getGroup, getLocation, getPage, getRectangle, getSnapClass, getSnapTarget, getX, getY, hasExteriorHandles, hitTest, isBleedMarginMarked, isHorizontal, isMirrored, isSelectionLocked, isTurned0DegreesFrom, isTurned180DegreesFrom, isTurned90DegreesFrom, isVertical, putClientProperty, setClassesSnappedTo, setGroup, setLocation, setLocation, setPage, setSelectionLocked, setSnapClass, setSnapTarget, setX, setY
-
-
-
-
Method Detail
-
getUprightWidth
protected double getUprightWidth()
Description copied from class:AbstractRenderedItem
Return the width of this item in its standard, upright orientation.- Overrides:
getUprightWidth
in classTile
- Returns:
- the width of the unoriented item
-
getUprightHeight
protected double getUprightHeight()
Description copied from class:AbstractRenderedItem
Return the height of this item in its standard, upright orientation.- Overrides:
getUprightHeight
in classTile
- Returns:
- the height of the unoriented item
-
paint
public void paint(java.awt.Graphics2D g, RenderTarget target, double renderResolutionHint)
Description copied from interface:PageItem
Paint this item at its current location. The graphics context will be scaled so that 1 unit represents 1 point. The resolution hint is a suggestion as to the resolution the item should be rendered at if it must be converted to a bitmap before being drawn. It may or may not represent the actual resolution of the output target.
-
getOutline
public java.awt.Shape getOutline()
Description copied from interface:PageItem
Return aShape
that corresponds to the outline of this item. In the simplest case, this can return the same result asPageItem.getRectangle()
. If precise geometry is available for the item, then this should return a more accurate bounding shape.- Specified by:
getOutline
in interfacePageItem
- Overrides:
getOutline
in classAbstractItem
- Returns:
- the outline of this object
-
getDragHandles
public DragHandle[] getDragHandles()
Description copied from class:AbstractItem
Returns an array of the customDragHandle
s for this item. If the item has no handles, returnsnull
.Concrete subclasses should create an array of handles on demand and cache them in the
dragHandles
field in order to ensure that handles are not shared between copies of the item. Example:public DragHandle[] getDragHandles() { if( dragHandles == null ) { dragHandles = new DragHandle[] { ... }; } return dragHandles; }
- Specified by:
getDragHandles
in interfacePageItem
- Overrides:
getDragHandles
in classAbstractItem
- Returns:
- an array of drag handles that can be used to manipulate the item,
or
null
-
clone
public PageItem clone()
Description copied from interface:PageItem
Returns a new page item, using this item as a template. The new item should generally be a deep copy, not sharing any objects with the original unless those objects are immutable. The deck editor absolutely relies on this method being implemented correctly! (For example, drag-and-drop and clipboard operations use clones to create copies of existing items.)- Specified by:
clone
in interfacePageItem
- Overrides:
clone
in classAbstractRenderedItem
- Returns:
- a new copy of this page item
-
getRotation
public double getRotation()
-
setRotation
public void setRotation(double angle)
-
writeImpl
protected void writeImpl(java.io.ObjectOutputStream out) throws java.io.IOException
-
-