JavaView® v2.00.008

jv.viewer
Class PvScene

java.lang.Object
  |
  +--jv.object.PsObject
        |
        +--jv.viewer.PvScene
All Implemented Interfaces:
java.lang.Cloneable, PsUpdateIf, java.io.Serializable

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.

Version:
02.07.00, 2.10 revised (kp) Maximal number of registered geometries now automatically adjusted if necessary.
09.04.00, 2.00 revised (kp) Renamed to PvScene from PvPaint.
21.06.99, 1.02 revised (kp) Clipping activated.
02.01.99, 1.01 revised (kp) Additional integer argument for setList calls.
00.00.97, 1.00 created (kp)
Author:
Konrad Polthier
See Also:
jv.project.PvGeometry, PgGeometryIf, PvDisplayIf, Serialized Form

Field Summary
protected  PdVector[] m_bndBox
          Rectangular bounding box of the geometry in world coordinates.
protected  PdVector m_center
          Center of geometries world coordinate system
protected  jv.viewer.PvGeometry m_currentGeom
          Container of selected geometry
protected  int m_dim
          Dimension of items.
protected  int m_dimWithZBuffer
          Determines number of components of each vector which describes a scanline.
protected  jv.viewer.PvGeometry[] m_geometry
          Set of associated real geometries which implement PgGeometryIf
protected  double[] m_itemHeight
          Array with z-values of each projected item.
protected  int[][] m_itemInd
          Position of items of each geometry in global item list
protected  int[] m_itemSort
          Index of item corresponding to a height entry in m_itemHeight.
protected  int m_maxNumGeometries
          Maximal number of registered geometries.
protected  int m_numGeometries
          Number of registered geometries.
protected  int m_numItems
          Total number of items of all geometries.
protected  int m_pickedGeometry
          Index of picked geometry, used for dragging.
protected  int m_pickedVertex
          Index of picked vertex, used for dragging.
protected  java.util.Vector m_special
          Vector containing all back and front geometries, they are not height sorted together with standard geometries.
protected static int m_zMax
           
protected static int m_zMin
           
protected static int t_itemInd
          Major paint method of JavaView.
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, NUM_TAGS
 
Constructor Summary
PvScene()
          Constructor.
 
Method Summary
 void addGeometry(jv.viewer.PvGeometry aGeometry)
          Register geometry to be displayed
 boolean containsGeometry(PgGeometryIf aGeometry)
          Checks whether geometry is registered in PvGeometry
 PdVector[] getBounds()
          Compute bounding box if scene has number of items, otherwise return null.
 double getDiameter()
          Compute diameter if scene has items, otherwise return 0
protected  jv.viewer.PvGeometry[] getGeometries()
          Get all registered geometries including back and front geometry.
protected  jv.viewer.PvGeometry getGeometry(PgGeometryIf aGeometry)
          Query geometry array to obtain the geometry container of a user geometry.
protected  double getHeightOfItemInCurrentGeometry(int itemInd)
          Get height of item with given index.
 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)
           
 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)
           
 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, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, toString, updatePanels
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_maxNumGeometries

protected int m_maxNumGeometries
Maximal number of registered geometries.

m_numGeometries

protected int m_numGeometries
Number of registered geometries.

m_geometry

protected jv.viewer.PvGeometry[] m_geometry
Set of associated real geometries which implement PgGeometryIf

m_special

protected java.util.Vector m_special
Vector containing all back and front geometries, they are not height sorted together with standard geometries.

m_currentGeom

protected jv.viewer.PvGeometry m_currentGeom
Container of selected geometry

m_numItems

protected int m_numItems
Total number of items of all geometries.

m_itemInd

protected int[][] m_itemInd
Position of items of each geometry in global item list

m_itemHeight

protected double[] m_itemHeight
Array with z-values of each projected item.

m_itemSort

protected int[] m_itemSort
Index of item corresponding to a height entry in m_itemHeight.

m_dim

protected int m_dim
Dimension of items.

m_bndBox

protected PdVector[] m_bndBox
Rectangular bounding box of the geometry in world coordinates.

m_center

protected PdVector m_center
Center of geometries world coordinate system

m_pickedVertex

protected int m_pickedVertex
Index of picked vertex, used for dragging.

m_pickedGeometry

protected int m_pickedGeometry
Index of picked geometry, used for dragging.

m_dimWithZBuffer

protected int m_dimWithZBuffer
Determines number of components of each vector which describes a scanline. First two components are the horizontal start and end pixel, third component is the z-depth in z-buffer mode, fourth component is the offest of the start and end pixel which avoids overlap with adjacent elements.

t_itemInd

protected static int t_itemInd
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.


m_zMin

protected static int m_zMin

m_zMax

protected static int m_zMax
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 to be displayed

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.

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)

containsGeometry

public boolean containsGeometry(PgGeometryIf aGeometry)
Checks whether geometry is registered in PvGeometry

getGeometry

protected jv.viewer.PvGeometry getGeometry(PgGeometryIf aGeometry)
Query geometry array to obtain the geometry container of a user geometry.

getGeometries

protected jv.viewer.PvGeometry[] getGeometries()
Get all registered geometries including back and front geometry. Remark: (Internal Note) Method does not just return array m_geometry but an array with length equal to number of geometries.
Returns:
PvGeometry array with registered geometry containers

setState

public void setState(int aKey,
                     boolean aState)

getBounds

public PdVector[] getBounds()
Compute bounding box if scene has number of items, otherwise return null.

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.
Overrides:
update in class PsObject
Following copied from class: jv.object.PsObject
See Also:
PsObject.setParent(PsUpdateIf), PsObject.getFather(), PsObject.addUpdateListener(PsUpdateIf)

paint

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

getHeightOfItemInCurrentGeometry

protected double getHeightOfItemInCurrentGeometry(int itemInd)
Get height of item with given index. Index refers to listing in geometry. If requested item is not in list, just return minus infinity. Such a situation may occur when an element set is only partially drawn. Then the neighbour references may refer to elements not available for display.

JavaView® v2.00.008

The software JavaView® is copyright protected. All Rights Reserved.