chemaxon.marvin.space
Class MoleculeComponent

java.lang.Object
  extended by chemaxon.marvin.space.GraphicComponent
      extended by chemaxon.marvin.space.MoleculeComponent
All Implemented Interfaces:
MacroMoleculeComponent.MoleculeVisualizer, chemaxon.marvin.space.UsableObject, chemaxon.struc.MoleculeIterators.MoleculeInterface

public class MoleculeComponent
extends GraphicComponent
implements chemaxon.struc.MoleculeIterators.MoleculeInterface, MacroMoleculeComponent.MoleculeVisualizer, chemaxon.marvin.space.UsableObject

MoleculeComponent is the basic visualizer of simple molecules in MarvinSpace. Displays atoms and bonds in classic drawing modes: wire, ball, stick, ball&stick, ball&wire, spacefill.
Atoms of the molecule can be individually selected.
Ligands of a complex structure can be visualized by MoleculeComponent, but in this case the MoleculeComponent is not directly added to the GraphicScene but is handled by the MacroMoleculeComponent as a MoleculeVisualizer.
Example of typical usage:

 ArrayList moleculeList = graphicScene.getEventHandler().readMolecule("molecule1.mol");
 MoleculeComponent mc = moleculeList.get(0);
 

Since:
Marvin 4.0.2
Version:
MarvinSpace 1.0
Author:
Judit Papp, Miklos Vargyas

Field Summary
protected  int ballPrecision
           
protected  double ballRadius
           
protected static int BOND_DRAW_TYPE_BOND
           
protected static int BOND_DRAW_TYPE_STICK
           
protected static int BOND_DRAW_TYPE_WIRE
           
protected static boolean BOND_FACING
           
protected  int bondDistance
           
protected  boolean bondFacing
           
protected  double bondRadius
           
protected  int bondSlicePrecision
           
protected  int bondWidth
           
protected  java.awt.Color color
           
protected  int colorType
           
protected static int COMPONENT_TYPE_ATOM
           
protected static int COMPONENT_TYPE_BOND
           
protected static int COMPONENT_TYPE_MOLECULE
           
protected static double DEFAULT_BALL_RADIUS
           
protected static int DEFAULT_BOND_DISTANCE
           
protected static double DEFAULT_BOND_RADIUS
           
protected static int DEFAULT_BOND_WIDTH
           
protected static java.awt.Color DEFAULT_COLOR
           
protected static int DEFAULT_H_BALL_PRECISION
           
protected static int DEFAULT_H_BOND_SLICE_PRECISION
           
protected static int DEFAULT_H_JOINT_PRECISION
           
protected static int DEFAULT_H_SPACEFILL_PRECISION
           
protected static int DEFAULT_H_STICK_SLICE_PRECISION
           
protected static int DEFAULT_L_BALL_PRECISION
           
protected static int DEFAULT_L_BOND_SLICE_PRECISION
           
protected static int DEFAULT_L_JOINT_PRECISION
           
protected static int DEFAULT_L_SPACEFILL_PRECISION
           
protected static int DEFAULT_L_STICK_SLICE_PRECISION
           
protected static double DEFAULT_LINE_WIDTH
           
protected static int DEFAULT_M_BALL_PRECISION
           
protected static int DEFAULT_M_BOND_SLICE_PRECISION
           
protected static int DEFAULT_M_JOINT_PRECISION
           
protected static int DEFAULT_M_SPACEFILL_PRECISION
           
protected static int DEFAULT_M_STICK_SLICE_PRECISION
           
protected static double DEFAULT_STICK_RADIUS
           
protected static boolean DISPLAY_BOND_ORDER
           
protected  boolean displayBondOrder
           
protected static int DRAW_TYPE_BALL
           
protected static int DRAW_TYPE_BALL_AND_STICK
           
protected static int DRAW_TYPE_BALL_AND_WIRE
           
protected static int DRAW_TYPE_SPACEFILL
           
protected static int DRAW_TYPE_STICK
           
protected static int DRAW_TYPE_WIRE
           
protected  boolean drawHydrogens
           
protected  int drawType
           
protected static java.util.HashMap drawTypes
           
static int[] elementList
           
protected  chemaxon.struc.MacroMolecule.HeteroComponent hc
           
protected  int jointPrecision
           
protected  double lineWidth
           
static int LONE_PAIR_TYPE
           
protected  MacroMoleculeComponent mmc
           
protected  Molecule mol
           
protected static boolean SCALED_BALLS
           
protected  boolean scaledBalls
           
protected  boolean[] selectedAtoms
           
protected  boolean selectionBeforeInit
           
protected static boolean SMOOTH_STICKS
           
protected  boolean smoothStickColoring
           
protected  int spacefillPrecision
           
protected  double stickRadius
           
protected  int stickSlicePrecision
           
 
Fields inherited from class chemaxon.marvin.space.GraphicComponent
active, associatedComponents, boundingBox, COMPONENT_TYPE_ENTIRE, drawProperties, gl, glu, graphicCell, irm, modifiesOrigin, motionMode, mousex, mousey, name, pickedItem, RENDERING_QUALITY_HIGH, RENDERING_QUALITY_LOW, RENDERING_QUALITY_MEDIUM, renderingQuality, rm, uoid, visible
 
Constructor Summary
protected MoleculeComponent()
          Creates a new instance of MoleculeComponent.
  MoleculeComponent(chemaxon.struc.MacroMolecule.HeteroComponent hc, MacroMoleculeComponent mmc)
          Creates a new instance of MoleculeComponent from the given HeteroComponent and MacroMoleculeComponent; this class can be used as a visualizer of a ligand.
  MoleculeComponent(Molecule mol)
          Creates a new instance of MoleculeComponent from the given molecule.
 
Method Summary
 void draw()
          Called by GraphicCell from the Jogl rendering thread and draws the molecule.
 void drawAtomSelection(int mode)
          To make selection faster we don't draw the atoms themself into the selection buffer, but we draw simple polygons instead.
protected  void drawSelection(int mode)
          Draws the component in the given mode (usually in selection mode), the rendering mode is for checking.
 void drawTransparentPart()
          Draws the molecule if the drawing type was wire.
 void exclusiveSelection()
          Sets the previously picked but unprocessed element to be selected, and sets every other parts not to be selected.
 void extendSelection()
          Sets the previously picked but unprocessed element to be selected, and leaves other parts as they are.
 void fadeSelected()
          The selected atoms will be faded.
 void fadeUnselected()
          The unselected atoms will be faded.
 int getAtomCount(boolean enumerateHydrogens)
          Returns the number of atoms in the molecule with arbitrarily enumerating hydrogens.
 chemaxon.struc.MoleculeIterators.AtomIteratorInterface getAtomIterator(boolean enumerateHydrogens)
          Returns the iterator of the atoms of the molecule.
 chemaxon.struc.MoleculeIterators.AtomPropertyInterface getAtomProperty()
          See MoleculeIterators.AtomPropertyInterface for details.
 boolean[] getAtomSelections()
           
 int getBondCount(boolean enumerateHydrogens)
          Returns the number of bonds in the molecule with arbitrarily enumerating hydrogens.
 chemaxon.struc.MoleculeIterators.BondIteratorInterface getBondIterator(boolean enumerateHydrogens)
          Returns the iterator of the atoms of the molecule.
 BoundingBox getBoundingBox()
          Returns the BoundingBox that is the smallest container box of the component.
 java.awt.Color getColor()
          Returns the constant color of the component.
 int getColorType()
          Returns the color type of the visualizer.
 ComponentElement getComponentElement()
          Returns the previously picked but unprocessed ComponentElement or the whole component as a ComponentElement, if no picking happened.
 void getCoordinates(ComponentElement element, float[] c)
          Sets the coordinates of the given element in the given preallocated array.
 java.lang.String getDescription(ComponentElement element)
          Returs the short description of the given part of the component.
 GraphicComponent getGraphicComponent()
           
 chemaxon.marvin.space.UOID getId()
          Returns the id of the component.
 ComponentElement[] getLabelInformation(java.lang.String labeltype)
           
 ComponentElement[] getLabelInformation(java.lang.String labeltype, boolean onlyOnHeavyAtoms)
          Labels will be created associated to this MoleculeComponent if the labeltype is "atom", "extraatomlabel" or "molecule".
 MacroMoleculeComponent getMacroMoleculeComponent()
          Returns the macromolecule visualizer if this MoleculeComponent visualizes a ligand in a complex.
 Molecule getMolecule()
          Returns the Molecule of the MoleculeComponent.
 MolAtom getSelectedAtom(int i)
           
 int getVisibleAtomCount()
          Returns the number of atoms currently visible.
 boolean hasSelectedElements()
          Returns true if the component has any selected part.
 boolean hasTransparentPart()
          Returns true if antialiased lines are drawn, that is in DRAW_TYPE_WIRE or DRAW_TYPE_BALL_AND_WIRE mode.
 void hideSelected()
          The selected atoms will be hidden.
 void hideUnselected()
          The unselected atoms will be hidden.
 void initDraw()
          Initializes gl related drawing variables, for example display lists.
 void invertSelection()
          Sets the the given part of the component to be selected if it was not set and vice versa.
 boolean isAtomFaded(int i)
          Tells whether the atom is faded or not.
 boolean isAtomVisible(int i)
          Returns if the atom is visible or hidden.
 boolean isControllable(java.lang.String type)
          Returns whether controling by the given type of controller is allowed to the component.
 boolean isGraphicComponent()
           
 boolean isHighlighted()
          This functionality is currently unavailable.
 boolean isLigand()
           
 boolean isMacromoleculePart()
          Tells whether this MoleculeComponent is a visualizer of a ligand in a complex or an independent small molecule.
 boolean isSelected()
          Returns true if the whole component is selected.
 boolean isSelected(ComponentElement item)
          Returns true if the given item is selected.
 boolean isSelectedAtom(int atomIndex)
          Returns true if the atom with the given index is selected.
 boolean isVisible()
          Returns true if this component is allowed to be drawn.
 boolean isVisible(ComponentElement item)
          Returns true if the given item is visible.
 void onRemove()
           
 void onRemoveGraphicComponent()
           
protected  void pickObject(int offset, double[] maxZ, float[] modelview)
          Sets GraphicComponent.pickedItem to be the picked part of the component.
 void reCreate()
           
 void rotate(float[] v, float[] center)
          Rotates the molecule with parameter center as an origin.
 void select()
          Sets the whole component to be selected.
 void selectAllAtoms()
          Sets all atoms to be selected.
 void selectAtom(int i)
          Sets the atom with the given index to be selected.
 void selectComponentElementsInside(BoundingBox bb)
          Atoms lying in the given box will be selected.
 int selectedAtomCount()
          Returns the number of atoms being selected.
protected  void setBoundingBox()
          Computes the bounding box of the visible atoms of the molecule, and adds 2 angstroms to each side.
 void setColor(java.awt.Color color)
          Sets the constant color of the component.
 void setColor(float r, float g, float b)
          Sets the constant color of the component.
 void setDrawProperty(java.lang.String propertyName, java.lang.String propertyValue)
          Sets a draw property.
 void setGL(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu)
          Sets drawing related variable.
 void setHighlighted(boolean v)
          This functionality is currently unavailable.
 void setMacroMoleculeComponent(MacroMoleculeComponent mmc)
          A MacroMoleculeComponent can be set and in this case this will be a visualizer of a ligand in the macromolecule.
 void setMolecule(Molecule mol)
          Sets the Molecule of the MoleculeComponent to mol, sets proper atomIterators, and computes the bounding box.
 void setVisible(boolean v)
          Sets the component to be visible/invisible.
 void showFaded()
          Faded atoms will be fully visible again.
 void torsion(double angle, float[] axis, float[] center, int[] atomArray)
          Changes torsion angle.
 void translate(float[] v)
          Translates the molecule with the parameter as a vector.
 void unSelect()
          Unselects the component, say sets all parts to be unselected.
 void unSelectAllAtoms()
          Sets all atoms to be unselected.
 void unSelectAtom(int i)
          Sets the atom with the given index to be unselected.
 
Methods inherited from class chemaxon.marvin.space.GraphicComponent
addDrawProperties, associate, draw2DPart, drawBoundingBox, drawCoordinateAxes, exclusiveSelection, extendSelection, getAssociatedComponents, getBoundingSphereRadius, getCell, getCoordinates, getDescription, getDrawProperties, getDrawProperty, getName, getRenderingQuality, getUsableObject, getZCoordinateTo2DPart, glColor, has2DPart, invertSelection, locateObject, notifyCoordinateChange, notifyInvisibility, notifySelection, notifyUnSelection, notifyVisibility, projectVector, receiveNotificationOnCoordinateChange, receiveNotificationOnInvisibility, receiveNotificationOnSelection, receiveNotificationOnUnSelection, receiveNotificationOnVisibility, removeAssociation, resize, rotate, rotate, select, setColor, setDrawProperties, setMotionMode, setName, setProgressBar, setRenderingQuality, setRotateMatrix, storeDrawProperty, toString, touchObject, unSelect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface chemaxon.marvin.space.MacroMoleculeComponent.MoleculeVisualizer
getDrawProperty, getName
 
Methods inherited from interface chemaxon.marvin.space.UsableObject
getName, setName, toString
 

Field Detail

DRAW_TYPE_WIRE

protected static final int DRAW_TYPE_WIRE
See Also:
Constant Field Values

DRAW_TYPE_BALL

protected static final int DRAW_TYPE_BALL
See Also:
Constant Field Values

DRAW_TYPE_STICK

protected static final int DRAW_TYPE_STICK
See Also:
Constant Field Values

DRAW_TYPE_BALL_AND_WIRE

protected static final int DRAW_TYPE_BALL_AND_WIRE
See Also:
Constant Field Values

DRAW_TYPE_BALL_AND_STICK

protected static final int DRAW_TYPE_BALL_AND_STICK
See Also:
Constant Field Values

DRAW_TYPE_SPACEFILL

protected static final int DRAW_TYPE_SPACEFILL
See Also:
Constant Field Values

BOND_DRAW_TYPE_BOND

protected static final int BOND_DRAW_TYPE_BOND
See Also:
Constant Field Values

BOND_DRAW_TYPE_STICK

protected static final int BOND_DRAW_TYPE_STICK
See Also:
Constant Field Values

BOND_DRAW_TYPE_WIRE

protected static final int BOND_DRAW_TYPE_WIRE
See Also:
Constant Field Values

DEFAULT_BALL_RADIUS

protected static final double DEFAULT_BALL_RADIUS
See Also:
Constant Field Values

DEFAULT_BOND_RADIUS

protected static final double DEFAULT_BOND_RADIUS
See Also:
Constant Field Values

DEFAULT_STICK_RADIUS

protected static final double DEFAULT_STICK_RADIUS
See Also:
Constant Field Values

DEFAULT_LINE_WIDTH

protected static final double DEFAULT_LINE_WIDTH
See Also:
Constant Field Values

DEFAULT_BOND_DISTANCE

protected static final int DEFAULT_BOND_DISTANCE
See Also:
Constant Field Values

DEFAULT_BOND_WIDTH

protected static final int DEFAULT_BOND_WIDTH
See Also:
Constant Field Values

SMOOTH_STICKS

protected static final boolean SMOOTH_STICKS
See Also:
Constant Field Values

BOND_FACING

protected static final boolean BOND_FACING
See Also:
Constant Field Values

SCALED_BALLS

protected static final boolean SCALED_BALLS
See Also:
Constant Field Values

DISPLAY_BOND_ORDER

protected static final boolean DISPLAY_BOND_ORDER
See Also:
Constant Field Values

DEFAULT_H_BALL_PRECISION

protected static final int DEFAULT_H_BALL_PRECISION
See Also:
Constant Field Values

DEFAULT_H_SPACEFILL_PRECISION

protected static final int DEFAULT_H_SPACEFILL_PRECISION
See Also:
Constant Field Values

DEFAULT_H_JOINT_PRECISION

protected static final int DEFAULT_H_JOINT_PRECISION
See Also:
Constant Field Values

DEFAULT_H_BOND_SLICE_PRECISION

protected static final int DEFAULT_H_BOND_SLICE_PRECISION
See Also:
Constant Field Values

DEFAULT_H_STICK_SLICE_PRECISION

protected static final int DEFAULT_H_STICK_SLICE_PRECISION
See Also:
Constant Field Values

DEFAULT_M_BALL_PRECISION

protected static final int DEFAULT_M_BALL_PRECISION
See Also:
Constant Field Values

DEFAULT_M_SPACEFILL_PRECISION

protected static final int DEFAULT_M_SPACEFILL_PRECISION
See Also:
Constant Field Values

DEFAULT_M_JOINT_PRECISION

protected static final int DEFAULT_M_JOINT_PRECISION
See Also:
Constant Field Values

DEFAULT_M_BOND_SLICE_PRECISION

protected static final int DEFAULT_M_BOND_SLICE_PRECISION
See Also:
Constant Field Values

DEFAULT_M_STICK_SLICE_PRECISION

protected static final int DEFAULT_M_STICK_SLICE_PRECISION
See Also:
Constant Field Values

DEFAULT_L_BALL_PRECISION

protected static final int DEFAULT_L_BALL_PRECISION
See Also:
Constant Field Values

DEFAULT_L_SPACEFILL_PRECISION

protected static final int DEFAULT_L_SPACEFILL_PRECISION
See Also:
Constant Field Values

DEFAULT_L_JOINT_PRECISION

protected static final int DEFAULT_L_JOINT_PRECISION
See Also:
Constant Field Values

DEFAULT_L_BOND_SLICE_PRECISION

protected static final int DEFAULT_L_BOND_SLICE_PRECISION
See Also:
Constant Field Values

DEFAULT_L_STICK_SLICE_PRECISION

protected static final int DEFAULT_L_STICK_SLICE_PRECISION
See Also:
Constant Field Values

COMPONENT_TYPE_ATOM

protected static final int COMPONENT_TYPE_ATOM
See Also:
Constant Field Values

COMPONENT_TYPE_BOND

protected static final int COMPONENT_TYPE_BOND
See Also:
Constant Field Values

COMPONENT_TYPE_MOLECULE

protected static final int COMPONENT_TYPE_MOLECULE
See Also:
Constant Field Values

DEFAULT_COLOR

protected static final java.awt.Color DEFAULT_COLOR

elementList

public static final int[] elementList

LONE_PAIR_TYPE

public static final int LONE_PAIR_TYPE
See Also:
Constant Field Values

drawTypes

protected static java.util.HashMap drawTypes

mol

protected Molecule mol

mmc

protected MacroMoleculeComponent mmc

hc

protected chemaxon.struc.MacroMolecule.HeteroComponent hc

drawType

protected int drawType

drawHydrogens

protected boolean drawHydrogens

ballRadius

protected double ballRadius

bondRadius

protected double bondRadius

stickRadius

protected double stickRadius

lineWidth

protected double lineWidth

bondDistance

protected int bondDistance

bondWidth

protected int bondWidth

smoothStickColoring

protected boolean smoothStickColoring

bondFacing

protected boolean bondFacing

scaledBalls

protected boolean scaledBalls

displayBondOrder

protected boolean displayBondOrder

ballPrecision

protected int ballPrecision

spacefillPrecision

protected int spacefillPrecision

bondSlicePrecision

protected int bondSlicePrecision

stickSlicePrecision

protected int stickSlicePrecision

jointPrecision

protected int jointPrecision

colorType

protected int colorType

selectedAtoms

protected boolean[] selectedAtoms

selectionBeforeInit

protected boolean selectionBeforeInit

color

protected java.awt.Color color
Constructor Detail

MoleculeComponent

protected MoleculeComponent()
Creates a new instance of MoleculeComponent. Molecule have to be set by #setMolecule()


MoleculeComponent

public MoleculeComponent(Molecule mol)
Creates a new instance of MoleculeComponent from the given molecule.


MoleculeComponent

public MoleculeComponent(chemaxon.struc.MacroMolecule.HeteroComponent hc,
                         MacroMoleculeComponent mmc)
Creates a new instance of MoleculeComponent from the given HeteroComponent and MacroMoleculeComponent; this class can be used as a visualizer of a ligand.

Method Detail

onRemoveGraphicComponent

public void onRemoveGraphicComponent()
Overrides:
onRemoveGraphicComponent in class GraphicComponent

onRemove

public void onRemove()
Specified by:
onRemove in interface MacroMoleculeComponent.MoleculeVisualizer

isGraphicComponent

public boolean isGraphicComponent()
Specified by:
isGraphicComponent in interface chemaxon.marvin.space.UsableObject
Overrides:
isGraphicComponent in class GraphicComponent

getGraphicComponent

public GraphicComponent getGraphicComponent()
Specified by:
getGraphicComponent in interface chemaxon.marvin.space.UsableObject
Overrides:
getGraphicComponent in class GraphicComponent

getId

public chemaxon.marvin.space.UOID getId()
Description copied from class: GraphicComponent
Returns the id of the component. This id contains internal cell and component indices. The id can be changed by client and internal mechanisms in GraphicCell may also alter its value. Thus to preserve a component for later use, store the component itself rather than its Id.

Specified by:
getId in interface chemaxon.marvin.space.UsableObject
Overrides:
getId in class GraphicComponent
Returns:
id of the component

setMacroMoleculeComponent

public void setMacroMoleculeComponent(MacroMoleculeComponent mmc)
A MacroMoleculeComponent can be set and in this case this will be a visualizer of a ligand in the macromolecule.


isMacromoleculePart

public boolean isMacromoleculePart()
Tells whether this MoleculeComponent is a visualizer of a ligand in a complex or an independent small molecule.


getMacroMoleculeComponent

public MacroMoleculeComponent getMacroMoleculeComponent()
Returns the macromolecule visualizer if this MoleculeComponent visualizes a ligand in a complex.

Specified by:
getMacroMoleculeComponent in interface MacroMoleculeComponent.MoleculeVisualizer

setGL

public void setGL(javax.media.opengl.GL2 gl,
                  javax.media.opengl.glu.GLU glu)
Sets drawing related variable.

Specified by:
setGL in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
setGL in class GraphicComponent
Parameters:
gl - Interface to OpenGL
glu - Interface to OpenGL

getColor

public java.awt.Color getColor()
Description copied from class: GraphicComponent
Returns the constant color of the component.

Specified by:
getColor in interface MacroMoleculeComponent.MoleculeVisualizer
Specified by:
getColor in interface chemaxon.marvin.space.UsableObject
Overrides:
getColor in class GraphicComponent

setColor

public void setColor(java.awt.Color color)
Sets the constant color of the component.

Specified by:
setColor in interface chemaxon.marvin.space.UsableObject
Overrides:
setColor in class GraphicComponent

setColor

public void setColor(float r,
                     float g,
                     float b)
Sets the constant color of the component.

Overrides:
setColor in class GraphicComponent

getBoundingBox

public BoundingBox getBoundingBox()
Returns the BoundingBox that is the smallest container box of the component. Either hydrogens are displayed or not they are always considered.

Specified by:
getBoundingBox in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
getBoundingBox in class GraphicComponent
Returns:
BoundingBox

getMolecule

public Molecule getMolecule()
Returns the Molecule of the MoleculeComponent.


setMolecule

public void setMolecule(Molecule mol)
Sets the Molecule of the MoleculeComponent to mol, sets proper atomIterators, and computes the bounding box.


getAtomIterator

public chemaxon.struc.MoleculeIterators.AtomIteratorInterface getAtomIterator(boolean enumerateHydrogens)
Returns the iterator of the atoms of the molecule. See MoleculeIterators.AtomIteratorInterface for details.

Specified by:
getAtomIterator in interface chemaxon.struc.MoleculeIterators.MoleculeInterface
Parameters:
enumerateHydrogens - enable/disable enumeration of hydrogens

getAtomProperty

public chemaxon.struc.MoleculeIterators.AtomPropertyInterface getAtomProperty()
See MoleculeIterators.AtomPropertyInterface for details.

Specified by:
getAtomProperty in interface chemaxon.struc.MoleculeIterators.MoleculeInterface

getBondIterator

public chemaxon.struc.MoleculeIterators.BondIteratorInterface getBondIterator(boolean enumerateHydrogens)
Returns the iterator of the atoms of the molecule. See MoleculeIterators.BondIteratorInterface for details.

Specified by:
getBondIterator in interface chemaxon.struc.MoleculeIterators.MoleculeInterface
Parameters:
enumerateHydrogens - enable/disable enumeration of hydrogens

getAtomCount

public int getAtomCount(boolean enumerateHydrogens)
Returns the number of atoms in the molecule with arbitrarily enumerating hydrogens.

Specified by:
getAtomCount in interface chemaxon.struc.MoleculeIterators.MoleculeInterface

getBondCount

public int getBondCount(boolean enumerateHydrogens)
Returns the number of bonds in the molecule with arbitrarily enumerating hydrogens.

Specified by:
getBondCount in interface chemaxon.struc.MoleculeIterators.MoleculeInterface

translate

public void translate(float[] v)
Translates the molecule with the parameter as a vector.

Overrides:
translate in class GraphicComponent
Parameters:
v - translation vector

rotate

public void rotate(float[] v,
                   float[] center)
Rotates the molecule with parameter center as an origin. Rotates around x axis with the x argument of vector as angle, and so on.

Overrides:
rotate in class GraphicComponent
Parameters:
v - measure of rotation around the 3 axes
center - Center of the rotation.

torsion

public void torsion(double angle,
                    float[] axis,
                    float[] center,
                    int[] atomArray)
Changes torsion angle. Atoms being in the atom array will be rotated by given angle around the given axis. Center means the origin, so first there is a translation to center, rotation follows, and finally translation back.


isControllable

public boolean isControllable(java.lang.String type)
Returns whether controling by the given type of controller is allowed to the component. This component is allowed to be translated and rotated.

Overrides:
isControllable in class GraphicComponent
Parameters:
type - "Shift", "Rotate", "Resize"
Returns:
is the component aloowed to be controlled or not

setBoundingBox

protected void setBoundingBox()
Computes the bounding box of the visible atoms of the molecule, and adds 2 angstroms to each side.


initDraw

public void initDraw()
Initializes gl related drawing variables, for example display lists. Called by MacroMoleculeComponent, because GraphicComponents would get GL2 from the GraphicCell during initialization, but MacroMoleculeComponent has to pass it to its visualizers.

Specified by:
initDraw in interface MacroMoleculeComponent.MoleculeVisualizer

reCreate

public void reCreate()
Specified by:
reCreate in interface MacroMoleculeComponent.MoleculeVisualizer

draw

public void draw()
Called by GraphicCell from the Jogl rendering thread and draws the molecule. See GraphicComponent.draw().

Specified by:
draw in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
draw in class GraphicComponent

drawTransparentPart

public void drawTransparentPart()
Draws the molecule if the drawing type was wire.

Specified by:
drawTransparentPart in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
drawTransparentPart in class GraphicComponent

getComponentElement

public ComponentElement getComponentElement()
Returns the previously picked but unprocessed ComponentElement or the whole component as a ComponentElement, if no picking happened.

Overrides:
getComponentElement in class GraphicComponent
Returns:
picked part of the component

getCoordinates

public void getCoordinates(ComponentElement element,
                           float[] c)
Sets the coordinates of the given element in the given preallocated array.

Overrides:
getCoordinates in class GraphicComponent
Parameters:
element - specific part of the component
c - allocated array where coordinates will be put

getDescription

public java.lang.String getDescription(ComponentElement element)
Returs the short description of the given part of the component.

Specified by:
getDescription in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
getDescription in class GraphicComponent
Parameters:
element - specific part of the component
Returns:
short description string

isLigand

public boolean isLigand()

getLabelInformation

public ComponentElement[] getLabelInformation(java.lang.String labeltype,
                                              boolean onlyOnHeavyAtoms)
Labels will be created associated to this MoleculeComponent if the labeltype is "atom", "extraatomlabel" or "molecule".

Overrides:
getLabelInformation in class GraphicComponent
Parameters:
labeltype -
onlyOnHeavyAtoms - label info needed only for heavy atoms.
Returns:
array of ComponentElements to create labels to

getLabelInformation

public ComponentElement[] getLabelInformation(java.lang.String labeltype)
Specified by:
getLabelInformation in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
getLabelInformation in class GraphicComponent

isSelectedAtom

public boolean isSelectedAtom(int atomIndex)
Returns true if the atom with the given index is selected.

Specified by:
isSelectedAtom in interface MacroMoleculeComponent.MoleculeVisualizer

getSelectedAtom

public MolAtom getSelectedAtom(int i)

getAtomSelections

public boolean[] getAtomSelections()

selectAtom

public void selectAtom(int i)
Sets the atom with the given index to be selected.

Specified by:
selectAtom in interface MacroMoleculeComponent.MoleculeVisualizer

unSelectAtom

public void unSelectAtom(int i)
Sets the atom with the given index to be unselected.

Specified by:
unSelectAtom in interface MacroMoleculeComponent.MoleculeVisualizer

selectAllAtoms

public void selectAllAtoms()
Sets all atoms to be selected.


unSelectAllAtoms

public void unSelectAllAtoms()
Sets all atoms to be unselected.


setVisible

public void setVisible(boolean v)
Sets the component to be visible/invisible. It is slighly different from the method of GraphicComponent, because in case of visualizing a ligand of a macromolecule, the BoundingBox should be refreshed.

Specified by:
setVisible in interface MacroMoleculeComponent.MoleculeVisualizer
Specified by:
setVisible in interface chemaxon.marvin.space.UsableObject
Overrides:
setVisible in class GraphicComponent
Parameters:
v - of visibility

showFaded

public void showFaded()
Faded atoms will be fully visible again.

Specified by:
showFaded in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
showFaded in class GraphicComponent

hideSelected

public void hideSelected()
The selected atoms will be hidden.

Specified by:
hideSelected in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
hideSelected in class GraphicComponent

hideUnselected

public void hideUnselected()
The unselected atoms will be hidden.

Specified by:
hideUnselected in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
hideUnselected in class GraphicComponent

fadeSelected

public void fadeSelected()
The selected atoms will be faded. Faded atoms will appear dark gray during visualization and they will behave as if they were hidden.

Specified by:
fadeSelected in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
fadeSelected in class GraphicComponent

fadeUnselected

public void fadeUnselected()
The unselected atoms will be faded. Faded atoms will appear dark gray during visualization and they will behave as if they were hidden.

Specified by:
fadeUnselected in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
fadeUnselected in class GraphicComponent

isHighlighted

public boolean isHighlighted()
This functionality is currently unavailable.

Specified by:
isHighlighted in interface MacroMoleculeComponent.MoleculeVisualizer
Returns:
whether the component is highlighted

setHighlighted

public void setHighlighted(boolean v)
This functionality is currently unavailable.

Specified by:
setHighlighted in interface MacroMoleculeComponent.MoleculeVisualizer

isVisible

public boolean isVisible()
Returns true if this component is allowed to be drawn.

Specified by:
isVisible in interface MacroMoleculeComponent.MoleculeVisualizer
Specified by:
isVisible in interface chemaxon.marvin.space.UsableObject
Overrides:
isVisible in class GraphicComponent
Returns:
visibility of the component

isVisible

public boolean isVisible(ComponentElement item)
Returns true if the given item is visible.

Overrides:
isVisible in class GraphicComponent
Parameters:
item - part of the component
Returns:
visibility of the part of the component

isAtomVisible

public boolean isAtomVisible(int i)
Returns if the atom is visible or hidden.

Specified by:
isAtomVisible in interface MacroMoleculeComponent.MoleculeVisualizer
Parameters:
i - atom index given by MoleculeIterators.AtomIteratorInterface.current() }
Returns:
false if the component is hidden or the atom is H atom but is not displayed or if the atom is explicitly hidden

isAtomFaded

public boolean isAtomFaded(int i)
Tells whether the atom is faded or not.

Specified by:
isAtomFaded in interface MacroMoleculeComponent.MoleculeVisualizer
Parameters:
i - atom index given by MoleculeIterators.AtomIteratorInterface.current() }
Returns:
true if the atom is explicitly set faded

getVisibleAtomCount

public int getVisibleAtomCount()
Returns the number of atoms currently visible.

Specified by:
getVisibleAtomCount in interface MacroMoleculeComponent.MoleculeVisualizer
Returns:
number of atoms except explicitly hidden atoms

hasTransparentPart

public boolean hasTransparentPart()
Returns true if antialiased lines are drawn, that is in DRAW_TYPE_WIRE or DRAW_TYPE_BALL_AND_WIRE mode.

Specified by:
hasTransparentPart in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
hasTransparentPart in class GraphicComponent
Returns:
will the component draw with transparency

select

public void select()
Sets the whole component to be selected.

Specified by:
select in interface MacroMoleculeComponent.MoleculeVisualizer
Specified by:
select in interface chemaxon.marvin.space.UsableObject
Overrides:
select in class GraphicComponent

unSelect

public void unSelect()
Unselects the component, say sets all parts to be unselected.

Specified by:
unSelect in interface MacroMoleculeComponent.MoleculeVisualizer
Specified by:
unSelect in interface chemaxon.marvin.space.UsableObject
Overrides:
unSelect in class GraphicComponent

selectComponentElementsInside

public void selectComponentElementsInside(BoundingBox bb)
Atoms lying in the given box will be selected.

Specified by:
selectComponentElementsInside in interface MacroMoleculeComponent.MoleculeVisualizer
Overrides:
selectComponentElementsInside in class GraphicComponent
Parameters:
bb - given box represented by a BoundingBox

isSelected

public boolean isSelected(ComponentElement item)
Returns true if the given item is selected.

Overrides:
isSelected in class GraphicComponent
Parameters:
item - specific part of the component
Returns:
selection state of the element

isSelected

public boolean isSelected()
Returns true if the whole component is selected.

Specified by:
isSelected in interface MacroMoleculeComponent.MoleculeVisualizer
Specified by:
isSelected in interface chemaxon.marvin.space.UsableObject
Overrides:
isSelected in class GraphicComponent
Returns:
selection state of the component

hasSelectedElements

public boolean hasSelectedElements()
Returns true if the component has any selected part.

Overrides:
hasSelectedElements in class GraphicComponent
Returns:
is any part of the component selected

selectedAtomCount

public int selectedAtomCount()
Returns the number of atoms being selected.

Specified by:
selectedAtomCount in interface MacroMoleculeComponent.MoleculeVisualizer

exclusiveSelection

public void exclusiveSelection()
Sets the previously picked but unprocessed element to be selected, and sets every other parts not to be selected.

Overrides:
exclusiveSelection in class GraphicComponent

extendSelection

public void extendSelection()
Sets the previously picked but unprocessed element to be selected, and leaves other parts as they are.

Overrides:
extendSelection in class GraphicComponent

invertSelection

public void invertSelection()
Sets the the given part of the component to be selected if it was not set and vice versa.

Overrides:
invertSelection in class GraphicComponent

drawSelection

protected void drawSelection(int mode)
Description copied from class: GraphicComponent
Draws the component in the given mode (usually in selection mode), the rendering mode is for checking.

Overrides:
drawSelection in class GraphicComponent
Parameters:
mode - GL_RENDER or GL_SELECT

drawAtomSelection

public void drawAtomSelection(int mode)
To make selection faster we don't draw the atoms themself into the selection buffer, but we draw simple polygons instead. Each polygon has 8 vertices, and approximates spheres well. To display these polygons, call drawAtomSelection(GL2.GL_RENDER) in the display method. You may not see the polygons though, because they have the same "radius" as the spheres. To achive that the polygons do not rotate from the viewing plane, we translate them to the origin, rotate them with the inverse rotation, and translate them back to the previous location.

Specified by:
drawAtomSelection in interface MacroMoleculeComponent.MoleculeVisualizer

pickObject

protected void pickObject(int offset,
                          double[] maxZ,
                          float[] modelview)
Description copied from class: GraphicComponent
Sets GraphicComponent.pickedItem to be the picked part of the component.

Overrides:
pickObject in class GraphicComponent
Parameters:
offset - Integer used in the name stack to identify the part of the component.
maxZ - Stores the z coordinate of the part with maximum z coordinate in the actual picking. It has to be set if the part with the current offset has greater z coordinate than the stored one. Example to compute: int aIdx = GeomCalc.newVector( picked.x(), picked.y(), picked.z() ); GeomCalc.multVectorWithMatrix(aIdx, modelview); z coordinate: maxZ[0] = GeomCalc.getZ(aIdx)
modelview - Is to compute the proper z coordinate.

getColorType

public int getColorType()
Returns the color type of the visualizer.

Specified by:
getColorType in interface MacroMoleculeComponent.MoleculeVisualizer
Returns:
identifier of the color type

setDrawProperty

public void setDrawProperty(java.lang.String propertyName,
                            java.lang.String propertyValue)
Sets a draw property.
Accepts the PropertyName -- PropertyValue (Meaning) pairs below:

Specified by:
setDrawProperty in interface MacroMoleculeComponent.MoleculeVisualizer
Specified by:
setDrawProperty in interface chemaxon.marvin.space.UsableObject
Overrides:
setDrawProperty in class GraphicComponent
Parameters:
propertyName - identifier of the draw property
propertyValue - value of the draw property as a String