public interface PgGeometryIf extends PsUpdateIf
paint(PvGeometryIf)
of
a registered geometry where the geometry should pass its data to the display.
paint()
is the most important method of this interface.
An implementation of the interface must assure that whenever a geometry has changed such that an update of the display is required, the update method of the display is called with the geometry as argument.
disp.update(geom)Then display automatically calls the method geom.
paint(PvGeometryIf)
to request data from geometry. Each display in JavaView implements the interface
PvDisplayIf to be able to handle geometries implementing the interface PgGeometryIf.
The interface PgGeometryIf is implemented by PgGeometry
.
By subclassing from PgGeometry the user only needs to override a few methods.
The class_name for info/control/material panel and methodMenu must follow special rules namely:
"name of main class"+"_BP" "name of main class"+"_CP" "name of main class"+"_IP" "name of main class"+"_MP" "name of main class"+"_TP" "name of main class"+"_Menu"
PgGeometry
,
PgJvxSrc
,
PvDisplayIf
,
PvDisplay
,
PvDisplayIf
Modifier and Type | Field and Description |
---|---|
static int |
AMBIENT_H2_HYPERBOLIC
Ambient space is hyperbolic 2d space in R3_L, used in model transformations.
|
static int |
AMBIENT_H3_HYPERBOLIC
Ambient space is hyperbolic 3d space in R3_L, used in model transformations.
|
static int |
AMBIENT_H4_HYPERBOLIC
Ambient space is hyperbolic 4d space in R5_L, used in model transformations.
|
static java.lang.String[][] |
AMBIENT_PROJECTIONS
List of names of projection methods from ambient spaces.
|
static int |
AMBIENT_R1_EUCLIDEAN
Ambient space is 1d-euclidean, used in model transformations.
|
static int |
AMBIENT_R2_EUCLIDEAN
Ambient space is 2d-euclidean, used in model transformations.
|
static int |
AMBIENT_R3_EUCLIDEAN
Ambient space is 3d-euclidean, used in model transformations.
|
static int |
AMBIENT_R4_EUCLIDEAN
Ambient space is 4d-euclidean, used in model transformations.
|
static int |
AMBIENT_R5_EUCLIDEAN
Ambient space is 5d-euclidean, used in model transformations.
|
static int |
AMBIENT_S1_SPHERE
Ambient space is unit circle in 2d-euclidean, used in model transformations.
|
static int |
AMBIENT_S2_SPHERE
Ambient space is unit sphere in R3, used in model transformations.
|
static int |
AMBIENT_S3_SPHERE
Ambient space is unit sphere in R4, used in model transformations.
|
static int |
AMBIENT_S4_SPHERE
Ambient space is unit sphere in R5, used in model transformations.
|
static java.lang.String[][] |
AMBIENT_SPACES
List of names of possible ambient spaces of geometries.
|
static int |
BLEND_ALPHA
Flag if texture of a greyscale image is only used to make surface semi-transparent.
|
static int |
BLEND_MATERIAL
Flag if texture is combined with surface color depending on texture transparency.
|
static int |
BLEND_REPLACE
Flag if texture overpaints all surface colors and a possible alpha channel makes surface semi-transparent.
|
static int |
FILTER_DIRECT
No filtering, for each pixel the texture image is sampled at a single point.
|
static int |
FILTER_LINEAR
Bilinear filtering, for each pixel the texture image is sampled at a four points.
|
static int |
FILTER_QUADRATIC
Biquadratic filtering, for each pixel the texture image is sampled at a nine points.
|
static int |
HAS_METHOD_MENU
Tag object as having a method menu.
|
static java.lang.String |
INSPECTOR_CONTROL
Deprecated.
use PsPanel.CONFIG instead
|
static java.lang.String |
INSPECTOR_CONTROL_EXT
Deprecated.
use PsPanel.CONFIG_EXT instead
|
static java.lang.String |
INSPECTOR_MATERIAL
Deprecated.
use PsPanel.MATERIAL instead
|
static java.lang.String |
INSPECTOR_MATERIAL_EXT
Deprecated.
use PsPanel.MATERIAL_EXT instead
|
static java.lang.String |
INSPECTOR_TEXTURE
Deprecated.
use PsPanel.TEXTURE instead
|
static java.lang.String |
INSPECTOR_TEXTURE_EXT
Deprecated.
use PsPanel.TEXTURE_EXT instead
|
static int |
LABEL_BASE |
static int |
LABEL_CENTER |
static int |
LABEL_HEAD |
static int |
LABEL_MIDDLE |
static int |
LABEL_TAIL |
static int |
LABEL_TOP |
static int |
m_numLabelTypes
Number of labal types such as PvGeometryIf.GEOM_ITEM_POINT, _EDGE, _POLYGON.
|
static java.lang.String |
METHOD_EXT
File name suffix of menu class to name of base class.
|
static int |
PERIODIC_BOTH
Flag determines that texture is continued periodically in both directions outside the unit texture domain.
|
static int |
PERIODIC_HEIGHT
Flag determines that texture is continued periodically in height directions outside the unit texture domain.
|
static int |
PERIODIC_NONE
Flag determines if and how texture is continued outside the unit texture domain.
|
static int |
PERIODIC_WIDTH
Flag determines that texture is continued periodically in width directions outside the unit texture domain.
|
static int |
PROJ_KLEIN_BALL
Projection into Klein's hyperbolic sphere, used in model transformations.
|
static int |
PROJ_PARALLEL
Parallel projection, used in model transformations.
|
static int |
PROJ_POINCARE_BALL
Conformal projection into Poincare's sphere, used in model transformations.
|
static int |
PROJ_STEREOGRAPHIC
Stereographic projection, used in model transformations.
|
static int |
PROJ_UPPER_HALFSPACE
Conformal projection into Poincare's hyperbolic upper half space model, used in model transformations.
|
static int |
SIDE_BACK
Flag determines if texture is applied to background side of a surface.
|
static int |
SIDE_BOTH
Flag determines if texture is applied to both sides of a surface.
|
static int |
SIDE_FRONT
Flag determines if texture is applied to foreground side of a surface.
|
static int |
SIDE_NONE
Flag determines if texture is applied to both sides of a surface.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addDisplay(PvDisplayIf display)
Register a new display to render the geometry.
|
int |
addElement(PiVector anElement)
Add a vector to a geometry, probably at the end of its element array.
|
int |
addPolygon(PiVector aPolygon)
Add a polygon to a geometry, probably at the end of its polygon array.
|
int |
addVertex(PdVector aVertex)
Add a vector to a geometry, probably at the end of its vertex array.
|
PsPanel |
assureInspector(java.lang.String type,
java.lang.String ext)
Get a certain panel - if it does not exist then try to allocate it.
|
boolean |
blend(double s,
PgGeometry a,
double t,
PgGeometry b)
Interpolate between two geometries, for example, in a smooth animation.
|
void |
clearTagElement(int index,
int aTag)
Clear a single tag of an element.
|
void |
clearTagPolygon(int index,
int aTag)
Clear a single tag of a polygon.
|
void |
clearTagVertex(int index,
int aTag)
Clear a single tag of a vertex.
|
java.lang.Object |
clone()
Duplicate geometry by recursively cloning all instance variables
except inspector panels and lists of registered listeners.
|
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.
|
PdMatrix |
getAmbientInvMatrix()
Get a reference of the ambient inverse 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 author information.
|
PsPanel |
getControlPanel()
Get control panel - if it does not exist try to allocate it.
|
int |
getDimOfSimplex()
Get dimension of simplicial complex, i.e. maximal dimension of occurring simplices.
|
int |
getDimOfVertices()
Get dimension of points used in geometry, i.e. the number coordinates per point.
|
java.util.Enumeration |
getDisplays()
Get all registered displays as Enumeration.
|
PiVector |
getElement(int anIndex)
Return reference to element with given index.
|
PsGeometryInfo |
getGeometryInfo()
Get geometry information.
|
PsPanel |
getInfoPanel()
Get info panel - if it does not exist try to allocate it.
|
PgJvxSrc |
getJvx()
Fills a geometry object with data from this instance, for example, to print to file.
|
PsPanel |
getMaterialPanel()
Get material panel - if it does not exist try to allocate it.
|
PdMatrix |
getModelMatrix()
Get model matrix of geometry.
|
java.lang.String |
getName()
Name of geometry, user should try to be unique inside JavaView.
|
PiVector |
getPolygon(int anIndex)
Return reference to polygon with given index.
|
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,
PvGeometry#GEOM_POINT_SET . |
PdVector |
getVertex(int anIndex)
Return reference to vertex with given index anIndex.
|
boolean |
hasAmbientMatrix()
Check for ambient model matrix of geometry.
|
boolean |
hasDisplay(PvDisplayIf display)
Check for a registered display by name.
|
boolean |
hasModelMatrix()
Check for model matrix of geometry.
|
boolean |
hasTag(int aBit)
Check whether tag of object is set.
|
boolean |
hasTagElement(int index,
int aTag)
Check whether element has given tag.
|
boolean |
hasTagPolygon(int index,
int aTag)
Check whether polygon has given tag.
|
boolean |
hasTagVertex(int index,
int aTag)
Check whether vertex has given tag.
|
PvPickEvent |
intersectionWithLine(PdVector base,
PdVector dir)
Find intersection with ray.
|
boolean |
isConfigurable(int panel)
Check whether class has a configuration panel to configure it.
|
boolean |
isVisible()
Check flag whether geometry is selected to be hidden or not in display.
|
boolean |
merge(PgGeometryIf geom)
Add another 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)
Remove an element with given index.
|
void |
removeMethodMenus()
Remove menu with items to invoke advanced methods of this geometry.
|
int[] |
removePolygon(int anIndex)
Remove polygon with given index.
|
int[] |
removeVertex(int anIndex)
Remove vertex with given index.
|
void |
setAmbientMatrix(PdMatrix ambientMat,
PdMatrix ambientInvMat)
Set ambient model matrix of geometry and its inverse.
|
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.
|
boolean |
setElement(int anIndex,
PiVector anElement)
Allow setting the vertex indices of a single element.
|
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.
|
void |
setModelMatrix(PdMatrix modelMat)
Set model matrix of geometry.
|
void |
setName(java.lang.String name)
Set name of geometry, user should try to be unique inside JavaView.
|
boolean |
setPolygon(int anIndex,
PiVector aPolygon)
Allow setting the vertex indices of a single polygon.
|
void |
setState(int key,
boolean state)
Set drawing flags of this geometry from within the display.
|
void |
setTagElement(int index,
int aTag)
Set a tag of an element.
|
void |
setTagPolygon(int index,
int aTag)
Set a tag of a polygon.
|
void |
setTagVertex(int index,
int aTag)
Set a tag of a vertex.
|
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.
|
boolean |
setVertex(int anIndex,
PdVector aVertex)
Allow setting the coordinates of a single vertex.
|
void |
setVisible(boolean flag)
Set geometry to be hidden or visible in display.
|
java.lang.String |
toString()
Get a detailed string representation of object, usually rather long.
|
getFather, setParent, update
static final int HAS_METHOD_MENU
PsObject.setTag(int)
,
Constant Field Valuesstatic final java.lang.String INSPECTOR_CONTROL_EXT
static final java.lang.String INSPECTOR_MATERIAL_EXT
static final java.lang.String INSPECTOR_TEXTURE_EXT
static final java.lang.String METHOD_EXT
static final java.lang.String INSPECTOR_CONTROL
static final java.lang.String INSPECTOR_MATERIAL
static final java.lang.String INSPECTOR_TEXTURE
static final int m_numLabelTypes
static final int LABEL_TOP
static final int LABEL_MIDDLE
static final int LABEL_BASE
static final int LABEL_HEAD
static final int LABEL_CENTER
static final int LABEL_TAIL
static final int SIDE_NONE
static final int SIDE_BOTH
static final int SIDE_FRONT
static final int SIDE_BACK
static final int PERIODIC_NONE
static final int PERIODIC_BOTH
static final int PERIODIC_WIDTH
static final int PERIODIC_HEIGHT
static final int BLEND_REPLACE
static final int BLEND_MATERIAL
static final int BLEND_ALPHA
static final int FILTER_DIRECT
static final int FILTER_LINEAR
static final int FILTER_QUADRATIC
static final int AMBIENT_R1_EUCLIDEAN
static final int AMBIENT_R2_EUCLIDEAN
static final int AMBIENT_S1_SPHERE
static final int AMBIENT_R3_EUCLIDEAN
static final int AMBIENT_S2_SPHERE
static final int AMBIENT_H2_HYPERBOLIC
static final int AMBIENT_R4_EUCLIDEAN
static final int AMBIENT_S3_SPHERE
static final int AMBIENT_H3_HYPERBOLIC
static final int AMBIENT_R5_EUCLIDEAN
static final int AMBIENT_S4_SPHERE
static final int AMBIENT_H4_HYPERBOLIC
static final int PROJ_PARALLEL
static final int PROJ_STEREOGRAPHIC
static final int PROJ_POINCARE_BALL
static final int PROJ_KLEIN_BALL
static final int PROJ_UPPER_HALFSPACE
static final java.lang.String[][] AMBIENT_SPACES
static final java.lang.String[][] AMBIENT_PROJECTIONS
AMBIENT_SPACES
int getAmbientSpace()
void setAmbientSpace(int mode)
mode
- One of the values PgGeometryIf#AMBIENT_...int getAmbientProjection()
void setAmbientProjection(int mode)
mode
- One of the values PgGeometryIf#PROJ_...int getType()
PvGeometry#GEOM_POINT_SET
.
This allows PvGeometry to check the class without accessing the
real Java classes in jv.geom.
The type should be set in the constructor of a geometry class.
void setState(int key, boolean state)
Subclasses should overwrite this method and call super for unhandled keys.
key
- flag to be set, choose among PvGeometryIf.SHOW_...state
- enable or disable statePsAuthorInfo getAuthorInfo()
void setAuthorInfo(PsAuthorInfo authorInfo)
PsGeometryInfo getGeometryInfo()
void setGeometryInfo(PsGeometryInfo geometryInfo)
void paint(PvGeometryIf dc)
PgGeometryIf geom; // An arbitrary geometry class disp.addGeometry(geom); // Register geometry in a JavaView display geom.computeSomething(); // Compute or modify geometry, e.g. surface coordinates etc. disp.update(geom); // After changing geometry invoke update of display.The call
disp.update(geom)
invokes the method geom.paint(dc)
to fill the container instance dc which is then rendered inside the display.
Use methods supplied in jv.project.PvGeometryIf
to
fill a container class. All data is duplicated allowing rendering and interaction
while the geometry data in the current class may already be modified, e.g. by
numerical processes.
Note: Whenever a geometry is registered in a project
jv.project.PjProject
then the project automatically
registers the geometry in associated displays, and it is sufficient to send an
update message to the project with the geometry as argument.
Note: Display properties such as auto-rotation, camera choices etc. are made
by calling methods of a display directly, see
jv.project.PvDisplayIf
.
java.awt.Menu fillMethodMenu(java.awt.Menu menu)
java.awt.Menu fillMethodMenu(java.awt.Menu menu, PvViewerIf viewer)
menu
- parent menu to which this menu is added.viewer
- optional viewer manager from which methods may access displays and inspectors.void removeMethodMenus()
java.lang.Object clone()
null
.PgJvxSrc getJvx()
void setJvx(PgJvxSrc src)
src
- a geometry source used to fill this instance with data.PsPanel getInfoPanel()
PsPanel getMaterialPanel()
PsPanel assureInspector(java.lang.String type, java.lang.String ext)
type
- type of panel, e.g. PsPanel.INFOext
- file name extension, e.g. PsPanel.INFO_EXTPsPanel getControlPanel()
boolean isConfigurable(int panel)
java.lang.String getTitle()
setName(String)
,
setTitle(String)
void setTitle(java.lang.String title)
getTitle()
,
setName(String)
java.lang.String getName()
getName
in interface PsUpdateIf
setName(String)
,
setTitle(String)
void setName(java.lang.String name)
getName()
,
setTitle(String)
java.lang.String toString()
toString
in class java.lang.Object
PvPickEvent intersectionWithLine(PdVector base, PdVector dir)
boolean blend(double s, PgGeometry a, double t, PgGeometry b)
this = s*a + t*b
.s
- weight of vertices of first elementSett
- weight of vertices of second elementSeta
- first source geometry used for blendingb
- second source geometry used for blendingtrue
on successboolean merge(PgGeometryIf geom)
geom
- geometry added to current geometryPgGeometry reflect(PdMatrix mat, boolean bOrient, boolean bVector)
mat
- 3*3 or 4*4 transformation matrixbOrient
- flag whether to keep the orientation of the geometrybVector
- flag whether to keep the orientation of vectorsboolean addDisplay(PvDisplayIf display)
java.util.Enumeration getDisplays()
boolean hasDisplay(PvDisplayIf display)
boolean removeDisplay(PvDisplayIf display)
boolean isVisible()
void setVisible(boolean flag)
PdMatrix getModelMatrix()
boolean hasModelMatrix()
void setModelMatrix(PdMatrix modelMat)
null
then model matrix is removed.PdMatrix getAmbientMatrix()
PdMatrix getAmbientInvMatrix()
boolean hasAmbientMatrix()
void setAmbientMatrix(PdMatrix ambientMat, PdMatrix ambientInvMat)
null
then ambient model matrix is removed.int getDimOfVertices()
int getDimOfSimplex()
int addVertex(PdVector aVertex)
aVertex
- vector with new vertex coordinatesPdVector getVertex(int anIndex)
anIndex
- index of vertex to be returnedint[] removeVertex(int anIndex)
anIndex
- index of vertex to be removedboolean setVertex(int anIndex, PdVector aVertex)
anIndex
- index of vertex to be changedaVertex
- vector with new vertex coordinatesint addPolygon(PiVector aPolygon)
aPolygon
- vector with indices of vertices in global vertex arrayPiVector getPolygon(int anIndex)
anIndex
- index of polygon to be returnedint[] removePolygon(int anIndex)
anIndex
- index of polygon to be removedboolean setPolygon(int anIndex, PiVector aPolygon)
anIndex
- index of polygon to be changedaPolygon
- vector with indices of vertices in global vertex arrayint addElement(PiVector anElement)
anElement
- vector with indices of vertices in global vertex arrayPiVector getElement(int anIndex)
anIndex
- index of element to be returnedint[] removeElement(int anIndex)
anIndex
- index of element to be removedboolean setElement(int anIndex, PiVector anElement)
anIndex
- index of element to be changedanElement
- vector with indices of vertices in global vertex arrayboolean hasTag(int aBit)
PsObject
.void clearTagVertex(int index, int aTag)
PsObject
.boolean hasTagVertex(int index, int aTag)
PsObject
.void setTagVertex(int index, int aTag)
PsObject
.void clearTagPolygon(int index, int aTag)
PsObject
.boolean hasTagPolygon(int index, int aTag)
PsObject
.void setTagPolygon(int index, int aTag)
PsObject
.void clearTagElement(int index, int aTag)
PsObject
.boolean hasTagElement(int index, int aTag)
PsObject
.void setTagElement(int index, int aTag)
PsObject
.java.lang.String getTextureImageName()
void setTextureImageName(java.lang.String name)
java.awt.Image getTextureImage()
void setTextureImage(java.awt.Image img)
"