Package VASSAL.counters
Class Footprint
java.lang.Object
VASSAL.counters.Decorator
VASSAL.counters.MovementMarkable
VASSAL.counters.Footprint
- All Implemented Interfaces:
PropertyNameSource
,PropertySource
,EditablePiece
,GamePiece
,PropertyExporter
,StateMergeable
,TranslatablePiece
,PersistentPropertyContainer
public class Footprint extends MovementMarkable
Displays a movement trail indicating where a piece has been moved
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
Footprint.Ed
Key Command Global Visibility Circle Radius Fill Color Line Color Selected Transparency Unselected Transparency Edge Buffer Display Limit Edge Buffer Point Limit -
Field Summary
Fields inherited from interface VASSAL.counters.PropertyExporter
LOCALIZED_NAME
Fields inherited from interface VASSAL.i18n.TranslatablePiece
PREFIX
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected void
addPoint(Point p)
Add Point to list and adjust the overall boundingBox to encompass the trail.Rectangle
boundingBox()
Return a bounding box covering the whole trail if it is visible, otherwise just return the standard piece bounding boxprotected void
clearTrail()
void
draw(Graphics g, int x, int y, Component obs, double zoom)
Draw this GamePieceprotected void
drawPoint(Graphics g, Point p, double zoom, int elementCount)
Draw a Circle at the given point.protected void
drawTrack(Graphics g, int x1, int y1, int x2, int y2, double zoom)
Draw a track from one Point to another.String
getDescription()
A plain-English description of this type of piecePieceEditor
getEditor()
Get the configurer for this traitHelpFile
getHelpFile()
PieceI18nData
getI18nData()
Return I18n data for this pieceObject
getLocalizedProperty(Object key)
Rectangle
getMyBoundingBox()
Return the boundingBox including the trailString
getName()
The plain English name for this pieceprotected Enumeration<Point>
getPointList()
Deprecated, for removal: This API element is subject to removal in a future version.Object
getProperty(Object key)
Shape
getShape()
The shape of the piece from the user's viewpoint.protected Image
getTrailImage(int elementCount)
Override this method to return an Image to display within each trail circleprotected String
getTrailText(int elementCount)
Override this method to return text to display within each trail circle.protected boolean
isTrailVisible()
Global Visibility means all players see the same trail Local Visibility means each player controls their own trail visibilityKeyCommand[]
myGetKeyCommands()
String
myGetState()
String
myGetType()
Command
myKeyEvent(KeyStroke stroke)
The response of this trait alone to the given KeyStrokevoid
mySetState(String newState)
Set just the state of this traitvoid
mySetType(String type)
Type is the character command that toggles footprint visiblityprotected void
recordCurrentPosition()
void
redraw()
void
setMoved(boolean justMoved)
setMoved is called with an argument of true each time the piece is moved.void
setProperty(Object key, Object val)
Other properties, possibly game-specific, can be associated with a piece.Methods inherited from class VASSAL.counters.MovementMarkable
getPropertyNames, isMoved
Methods inherited from class VASSAL.counters.Decorator
getCommandDescription, getDecorator, getI18nData, getI18nData, getId, getInner, getInnermost, getKeyCommands, getLocalizedName, getMap, getOuter, getOutermost, getParent, getPersistentProperty, getPosition, getProperties, getState, getTranslation, getType, isSelected, keyEvent, mergeState, putOldProperties, repack, reportDataError, reportDataError, reportDataError, setId, setInner, setMap, setOldProperties, setOldProperties, setParent, setPersistentProperty, setPosition, setSelected, setState, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface VASSAL.counters.GamePiece
getId, getLocalizedName, getMap, getParent, getPosition, getState, getType, keyEvent, setId, setMap, setParent, setPosition, setState
Methods inherited from interface VASSAL.counters.PropertyExporter
getProperties
-
Field Details
-
ID
- See Also:
- Constant Field Values
-
globalVisibility
protected boolean globalVisibility -
startMapId
-
pointList
-
trailKey
-
trailKeyOn
-
trailKeyOff
-
trailKeyClear
-
initiallyVisible
protected boolean initiallyVisible -
globallyVisible
protected boolean globallyVisible -
circleRadius
protected int circleRadius -
selectedTransparency
protected int selectedTransparency -
unSelectedTransparency
protected int unSelectedTransparency -
lineColor
-
fillColor
-
edgePointBuffer
protected int edgePointBuffer -
edgeDisplayBuffer
protected int edgeDisplayBuffer -
DEFAULT_TRAIL_KEY
protected static final char DEFAULT_TRAIL_KEY- See Also:
- Constant Field Values
-
DEFAULT_MENU_COMMAND
- See Also:
- Constant Field Values
-
DEFAULT_INITIALLY_VISIBLE
-
DEFAULT_GLOBALLY_VISIBLE
-
DEFAULT_CIRCLE_RADIUS
protected static final int DEFAULT_CIRCLE_RADIUS- See Also:
- Constant Field Values
-
DEFAULT_FILL_COLOR
-
DEFAULT_LINE_COLOR
-
DEFAULT_SELECTED_TRANSPARENCY
protected static final int DEFAULT_SELECTED_TRANSPARENCY- See Also:
- Constant Field Values
-
DEFULT_UNSELECTED_TRANSPARENCY
protected static final int DEFULT_UNSELECTED_TRANSPARENCY- See Also:
- Constant Field Values
-
DEFAULT_EDGE_POINT_BUFFER
protected static final int DEFAULT_EDGE_POINT_BUFFER- See Also:
- Constant Field Values
-
DEFAULT_EDGE_DISPLAY_BUFFER
protected static final int DEFAULT_EDGE_DISPLAY_BUFFER- See Also:
- Constant Field Values
-
LINE_WIDTH
protected static final float LINE_WIDTH- See Also:
- Constant Field Values
-
myBoundingBox
-
font
-
lastZoom
protected double lastZoom -
localVisibility
protected boolean localVisibility -
initialized
protected boolean initialized -
lineWidth
protected double lineWidth
-
-
Constructor Details
-
Footprint
public Footprint() -
Footprint
-
-
Method Details
-
getPointList
Deprecated, for removal: This API element is subject to removal in a future version.UsepointList
directly. -
mySetState
Description copied from class:Decorator
Set just the state of this trait- Overrides:
mySetState
in classMovementMarkable
- See Also:
Decorator.myGetState()
-
myGetState
- Overrides:
myGetState
in classMovementMarkable
- Returns:
- the state of this trait alone
- See Also:
Decorator.getState()
-
mySetType
Type is the character command that toggles footprint visiblity- Specified by:
mySetType
in interfaceEditablePiece
- Overrides:
mySetType
in classMovementMarkable
-
myGetType
- Overrides:
myGetType
in classMovementMarkable
- Returns:
- the type of this trait alone
- See Also:
Decorator.getType()
-
setProperty
Description copied from interface:GamePiece
Other properties, possibly game-specific, can be associated with a piece. The properties may or may not need to be encoded in the piece'sGamePiece.getState()
method.- Specified by:
setProperty
in interfaceGamePiece
- Overrides:
setProperty
in classMovementMarkable
-
getLocalizedProperty
- Specified by:
getLocalizedProperty
in interfacePropertySource
- Overrides:
getLocalizedProperty
in classMovementMarkable
-
getProperty
- Specified by:
getProperty
in interfaceGamePiece
- Specified by:
getProperty
in interfacePropertySource
- Overrides:
getProperty
in classMovementMarkable
-
setMoved
public void setMoved(boolean justMoved)setMoved is called with an argument of true each time the piece is moved. The argument is false when the unit is marked as not moved.- Overrides:
setMoved
in classMovementMarkable
-
recordCurrentPosition
protected void recordCurrentPosition() -
clearTrail
protected void clearTrail() -
getHelpFile
- Specified by:
getHelpFile
in interfaceEditablePiece
- Overrides:
getHelpFile
in classMovementMarkable
-
addPoint
Add Point to list and adjust the overall boundingBox to encompass the trail. -
redraw
public void redraw() -
getDescription
Description copied from interface:EditablePiece
A plain-English description of this type of piece- Specified by:
getDescription
in interfaceEditablePiece
- Overrides:
getDescription
in classMovementMarkable
-
draw
Description copied from interface:GamePiece
Draw this GamePiece- Specified by:
draw
in interfaceGamePiece
- Overrides:
draw
in classMovementMarkable
x
- x-location of the center of the piecey
- y-location of the center of the pieceobs
- the Component on which this piece is being drawnzoom
- the scaling factor.
-
drawPoint
Draw a Circle at the given point. Override this method to do something different (eg. display an Icon) -
drawTrack
Draw a track from one Point to another. Don't draw under the circle as it shows through with transparency turned on. -
getTrailImage
Override this method to return an Image to display within each trail circle -
getTrailText
Override this method to return text to display within each trail circle. Note, there will normally be only room for 1 character. -
isTrailVisible
protected boolean isTrailVisible()Global Visibility means all players see the same trail Local Visibility means each player controls their own trail visibility -
boundingBox
Return a bounding box covering the whole trail if it is visible, otherwise just return the standard piece bounding box- Specified by:
boundingBox
in interfaceGamePiece
- Overrides:
boundingBox
in classMovementMarkable
-
getMyBoundingBox
Return the boundingBox including the trail -
getShape
Description copied from interface:GamePiece
The shape of the piece from the user's viewpoint. This defines the area in which the user must click to select or move the piece, for example. LikeGamePiece.boundingBox()
, it assumes the position is (0,0) and must be translated to the actual location where the piece is being drawn.- Specified by:
getShape
in interfaceGamePiece
- Overrides:
getShape
in classMovementMarkable
-
getName
Description copied from interface:GamePiece
The plain English name for this piece- Specified by:
getName
in interfaceGamePiece
- Overrides:
getName
in classMovementMarkable
-
myGetKeyCommands
- Overrides:
myGetKeyCommands
in classMovementMarkable
- Returns:
- the commands for this trait alone
- See Also:
Decorator.getKeyCommands()
-
myKeyEvent
Description copied from class:Decorator
The response of this trait alone to the given KeyStroke- Overrides:
myKeyEvent
in classMovementMarkable
- Parameters:
stroke
- Stroke to apply- Returns:
- Generated Command or null if no effect
- See Also:
Decorator.keyEvent(javax.swing.KeyStroke)
-
getEditor
Description copied from interface:EditablePiece
Get the configurer for this trait- Specified by:
getEditor
in interfaceEditablePiece
- Overrides:
getEditor
in classMovementMarkable
-
getI18nData
Description copied from class:Decorator
Return I18n data for this piece- Specified by:
getI18nData
in interfaceTranslatablePiece
- Overrides:
getI18nData
in classMovementMarkable
- Returns:
- I18n data
-
pointList
directly.