[PolyCollection] gracefully handle empty PolyCollections
This commit is contained in:
parent
72f462d077
commit
278f0783da
1 changed files with 5 additions and 1 deletions
|
|
@ -56,6 +56,8 @@ class PolyCollection(Shape):
|
|||
"""
|
||||
Iterator which provides slices which index vertex_lists
|
||||
"""
|
||||
if self._vertex_offsets.size == 0:
|
||||
return
|
||||
for ii, ff in zip(
|
||||
self._vertex_offsets,
|
||||
chain(self._vertex_offsets, (self._vertex_lists.shape[0],)),
|
||||
|
|
@ -168,7 +170,9 @@ class PolyCollection(Shape):
|
|||
annotations = copy.deepcopy(self.annotations),
|
||||
) for vv in self.polygon_vertices]
|
||||
|
||||
def get_bounds_single(self) -> NDArray[numpy.float64]: # TODO note shape get_bounds doesn't include repetition
|
||||
def get_bounds_single(self) -> NDArray[numpy.float64] | None: # TODO note shape get_bounds doesn't include repetition
|
||||
if self._vertex_lists.size == 0:
|
||||
return None
|
||||
return numpy.vstack((numpy.min(self._vertex_lists, axis=0),
|
||||
numpy.max(self._vertex_lists, axis=0)))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue