|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchemaxon.marvin.space.GraphicCell
public class GraphicCell
GraphicCell
is a rectangular part of the OpenGL2 canvas containing GraphicComponent
s.
Each cell has its own camera/viewing settings, own origin, clipping planes,
and handling of viewing events such as rotation, zoom, shift, depth cue, etc.
Example of typical usage:
graphicScene.createNewCell(); GraphicCell cell = graphicScene.getActiveCell(); ArrayList molecules = graphicScene.readMolecule(moleculeFile.mol); GraphicComponent gc = molecules.get(0); cell.setTransformationCenter(gc.getId()); gc.select(); cell.hideSelectedComponents();
Field Summary | |
---|---|
protected static int |
DEFAULT_NEAR_EDGE
|
protected static int |
MAX_NUMBER_OF_COMPONENTS_PER_CELL
|
protected static int |
MODE_NORMAL
|
protected static int |
MODE_PICK
|
Constructor Summary | |
---|---|
GraphicCell()
Creates a new instance of GraphicCell . |
|
GraphicCell(javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu)
Creates a new instance of GraphicCell . |
Method Summary | |
---|---|
int |
addComponent(GraphicComponent component)
Adds a new component to this cell. |
void |
clearSelections()
Sets all components and parts of components to be unselected. |
boolean |
componentBecameSelected()
Returns true if a component became selected previously. |
boolean |
componentBecameUnselected()
Returns true if a component became unselected previously. |
boolean |
containsComponent(GraphicComponent gc)
Tells whether the component is in the cell. |
void |
draw()
Makes the vieport draw this cell. |
void |
drawBorders()
Draw borders of the cell. |
void |
drawCell()
Draws all components of the cell. |
void |
drawSmoothBackground()
|
void |
drawSphere()
Draws the rotation sphere. |
void |
exclusiveSelection(int itemIndex)
Exclusive selection in the given component. |
void |
extendSelection(int itemIndex)
Additive selection in the given component, so the previously picked part of the component will be selected, and all selection remains as is. |
void |
fadeSelectedComponents()
Sets all selected components to faded. |
void |
fadeUnselectedComponents()
Sets all selected components to faded. |
int |
getBottom()
Returns the y coordinate of the bottom of the cell in pixels. |
BoundingBox |
getBoundingBoxAndSetSphereRadius()
Computes the radius of the bounding sphere in order to set the z coordinate of the camera properly. |
double |
getCameraZ()
Returns the z coordinate of the camera. |
java.lang.String |
getCellDrawProperty(java.lang.String propertyName)
Returns the value of the cell-range drawing property with the given name. |
GraphicComponent |
getComponent(int componentIndex)
Returns the component having the given index. |
int |
getComponentCount()
Returns the number of components of the cell including monitors, surfaces and so on. |
java.util.Iterator |
getComponentIterator()
Returns the iterator of the GraphicComponent s of the cell. |
GraphicComponent |
getControllableObject(java.lang.String type)
Returns a component if there is any which allows itself to be controlled. |
float |
getFarClip()
Returns the z coordinate of the farther clipping plane which is computed considering all components. |
float |
getFovY()
Returns the field of view. |
int |
getHeight()
Returns the height of the cell. |
chemaxon.marvin.space.UOID |
getId()
Returns the cell id as a UOID . |
int |
getIndex()
Returns the internal index of the cell. |
int |
getLeft()
Returns the x coordinate of the left edge of the active cell. |
float |
getNearClip()
Returns the z coordinate of the nearer clipping plane which is computed considering all components. |
int |
getRight()
Returns the x coordinate of the right edge of the cell. |
float[] |
getRotateMatrix()
Returns the matrix of rotation. |
double |
getShiftX()
Returns the shifting value of the x direction. |
double |
getShiftY()
Returns the shifting value of the y direction. |
int |
getTop()
Returns the y coordinate of the top of the cell. |
float[] |
getTransformationCenter()
Returns the transformation center. |
int |
getVerboseLevel()
Gets the verbose level. |
int |
getWidth()
Returns the width of the cell. |
boolean |
hasSelectedComponent()
Returns true if there is at least 1 selected component. |
boolean |
hasSelectedComponentElement()
Returns true if there is at least 1 component with a selected part. |
void |
hideAllComponents(java.lang.Class c)
Sets all components of the given class to invisible. |
void |
hideAllMonitors()
Sets all monitor type components (labels as well) to invisible. |
void |
hideSelectedComponents()
Sets all selected components to invisible. |
void |
hideUnselectedComponents()
Sets all selected components to invisible. |
void |
invertSelection(int itemIndex)
The previously picked part of the component will be selected if it was unselected and vice versa. |
boolean |
isActive()
Returns true if this cell is the active cell of the entire scene. |
boolean |
isSelectedComponent(int componentIndex)
Tells whether the given component is selected. |
boolean |
isVerbose()
Gets the verbose level. |
chemaxon.marvin.space.UOID |
locateObject(int x,
int y)
Returns the internal id of the component under x, y location, or the id of the cell itself if there is no component in that location. |
chemaxon.marvin.space.UOID |
locateObject(int x,
int y,
java.lang.Class componentClass)
Returns the internal id of the given class component under x, y location, or the id of the cell itself if there is no component in that location. |
boolean |
locationNearEdgeX(int x,
int y)
Tells whether the given location is near the vertical edges of the cell. |
boolean |
locationNearEdgeY(int x,
int y)
Tells whether the given location is near the horizontal edges of the cell. |
void |
notifyZCoordinateChange()
Components with 2D parts should notify the container cell when their 'pseudo z' coordinate changes in order to display them in a correct order. |
void |
removeAllComponents()
Removes all components from the cell. |
void |
removeComponent(java.lang.Class componentClass)
|
boolean |
removeComponent(GraphicComponent component)
Removes the component and all associated components from the cell. |
void |
removeComponent(int componentIndex)
Removes the component which has the given index, and all of its associated components from the cell. |
void |
removeSelectedComponents()
Removes all selected components and all associated components from the cell. |
void |
removeUnselectedComponents()
Removes all unselected components and all associated components from the cell. |
void |
removeUnselectedMonitors()
Removes all unsselected monitor components from the cell. |
void |
resetView()
|
void |
resetZoom()
|
void |
rotate(double angleX,
double angleY,
double angleZ)
|
void |
selectComponentElementsInside(BoundingBox bb)
Sets all components lying inside the given box to be selected. |
void |
setActive()
Sets this cell to the active cell of the scene. |
void |
setAntialias(boolean antialias)
Switches the full scene anti-aliasing on/off. |
void |
setBackgroundColor(java.awt.Color newColor)
Sets the background color of the cell used by drawing smooth background. |
void |
setCellDrawProperties(java.util.Properties drawProperties)
Sets the drawing properties of all components of the cell. |
void |
setContexts(int inRow,
int inColumn,
int index,
int left,
int bottom,
javax.media.opengl.GL2 gl,
javax.media.opengl.glu.GLU glu)
Sets the indices of row and column of the scene in which this cell is in, and sets the GL2 related variables to be able to draw. |
void |
setDrawProperty(java.lang.String propertyName,
java.lang.String propertyValue)
Sets the drawing properties of all components of the cell. |
void |
setDrawSphere(boolean flag)
Enables/disables drawing of the rotation sphere. |
void |
setInactive()
Deactivates this cell, so it is no longer the active cell of the scene. |
void |
setIndex(int index)
Sets the internal index of the cell. |
void |
setIndices(int inRow,
int inColumn)
Sets which row and column of the scene is this cell in. |
void |
setMotionMode(int mode)
Notifies every component of moving and standing modes. |
void |
setNearEdgeTolerance(int tolerance)
Sets the tolerance we consider to be near the edge of the cell. |
void |
setOrigin(int left,
int bottom)
Sets the leftmost and bottomost coordinate of the cell. |
boolean |
setPickMatrix()
|
void |
setRotateMatrix(float[] rm)
Sets the matrix of rotation explicitly. |
void |
setSize(int width,
int height)
Sets the size of the viewport of this cell in pixels. |
void |
setSmoothBackgroud(boolean b)
Enables/disables shaded background coloring. |
void |
setTransformationCenter(float x,
float y,
float z)
Sets the transformation center and resets shifting values. |
void |
setTransformationCenter(chemaxon.marvin.space.UOID itemId)
Sets the transformation center to the center of the component with the given id and resets shifting values. |
void |
setTransformationCenterX(float value)
Sets the x coordinate of the transformation center. |
void |
setTransformationCenterY(float value)
Sets the y coordinate of the transformation center. |
void |
setTransformationCenterZ(float value)
Sets the z coordinate of the transformation center. |
void |
setVerbose(boolean flag)
Sets the verbose level on/off. |
void |
setVerbose(int level)
Sets the verbose level to the given level. |
void |
shift(double shiftx,
double shifty)
|
void |
showAllComponents()
Sets all components to visible. |
void |
showAllComponents(java.lang.Class c)
Sets all components of the given class to visible. |
void |
showAllMonitors()
Sets all monitor type components (labels as well) to visible. |
void |
showFaded()
Sets all faded components to visible. |
void |
updateRotationMatrix()
|
void |
zoom(double factor)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final int MAX_NUMBER_OF_COMPONENTS_PER_CELL
protected static final int DEFAULT_NEAR_EDGE
protected static final int MODE_NORMAL
protected static final int MODE_PICK
Constructor Detail |
---|
public GraphicCell()
GraphicCell
.
public GraphicCell(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu)
GraphicCell
.
gl
- Interface to OpenGLMethod Detail |
---|
public boolean isVerbose()
getVerboseLevel()
.
public int getVerboseLevel()
GraphicScene.VERBOSE_LEVEL_NONE
, GraphicScene.VERBOSE_LEVEL_BASIC
,
GraphicScene.VERBOSE_LEVEL_DEVEL
.
public void setVerbose(boolean flag)
setVerbose(int level)
.
public void setVerbose(int level)
GraphicScene.VERBOSE_LEVEL_NONE
, GraphicScene.VERBOSE_LEVEL_BASIC
,
GraphicScene.VERBOSE_LEVEL_DEVEL
.
level
- level of verbosenesspublic int getIndex()
public chemaxon.marvin.space.UOID getId()
UOID
.
public void setIndex(int index)
index
- new index of the cellpublic void setSize(int width, int height)
width
- horizontal size of the cell in pixelsheight
- vertical size of the cell in pixelspublic double getShiftX()
public double getShiftY()
public float getNearClip()
public float getFarClip()
public float getFovY()
public double getCameraZ()
public int addComponent(GraphicComponent component) throws java.lang.Exception
java.lang.Exception
- is thrown when an unlicensed draw property (e.g. partial charge coloring)
is set to the newly added component
For technical reasons the actual type of the exception is PluginException.public void removeSelectedComponents()
public void removeUnselectedComponents()
public void removeUnselectedMonitors()
public boolean removeComponent(GraphicComponent component)
component
- to remove
public void removeComponent(java.lang.Class componentClass)
public void removeComponent(int componentIndex)
componentIndex
- index of the component to removepublic void removeAllComponents()
public int getComponentCount()
public boolean hasSelectedComponent()
public boolean hasSelectedComponentElement()
public boolean containsComponent(GraphicComponent gc)
gc
- component
public GraphicComponent getComponent(int componentIndex)
componentIndex
- internal index of the component
public java.util.Iterator getComponentIterator()
GraphicComponent
s of the cell.
public boolean isSelectedComponent(int componentIndex)
componentIndex
- internal index of the component
public boolean isActive()
public void setActive()
public void setInactive()
public void hideSelectedComponents()
public void hideUnselectedComponents()
public void fadeSelectedComponents()
public void fadeUnselectedComponents()
public void showAllComponents()
public void showAllComponents(java.lang.Class c)
public void hideAllComponents(java.lang.Class c)
public void showFaded()
public void hideAllMonitors()
public void showAllMonitors()
public void setOrigin(int left, int bottom)
left
- lowest x coordinate in the scenebottom
- lowest y coordinate in the scenepublic void setIndices(int inRow, int inColumn)
inRow
- which row of the scene is this cell ininColumn
- which column of the scene is this cell inpublic void setNearEdgeTolerance(int tolerance)
tolerance
- width of the border in pixelspublic void setContexts(int inRow, int inColumn, int index, int left, int bottom, javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu)
inRow
- which row of the scene is this cell ininColumn
- which column of the scene is this cell inindex
- internal index of the cellleft
- lowest x coordinate in the scenebottom
- lowest y coordinate in the scenegl
- interface to OpenGLpublic java.lang.String getCellDrawProperty(java.lang.String propertyName)
public void setCellDrawProperties(java.util.Properties drawProperties) throws java.lang.Exception
drawProperties
- properties to set one by one
java.lang.Exception
- is thrown when an unlicensed draw property (e.g. partial charge coloring)
is set to the newly added component
For technical reasons the actual type of the exception is PluginException.public void setDrawProperty(java.lang.String propertyName, java.lang.String propertyValue) throws java.lang.Exception
propertyName
- name of the drawing property identified by GraphicComponent
spropertyValue
- value of the property as a String
java.lang.Exception
public void setAntialias(boolean antialias)
antialias
- state of full-screen anti-aliasingpublic void setMotionMode(int mode)
mode
- GraphicScene.MODE_MOVING
or GraphicScene.MODE_STANDING
public chemaxon.marvin.space.UOID locateObject(int x, int y)
x
- horizontal mouse location in absolute window coordinatey
- vertical mouse location in absolute window coordinatepublic chemaxon.marvin.space.UOID locateObject(int x, int y, java.lang.Class componentClass)
x
- horizontal mouse location in absolute window coordinatey
- vertical mouse location in absolute window coordinatecomponentClass
- components of other classes will be ignored in locationpublic boolean locationNearEdgeX(int x, int y)
x
- horizontal mouse location in absolute window coordinatey
- vertical mouse location in absolute window coordinatepublic boolean locationNearEdgeY(int x, int y)
x
- horizontal mouse location in absolute window coordinatey
- vertical mouse location in absolute window coordinatepublic int getWidth()
public int getHeight()
public int getTop()
public int getBottom()
public int getLeft()
public int getRight()
public void clearSelections()
public void selectComponentElementsInside(BoundingBox bb)
bb
- box given as BoundingBox
public void exclusiveSelection(int itemIndex)
itemIndex
- internal index of hte componentpublic void extendSelection(int itemIndex)
itemIndex
- internal index of hte componentpublic void invertSelection(int itemIndex)
itemIndex
- internal index of hte componentpublic boolean componentBecameSelected()
public boolean componentBecameUnselected()
public void setTransformationCenterX(float value)
value
- x coordinate in the model spacepublic void setTransformationCenterY(float value)
value
- y coordinate in the model spacepublic void setTransformationCenterZ(float value)
value
- z coordinate in the model spacepublic float[] getTransformationCenter()
public void setTransformationCenter(chemaxon.marvin.space.UOID itemId)
GraphicComponent.getCoordinates(float[])
.
itemId
- id of the componentpublic void setTransformationCenter(float x, float y, float z)
x
- coordinate in the model spacey
- coordinate in the model spacez
- coordinate in the model spacepublic GraphicComponent getControllableObject(java.lang.String type)
type
- identifier of the type of the controller, "Shift", "Rotate", "Resize"
public void notifyZCoordinateChange()
public void draw()
public void drawCell()
public void setBackgroundColor(java.awt.Color newColor)
newColor
- color as java.awt.Color
public void setSmoothBackgroud(boolean b)
b
- public void drawSmoothBackground()
public void setDrawSphere(boolean flag)
flag
- state of drawing spherepublic void drawBorders()
public void drawSphere()
public void resetZoom()
public void zoom(double factor)
public void rotate(double angleX, double angleY, double angleZ)
public void shift(double shiftx, double shifty)
public void resetView()
public void updateRotationMatrix()
public float[] getRotateMatrix()
public void setRotateMatrix(float[] rm)
rm
- 4x4 rotation matrix row-by-rowpublic BoundingBox getBoundingBoxAndSetSphereRadius()
public boolean setPickMatrix()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |