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 intbottomLayerprotected boolean[]enabledprotected SimplePieceCollection[]layers -
Constructor Summary
Constructors Modifier Constructor Description protectedCompoundPieceCollection(int layerCount) -
Method Summary
Modifier and Type Method Description voidadd(GamePiece p)Adds a piecebooleancanMerge(GamePiece p1, GamePiece p2)Return true if the two pieces can be merged into a single stackprotected booleancanPiecesMerge(GamePiece p1, GamePiece p2)protected booleancanStackAndPieceMerge(Stack s, GamePiece p)protected booleancanStacksMerge(Stack s1, Stack s2)voidclear()Remove all piecesGamePiece[]getAllPieces()Return all pieces in the collection, regardless of visibilityintgetBottomLayer()protected PieceCollectiongetCollectionForPiece(GamePiece p)intgetLayerCount()intgetLayerForName(String layerName)intgetLayerForPiece(GamePiece p)StringgetLayerNameForPiece(GamePiece p)GamePiece[]getPieces()Return all currently-visible pieces in the collection as a read-only arrayprotected GamePiece[]getPieces(boolean includeDisabled)intgetTopLayer()intindexOf(GamePiece p)Returns the index of a piece.protected voidinitLayers(int layerCount)voidmoveToBack(GamePiece p)Reposition a piece to the back of all others in the same layervoidmoveToFront(GamePiece p)Reposition a piece to the front of all others in the same layervoidremove(GamePiece p)Removes the piecevoidreset()voidrotate(boolean rotateUp)voidrotate(boolean rotateUp, boolean skipNullLayers)voidsetBottomLayer(int layer)voidsetLayerEnabled(int layer, boolean b)voidsetLayerEnabled(String layer, boolean b)voidtoggleLayerEnabled(int layer)voidtoggleLayerEnabled(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:PieceCollectionAdds a piece- Specified by:
addin interfacePieceCollection
-
clear
public void clear()Description copied from interface:PieceCollectionRemove all pieces- Specified by:
clearin interfacePieceCollection
-
getPieces
Description copied from interface:PieceCollectionReturn all currently-visible pieces in the collection as a read-only array- Specified by:
getPiecesin interfacePieceCollection
-
getPieces
-
getAllPieces
Description copied from interface:PieceCollectionReturn all pieces in the collection, regardless of visibility- Specified by:
getAllPiecesin interfacePieceCollection
-
indexOf
Description copied from interface:PieceCollectionReturns the index of a piece. When painting the map, pieces are drawn in order of index- Specified by:
indexOfin interfacePieceCollection
-
remove
Description copied from interface:PieceCollectionRemoves the piece- Specified by:
removein interfacePieceCollection
-
moveToBack
Description copied from interface:PieceCollectionReposition a piece to the back of all others in the same layer- Specified by:
moveToBackin interfacePieceCollection
-
moveToFront
Description copied from interface:PieceCollectionReposition a piece to the front of all others in the same layer- Specified by:
moveToFrontin interfacePieceCollection
-
canMerge
Description copied from interface:PieceCollectionReturn true if the two pieces can be merged into a single stack- Specified by:
canMergein 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()
-