jv.viewer

## Class PvScene

- java.lang.Object
- - jv.object.PsObject
  - - jv.viewer.PvScene

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf

      public final class PvScene
      extends PsObject

  Container class for display. This class holds a set of geometries of class PvGeometry. Each PgGeometry registered in a PvDisplay is stored in the PvScene class associated with the display.
  See Also:
    `PvGeometryIf`, `PgGeometryIf`, `PvDisplayIf`, Serialized Form

- - ### Field Summary

    - ### Fields inherited from class jv.object.PsObject

      `HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PvScene()` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addGeometry(jv.viewer.PvGeometry aGeometry)` Register geometry in scene for display.
    `boolean` | `containsGeometry(PgGeometryIf aGeometry)` Checks whether geometry is registered in PvGeometry
    `PdVector[]` | `getBounds()` Compute bounding box of all items in the scene, or return null if no items available.
    `double` | `getDiameter()` Compute diameter if scene has items, otherwise return 0
    `void` | `init()` If instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.
    `void` | `paint(java.awt.Graphics g, PvDisplayIf disp)` Major paint method of JavaView.
    `jv.viewer.PvGeometry` | `removeGeometry(jv.viewer.PvGeometry aGeometry)` Remove geometry from list of registered geometries and return new current geometry container.
    `void` | `selectGeometry(jv.viewer.PvGeometry aGeometry)` Select current geometry which may become null if only special geometries are left.
    `void` | `setState(int aKey, boolean aState)`
    `boolean` | `update(java.lang.Object event)` Update the class whenever a child has changed.

    - ### Methods inherited from class jv.object.PsObject

      `addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### PvScene

          public PvScene()

      Constructor.

  - ### Method Detail

    - #### init

          public void init()

      Description copied from class: `PsObject`
      If instance has missing name then assign default name 'Object_NUMBER' where number is the total number of already created instances.
      Overrides:
        `init` in class `PsObject`

    - #### addGeometry

          public void addGeometry(jv.viewer.PvGeometry aGeometry)

      Register geometry in scene for display.

    - #### removeGeometry

          public jv.viewer.PvGeometry removeGeometry(jv.viewer.PvGeometry aGeometry)

      Remove geometry from list of registered geometries and return new current geometry container. The current geometry changes if it was the removed geometry. The visible geometry with smallest index is taken, otherwise the first geometry.

      Remark: (Internal Note) The internal index of the current geometry also changes if it was the last one in the geometry array.

      Returns:
        PvGeometry new current geometry container

    - #### selectGeometry

          public void selectGeometry(jv.viewer.PvGeometry aGeometry)

      Select current geometry which may become null if only special geometries are left.

    - #### containsGeometry

          public boolean containsGeometry(PgGeometryIf aGeometry)

      Checks whether geometry is registered in PvGeometry

    - #### setState

          public void setState(int aKey,
                      boolean aState)

    - #### getBounds

          public PdVector[] getBounds()

      Compute bounding box of all items in the scene, or return null if no items available. All items are multiplied with their modelling matrix before bounding box calculation.

    - #### getDiameter

          public double getDiameter()

      Compute diameter if scene has items, otherwise return 0

    - #### update

          public boolean update(java.lang.Object event)

      Update the class whenever a child has changed. Method is usually invoked from the children.
      Specified by:
        `update` in interface `PsUpdateIf`
      Overrides:
        `update` in class `PsObject`
      Parameters:
        `event` - carries a lot of information
      Returns:
        true if event has been handled, otherwise false
      See Also:
        `PsObject.setParent(PsUpdateIf)`, `PsObject.getFather()`, `PsObject.addUpdateListener(PsUpdateIf)`

    - #### paint

          public void paint(java.awt.Graphics g,
                   PvDisplayIf disp)

      Major paint method of JavaView. All geometry items are z-sorted and drawn using Painter's algorithm. For each geometry items exists a reference by index to its geometry whose drawing method is invoked.

      It is possible to draw a single geometry in the background first, and another geometry in the foreground after all major drawing has happened. Back- and foreground geometry are drawn by applying Painter's only to their own geometry items.

"

The software JavaView? is copyright protected. All Rights Reserved.
"