JavaView© v3.95.000

jv.project
Class PgGeometry

java.lang.Object
  extended byjv.object.PsObject
      extended byjv.project.PgGeometry
All Implemented Interfaces:
java.lang.Cloneable, PgGeometryIf, PsUpdateIf, java.io.Serializable
Direct Known Subclasses:
PgAxes, PgJvxSrc, PgPointSet, PgSurfacePair, PgVectorField, PgWeierstrassDescr, PsKeyframe

public abstract class PgGeometry
extends PsObject
implements PgGeometryIf, java.lang.Cloneable

Abstract class for all geometry classes in JavaView, and implementation of PgGeometryIf. Users may derive their own geometry classes either from this class resp. its subclasses, or by writing a class implementing the interface PgGeometryIf. Either of the two options is required to view the geometry in a JavaView display.

See Also:
PgGeometryIf, PvDisplayIf, Serialized Form

Field Summary
 
Fields inherited from class jv.object.PsObject
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
 
Fields inherited from interface jv.project.PgGeometryIf
AMBIENT_H2_HYPERBOLIC, AMBIENT_H3_HYPERBOLIC, AMBIENT_H4_HYPERBOLIC, AMBIENT_PROJECTIONS, AMBIENT_R1_EUCLIDEAN, AMBIENT_R2_EUCLIDEAN, AMBIENT_R3_EUCLIDEAN, AMBIENT_R4_EUCLIDEAN, AMBIENT_R5_EUCLIDEAN, AMBIENT_S1_SPHERE, AMBIENT_S2_SPHERE, AMBIENT_S3_SPHERE, AMBIENT_S4_SPHERE, AMBIENT_SPACES, HAS_METHOD_MENU, INSPECTOR_CONTROL, INSPECTOR_CONTROL_EXT, INSPECTOR_MATERIAL, INSPECTOR_MATERIAL_EXT, INSPECTOR_TEXTURE, INSPECTOR_TEXTURE_EXT, LABEL_BASE, LABEL_CENTER, LABEL_HEAD, LABEL_MIDDLE, LABEL_TAIL, LABEL_TOP, m_numLabelTypes, METHOD_EXT, PROJ_KLEIN_BALL, PROJ_PARALLEL, PROJ_POINCARE_BALL, PROJ_STEREOGRAPHIC, PROJ_UPPER_HALFSPACE
 
Constructor Summary
PgGeometry()
          Constructor.
PgGeometry(int aDim)
          Constructor with dimension of geometric points, must be constant for all points.
 
Method Summary
 boolean addDisplay(PvDisplayIf display)
          Register a new display.
 int addElement(PiVector anElement)
          Method does nothing and may be overriden by subclasses.
 int addPolygon(PiVector aPolygon)
          Method does nothing and may be overriden by subclasses.
 int addVertex(PdVector aVertex)
          Method does nothing and may be overriden by subclasses.
 boolean applyAmbientMatrix()
          Multiply the ambient matrix to all geometry items.
 boolean applyModelingMatrix()
          Multiply the modeling matrix to all geometry items.
 boolean blend(double s, PgGeometry a, double t, PgGeometry b)
          Blend between two geometries, used in interpolation and computing the associate surfaces this = s*a + t*b.
 void clearTagElement(int index, int aTag)
          Method does nothing and may be overriden by subclasses.
 void clearTagPolygon(int index, int aTag)
          Method does nothing and may be overriden by subclasses.
 void clearTagVertex(int index, int aTag)
          Method does nothing and may be overriden by subclasses.
 java.lang.Object clone()
          Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners.
 void copy(PsObject object)
          Copy argument object into this object by recursively copying all instance variables.
 java.awt.Menu fillMethodMenu(java.awt.Menu menu)
          Deprecated. use fillMethodMenu(Menu, PvViewerIf)
 java.awt.Menu fillMethodMenu(java.awt.Menu menu, PvViewerIf viewer)
          Fill menu with items to invoke advanced methods of this geometry.
 PdVector[] getAmbientBounds()
          Compute bounding box of this geometry from the set of all vertices, or return null if no vertices.
 PdMatrix getAmbientInvMatrix()
          Get a reference of the inverse ambient model matrix of geometry.
 PdMatrix getAmbientMatrix()
          Get a reference of the ambient model matrix of geometry.
 int getAmbientProjection()
          Get projection mode of ambient space used in model transformations.
 int getAmbientSpace()
          Get ambient space used in model transformations.
 PsAuthorInfo getAuthorInfo()
          Get a reference to this author information.
 PsAuthorInfo getAuthors()
          Deprecated. used getAuthorInfo()
 PdVector[] getBounds()
          Compute bounding box of the vertices which are transformed with ambient and model matrix.
 PdVector getCenter()
          Get center of geometry which local transformations use as origin.
static PdVector getCenterOfElement(PdVector center, PdVector[] vertex, int[] vertInd)
          Compute the barycenter of a geometry element like face or polygon edge.
 PsPanel getControlPanel()
          Get control panel - if it does not exist try to allocate it.
 double getDiameter()
          Get diameter of object which is the diagonal in the bounding box.
 int getDimOfSimplex()
          Get dimension of simplicial complex, i.e. maximal dimension of occurring simplices.
 int getDimOfVertices()
          Retrieve dimension of vertices, which must be the same for all vertices.
 java.util.Vector getDisplayList()
          Get all registered displays as vector.
 java.util.Enumeration getDisplays()
          Get all registered displays as enumeration.
 PiVector getElement(int anIndex)
          Method does nothing and may be overriden by subclasses.
 PsGeometryInfo getGeometryInfo()
          Get geometry information.
 PgJvxSrc getJvx()
          Fills a geometry object with data from this instance, for example, to print to file.
 PiVector getLabelAttribute(int type)
          Get offset vector in pixel coordinates of label w.r.t. base point.
 java.awt.Color getLabelColor(int type)
          Get color of specified label type.
 java.lang.String getLabelFont(int type)
          Get font name of specified label type.
 double getLabelSize(int type)
          Get font size of specified label type.
 int getLabelStyle(int type)
          Get font style of specified label type.
 PsPanel getMaterialPanel()
          Get material panel - if it does not exist try to allocate it.
 PdMatrix getModelMatrix()
          Get a copy of the model matrix of geometry.
 PiVector getPolygon(int anIndex)
          Method does nothing and may be overriden by subclasses.
 boolean getState(int aKey)
          Get a drawing flag of this geometry.
 java.awt.Image getTextureImage()
          Get image of texture.
 java.lang.String getTextureImageName()
          Get name of texture image, a full URL or a relative file name.
 java.lang.String getTitle()
          Get the title of a geometry which may be the same for several geometries of a scene indicating a grouping or other purposes.
 int getType()
          Get type of geometry, for example PvGeometryIf#GEOM_POINT_SET and PvGeometryIf#GEOM_ELEMENT_SET.
 java.lang.String getVersion()
           
 java.lang.String getVersionType()
           
 PdVector getVertex(int anIndex)
          Method does nothing and may be overriden by subclasses.
 boolean hasAmbientMatrix()
          Check for ambient model matrix of geometry.
 boolean hasDisplay(PvDisplayIf display)
          Check if a given display is registered in this geometry.
 boolean hasModelMatrix()
          Check if geometry has a model matrix.
 boolean hasTagElement(int index, int aTag)
          Method does nothing and may be overriden by subclasses.
 boolean hasTagPolygon(int index, int aTag)
          Method does nothing and may be overriden by subclasses.
 boolean hasTagVertex(int index, int aTag)
          Method does nothing and may be overriden by subclasses.
 void init()
          Initializes and resets geometry.
 PvPickEvent intersectionWithLine(PdVector base, PdVector dir)
          Method used for picking, should be overriden by subclasses.
 boolean isConfigurable(int panel)
          Determine whether class has a configuration panel of a given type.
 boolean isEnabledInstanceSharing()
          Determines if sharing of vertices and other instances with a base geometry is enabled when this instance is filled in PgGeomtry#getJvx().
 boolean isShowingBndBox()
          Set flag to enable drawing of bounding box.
 boolean isShowingCenter()
          Set flag to enable drawing of center of geometry.
 boolean isShowingName()
          Check whether showing of name of geometry is switched on.
 boolean isShowingTitle()
          Check whether showing of title of geometry is switched on.
 boolean isVisible()
          Check the visibility flag of the geometry.
 boolean merge(PgGeometryIf geomIf)
          Add another of same geometry of same type to this geometry.
 void paint(PvGeometryIf dc)
          Major rendering method fills an internal container class supplied by the display.
 boolean projectFromAmbientSpace()
          Apply projection matrix and perform projection determined by projection flag of the surface in a Euclidean model R3, R2, or R1 with parallel projection.
 PgGeometry reflect(PdMatrix mat, boolean bOrient, boolean bVector)
          Generate a cloned geometry and transform vertices by a matrix.
 boolean removeDisplay(PvDisplayIf display)
          Remove a registered display from list of registered displays.
 int[] removeElement(int anIndex)
          Method does nothing and may be overriden by subclasses.
 void removeMethodMenus()
          Remove all menus with items to invoke advanced methods of this geometry.
 int[] removePolygon(int anIndex)
          Method does nothing and may be overriden by subclasses.
 int[] removeVertex(int anIndex)
          Method does nothing and may be overriden by subclasses.
 void setAmbientMatrix(PdMatrix ambientMat, PdMatrix ambientInvMat)
          Set ambient model matrix of geometry to copy of argument matrix.
 void setAmbientProjection(int mode)
          Set projection mode of ambient space used in model transformations.
 void setAmbientSpace(int mode)
          Set ambient space used in model transformations.
 void setAuthorInfo(PsAuthorInfo authorInfo)
          Set author information by copying or cloning the argument author info.
 void setAuthors(PsAuthorInfo author)
          Deprecated. used setAuthorInfo(PsAuthorInfo)
 void setCenter(PdVector center)
          Set center of geometry which local transformations use as origin.
 void setDimOfSimplex(int dim)
          Set dimension of simplicial complex, i.e. maximal dimension of occurring simplices.
 boolean setElement(int anIndex, PiVector aElement)
          Method does nothing and may be overriden by subclasses.
 void setEnabledInstanceSharing(boolean flag)
          Determines if sharing of vertices and other instances with a base geometry is enabled when this instance is filled in PgGeomtry#getJvx().
 void setGeometryInfo(PsGeometryInfo geometryInfo)
          Set geometry information by copying or cloning the argument geometry info.
 void setJvx(PgJvxSrc src)
          Fill this instance with data from a geometry source, for example, previously read from file.
 boolean setLabelAttribute(int type, int xOffset, int yOffset, int horAdjust, int verAdjust, int font)
          Set offset vector in pixel coordinates of label w.r.t. base point.
 boolean setLabelAttribute(int type, PiVector labelAtt)
          Set attributes of labels of given type.
 void setLabelColor(int type, java.awt.Color color)
          Set color of specified label type.
 void setLabelFont(int type, java.lang.String font)
          Set font name of specified label type.
 void setLabelSize(int type, double size)
          Set font size of specified label type.
 void setLabelStyle(int type, int style)
          Set font style of specified label type.
 void setModelMatrix(PdMatrix modelMat)
          Set model matrix of geometry to copy of argument matrix.
 boolean setPolygon(int anIndex, PiVector aPolygon)
          Method does nothing and may be overriden by subclasses.
 void setState(int aKey, boolean aState)
          Set a drawing flag of this geometry.
 void setTagElement(int index, int aTag)
          Method does nothing and may be overriden by subclasses.
 void setTagPolygon(int index, int aTag)
          Method does nothing and may be overriden by subclasses.
 void setTagVertex(int index, int aTag)
          Method does nothing and may be overriden by subclasses.
 void setTextureImage(java.awt.Image img)
          Set texture image for vertex and element textures.
 void setTextureImageName(java.lang.String name)
          Set name of texture image, a URL or a relative file name.
 void setTitle(java.lang.String title)
          Set the title of a geometry which may be the same for several geometries of a scene indicating a grouping or other purposes.
 void setType(int type)
          Set type of geometry, for example PvGeometryIf#GEOM_POINT_SET and PvGeometryIf#GEOM_ELEMENT_SET.
 void setVersion(java.lang.String version)
           
 void setVersionType(java.lang.String versionType)
           
 boolean setVertex(int anIndex, PdVector aVertex)
          Method does nothing and may be overriden by subclasses.
 void setVisible(boolean flag)
          Set the visibility flag of the geometry.
 void showBndBox(boolean flag)
          Set flag to enable drawing of bounding box.
 void showCenter(boolean flag)
          Set flag to enable drawing of center of geometry.
 void showName(boolean flag)
          Enable and disable showing of name of geometry in display.
 void showTitle(boolean flag)
          Enable and disable showing of title of geometry in display.
 java.lang.String toString()
          Create a multi-line string representation with detailed information about all instance variables.
 boolean update(java.lang.Object event)
          Update method of geometry updates registered panels, update listeners, and invokes a repaint in the registered displays.
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, updatePanels
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.project.PgGeometryIf
assureInspector, getInfoPanel, getName, hasTag, setName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, setParent
 

Constructor Detail

PgGeometry

public PgGeometry()
Constructor.


PgGeometry

public PgGeometry(int aDim)
Constructor with dimension of geometric points, must be constant for all points. The initial value of the dimension is a required argument of the constructor.

Parameters:
aDim - dimension of geometric points
See Also:
getDimOfVertices()
Method Detail

init

public void init()
Initializes and resets geometry.

Overrides:
init in class PsObject

isEnabledInstanceSharing

public boolean isEnabledInstanceSharing()
Determines if sharing of vertices and other instances with a base geometry is enabled when this instance is filled in PgGeomtry#getJvx().

Since:
JavaView 3.84.012

setEnabledInstanceSharing

public void setEnabledInstanceSharing(boolean flag)
Determines if sharing of vertices and other instances with a base geometry is enabled when this instance is filled in PgGeomtry#getJvx().

If sharing is enabled then base geometry and this container physically share memory of many instance arrays such as vertex, normal, face etc arrays. Sharing should be carefully enabled and special care must be taken.

Since:
JavaView 3.84.012

getAuthorInfo

public PsAuthorInfo getAuthorInfo()
Get a reference to this author information.

Specified by:
getAuthorInfo in interface PgGeometryIf

setAuthorInfo

public void setAuthorInfo(PsAuthorInfo authorInfo)
Set author information by copying or cloning the argument author info. If argument is null then this author info is also nulled.

Specified by:
setAuthorInfo in interface PgGeometryIf

getAuthors

public PsAuthorInfo getAuthors()
Deprecated. used getAuthorInfo()

Get author information.


setAuthors

public void setAuthors(PsAuthorInfo author)
Deprecated. used setAuthorInfo(PsAuthorInfo)

Set author information.


getGeometryInfo

public PsGeometryInfo getGeometryInfo()
Get geometry information.

Specified by:
getGeometryInfo in interface PgGeometryIf

setGeometryInfo

public void setGeometryInfo(PsGeometryInfo geometryInfo)
Set geometry information by copying or cloning the argument geometry info. If argument is null then this geometry info is also nulled.

Specified by:
setGeometryInfo in interface PgGeometryIf

getType

public int getType()
Get type of geometry, for example PvGeometryIf#GEOM_POINT_SET and PvGeometryIf#GEOM_ELEMENT_SET.

Specified by:
getType in interface PgGeometryIf
Returns:
type of geometry such as PgGeometrIy#GEOM_POINT_SET.

setType

public void setType(int type)
Set type of geometry, for example PvGeometryIf#GEOM_POINT_SET and PvGeometryIf#GEOM_ELEMENT_SET. Change display of vertices to default setting depending on geometry type.


getVersion

public java.lang.String getVersion()

setVersion

public void setVersion(java.lang.String version)

getVersionType

public java.lang.String getVersionType()

setVersionType

public void setVersionType(java.lang.String versionType)

getTitle

public java.lang.String getTitle()
Get the title of a geometry which may be the same for several geometries of a scene indicating a grouping or other purposes.

Specified by:
getTitle in interface PgGeometryIf
See Also:
PsObject.setName(String), showTitle(boolean), setTitle(String)

setTitle

public void setTitle(java.lang.String title)
Set the title of a geometry which may be the same for several geometries of a scene indicating a grouping or other purposes.

Specified by:
setTitle in interface PgGeometryIf
See Also:
PsObject.setName(String), showTitle(boolean), setTitle(String)

getDiameter

public double getDiameter()
Get diameter of object which is the diagonal in the bounding box.


getBounds

public PdVector[] getBounds()
Compute bounding box of the vertices which are transformed with ambient and model matrix.

The two returned bounding box vectors are 3-dimensional. If dimension of vertices is less than 3 then remaining components are zeroed.

Note, transformation not supported yet.

Returns:
two 3d vectors which are the extremal corners of the bounding cube
See Also:
getAmbientBounds()

getAmbientBounds

public PdVector[] getAmbientBounds()
Compute bounding box of this geometry from the set of all vertices, or return null if no vertices. Method returns two vectors whose size is equal to the dimenstion of this geometry. The two bounding vectors are first, the minimal corner, and second, the maximal corner of the bounding m_dim-cube. Both vectors uniquely determine the bounding box.

Subclasses may return null if no geometric size information available, for example, no vertices allocated yet.

Note, the bounding box does not include transformations from the ambient or model matrix.

Returns:
two vectors which are the extremal corners of the bounding cube
See Also:
getBounds()

getCenter

public PdVector getCenter()
Get center of geometry which local transformations use as origin. If the center has not been set then the origin of the world is returned, which is usually (0,0,0).

Returns:
a vector which is the local origin of the geometry

setCenter

public void setCenter(PdVector center)
Set center of geometry which local transformations use as origin. This method sets an instance variable and does not modify vertices.

Parameters:
center - vector which becomes the local origin of the geometry

isConfigurable

public boolean isConfigurable(int panel)
Determine whether class has a configuration panel of a given type. Default status is that class has no configuration panel. Possible choices of argument are HAS_INFO_PANEL or HAS_MATERIAL_PANEL or HAS_TEXTURE_PANEL or HAS_CONFIG_PANEL.

Specified by:
isConfigurable in interface PgGeometryIf
Parameters:
panel - Identifier of panel

getDimOfSimplex

public int getDimOfSimplex()
Get dimension of simplicial complex, i.e. maximal dimension of occurring simplices. For example, polygonal curves have simplex dimension 1, triangulated surfaces 2, and volumes have 3. Usually, this variable must be set in the constructor of a class.

Specified by:
getDimOfSimplex in interface PgGeometryIf
Since:
JavaView 1.95
See Also:
setDimOfSimplex(int)

setDimOfSimplex

public void setDimOfSimplex(int dim)
Set dimension of simplicial complex, i.e. maximal dimension of occurring simplices. For example, polygonal curves have simplex dimension 1, triangulated surfaces 2, and volumes have 3. Usually, this variable must be set in the constructor of a class.

Since:
JavaView 1.95
See Also:
getDimOfSimplex()

getJvx

public PgJvxSrc getJvx()
Fills a geometry object with data from this instance, for example, to print to file.

Specified by:
getJvx in interface PgGeometryIf
Returns:
src a geometry source filled with data from this instance.

setJvx

public void setJvx(PgJvxSrc src)
Fill this instance with data from a geometry source, for example, previously read from file.

Specified by:
setJvx in interface PgGeometryIf
Parameters:
src - a geometry source used to fill this instance with data.

toString

public java.lang.String toString()
Create a multi-line string representation with detailed information about all instance variables.

Specified by:
toString in interface PgGeometryIf
Overrides:
toString in class PsObject

clone

public java.lang.Object clone()
Duplicate geometry by recursively cloning all instance variables except inspector panels and lists of registered listeners. The parent relationship is maintained only within this class but not to external classes. In general, all links of the clone to external objects are set to null.

Display list is not cloned but set to null. Method menu is not cloned.

Specified by:
clone in interface PgGeometryIf
Overrides:
clone in class PsObject
See Also:
copy(PsObject)

copy

public void copy(PsObject object)
Copy argument object into this object by recursively copying all instance variables. Does not copy dimension of vertices, author info, geometry info, and visibility attributes.

The argument was changed from PgGeometry to PsObject since there were problems in J/Link which preferred to use PsObject#copy(PsObject) instead of PgGeometry#copy(PsObject).

Overrides:
copy in class PsObject
See Also:
PsObject.clone()

update

public boolean update(java.lang.Object event)
Update method of geometry updates registered panels, update listeners, and invokes a repaint in the registered displays. Usage:
1. event == this : geometry has changed, all panels will be updated.
2. event == null : geometry has changed, no need to update a panel.
3. event == a panel : geometry has changed, all panels except 'panel' will be updated.
3. event == else : unhandled event, error.
Panels are not updated if they have not been created yet, or if they are not visible.

Any update is forwarded to the parent of the geometry with the geometry as event.

Any update is forwarded to each registered display with the geometry as event which leads to a repaint of the display.

Specified by:
update in interface PsUpdateIf
Overrides:
update in class PsObject
See Also:
PsObject.setParent(PsUpdateIf), PsObject.getFather(), PsObject.addUpdateListener(PsUpdateIf)

paint

public void paint(PvGeometryIf dc)
Major rendering method fills an internal container class supplied by the display. See jv.project.PgGeometryIf for detailed information.

Specified by:
paint in interface PgGeometryIf
See Also:
PgGeometryIf

getDimOfVertices

public int getDimOfVertices()
Retrieve dimension of vertices, which must be the same for all vertices. An initial value of the dimension is a required argument of the constructor. The dimension of vertices is read-only.

Specified by:
getDimOfVertices in interface PgGeometryIf
See Also:
PgGeometry(int)

getAmbientSpace

public int getAmbientSpace()
Get ambient space used in model transformations.

Specified by:
getAmbientSpace in interface PgGeometryIf
Returns:
One of the values PgGeometryIf#AMBIENT_...

setAmbientSpace

public void setAmbientSpace(int mode)
Set ambient space used in model transformations.

Specified by:
setAmbientSpace in interface PgGeometryIf
Parameters:
mode - One of the values PgGeometryIf#AMBIENT_...

getAmbientProjection

public int getAmbientProjection()
Get projection mode of ambient space used in model transformations.

Specified by:
getAmbientProjection in interface PgGeometryIf
Returns:
One of the values PgGeometryIf#PROJ_...

setAmbientProjection

public void setAmbientProjection(int mode)
Set projection mode of ambient space used in model transformations.

Specified by:
setAmbientProjection in interface PgGeometryIf
Parameters:
mode - One of the values PgGeometryIf#PROJ_...

getState

public boolean getState(int aKey)
Get a drawing flag of this geometry. Method used be overwritten by subclasses to catch specific states. Currently, this method is not intended for public use.

This method catches unhandled keys of subclasses. Subclasses should overwrite this method and call super for unhandled keys.

Parameters:
aKey - flag to be set, choose among PvGeometryIf.SHOW_...
Returns:
boolean state of this key
Since:
JavaView 2.89.000

setState

public void setState(int aKey,
                     boolean aState)
Set a drawing flag of this geometry. Method used be overwritten by subclasses to catch specific states. Currently, this method is not intended for public use.

This method catches unhandled keys of subclasses. Subclasses should overwrite this method and call super for unhandled keys.

Specified by:
setState in interface PgGeometryIf
Parameters:
aKey - flag to be set, choose among PvGeometryIf.SHOW_...
aState - enable or disable state
Since:
JavaView 2.89.000

getModelMatrix

public PdMatrix getModelMatrix()
Get a copy of the model matrix of geometry. If geometry has no model matrix, then create and assign the identity matrix and return it.

Specified by:
getModelMatrix in interface PgGeometryIf

hasModelMatrix

public boolean hasModelMatrix()
Check if geometry has a model matrix.

Specified by:
hasModelMatrix in interface PgGeometryIf

setModelMatrix

public void setModelMatrix(PdMatrix modelMat)
Set model matrix of geometry to copy of argument matrix. If argument is null then model matrix is removed.

Specified by:
setModelMatrix in interface PgGeometryIf

applyModelingMatrix

public boolean applyModelingMatrix()
Multiply the modeling matrix to all geometry items. Method of this class does nothing. Subclasses are expected to reset the modeling matrix of this geometry to the identity matrix.

Returns:
true if this geometry has a model matrix.
Since:
JavaView 3.24

applyAmbientMatrix

public boolean applyAmbientMatrix()
Multiply the ambient matrix to all geometry items. Method of this class does nothing. Subclasses are expected to reset the ambient matrix of this geometry to the identity matrix.

Returns:
true if this geometry has a ambient matrix.
Since:
JavaView 3.24

getAmbientMatrix

public PdMatrix getAmbientMatrix()
Get a reference of the ambient model matrix of geometry. If geometry has no ambient matrix, then create and assign the identity matrix and return it.

Specified by:
getAmbientMatrix in interface PgGeometryIf

getAmbientInvMatrix

public PdMatrix getAmbientInvMatrix()
Get a reference of the inverse ambient model matrix of geometry. If geometry has no ambient matrix, then create and assign the identity matrix and return it.

Specified by:
getAmbientInvMatrix in interface PgGeometryIf

hasAmbientMatrix

public boolean hasAmbientMatrix()
Check for ambient model matrix of geometry.

Specified by:
hasAmbientMatrix in interface PgGeometryIf

setAmbientMatrix

public void setAmbientMatrix(PdMatrix ambientMat,
                             PdMatrix ambientInvMat)
Set ambient model matrix of geometry to copy of argument matrix. If one argument is null then the ambient model matrices are removed. Note, the ambient projection remains unchanged.

Specified by:
setAmbientMatrix in interface PgGeometryIf

projectFromAmbientSpace

public boolean projectFromAmbientSpace()
Apply projection matrix and perform projection determined by projection flag of the surface in a Euclidean model R3, R2, or R1 with parallel projection. Dimension of vertices may be decremented by one after this operation.

Returns:
true if operation was applied successfully.
Since:
JavaView 3.24.001

isVisible

public boolean isVisible()
Check the visibility flag of the geometry. A geometry may be hidden to be invisible in all displays by setting the visibility flag.

Specified by:
isVisible in interface PgGeometryIf
See Also:
setVisible(boolean)

setVisible

public void setVisible(boolean flag)
Set the visibility flag of the geometry. A geometry may be hidden to be invisible in all displays by setting the visibility flag. This does not remove the geometries from the displays but just deactivates their drawing.

Specified by:
setVisible in interface PgGeometryIf
See Also:
isVisible()

isShowingTitle

public boolean isShowingTitle()
Check whether showing of title of geometry is switched on. On default, showing of title is disabled.

See Also:
PsObject.setName(String), showName(boolean), setTitle(String)

showTitle

public void showTitle(boolean flag)
Enable and disable showing of title of geometry in display. On default, showing of title is disabled.

See Also:
PsObject.setName(String), showName(boolean), setTitle(String)

isShowingName

public boolean isShowingName()
Check whether showing of name of geometry is switched on. On default, showing of name is disabled.

Since:
JavaView 2.47
See Also:
showTitle(boolean), PsObject.setName(String)

showName

public void showName(boolean flag)
Enable and disable showing of name of geometry in display. On default, showing of title is disabled.

Since:
JavaView 2.47
See Also:
showTitle(boolean), PsObject.setName(String)

isShowingBndBox

public boolean isShowingBndBox()
Set flag to enable drawing of bounding box.


showBndBox

public void showBndBox(boolean flag)
Set flag to enable drawing of bounding box.


isShowingCenter

public boolean isShowingCenter()
Set flag to enable drawing of center of geometry.


showCenter

public void showCenter(boolean flag)
Set flag to enable drawing of center of geometry.


getLabelAttribute

public PiVector getLabelAttribute(int type)
Get offset vector in pixel coordinates of label w.r.t. base point. First two components are pixel coordinates. Third component is in [1..3] and indices whether head, center or tail is located at base+offset. Fourth component indicates font. Note, (0,0) is in the upper left corner of the screen. For possible type see PvGeometryIf#GEOM_ITEM_POINT and other items.

Parameters:
type - type of label, vertex, polygon, element or title labels.
Returns:
vector with three components, x, y, and position on string.

setLabelAttribute

public boolean setLabelAttribute(int type,
                                 int xOffset,
                                 int yOffset,
                                 int horAdjust,
                                 int verAdjust,
                                 int font)
Set offset vector in pixel coordinates of label w.r.t. base point. The base point of vertices is the vertex, the base point of elements and edges and polygon edges is the barycenter, i.e. midpoint.

First two components of attr are pixel coordinates determining the offset with respect to the base point. For example, an offset pair (1,-2) locates label center 1 to the right and 2 pixels up of the base point (since the upper left corner of the display is (0,0) in screen coordinates).

Third component of attr is PgGeometryIf.LABEL_HEAD or PgGeometryIf.LABEL_CENTER or PgGeometryIf.LABEL_TAIL and indicates whether head, tail, or center of label is located at base+offset.

Fourth component of attr is PgGeometryIf.LABEL_TOP or PgGeometryIf.LABEL_MIDDLE or PgGeometryIf.LABEL_BASE and indicates whether top, middle, or base of label is located at base+offset. Not implemented yet.

Fifth component of attr indicates font. For possible fonts see PsConfig.

Note, it is currently not possible to set the label attribute, say, of a single vertex unless you have a geometry with just one vertex.

There exist one vector for each of the basic primitive types GEOM_ITEM_POINT, GEOM_ITEM_EDGE,GEOM_ITEM_POLYGON,GEOM_ITEM_ELEMENT,GEOM_ITEM_TETRA, GEOM_ITEM_NAME and GEOM_ITEM_TITLE. For possible type see PvGeometryIf#GEOM_ITEM_POINT and other items.

Parameters:
type - Type of geometry items affected by this setting
xOffset - Offset in x-direction in pixels.
yOffset - Offset in y-direction in pixels.
horAdjust - Layout in horizontal direction, see PgGeometryIf#LABEL_.
verAdjust - Layout in vertikal direction, see PgGeometryIf#LABEL_.
font - Identifier of font, see PsConfig#FONT_
Returns:
false if type is unknown.

setLabelAttribute

public boolean setLabelAttribute(int type,
                                 PiVector labelAtt)
Set attributes of labels of given type. Methods just calls setLabelAttribute(int,int,int,int,int,int) with integer arguments. Length of vector must be equal to (or larger than) 5.

Parameters:
type - Type of geometry items affected by this setting
labelAtt - Vector with different attribute values

getLabelColor

public java.awt.Color getLabelColor(int type)
Get color of specified label type.

Basic primitive types are GEOM_ITEM_POINT, GEOM_ITEM_EDGE, GEOM_ITEM_POLYGON, GEOM_ITEM_ELEMENT, GEOM_ITEM_TETRA, GEOM_ITEM_NAME and GEOM_ITEM_TITLE. For possible type see PvGeometryIf#GEOM_ITEM_POINT.

Parameters:
type - Type of geometry items affected by this setting
Since:
JavaView 3.28.002

setLabelColor

public void setLabelColor(int type,
                          java.awt.Color color)
Set color of specified label type.

Basic primitive types are GEOM_ITEM_POINT, GEOM_ITEM_EDGE, GEOM_ITEM_POLYGON, GEOM_ITEM_ELEMENT, GEOM_ITEM_TETRA, GEOM_ITEM_NAME and GEOM_ITEM_TITLE. For possible type see PvGeometryIf#GEOM_ITEM_POINT.

Parameters:
type - Type of geometry items affected by this setting
color - Color used to draw the label
Since:
JavaView 3.05.003

getLabelSize

public double getLabelSize(int type)
Get font size of specified label type.

Basic primitive types are GEOM_ITEM_POINT, GEOM_ITEM_EDGE, GEOM_ITEM_POLYGON, GEOM_ITEM_ELEMENT, GEOM_ITEM_TETRA, GEOM_ITEM_NAME and GEOM_ITEM_TITLE. For possible type see PvGeometryIf#GEOM_ITEM_POINT.

Parameters:
type - Type of geometry items affected by this setting
Since:
JavaView 3.52.001

setLabelSize

public void setLabelSize(int type,
                         double size)
Set font size of specified label type.

Basic primitive types are GEOM_ITEM_POINT, GEOM_ITEM_EDGE, GEOM_ITEM_POLYGON, GEOM_ITEM_ELEMENT, GEOM_ITEM_TETRA, GEOM_ITEM_NAME and GEOM_ITEM_TITLE. For possible type see PvGeometryIf#GEOM_ITEM_POINT.

Parameters:
type - Type of geometry items affected by this setting
size - Font size used to draw the label
Since:
JavaView 3.52.001

getLabelFont

public java.lang.String getLabelFont(int type)
Get font name of specified label type.

Basic primitive types are GEOM_ITEM_POINT, GEOM_ITEM_EDGE, GEOM_ITEM_POLYGON, GEOM_ITEM_ELEMENT, GEOM_ITEM_TETRA, GEOM_ITEM_NAME and GEOM_ITEM_TITLE. For possible type see PvGeometryIf#GEOM_ITEM_POINT.

Parameters:
type - Type of geometry items affected by this setting
Since:
JavaView 3.52.001

setLabelFont

public void setLabelFont(int type,
                         java.lang.String font)
Set font name of specified label type.

Basic primitive types are GEOM_ITEM_POINT, GEOM_ITEM_EDGE, GEOM_ITEM_POLYGON, GEOM_ITEM_ELEMENT, GEOM_ITEM_TETRA, GEOM_ITEM_NAME and GEOM_ITEM_TITLE. For possible type see PvGeometryIf#GEOM_ITEM_POINT.

Parameters:
type - Type of geometry items affected by this setting
font - Font used to draw the label
Since:
JavaView 3.52.001

getLabelStyle

public int getLabelStyle(int type)
Get font style of specified label type.

Basic primitive types are GEOM_ITEM_POINT, GEOM_ITEM_EDGE, GEOM_ITEM_POLYGON, GEOM_ITEM_ELEMENT, GEOM_ITEM_TETRA, GEOM_ITEM_NAME and GEOM_ITEM_TITLE. For possible type see PvGeometryIf#GEOM_ITEM_POINT.

Parameters:
type - Type of geometry items affected by this setting
Since:
JavaView 3.52.001

setLabelStyle

public void setLabelStyle(int type,
                          int style)
Set font style of specified label type.

Basic primitive types are GEOM_ITEM_POINT, GEOM_ITEM_EDGE, GEOM_ITEM_POLYGON, GEOM_ITEM_ELEMENT, GEOM_ITEM_TETRA, GEOM_ITEM_NAME and GEOM_ITEM_TITLE. For possible type see PvGeometryIf#GEOM_ITEM_POINT.

Parameters:
type - Type of geometry items affected by this setting
style - Font style used to draw the label
Since:
JavaView 3.52.001

getMaterialPanel

public PsPanel getMaterialPanel()
Get material panel - if it does not exist try to allocate it. Standard panel for inspecting material properties of geometry.

Method is a shortcut to avoid checking, creating, and adding the panel to the inspector list.

Specified by:
getMaterialPanel in interface PgGeometryIf

getControlPanel

public PsPanel getControlPanel()
Get control panel - if it does not exist try to allocate it. Standard panel for inspecting functional data of a geometry, usually used by subclasses of geometry classes which have additional functionality.

Method is a shortcut to avoid checking, creating, and adding the panel to the inspector list.

Specified by:
getControlPanel in interface PgGeometryIf

fillMethodMenu

public java.awt.Menu fillMethodMenu(java.awt.Menu menu)
Deprecated. use fillMethodMenu(Menu, PvViewerIf)

Fill menu with items to invoke advanced methods of this geometry.

Specified by:
fillMethodMenu in interface PgGeometryIf

fillMethodMenu

public java.awt.Menu fillMethodMenu(java.awt.Menu menu,
                                    PvViewerIf viewer)
Fill menu with items to invoke advanced methods of this geometry. Via the optional parameter viewer the methods invoked by the menu may access the displays and inspectors of the environment.

Specified by:
fillMethodMenu in interface PgGeometryIf
Parameters:
menu - parent menu to which this menu is added.
viewer - optional viewer manager from which methods may access displays and inspectors.
Since:
JavaView 2.45

removeMethodMenus

public void removeMethodMenus()
Remove all menus with items to invoke advanced methods of this geometry.

Specified by:
removeMethodMenus in interface PgGeometryIf

addDisplay

public boolean addDisplay(PvDisplayIf display)
Register a new display. Display will be informed by update() whenever geometry changes require a repaint of the display. For example, method is called from PvDisplay when registering the geometry in the display.

Specified by:
addDisplay in interface PgGeometryIf
Parameters:
display - Display to be registered
Returns:
false if instance already registered.
See Also:
getDisplays()

getDisplayList

public java.util.Vector getDisplayList()
Get all registered displays as vector.

Returns:
Enumeration of registered displays, null if no displays found.
See Also:
getDisplays()

getDisplays

public java.util.Enumeration getDisplays()
Get all registered displays as enumeration.

Specified by:
getDisplays in interface PgGeometryIf
Returns:
Enumeration of registered displays, null if no displays found.
See Also:
TODO: use getDisplayList() since Enumeration may become obsolete in multi-threading.

hasDisplay

public boolean hasDisplay(PvDisplayIf display)
Check if a given display is registered in this geometry.

Specified by:
hasDisplay in interface PgGeometryIf
Parameters:
display - Display which is checked if registered
Returns:
true if registered display found.
See Also:
addDisplay(PvDisplayIf), getDisplays()

removeDisplay

public boolean removeDisplay(PvDisplayIf display)
Remove a registered display from list of registered displays. For example, method is called from PvDisplay when removing the geometry from the display.

Specified by:
removeDisplay in interface PgGeometryIf
Parameters:
display - Registered display to be removed
Returns:
false if display does not exists.
See Also:
addDisplay(PvDisplayIf)

addVertex

public int addVertex(PdVector aVertex)
Method does nothing and may be overriden by subclasses.

Specified by:
addVertex in interface PgGeometryIf
Parameters:
aVertex - vector with new vertex coordinates

getVertex

public PdVector getVertex(int anIndex)
Method does nothing and may be overriden by subclasses.

Specified by:
getVertex in interface PgGeometryIf
Parameters:
anIndex - index of vertex to be returned
Returns:
reference to vertex vector with given index

removeVertex

public int[] removeVertex(int anIndex)
Method does nothing and may be overriden by subclasses.

Specified by:
removeVertex in interface PgGeometryIf
Parameters:
anIndex - index of vertex to be removed
Returns:
array with indices of new positions of vertices

setVertex

public boolean setVertex(int anIndex,
                         PdVector aVertex)
Method does nothing and may be overriden by subclasses.

Specified by:
setVertex in interface PgGeometryIf
Parameters:
anIndex - index of vertex to be changed
aVertex - vector with new vertex coordinates

addPolygon

public int addPolygon(PiVector aPolygon)
Method does nothing and may be overriden by subclasses.

Specified by:
addPolygon in interface PgGeometryIf
Parameters:
aPolygon - vector with indices of vertices in global vertex array

getPolygon

public PiVector getPolygon(int anIndex)
Method does nothing and may be overriden by subclasses.

Specified by:
getPolygon in interface PgGeometryIf
Parameters:
anIndex - index of polygon to be returned
Returns:
reference to polygon vector with given index

removePolygon

public int[] removePolygon(int anIndex)
Method does nothing and may be overriden by subclasses.

Specified by:
removePolygon in interface PgGeometryIf
Parameters:
anIndex - index of polygon to be removed
Returns:
array with indices of new positions of polygons

setPolygon

public boolean setPolygon(int anIndex,
                          PiVector aPolygon)
Method does nothing and may be overriden by subclasses.

Specified by:
setPolygon in interface PgGeometryIf
Parameters:
anIndex - index of polygon to be changed
aPolygon - vector with indices of vertices in global vertex array

addElement

public int addElement(PiVector anElement)
Method does nothing and may be overriden by subclasses.

Specified by:
addElement in interface PgGeometryIf
Parameters:
anElement - vector with indices of vertices in global vertex array

getElement

public PiVector getElement(int anIndex)
Method does nothing and may be overriden by subclasses.

Specified by:
getElement in interface PgGeometryIf
Parameters:
anIndex - index of element to be returned
Returns:
reference to element vector with given index

removeElement

public int[] removeElement(int anIndex)
Method does nothing and may be overriden by subclasses.

Specified by:
removeElement in interface PgGeometryIf
Parameters:
anIndex - index of element to be removed
Returns:
array with indices of new positions of elements

setElement

public boolean setElement(int anIndex,
                          PiVector aElement)
Method does nothing and may be overriden by subclasses.

Specified by:
setElement in interface PgGeometryIf
Parameters:
anIndex - index of element to be changed
aElement - vector with indices of vertices in global vertex array

clearTagVertex

public void clearTagVertex(int index,
                           int aTag)
Method does nothing and may be overriden by subclasses.

Specified by:
clearTagVertex in interface PgGeometryIf

hasTagVertex

public boolean hasTagVertex(int index,
                            int aTag)
Method does nothing and may be overriden by subclasses.

Specified by:
hasTagVertex in interface PgGeometryIf

setTagVertex

public void setTagVertex(int index,
                         int aTag)
Method does nothing and may be overriden by subclasses.

Specified by:
setTagVertex in interface PgGeometryIf

clearTagPolygon

public void clearTagPolygon(int index,
                            int aTag)
Method does nothing and may be overriden by subclasses.

Specified by:
clearTagPolygon in interface PgGeometryIf

hasTagPolygon

public boolean hasTagPolygon(int index,
                             int aTag)
Method does nothing and may be overriden by subclasses.

Specified by:
hasTagPolygon in interface PgGeometryIf

setTagPolygon

public void setTagPolygon(int index,
                          int aTag)
Method does nothing and may be overriden by subclasses.

Specified by:
setTagPolygon in interface PgGeometryIf

clearTagElement

public void clearTagElement(int index,
                            int aTag)
Method does nothing and may be overriden by subclasses.

Specified by:
clearTagElement in interface PgGeometryIf

hasTagElement

public boolean hasTagElement(int index,
                             int aTag)
Method does nothing and may be overriden by subclasses.

Specified by:
hasTagElement in interface PgGeometryIf

setTagElement

public void setTagElement(int index,
                          int aTag)
Method does nothing and may be overriden by subclasses.

Specified by:
setTagElement in interface PgGeometryIf

intersectionWithLine

public PvPickEvent intersectionWithLine(PdVector base,
                                        PdVector dir)
Method used for picking, should be overriden by subclasses.

Specified by:
intersectionWithLine in interface PgGeometryIf

blend

public boolean blend(double s,
                     PgGeometry a,
                     double t,
                     PgGeometry b)
Blend between two geometries, used in interpolation and computing the associate surfaces this = s*a + t*b.

Specified by:
blend in interface PgGeometryIf
Parameters:
s - weight of vertices of first elementSet
t - weight of vertices of second elementSet
a - first source geometry used for blending
b - second source geometry used for blending
Returns:
true on success

merge

public boolean merge(PgGeometryIf geomIf)
Add another of same geometry of same type to this geometry. If types of geometries are different then nothing is done.

Method applies model and ambient matrices to argument geometry if such local transformation matrices exist.

Specified by:
merge in interface PgGeometryIf
Parameters:
geomIf - geometry merged into the current geometry
Returns:
true on success

getCenterOfElement

public static PdVector getCenterOfElement(PdVector center,
                                          PdVector[] vertex,
                                          int[] vertInd)
Compute the barycenter of a geometry element like face or polygon edge.

Parameters:
center - existing vector of dimension m_dim which will be filled and returned
vertex - vertex array to which the index vector refers
vertInd - index vector with indices in the vertex array
Returns:
Argument center is filled with the position of the barycenter

reflect

public PgGeometry reflect(PdMatrix mat,
                          boolean bOrient,
                          boolean bVector)
Generate a cloned geometry and transform vertices by a matrix. For example, this method is called to calculate mirror images of a geometry. Orientation of geometry affects surface vectors.

Specified by:
reflect in interface PgGeometryIf
Parameters:
mat - 3*3 or 4*4 transformation matrix
bOrient - flag whether to keep the orientation of the geometry
bVector - flag whether to keep the orientation of vectors
Returns:
new reflected copy of the geometry

getTextureImageName

public java.lang.String getTextureImageName()
Get name of texture image, a full URL or a relative file name.

Specified by:
getTextureImageName in interface PgGeometryIf

setTextureImageName

public void setTextureImageName(java.lang.String name)
Set name of texture image, a URL or a relative file name.

Specified by:
setTextureImageName in interface PgGeometryIf

getTextureImage

public java.awt.Image getTextureImage()
Get image of texture.

Specified by:
getTextureImage in interface PgGeometryIf

setTextureImage

public void setTextureImage(java.awt.Image img)
Set texture image for vertex and element textures.

Specified by:
setTextureImage in interface PgGeometryIf

JavaView© v3.95.000

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