com.partnersoft.maps.rover
Class AbstractRoverPointShape<T extends AbstractRoverPointShape>

java.lang.Object
  extended by com.partnersoft.maps.rover.AbstractRoverShape<T>
      extended by com.partnersoft.maps.rover.AbstractRoverPointShape<T>
All Implemented Interfaces:
Immutable, RoverShape<T>
Direct Known Subclasses:
RoverImage, RoverPoint, RoverText

public abstract class AbstractRoverPointShape<T extends AbstractRoverPointShape>
extends AbstractRoverShape<T>

Contains fields common to RoverImage, RoverPoint and RoverText.

The rationale for this class is that having e.g. RoverText extend RoverPoint is a bad idea, since it causes unwarranted assumptions with instanceof.

Copyright 2008 Partner Software, Inc.

Version:
$Id$
Author:
Paul Reavis

Constructor Summary
AbstractRoverPointShape(int id, int dataId, int drawId, boolean selectable, XyPoint point, XyRotation rotation, int offsetX, int offsetY)
          Constructs an AbstractRoverPointShape with all values set.
 
Method Summary
 XyBounds getBounds()
          The bounds of the shape.
 XyPoint getCentroid()
          The center of the bounds of the shape.
 XyPoint getEndPoint()
          The last point in the shape.
 byte getOffsetX()
          Pixel offset on the X axis of the graphics for this shape.
 byte getOffsetY()
          Pixel offset on the Y axis of the graphics for this shape.
 XyPoint getPoint()
          The geographic anchor point for this shape.
 XyRotation getRotation()
          Rotation of the graphics for this shape.
 XyPoint getStartPoint()
          The first point in the shape.
 boolean isOffset()
          Returns true if this shape has a rotation.
 boolean isRotated()
          Returns true if this shape has a rotation.
 
Methods inherited from class com.partnersoft.maps.rover.AbstractRoverShape
getDataId, getDrawId, getId, hasZ, isSelectable, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.partnersoft.maps.rover.RoverShape
withDataId, withDrawId, withId, withIds
 

Constructor Detail

AbstractRoverPointShape

public AbstractRoverPointShape(int id,
                               int dataId,
                               int drawId,
                               boolean selectable,
                               XyPoint point,
                               XyRotation rotation,
                               int offsetX,
                               int offsetY)
Constructs an AbstractRoverPointShape with all values set. Offsets will be clamped to -127 <= offset <= 127.

Method Detail

getBounds

public XyBounds getBounds()
Description copied from interface: RoverShape
The bounds of the shape.


getCentroid

public XyPoint getCentroid()
Description copied from interface: RoverShape
The center of the bounds of the shape.


getEndPoint

public XyPoint getEndPoint()
Description copied from interface: RoverShape
The last point in the shape. May be the same as the start point.


getStartPoint

public XyPoint getStartPoint()
Description copied from interface: RoverShape
The first point in the shape. May be a better choice for locating the shape than the center.


getPoint

public XyPoint getPoint()
The geographic anchor point for this shape. Placement of the actual graphics is done based on this reference point.

Returns:
shape anchor point

getRotation

public XyRotation getRotation()
Rotation of the graphics for this shape.

Returns:
rotation of the graphics for this shape.

getOffsetX

public byte getOffsetX()
Pixel offset on the X axis of the graphics for this shape. This is a single signed byte value, so can only be +-127.

Returns:
pixel offset on X axis

getOffsetY

public byte getOffsetY()
Pixel offset on the Y axis of the graphics for this shape. This is a single signed byte value, so can only be +-127.

Returns:
pixel offset on Y axis

isOffset

public boolean isOffset()
Description copied from interface: RoverShape
Returns true if this shape has a rotation.

Specified by:
isOffset in interface RoverShape<T extends AbstractRoverPointShape>
Overrides:
isOffset in class AbstractRoverShape<T extends AbstractRoverPointShape>

isRotated

public boolean isRotated()
Description copied from interface: RoverShape
Returns true if this shape has a rotation.

Specified by:
isRotated in interface RoverShape<T extends AbstractRoverPointShape>
Overrides:
isRotated in class AbstractRoverShape<T extends AbstractRoverPointShape>