|
JavaView® v2.00.008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--jv.object.PsObject
|
+--jv.project.PgGeometry
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.
PgGeometryIf,
PvDisplayIf, Serialized Form| Field Summary | |
protected int |
m_ambientProj
Projection from ambient space to R3 used in transformations of model. |
protected int |
m_ambientSpace
Ambient space used in transformations of model. |
protected PsAuthorInfo |
m_authorInfo
List of authors of geometry. |
protected boolean |
m_bShowBndBox
Flag whether bounding box is shown in display. |
protected boolean |
m_bShowCenter
Flag whether center is shown in display. |
protected boolean |
m_bShowing
Geometry is visible or hidden in its display. |
protected boolean |
m_bShowTitle
Flag whether title is shown in display. |
protected PdVector |
m_center
Center of geometry's world coordinate system |
protected int |
m_dim
Dimension of geometric points of this geometry, must be constant for all points. |
protected int |
m_dimOfSimplex
Dimension of simplicial complex, i.e. maximal dimension of occurring simplices. |
protected java.util.Vector |
m_displayList
List of display windows where this geometry is registered. |
protected PsGeometryInfo |
m_geometryInfo
Full description of geometry. |
protected PiVector[] |
m_labelAttribute
Offset vector in pixel coordinates of label w.r.t. base point. |
protected PsMethodMenu |
m_methodMenu
Method menu of geometry classes. |
protected PdMatrix |
m_modelMatrix
4*4 model matrix of geometry, usually not allocated. |
protected java.lang.String |
m_title
Title of geometry, length up to one line. |
protected java.lang.String |
m_version
Version number of the data of this geometry. |
protected java.lang.String |
m_versionType
Type of version of the data of this geometry in {"dump","beta","final"}. |
| 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 | |
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 |
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(PgGeometry geom)
Copy argument object into this object by recursively copying all instance variables. |
java.awt.Menu |
fillMethodMenu(java.awt.Menu aMenu)
Fill menu with items to invoke advanced methods of this 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 author information. |
PsAuthorInfo |
getAuthors()
Deprecated. used getAuthorInfo() |
PdVector[] |
getBounds()
Compute bounding box if geometry has number of vertices, otherwise return null. |
PdVector |
getCenter()
Get center of geometry which local transformation use as origin. |
static PdVector |
getCenterOfElement(PdVector center,
PdVector[] vertex,
int[] vertInd)
Compute the bary center 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.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. |
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. |
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()
|
java.lang.String |
getVersion()
|
java.lang.String |
getVersionType()
|
PdVector |
getVertex(int anIndex)
Method does nothing and may be overriden by subclasses. |
boolean |
hasDisplay(PvDisplayIf display)
Check for a registered display. |
boolean |
hasModelMatrix()
Check for model matrix of geometry. |
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 |
isShowingBndBox()
Set flag to enable drawing of bounding box. |
boolean |
isShowingCenter()
Set flag to enable drawing of center of geometry. |
boolean |
isShowingTitle()
Check whether showing of title of geometry is switched on. |
boolean |
isVisible()
Check the visibility flag of the geometry. |
boolean |
merge(PgGeometryIf geom)
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. |
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. |
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 |
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. |
void |
setAuthors(PsAuthorInfo author)
Deprecated. used setAuthorInfo(PsAuthorInfo) |
void |
setCenter(PdVector aCenter)
Set center of geometry which local transformation 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 |
setGeometryInfo(PsGeometryInfo geometryInfo)
Set geometry information. |
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 |
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 |
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)
|
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 |
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, clearTag, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, updatePanels |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface jv.project.PgGeometryIf |
getInfoPanel, getName, setName |
| Methods inherited from interface jv.object.PsUpdateIf |
getFather, setParent |
| Field Detail |
protected java.lang.String m_version
protected java.lang.String m_versionType
protected java.lang.String m_title
protected PsAuthorInfo m_authorInfo
protected PsGeometryInfo m_geometryInfo
protected int m_dim
PgGeometry(int)protected int m_dimOfSimplex
protected boolean m_bShowing
protected boolean m_bShowTitle
protected boolean m_bShowBndBox
protected boolean m_bShowCenter
protected PdVector m_center
protected int m_ambientSpace
protected int m_ambientProj
protected PdMatrix m_modelMatrix
protected transient PsMethodMenu m_methodMenu
protected java.util.Vector m_displayList
update() method of this geometry
will initate a repaint of the registered display windows.protected PiVector[] m_labelAttribute
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.
Third component is in [0..2] and indicates whether head, center or tail
is located at base+offset.
For possible type see PvGeometryIf#GEOM_ITEM_POINT
and other items.
Fourth component is a font id from the set of fonts available in PsConfig.
setLabelAttribute(int, int, int, int, int, int)| Constructor Detail |
public PgGeometry()
public PgGeometry(int aDim)
aDim - dimension of geometric pointsgetDimOfVertices()| Method Detail |
public void init()
init in class PsObjectpublic PsAuthorInfo getAuthorInfo()
public void setAuthorInfo(PsAuthorInfo authorInfo)
public PsAuthorInfo getAuthors()
public void setAuthors(PsAuthorInfo author)
public PsGeometryInfo getGeometryInfo()
public void setGeometryInfo(PsGeometryInfo geometryInfo)
public java.lang.String getVersion()
public java.lang.String getVersionType()
public java.lang.String getTitle()
public void setVersion(java.lang.String version)
public void setVersionType(java.lang.String versionType)
public void setTitle(java.lang.String title)
public double getDiameter()
public PdVector[] getBounds()
public PdVector getCenter()
public void setCenter(PdVector aCenter)
a - vector which becomes the local origin of the geometrypublic boolean isConfigurable(int panel)
HAS_INSPECTOR_PANEL or
HAS_MATERIAL_PANEL or
HAS_CONFIG_PANEL orisConfigurable in interface PgGeometryIfpanel - Identifier of panelpublic int getDimOfSimplex()
getDimOfSimplex in interface PgGeometryIf#setDimOfSimplex()public void setDimOfSimplex(int dim)
#setDimOfSimplex()public PgJvxSrc getJvx()
getJvx in interface PgGeometryIfpublic void setJvx(PgJvxSrc src)
setJvx in interface PgGeometryIfsrc - a geometry source used to fill this instance with data.public java.lang.String toString()
toString in interface PgGeometryIftoString in class PsObjectpublic java.lang.Object clone()
null.
Tags of this object are not copied but maybe copied of subclasses.
Display list is not cloned but set to null. Method menu is not cloned.
clone in interface PgGeometryIfclone in class PsObjectcopy(PgGeometry)public void copy(PgGeometry geom)
public boolean update(java.lang.Object event)
update in interface PsUpdateIfupdate in class PsObjectjv.object.PsUpdateIfevent - carries a lot of informationPsObject,
PsUpdateIf.getFather(),
PsUpdateIf.setParent(PsUpdateIf)public void paint(PvGeometryIf dc)
jv.project.PgGeometryIf for detailed information.paint in interface PgGeometryIfPgGeometryIfpublic int getDimOfVertices()
getDimOfVertices in interface PgGeometryIfPgGeometry(int)public int getAmbientSpace()
public void setAmbientSpace(int mode)
public int getAmbientProjection()
public void setAmbientProjection(int mode)
public PdMatrix getModelMatrix()
getModelMatrix in interface PgGeometryIfpublic boolean hasModelMatrix()
hasModelMatrix in interface PgGeometryIfpublic void setModelMatrix(PdMatrix modelMat)
setModelMatrix in interface PgGeometryIfpublic boolean isVisible()
isVisible in interface PgGeometryIfsetVisible(boolean)public void setVisible(boolean flag)
setVisible in interface PgGeometryIfisVisible()public boolean isShowingTitle()
public void showTitle(boolean flag)
public boolean isShowingBndBox()
public void showBndBox(boolean flag)
public boolean isShowingCenter()
public void showCenter(boolean flag)
public PiVector getLabelAttribute(int type)
PvGeometryIf#GEOM_ITEM_POINT
and other items.type - type of label, vertex, polygon, element or title labels.
public boolean setLabelAttribute(int type,
int xOffset,
int yOffset,
int horAdjust,
int verAdjust,
int font)
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,
and GEOM_ITEM_TITLE. For possible type see PvGeometryIf#GEOM_ITEM_POINT and other items.
type - Type of group of geometry items to set attributesattr - Attribute vector with four componentsfalse if type is unknown.
public boolean setLabelAttribute(int type,
PiVector labelAtt)
setLabelAttribute() with integer arguments.
Length of vector must be equal to (or larger than) 5.public PsPanel getMaterialPanel()
Method is a shortcut to avoid checking, creating, and adding the panel to the inspector list.
getMaterialPanel in interface PgGeometryIfpublic PsPanel getControlPanel()
Method is a shortcut to avoid checking, creating, and adding the panel to the inspector list.
getControlPanel in interface PgGeometryIfpublic java.awt.Menu fillMethodMenu(java.awt.Menu aMenu)
fillMethodMenu in interface PgGeometryIfpublic boolean addDisplay(PvDisplayIf display)
update() whenever geometry changes
require a repaint of the display.
For example, method is called from PvDisplay when registering the geometry in the
display.addDisplay in interface PgGeometryIffalse if instance already registered.getDisplays()public java.util.Enumeration getDisplays()
getDisplays in interface PgGeometryIfnull if no displays found.addDisplay(PvDisplayIf)public boolean hasDisplay(PvDisplayIf display)
hasDisplay in interface PgGeometryIftrue if registered display found.addDisplay(PvDisplayIf),
getDisplays()public boolean removeDisplay(PvDisplayIf display)
removeDisplay in interface PgGeometryIfDisplay - false if display does not exists.addDisplay(PvDisplayIf)public int addVertex(PdVector aVertex)
addVertex in interface PgGeometryIfjv.project.PgGeometryIfaVertex - vector with new vertex coordinatespublic PdVector getVertex(int anIndex)
getVertex in interface PgGeometryIfjv.project.PgGeometryIfanIndex - index of vertex to be returnedpublic int[] removeVertex(int anIndex)
removeVertex in interface PgGeometryIfjv.project.PgGeometryIfanIndex - index of vertex to be removed
public boolean setVertex(int anIndex,
PdVector aVertex)
setVertex in interface PgGeometryIfjv.project.PgGeometryIfanIndex - index of vertex to be changedaVertex - vector with new vertex coordinatespublic int addPolygon(PiVector aPolygon)
addPolygon in interface PgGeometryIfjv.project.PgGeometryIfaPolygon - vector with indices of vertices in global vertex arraypublic PiVector getPolygon(int anIndex)
getPolygon in interface PgGeometryIfjv.project.PgGeometryIfanIndex - index of polygon to be returnedpublic int[] removePolygon(int anIndex)
removePolygon in interface PgGeometryIfjv.project.PgGeometryIfanIndex - index of polygon to be removed
public boolean setPolygon(int anIndex,
PiVector aPolygon)
setPolygon in interface PgGeometryIfjv.project.PgGeometryIfanIndex - index of polygon to be changedaPolygon - vector with indices of vertices in global vertex arraypublic int addElement(PiVector anElement)
addElement in interface PgGeometryIfjv.project.PgGeometryIfaPolygon - vector with indices of vertices in global vertex arraypublic PiVector getElement(int anIndex)
getElement in interface PgGeometryIfjv.project.PgGeometryIfanIndex - index of element to be returnedpublic int[] removeElement(int anIndex)
removeElement in interface PgGeometryIfjv.project.PgGeometryIfanIndex - index of element to be removed
public boolean setElement(int anIndex,
PiVector aElement)
setElement in interface PgGeometryIfjv.project.PgGeometryIfanIndex - index of element to be changedaVertex - vector with indices of vertices in global vertex array
public void clearTagVertex(int index,
int aTag)
clearTagVertex in interface PgGeometryIf
public boolean hasTagVertex(int index,
int aTag)
hasTagVertex in interface PgGeometryIf
public void setTagVertex(int index,
int aTag)
setTagVertex in interface PgGeometryIf
public void clearTagPolygon(int index,
int aTag)
clearTagPolygon in interface PgGeometryIf
public boolean hasTagPolygon(int index,
int aTag)
hasTagPolygon in interface PgGeometryIf
public void setTagPolygon(int index,
int aTag)
setTagPolygon in interface PgGeometryIf
public void clearTagElement(int index,
int aTag)
clearTagElement in interface PgGeometryIf
public boolean hasTagElement(int index,
int aTag)
hasTagElement in interface PgGeometryIf
public void setTagElement(int index,
int aTag)
setTagElement in interface PgGeometryIf
public PvPickEvent intersectionWithLine(PdVector base,
PdVector dir)
intersectionWithLine in interface PgGeometryIf
public boolean blend(double s,
PgGeometry a,
double t,
PgGeometry b)
this = s*a + t*b.blend in interface PgGeometryIfdouble - s, t weights of vertices of each elementSetPgGeometry - a, b two geometries used for blendingpublic boolean merge(PgGeometryIf geom)
merge in interface PgGeometryIfgeom - geometry added to current geometry
public static PdVector getCenterOfElement(PdVector center,
PdVector[] vertex,
int[] vertInd)
center - existing vector of dimension m_dim which will be filled and returnedvertex - vertex array to which the index vector refersvertInd - index vector with indices in the vertex array
public PgGeometry reflect(PdMatrix mat,
boolean bOrient,
boolean bVector)
reflect in interface PgGeometryIfmat - 3*3 or 4*4 transformation matrixbOrient - flag whether to keep the orientation of the geometrybVector - flag whether to keep the orientation of vectorspublic java.lang.String getTextureImageName()
getTextureImageName in interface PgGeometryIfpublic void setTextureImageName(java.lang.String name)
setTextureImageName in interface PgGeometryIfpublic java.awt.Image getTextureImage()
getTextureImage in interface PgGeometryIfpublic void setTextureImage(java.awt.Image img)
setTextureImage in interface PgGeometryIf
|
JavaView® v2.00.008 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||