From 259fce6ca0fa4fe92e6dc2266d442c62723eb73c Mon Sep 17 00:00:00 2001 From: Sven Göthel Date: Sun, 7 Jan 2024 04:44:01 +0100 Subject: GraphUI Cleanup: Simplify Shape.draw*() and Container.{add,remove*}Shape[s](); Remove Scene.setDebugBorderBox() Simplify Shape/Scene - Split scene.display()/shape.drawImpl0() and scene.displayGLSelect()/shape.drawToSelectImpl0() Simplify Container (Scene/Group) - {add,remove*}Shape[s](), i.e. drop unusual removeShape*() and simplify implementation Scene - Remove setDebugBorderBox() --- .../classes/com/jogamp/graph/ui/Container.java | 29 ++++++++++++++-------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src/graphui/classes/com/jogamp/graph/ui/Container.java') diff --git a/src/graphui/classes/com/jogamp/graph/ui/Container.java b/src/graphui/classes/com/jogamp/graph/ui/Container.java index dd8fe99f9..545ceec60 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Container.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Container.java @@ -1,5 +1,5 @@ /** - * Copyright 2023 JogAmp Community. All rights reserved. + * Copyright 2023-2024 JogAmp Community. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: @@ -34,6 +34,8 @@ import java.util.List; import com.jogamp.graph.ui.Shape.Visitor2; import com.jogamp.math.geom.AABBox; import com.jogamp.math.util.PMVMatrix4f; +import com.jogamp.opengl.GL2ES2; +import com.jogamp.graph.curve.opengl.RegionRenderer; import com.jogamp.graph.ui.Shape.Visitor1; /** @@ -53,25 +55,30 @@ public interface Container { void addShape(Shape s); /** - * Removes given shape, w/o {@link Shape#destroy(com.jogamp.opengl.GL2ES2, com.jogamp.graph.curve.opengl.RegionRenderer) destroying} them. + * Removes given shape, w/o {@link Shape#destroy(GL2ES2, RegionRenderer)}. * @return the removed shape or null if not contained */ - Shape removeShape(Shape s); + Shape removeShape(final Shape s); + + /** Removes all given shapes, w/o {@link Shape#destroy(GL2ES2, RegionRenderer)}. */ + void removeShapes(Collection shapes); /** - * Removes shape at given index, w/o {@link Shape#destroy(com.jogamp.opengl.GL2ES2, com.jogamp.graph.curve.opengl.RegionRenderer) destroying} them. - * @return the removed shape - * @throws IndexOutOfBoundsException if index is out of bounds, i.e. (index < 0 || index >= size()) + * Removes given shape with {@link Shape#destroy(GL2ES2, RegionRenderer)}, if contained. + * @param gl GL2ES2 context + * @param renderer + * @param s the shape to be removed + * @return true if given Shape is removed and destroyed */ - Shape removeShape(final int idx); + boolean removeShape(final GL2ES2 gl, final RegionRenderer renderer, final Shape s); void addShapes(Collection shapes); - /** Removes all given shapes, w/o {@link Shape#destroy(com.jogamp.opengl.GL2ES2, com.jogamp.graph.curve.opengl.RegionRenderer) destroying} them. */ - void removeShapes(Collection shapes); + /** Removes all given shapes with {@link Shape#destroy(GL2ES2, RegionRenderer)}. */ + void removeShapes(final GL2ES2 gl, final RegionRenderer renderer, final Collection shapes); - /** Removes all contained shapes, w/o {@link Shape#destroy(com.jogamp.opengl.GL2ES2, com.jogamp.graph.curve.opengl.RegionRenderer) destroying} them. */ - void removeAllShapes(); + /** Removes all contained shapes with {@link Shape#destroy(GL2ES2, RegionRenderer)}. */ + void removeAllShapes(final GL2ES2 gl, final RegionRenderer renderer); boolean contains(Shape s); -- cgit v1.2.3