de.fhg.igd.earth.model.graph
Class Polygon

java.lang.Object
  extended byde.fhg.igd.earth.model.graph.ProjectorObject
      extended byde.fhg.igd.earth.model.graph.ModelGraphObject
          extended byde.fhg.igd.earth.model.graph.Node
              extended byde.fhg.igd.earth.model.graph.Leaf
                  extended byde.fhg.igd.earth.model.graph.Shape
                      extended byde.fhg.igd.earth.model.graph.Polygon
All Implemented Interfaces:
Cloneable, Serializable

public class Polygon
extends Shape
implements Serializable, Cloneable

This class represents a polygon (graphic object, leaf). A polygon includes coordinates, normals, textureCoordinates and a bounding box. For a wire frame visualization only the coordinates are needed. For a solid visualization the coordinates and the normals are needed. For a textured visualization the coordinates, the normals and the textureCoordinates are needed. The bounding box is stored permanently. Title : Earth Copyright : Copyright (c) 2001 Organisation : IGD FhG

Version:
: 1.0
Author:
: Werner Beutel
See Also:
Serialized Form

Field Summary
private  cBoundingBox boundingBox_
          a bounding box object (2 points)
private  Vector coordinates_
          point coordinates (cVector3d)
private  Vector normals_
          normals (cVector3f)
private  Vector textureCoordinates_
          texture coordinates (cVector2f)
 
Fields inherited from class de.fhg.igd.earth.model.graph.Shape
CULL_BACKFACE, CULL_FRONTFACE, CULL_NONE, STYLE_SOLID, STYLE_TEXTURE, STYLE_WIRE_FRAME
 
Fields inherited from class de.fhg.igd.earth.model.graph.Leaf
 
Fields inherited from class de.fhg.igd.earth.model.graph.Node
boundless_, collidable_, icon_, parent_, pickable_
 
Fields inherited from class de.fhg.igd.earth.model.graph.ModelGraphObject
CHANGE_AddChild, CHANGE_Anything, CHANGE_Appearance, CHANGE_Color, CHANGE_Create, CHANGE_Delete, CHANGE_Focus, CHANGE_HistoryGroup, CHANGE_InfoTable, CHANGE_Object, CHANGE_RemoveChild, CHANGE_Shape, CHANGE_Trace, CHANGE_Update, CHANGE_Visibility, changes_, infoTable_, mutable_, name_, subChanges_, SUBTYPE_BackGround, SUBTYPE_Box, SUBTYPE_BranchGroup, SUBTYPE_Cone, SUBTYPE_Cylinder, SUBTYPE_DetailGroup, SUBTYPE_DistanceDetailGroup, SUBTYPE_Group, SUBTYPE_HistoryGroup, SUBTYPE_LatchGroup, SUBTYPE_ModelGraph, SUBTYPE_Polygon, SUBTYPE_Primitive, SUBTYPE_Sphere, SUBTYPE_Text, SUBTYPE_TransformGroup, SUBTYPE_WireBoxGroup, timeStamp_, trace_, traceable_, TYPE_Group, TYPE_Leaf
 
Fields inherited from class de.fhg.igd.earth.model.graph.ProjectorObject
projectorObject_
 
Constructor Summary
Polygon()
          Constructs and initializes an empty polygon.
 
Method Summary
protected  boolean addPoint(cPoint3d c)
          Adds a Point to this polygon (blocked by mutable).
 boolean addPoint(cPoint3d c, cVector3f n)
          Adds a Point to this polygon (blocked by mutable).
 boolean addPoint(cPoint3d c, cVector3f n, cPoint2f t)
          Adds a Point to this polygon (blocked by mutable).
 boolean addPoint(double cx, double cy, double cz)
          Adds a Point to this polygon (blocked by mutable).
 boolean addPoint(double cx, double cy, double cz, float nx, float ny, float nz)
          Adds a Point to this polygon (blocked by mutable).
 boolean addPoint(double cx, double cy, double cz, float nx, float ny, float nz, float tx, float ty)
          Adds a Point to this polygon (blocked by mutable).
protected  void calcBoundingBox(cBoundingBox boundingBox)
          Calculates the bounding box of this box.
 Object clone()
          Clones this polygon
 Vector getCoordinates()
          Returns the coordinates vector
 cPoint3d[] getCoordinatesArray()
          Returns the coordinates array
 Vector getNormals()
          Returns the normals vector
 cVector3f[] getNormalsArray()
          Returns the normals array
 int getSubType()
          Returns SUBTYPE_POLYGON
 Vector getTextureCoordinates()
          Returns the textureCoordinates vector
 cPoint2f[] getTextureCoordinatesArray()
          Returns the textureCoordinates array
 int getType()
          Returns TYPE_LEAF
protected  boolean setCoordinates(Vector c)
          Sets the coordinates vector (blocked by mutable).
 boolean setNormals(Vector n)
          Sets the normals vector (blocked by mutable).
 boolean setTextureCoordinates(Vector tc)
          Sets the textureCoordinates vector (blocked by mutable).
 
Methods inherited from class de.fhg.igd.earth.model.graph.Shape
getColor, getCullingMode, getHighLight, getHighLightColor, getImage, getStyle, getTransparency, setColor, setCullingMode, setHighLight, setHighLightColor, setImage, setStyle, setTransparency
 
Methods inherited from class de.fhg.igd.earth.model.graph.Leaf
createLeafList, createSubGroupList, createSubNodeList, detach, getVisible, searchDown, searchDown, searchDown, searchDown, searchDownInserter, searchDownInserter, setMutable, setVisible
 
Methods inherited from class de.fhg.igd.earth.model.graph.Node
broadcastCreation, broadcastResetChanges, createParentGroupList, delete, delete, getBoundingBox, getBoundless, getBranchGroup, getCollidable, getGroup, getIcon, getLeafList, getModelGraph, getParent, getParentGroupList, getPickable, getSubGroupList, getSubNodeList, isFocused, move, move, moveTo, publishChanges, resetProjectorObject, searchUp, searchUp, searchUp, searchUp, setBoundless, setCollidable, setIcon, setParent, setPickable
 
Methods inherited from class de.fhg.igd.earth.model.graph.ModelGraphObject
anyChanges, anySubChanges, getChanges, getChanges, getInfoTable, getInfoTableElements, getInfoTableKeys, getInfoTableSize, getInfoTableValues, getMutable, getName, getSubChanges, getSubChanges, getSubTypeName, getTimeStamp, getTrace, getTraceable, putInfo, resetChanges, setChanges, setInfoTable, setName, setSubChanges, setTrace, VectorClone
 
Methods inherited from class de.fhg.igd.earth.model.graph.ProjectorObject
getProjectorObject, setProjectorObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

normals_

private Vector normals_
normals (cVector3f)


coordinates_

private Vector coordinates_
point coordinates (cVector3d)


textureCoordinates_

private Vector textureCoordinates_
texture coordinates (cVector2f)


boundingBox_

private cBoundingBox boundingBox_
a bounding box object (2 points)

Constructor Detail

Polygon

public Polygon()
Constructs and initializes an empty polygon.

Method Detail

getType

public int getType()
Returns TYPE_LEAF

Specified by:
getType in class ModelGraphObject
Returns:
TYPE_LEAF

getSubType

public int getSubType()
Returns SUBTYPE_POLYGON

Specified by:
getSubType in class ModelGraphObject
Returns:
SUBTYPE_POLYGON

addPoint

public boolean addPoint(double cx,
                        double cy,
                        double cz,
                        float nx,
                        float ny,
                        float nz,
                        float tx,
                        float ty)
Adds a Point to this polygon (blocked by mutable). Released changes: CHANGE_UPDATE, CHANGE_SHAPE

Returns:
true on success.

addPoint

public boolean addPoint(cPoint3d c,
                        cVector3f n,
                        cPoint2f t)
Adds a Point to this polygon (blocked by mutable). Released changes: CHANGE_UPDATE, CHANGE_SHAPE

Parameters:
c - coordinate
n - normal
t - textureCoordinate
Returns:
true on success.

addPoint

public boolean addPoint(double cx,
                        double cy,
                        double cz,
                        float nx,
                        float ny,
                        float nz)
Adds a Point to this polygon (blocked by mutable). Released changes: CHANGE_UPDATE, CHANGE_SHAPE

Returns:
true on success.

addPoint

public boolean addPoint(cPoint3d c,
                        cVector3f n)
Adds a Point to this polygon (blocked by mutable). Released changes: CHANGE_UPDATE, CHANGE_SHAPE

Parameters:
c - coordinate
n - normal
Returns:
true on success.

addPoint

public boolean addPoint(double cx,
                        double cy,
                        double cz)
Adds a Point to this polygon (blocked by mutable). Released changes: CHANGE_UPDATE, CHANGE_SHAPE

Returns:
true on success.

addPoint

protected boolean addPoint(cPoint3d c)
Adds a Point to this polygon (blocked by mutable). Released changes: CHANGE_UPDATE, CHANGE_SHAPE

Parameters:
c - coordinate
Returns:
true on success.

setCoordinates

protected boolean setCoordinates(Vector c)
Sets the coordinates vector (blocked by mutable). Released changes: CHANGE_UPDATE, CHANGE_SHAPE

Parameters:
c - coordinates vector
Returns:
true on success.

getCoordinates

public Vector getCoordinates()
Returns the coordinates vector

Returns:
The coordinates vector

getCoordinatesArray

public cPoint3d[] getCoordinatesArray()
Returns the coordinates array

Returns:
The coordinates array

setTextureCoordinates

public boolean setTextureCoordinates(Vector tc)
Sets the textureCoordinates vector (blocked by mutable). Released changes: CHANGE_UPDATE, CHANGE_SHAPE

Parameters:
tc - textureCoordinates vector
Returns:
true on success.

getTextureCoordinates

public Vector getTextureCoordinates()
Returns the textureCoordinates vector

Returns:
The textureCoordinates vector

getTextureCoordinatesArray

public cPoint2f[] getTextureCoordinatesArray()
Returns the textureCoordinates array

Returns:
The textureCoordinates array

setNormals

public boolean setNormals(Vector n)
Sets the normals vector (blocked by mutable). Released changes: CHANGE_UPDATE, CHANGE_SHAPE

Parameters:
n - normals vector
Returns:
true on success.

getNormals

public Vector getNormals()
Returns the normals vector

Returns:
The normals vector

getNormalsArray

public cVector3f[] getNormalsArray()
Returns the normals array

Returns:
The normals array

calcBoundingBox

protected void calcBoundingBox(cBoundingBox boundingBox)
Calculates the bounding box of this box. This method is used by getBoundingBox().

Specified by:
calcBoundingBox in class Node
Parameters:
boundingBox - which will be combined with

clone

public Object clone()
Clones this polygon

Overrides:
clone in class Shape


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.