Class VassalMapQuadTree
java.lang.Object
VASSAL.tools.qtree.QuadTree
VASSAL.build.module.index.VassalMapQuadTree
- All Implemented Interfaces:
Cloneable
A Quadtree index of pieces on the playable area of the Map.
Each node of the Quadtree holds an Arraylist of the Game Pieces at that Map location
Pieces that do not reside on the actual map (i.e. in the edge buffer, or off map) will not be
indexed and NOT be found by a Ranged GKC
-
Constructor Summary
ConstructorDescriptionVassalMapQuadTree
(VassalMapQuadTree qtree, int x1, int y1, int x2, int y2) Create a new Quadtree with larger bounds from an existing QuadtreeVassalMapQuadTree
(Map map) Create a QuadTree to cover the entire map -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a piece to the Qtree, or change it's locationReturn the bounds of the current QuadtreegetPiecesInRange
(Point pos, int range) Return a list of all pieces within range of a given Point NOTE: This is just a pre-selection, we are seacrchign a box, not a circle so extra pieces will be returned that are not in range.void
Remove a piece from the Qtree and the cross-referenceMethods inherited from class VASSAL.tools.qtree.QuadTree
clear, clone, contains, find, get, getCount, getKeys, getRootNode, getValues, isEmpty, navigate, remove, searchIntersect, searchWithin, set, setRootNode, traverse
-
Constructor Details
-
VassalMapQuadTree
-
VassalMapQuadTree
Create a new Quadtree with larger bounds from an existing Quadtree- Parameters:
qtree
- Existing Quadtreex1
- New left marginy1
- New top marginx2
- New right marginy2
- New bottom margin
-
-
Method Details
-
getBounds
-
addOrUpdatePiece
Add a piece to the Qtree, or change it's location- Parameters:
p
- Piece to add/move
-
removePiece
Remove a piece from the Qtree and the cross-reference- Parameters:
p
- Piece to remove
-
getPiecesInRange
Return a list of all pieces within range of a given Point NOTE: This is just a pre-selection, we are seacrchign a box, not a circle so extra pieces will be returned that are not in range. This will be handled at the level above which will post-process our selection.- Parameters:
pos
- Positionrange
- range in pixels to search- Returns:
- List of pieces
-