Package geomss.app

Class GeomSSCanvas3D

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.awt.print.Printable, java.io.Serializable, javax.accessibility.Accessible

    public class GeomSSCanvas3D
    extends BGFGCanvas3D
    implements java.awt.print.Printable
    The 3D canvas used by this application to display the user's geometry.

    Modified by: Joseph A. Huwaldt

    Version:
    February 17, 2025
    Author:
    Joseph A. Huwaldt, Date: April 14, 2009
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  GeomSSCanvas3D.PDViewAngle
      Pre-defined view angles used with setView.
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.BaselineResizeBehavior
    • Field Summary

      • Fields inherited from class org.jogamp.java3d.Canvas3D

        FIELD_ALL, FIELD_LEFT, FIELD_RIGHT
      • Fields inherited from class java.awt.Component

        BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
      • Fields inherited from interface java.awt.print.Printable

        NO_SUCH_PAGE, PAGE_EXISTS
    • Constructor Summary

      Constructors 
      Constructor Description
      GeomSSCanvas3D​(GeomElement geometry, int width, int height)
      Constructs and initializes a new Canvas3D object that Java 3D can render into.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTransformChangeListener​(TransformChangeListener listener)
      Add a TransformChangeListener to this canvas.
      GeomSSScene getScene()  
      void postSwap()
      Process code after we have swapped the image to the foreground.
      int print​(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)
      Prints the 3D model image from this canvas to the specified Graphics context using the specified page format.
      void removeTransformChangeListener​(TransformChangeListener listener)
      Remove a TransformChangeListener from this canvas.
      void setView​(GeomSSCanvas3D.PDViewAngle viewAngle)
      Set the viewing angle for this canvas to one of the pre-set angles.
      void waitForRendering​(long timeout)
      Causes the calling thread to wait until either the current rendering is complete, or until the specified amount of time has elapsed.
      • Methods inherited from class org.jogamp.java3d.Canvas3D

        addNotify, getCenterEyeInImagePlate, getDoubleBufferAvailable, getDoubleBufferEnable, getGraphics2D, getGraphicsContext3D, getImagePlateToVworld, getInverseVworldProjection, getLeftEyeInImagePlate, getLeftManualEyeInImagePlate, getLocationOnScreen, getMonoscopicViewPolicy, getOffScreenBuffer, getOffScreenLocation, getOffScreenLocation, getPhysicalHeight, getPhysicalWidth, getPixelLocationFromImagePlate, getPixelLocationInImagePlate, getPixelLocationInImagePlate, getRightEyeInImagePlate, getRightManualEyeInImagePlate, getSceneAntialiasingAvailable, getScreen3D, getStereoAvailable, getStereoEnable, getView, getVworldProjection, getVworldToImagePlate, isOffScreen, isRendererRunning, isShadingLanguageSupported, paint, queryProperties, removeNotify, renderField, renderOffScreenBuffer, setDoubleBufferEnable, setLeftManualEyeInImagePlate, setMonoscopicViewPolicy, setOffScreenBuffer, setOffScreenLocation, setOffScreenLocation, setRightManualEyeInImagePlate, setStereoEnable, startRenderer, stopRenderer, swap, waitForOffScreenRendering
      • Methods inherited from class java.awt.Canvas

        createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • GeomSSCanvas3D

        public GeomSSCanvas3D​(GeomElement geometry,
                              int width,
                              int height)
        Constructs and initializes a new Canvas3D object that Java 3D can render into.
        Parameters:
        geometry - The geometry to be displayed.
        width - The width of the canvas (must be > 0).
        height - The height of the canvas (must be > 0).
        Throws:
        java.lang.IllegalArgumentException - if the specified GraphicsConfiguration does not support 3D rendering
    • Method Detail

      • getScene

        public GeomSSScene getScene()
        Returns:
        the 3D scene displayed in this canvas (for use in BeanShell primarily).
      • setView

        public void setView​(GeomSSCanvas3D.PDViewAngle viewAngle)
        Set the viewing angle for this canvas to one of the pre-set angles.
        Parameters:
        viewAngle - The pre-defined viewing angle for this canvas.
      • print

        public int print​(java.awt.Graphics graphics,
                         java.awt.print.PageFormat pageFormat,
                         int pageIndex)
                  throws java.awt.print.PrinterException
        Prints the 3D model image from this canvas to the specified Graphics context using the specified page format. This method is called by a PrinerJob and should not be called directly by users.
        Specified by:
        print in interface java.awt.print.Printable
        Parameters:
        graphics - the context into which the page is drawn
        pageFormat - the size and orientation of the page being drawn
        pageIndex - the zero based index of the page to be drawn.
        Returns:
        PAGE_EXISTS if the page is rendered successfully or NO_SUCH_PAGE if pageIndex specifies a non-existent page.
        Throws:
        java.awt.print.PrinterException
      • waitForRendering

        public void waitForRendering​(long timeout)
                              throws java.lang.IllegalArgumentException
        Causes the calling thread to wait until either the current rendering is complete, or until the specified amount of time has elapsed. If the calling thread is interrupted by any thread before or while it is waiting, then this method will simply return immediately.
        Parameters:
        timeout - the maximum time to wait in milliseconds.
        Throws:
        java.lang.IllegalArgumentException - if the value of timeout is negative.