avoid calling to_polygons on Polygons (for speed)
This commit is contained in:
parent
de4726955b
commit
08cf7ca4b1
@ -454,6 +454,14 @@ def _shapes_to_elements(shapes: List[Shape],
|
||||
extension=extension,
|
||||
properties=properties)
|
||||
elements.append(path)
|
||||
elif isinstance(shape, Polygon):
|
||||
polygon = shape
|
||||
xy_open = numpy.round(polygon.vertices + polygon.offset).astype(int)
|
||||
xy_closed = numpy.vstack((xy_open, xy_open[0, :]))
|
||||
boundary = klamath.elements.Boundary(layer=(layer, data_type),
|
||||
xy=xy_closed,
|
||||
properties=properties)
|
||||
elements.append(boundary)
|
||||
else:
|
||||
for polygon in shape.to_polygons():
|
||||
xy_open = numpy.round(polygon.vertices + polygon.offset).astype(int)
|
||||
|
Loading…
Reference in New Issue
Block a user