Package VASSAL.build.module.map
Class CompoundPieceCollection
java.lang.Object
VASSAL.build.module.map.CompoundPieceCollection
- All Implemented Interfaces:
PieceCollection
- Direct Known Subclasses:
DefaultPieceCollection
,LayeredPieceCollection.Collection
public abstract class CompoundPieceCollection extends Object implements PieceCollection
Base class for PieceCollection implementation that organize
pieces into distinct layers. The layers are drawn in order of their index, i.e.
layer 0 is on the bottom.
-
Field Summary
Fields Modifier and Type Field Description protected int
bottomLayer
protected boolean[]
enabled
protected SimplePieceCollection[]
layers
-
Constructor Summary
Constructors Modifier Constructor Description protected
CompoundPieceCollection(int layerCount)
-
Method Summary
Modifier and Type Method Description void
add(GamePiece p)
Adds a pieceboolean
canMerge(GamePiece p1, GamePiece p2)
Return true if the two pieces can be merged into a single stackprotected boolean
canPiecesMerge(GamePiece p1, GamePiece p2)
protected boolean
canStackAndPieceMerge(Stack s, GamePiece p)
protected boolean
canStacksMerge(Stack s1, Stack s2)
void
clear()
Remove all piecesGamePiece[]
getAllPieces()
Return all pieces in the collection, regardless of visibilityint
getBottomLayer()
protected PieceCollection
getCollectionForPiece(GamePiece p)
int
getLayerCount()
int
getLayerForName(String layerName)
int
getLayerForPiece(GamePiece p)
String
getLayerNameForPiece(GamePiece p)
GamePiece[]
getPieces()
Return all currently-visible pieces in the collection as a read-only arrayprotected GamePiece[]
getPieces(boolean includeDisabled)
int
getTopLayer()
int
indexOf(GamePiece p)
Returns the index of a piece.protected void
initLayers(int layerCount)
void
moveToBack(GamePiece p)
Reposition a piece to the back of all others in the same layervoid
moveToFront(GamePiece p)
Reposition a piece to the front of all others in the same layervoid
remove(GamePiece p)
Removes the piecevoid
reset()
void
rotate(boolean rotateUp)
void
rotate(boolean rotateUp, boolean skipNullLayers)
void
setBottomLayer(int layer)
void
setLayerEnabled(int layer, boolean b)
void
setLayerEnabled(String layer, boolean b)
void
toggleLayerEnabled(int layer)
void
toggleLayerEnabled(String layer)
-
Field Details
-
layers
-
bottomLayer
protected int bottomLayer -
enabled
protected boolean[] enabled
-
-
Constructor Details
-
CompoundPieceCollection
protected CompoundPieceCollection(int layerCount)
-
-
Method Details
-
initLayers
protected void initLayers(int layerCount) -
getLayerForPiece
-
getLayerNameForPiece
-
getLayerForName
-
getCollectionForPiece
-
add
Description copied from interface:PieceCollection
Adds a piece- Specified by:
add
in interfacePieceCollection
-
clear
public void clear()Description copied from interface:PieceCollection
Remove all pieces- Specified by:
clear
in interfacePieceCollection
-
getPieces
Description copied from interface:PieceCollection
Return all currently-visible pieces in the collection as a read-only array- Specified by:
getPieces
in interfacePieceCollection
-
getPieces
-
getAllPieces
Description copied from interface:PieceCollection
Return all pieces in the collection, regardless of visibility- Specified by:
getAllPieces
in interfacePieceCollection
-
indexOf
Description copied from interface:PieceCollection
Returns the index of a piece. When painting the map, pieces are drawn in order of index- Specified by:
indexOf
in interfacePieceCollection
-
remove
Description copied from interface:PieceCollection
Removes the piece- Specified by:
remove
in interfacePieceCollection
-
moveToBack
Description copied from interface:PieceCollection
Reposition a piece to the back of all others in the same layer- Specified by:
moveToBack
in interfacePieceCollection
-
moveToFront
Description copied from interface:PieceCollection
Reposition a piece to the front of all others in the same layer- Specified by:
moveToFront
in interfacePieceCollection
-
canMerge
Description copied from interface:PieceCollection
Return true if the two pieces can be merged into a single stack- Specified by:
canMerge
in interfacePieceCollection
-
canStacksMerge
-
canStackAndPieceMerge
-
canPiecesMerge
-
getLayerCount
public int getLayerCount() -
setBottomLayer
public void setBottomLayer(int layer) -
getBottomLayer
public int getBottomLayer() -
getTopLayer
public int getTopLayer() -
rotate
public void rotate(boolean rotateUp, boolean skipNullLayers) -
rotate
public void rotate(boolean rotateUp) -
setLayerEnabled
public void setLayerEnabled(int layer, boolean b) -
toggleLayerEnabled
public void toggleLayerEnabled(int layer) -
setLayerEnabled
-
toggleLayerEnabled
-
reset
public void reset()
-