Class 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
    • Constructor Detail

      • RotatableTile

        public RotatableTile​(java.lang.String name,
                             java.lang.String identifier,
                             double dpi)
    • 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 class Tile
        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 class Tile
        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.
        Specified by:
        paint in interface PageItem
        Overrides:
        paint in class Tile
        Parameters:
        g - the graphics context to paint to
        target - the type of destination being drawn to
        renderResolutionHint - a source resolution hint
      • getOutline

        public java.awt.Shape getOutline()
        Description copied from interface: PageItem
        Return a Shape that corresponds to the outline of this item. In the simplest case, this can return the same result as PageItem.getRectangle(). If precise geometry is available for the item, then this should return a more accurate bounding shape.
        Specified by:
        getOutline in interface PageItem
        Overrides:
        getOutline in class AbstractItem
        Returns:
        the outline of this object
      • getDragHandles

        public DragHandle[] getDragHandles()
        Description copied from class: AbstractItem
        Returns an array of the custom DragHandles for this item. If the item has no handles, returns null.

        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 interface PageItem
        Overrides:
        getDragHandles in class AbstractItem
        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 interface PageItem
        Overrides:
        clone in class AbstractRenderedItem
        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
        Overrides:
        writeImpl in class Tile
        Throws:
        java.io.IOException
      • readImpl

        protected void readImpl​(java.io.ObjectInputStream in)
                         throws java.io.IOException,
                                java.lang.ClassNotFoundException
        Overrides:
        readImpl in class Tile
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException