@Override public void selectShape(final WiresBaseShape shape) { if (shape == null) { return; } if (shape.equals(selectedShape)) { return; } clearSelection(); selectedShape = shape; selectedShape.setSelected(true); if (shape instanceof HasControlPoints) { ((HasControlPoints) selectedShape).showControlPoints(); } canvasLayer.batch(); }
@Override public void selectShape(final WiresBaseShape shape) { if (shape == null) { return; } if (shape.equals(selectedShape)) { return; } clearSelection(); selectedShape = shape; selectedShape.setSelected(true); if (shape instanceof HasControlPoints) { ((HasControlPoints) selectedShape).showControlPoints(); } canvasLayer.batch(); }
public void clear() { //Detach Shapes in Containers; as destroying a Container automatically destroys it's contained Shapes //This sounds as though we need not worry about those, however "shapesInCanvas" this means we cannot //simply iterate over "shapesInCanvas" as it's content changes as Shapes are destroyed. for (WiresShape shape : shapesInCanvas) { if (shape instanceof WiresContainer) { final WiresContainer wc = (WiresContainer) shape; for (WiresBaseShape bc : wc.getContainedShapes()) { wc.detachShape(bc); } } } //Now it's safe to destroy all Shapes for (WiresShape shape : shapesInCanvas) { shape.destroy(); canvasLayer.remove((IPrimitive<?>) shape); } clearSelection(); shapesInCanvas.clear(); panel.getViewport().setPixelSize(DEFAULT_SIZE_WIDTH, DEFAULT_SIZE_HEIGHT); panel.getViewport().draw(); }
public void clear() { //Detach Shapes in Containers; as destroying a Container automatically destroys it's contained Shapes //This sounds as though we need not worry about those, however "shapesInCanvas" this means we cannot //simply iterate over "shapesInCanvas" as it's content changes as Shapes are destroyed. for (WiresShape shape : shapesInCanvas) { if (shape instanceof WiresContainer) { final WiresContainer wc = (WiresContainer) shape; for (WiresBaseShape bc : wc.getContainedShapes()) { wc.detachShape(bc); } } } //Now it's safe to destroy all Shapes for (WiresShape shape : shapesInCanvas) { shape.destroy(); canvasLayer.remove((IPrimitive<?>) shape); } clearSelection(); shapesInCanvas.clear(); panel.getViewport().setPixelSize(DEFAULT_SIZE_WIDTH, DEFAULT_SIZE_HEIGHT); panel.getViewport().draw(); }