If you want to build a more complex UI than a simple 3D view, it is useful to be able to divide the viewing space into several zones.
One option is to create several instances of cgJOGL3DPlotView and perform a classical Java layout. This is a valid solution if the different 3D views do not share a lot between them.
However, if the purpose is to see the same data from different points of view or to view different data from the same point of view, you will need to perform synchronization between views. This can lead to poor user experience since each view will be rendered individually and therefore a little delay will occur between each rendering.
A solution can be to use split panes directly into a single 3D view scene graph.
The class cgJOGLSplitPaneNode allows to perform such a separation.
Frame split using 3 different splitting nodes.
Sample code
// Constructor cgJOGLSplitPaneNode splitPane = new cgJOGLSplitPaneNode(); // Set divider's orientation splitPane.setOrientation(cgJOGLSplitPaneNode.VERTICAL); // Set divider's color splitPane.setDividerColor(Color.BLACK); // Set divider's size splitPane.setDividerSize(3); // Set divider's location splitPane.setDividerLocation(0.3); //here we use a relative location.//location can be absolute by using the setDividerLocation(int) method.//Add your nodes with the method :// splitPane.addNode(cgJOGLSplitPaneNode.LEFT, node);// Location can be TOP, BOTTOM, LEFT, RIGHT splitPane.addNode(cgJOGLSplitPaneNode.LEFT, leftNode); splitPane.addNode(cgJOGLSplitPaneNode.RIGHT, rightNode); // Add the split pane node to the scenegraph parent.addNode(splitPane);
Another use case of the view dividing tool is when you want to display information on top of the 3D view. For this purpose, you can use the cgJOGLSimpleInternalFrameNode class.
The following example shows a colormap (very simple) shown in an internal frame. This internal frame can be collapsed or expansed. It also can be placed anywhere on the 3D view.
Internal Frame : expanded and collapsed
Sample code
// Constructor.// Origin location is the top left corner of the frame// Dimension is in pixel cgJOGLSimpleInternalFrameNode internalFrame = new cgJOGLSimpleInternalFrameNode(100, 50, 200, 200); //x,y,width,height// You can now add you're nodes in the internal frame with the method : internalFrame.addNode(colorMapNode); // Name the frame internalFrame.setTitle("Surface color map"); // Add the internal frame node to the scenegraph parent.addNode(internalFrame);
To control the internal frame, you can use the methods collapse(), expand(), setSize(int width, int height) and setLocation(int x, int y).
More customization methods are available (see cgJOGLSimpleInternalFrameNode javadoc).