Add delete shape operation
This commit is contained in:
@@ -8,16 +8,17 @@ import ovh.gasser.newshapes.attributes.SelectionAttributes;
|
||||
import ovh.gasser.newshapes.util.Streamable;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Spliterator;
|
||||
|
||||
public class SCollection extends AbstractShape implements Streamable<Shape> {
|
||||
private final static Logger logger = LoggerFactory.getLogger(SCollection.class);
|
||||
private final List<Shape> children;
|
||||
private List<Shape> children;
|
||||
|
||||
private SCollection(Shape... shapes) {
|
||||
this.children = List.of(shapes);
|
||||
this.children = new ArrayList<>(List.of(shapes));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -58,6 +59,12 @@ public class SCollection extends AbstractShape implements Streamable<Shape> {
|
||||
return children.spliterator();
|
||||
}
|
||||
|
||||
public void remove(Shape s) {
|
||||
if (!children.remove(s)) {
|
||||
logger.error("Unable to delete shape: {}", s);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("SCollection{");
|
||||
|
||||
Reference in New Issue
Block a user