box module¶
-
class
amulet.api.selection.
Selection
(boxes=None)[source]¶ Bases:
object
Holding class for multiple SubSelectionBoxes which allows for non-rectangular and non-contiguous selections
-
add_box
(other, do_merge_check=True)[source]¶ Adds a SubSelectionBox to the selection box. If other is next to another SubSelectionBox in the selection, matches in any 2 dimensions, and do_merge_check is True, then the 2 boxes will be combined into 1 box.
Parameters: - other (
SubSelectionBox
) – The box to add - do_merge_check (
bool
) – Boolean flag to merge boxes if able
- other (
-
intersection
(other)[source]¶ Get a new Selection that represents the area contained within self and other
Return type: Selection
-
is_contiguous
¶ Does the Selection represent one connected region (True) or multiple separated regions (False)
Return type: bool
-
is_rectangular
¶ Checks if the Selection is a rectangle
Return type: bool
Returns: True is the selection is a rectangle, False otherwise
-
subboxes
¶ Returns an iterator of the SubSelectionBoxes in the Selection
Return type: Iterator
[SubSelectionBox
]Returns: An iterator of the SubSelectionBoxes
-
-
class
amulet.api.selection.
SubSelectionBox
(min_point, max_point)[source]¶ Bases:
object
A SubSelectionBox is a box that can represent the entirety of a Selection or just a subsection of one. This allows for non-rectangular and non-contiguous selections.
The both the minimum and maximum coordinate points are inclusive.
-
intersection
(other)[source]¶ Get a SubSelectionBox that represents the region contained within self and other. Box may be a zero width box. Use self.intersects to check that it actually intersects.
Return type: SubSelectionBox
-
intersects
(other)[source]¶ Method to check whether this instance of SubSelectionBox intersects another SubSelectionBox
Parameters: other ( SubSelectionBox
) – The other SubSelectionBox to check for intersectionReturn type: bool
Returns: True if the two SubSelectionBoxes intersect, False otherwise
-