Package chemaxon.marvin.space
Class MoleculeComponent
java.lang.Object
chemaxon.marvin.space.GraphicComponent
chemaxon.marvin.space.MoleculeComponent
- All Implemented Interfaces:
MacroMoleculeComponent.MoleculeVisualizer
,chemaxon.marvin.space.UsableObject
,chemaxon.struc.MoleculeIterators.MoleculeInterface
@PublicAPI
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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected double
protected static final int
protected static final int
protected static final int
protected static final boolean
protected int
protected boolean
protected double
protected int
protected int
protected float[]
protected int
protected static final int
protected static final int
protected static final int
protected static final double
protected static final int
protected static final double
protected static final int
protected static final float[]
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final double
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final double
protected static final boolean
protected boolean
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected static final int
protected boolean
protected int
protected static HashMap
static final int[]
protected chemaxon.struc.MacroMolecule.HeteroComponent
protected int
protected double
static final int
protected MacroMoleculeComponent
protected Molecule
protected static final boolean
protected boolean
protected boolean[]
protected boolean
protected static final boolean
protected boolean
protected int
protected double
protected int
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
ConstructorsModifierConstructorDescriptionprotected
Creates a new instance of MoleculeComponent.MoleculeComponent
(chemaxon.struc.MacroMolecule.HeteroComponent hc, MacroMoleculeComponent mmc) Creates a new instance ofMoleculeComponent
from the givenHeteroComponent
andMacroMoleculeComponent
; this class can be used as a visualizer of a ligand.Creates a new instance ofMoleculeComponent
from the given molecule. -
Method Summary
Modifier and TypeMethodDescriptionvoid
draw()
Called byGraphicCell
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
Draws the molecule if the drawing type was wire.void
Sets the previously picked but unprocessed element to be selected, and sets every other parts not to be selected.void
Sets the previously picked but unprocessed element to be selected, and leaves other parts as they are.void
The selected atoms will be faded.void
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
SeeMoleculeIterators.AtomPropertyInterface
for details.boolean[]
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.Returns theBoundingBox
that is the smallest container box of the component.getColor()
Returns the constant color of the component.float[]
int
Returns the color type of the visualizer.Returns the previously picked but unprocessedComponentElement
or the whole component as aComponentElement
, if no picking happened.void
getCoordinates
(ComponentElement element, float[] c) Sets the coordinates of the given element in the given preallocated array.getDescription
(ComponentElement element) Returs the short description of the given part of the component.chemaxon.marvin.space.UOID
getId()
Returns the id of the component.getLabelInformation
(String labeltype) getLabelInformation
(String labeltype, boolean onlyOnHeavyAtoms) Labels will be created associated to this MoleculeComponent if the labeltype is "atom", "extraatomlabel" or "molecule".Returns the macromolecule visualizer if thisMoleculeComponent
visualizes a ligand in a complex.Returns theMolecule
of theMoleculeComponent
.getSelectedAtom
(int i) int
Returns the number of atoms currently visible.boolean
Returns true if the component has any selected part.boolean
Returns true if antialiased lines are drawn, that is inDRAW_TYPE_WIRE
orDRAW_TYPE_BALL_AND_WIRE
mode.void
The selected atoms will be hidden.void
The unselected atoms will be hidden.void
initDraw()
Initializes gl related drawing variables, for example display lists.void
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
(String type) Returns whether controling by the given type of controller is allowed to the component.boolean
boolean
This functionality is currently unavailable.boolean
isLigand()
boolean
Tells whether thisMoleculeComponent
is a visualizer of a ligand in a complex or an independent small molecule.boolean
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
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
protected void
pickObject
(int offset, double[] maxZ, float[] modelview) SetsGraphicComponent.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
Sets all atoms to be selected.void
selectAtom
(int i) Sets the atom with the given index to be selected.void
Atoms lying in the given box will be selected.int
Returns the number of atoms being selected.protected void
Computes the bounding box of the visible atoms of the molecule, and adds 2 angstroms to each side.void
setColor
(float[] color) Sets the constant color of the component.void
setColor
(float r, float g, float b) Sets the constant color of the component.void
Sets the constant color of the component.void
setDrawProperty
(String propertyName, String propertyValue) Sets adraw 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
AMacroMoleculeComponent
can be set and in this case this will be a visualizer of a ligand in the macromolecule.void
setMolecule
(Molecule mol) Sets theMolecule
of theMoleculeComponent
to mol, sets proper atomIterators, and computes the bounding box.void
setVisible
(boolean v) Sets the component to be visible/invisible.void
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
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, cleanup, 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 Details
-
DRAW_TYPE_WIRE
protected static final int DRAW_TYPE_WIRE- See Also:
-
DRAW_TYPE_BALL
protected static final int DRAW_TYPE_BALL- See Also:
-
DRAW_TYPE_STICK
protected static final int DRAW_TYPE_STICK- See Also:
-
DRAW_TYPE_BALL_AND_WIRE
protected static final int DRAW_TYPE_BALL_AND_WIRE- See Also:
-
DRAW_TYPE_BALL_AND_STICK
protected static final int DRAW_TYPE_BALL_AND_STICK- See Also:
-
DRAW_TYPE_SPACEFILL
protected static final int DRAW_TYPE_SPACEFILL- See Also:
-
BOND_DRAW_TYPE_BOND
protected static final int BOND_DRAW_TYPE_BOND- See Also:
-
BOND_DRAW_TYPE_STICK
protected static final int BOND_DRAW_TYPE_STICK- See Also:
-
BOND_DRAW_TYPE_WIRE
protected static final int BOND_DRAW_TYPE_WIRE- See Also:
-
DEFAULT_BALL_RADIUS
protected static final double DEFAULT_BALL_RADIUS- See Also:
-
DEFAULT_BOND_RADIUS
protected static final double DEFAULT_BOND_RADIUS- See Also:
-
DEFAULT_STICK_RADIUS
protected static final double DEFAULT_STICK_RADIUS- See Also:
-
DEFAULT_LINE_WIDTH
protected static final double DEFAULT_LINE_WIDTH- See Also:
-
DEFAULT_BOND_DISTANCE
protected static final int DEFAULT_BOND_DISTANCE- See Also:
-
DEFAULT_BOND_WIDTH
protected static final int DEFAULT_BOND_WIDTH- See Also:
-
SMOOTH_STICKS
protected static final boolean SMOOTH_STICKS- See Also:
-
BOND_FACING
protected static final boolean BOND_FACING- See Also:
-
SCALED_BALLS
protected static final boolean SCALED_BALLS- See Also:
-
DISPLAY_BOND_ORDER
protected static final boolean DISPLAY_BOND_ORDER- See Also:
-
DEFAULT_H_BALL_PRECISION
protected static final int DEFAULT_H_BALL_PRECISION- See Also:
-
DEFAULT_H_SPACEFILL_PRECISION
protected static final int DEFAULT_H_SPACEFILL_PRECISION- See Also:
-
DEFAULT_H_JOINT_PRECISION
protected static final int DEFAULT_H_JOINT_PRECISION- See Also:
-
DEFAULT_H_BOND_SLICE_PRECISION
protected static final int DEFAULT_H_BOND_SLICE_PRECISION- See Also:
-
DEFAULT_H_STICK_SLICE_PRECISION
protected static final int DEFAULT_H_STICK_SLICE_PRECISION- See Also:
-
DEFAULT_M_BALL_PRECISION
protected static final int DEFAULT_M_BALL_PRECISION- See Also:
-
DEFAULT_M_SPACEFILL_PRECISION
protected static final int DEFAULT_M_SPACEFILL_PRECISION- See Also:
-
DEFAULT_M_JOINT_PRECISION
protected static final int DEFAULT_M_JOINT_PRECISION- See Also:
-
DEFAULT_M_BOND_SLICE_PRECISION
protected static final int DEFAULT_M_BOND_SLICE_PRECISION- See Also:
-
DEFAULT_M_STICK_SLICE_PRECISION
protected static final int DEFAULT_M_STICK_SLICE_PRECISION- See Also:
-
DEFAULT_L_BALL_PRECISION
protected static final int DEFAULT_L_BALL_PRECISION- See Also:
-
DEFAULT_L_SPACEFILL_PRECISION
protected static final int DEFAULT_L_SPACEFILL_PRECISION- See Also:
-
DEFAULT_L_JOINT_PRECISION
protected static final int DEFAULT_L_JOINT_PRECISION- See Also:
-
DEFAULT_L_BOND_SLICE_PRECISION
protected static final int DEFAULT_L_BOND_SLICE_PRECISION- See Also:
-
DEFAULT_L_STICK_SLICE_PRECISION
protected static final int DEFAULT_L_STICK_SLICE_PRECISION- See Also:
-
COMPONENT_TYPE_ATOM
protected static final int COMPONENT_TYPE_ATOM- See Also:
-
COMPONENT_TYPE_BOND
protected static final int COMPONENT_TYPE_BOND- See Also:
-
COMPONENT_TYPE_MOLECULE
protected static final int COMPONENT_TYPE_MOLECULE- See Also:
-
DEFAULT_COLOR
protected static final float[] DEFAULT_COLOR -
elementList
public static final int[] elementList -
LONE_PAIR_TYPE
public static final int LONE_PAIR_TYPE- See Also:
-
drawTypes
-
mol
-
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 float[] color
-
-
Constructor Details
-
MoleculeComponent
protected MoleculeComponent()Creates a new instance of MoleculeComponent. Molecule have to be set by #setMolecule() -
MoleculeComponent
Creates a new instance ofMoleculeComponent
from the given molecule. -
MoleculeComponent
public MoleculeComponent(chemaxon.struc.MacroMolecule.HeteroComponent hc, MacroMoleculeComponent mmc) Creates a new instance ofMoleculeComponent
from the givenHeteroComponent
andMacroMoleculeComponent
; this class can be used as a visualizer of a ligand.
-
-
Method Details
-
onRemoveGraphicComponent
public void onRemoveGraphicComponent()- Overrides:
onRemoveGraphicComponent
in classGraphicComponent
-
onRemove
public void onRemove()- Specified by:
onRemove
in interfaceMacroMoleculeComponent.MoleculeVisualizer
-
isGraphicComponent
public boolean isGraphicComponent()- Specified by:
isGraphicComponent
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
isGraphicComponent
in classGraphicComponent
-
getGraphicComponent
- Specified by:
getGraphicComponent
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
getGraphicComponent
in classGraphicComponent
-
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 inGraphicCell
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 interfacechemaxon.marvin.space.UsableObject
- Overrides:
getId
in classGraphicComponent
- Returns:
- id of the component
-
setMacroMoleculeComponent
AMacroMoleculeComponent
can be set and in this case this will be a visualizer of a ligand in the macromolecule. -
isMacromoleculePart
public boolean isMacromoleculePart()Tells whether thisMoleculeComponent
is a visualizer of a ligand in a complex or an independent small molecule. -
getMacroMoleculeComponent
Returns the macromolecule visualizer if thisMoleculeComponent
visualizes a ligand in a complex.- Specified by:
getMacroMoleculeComponent
in interfaceMacroMoleculeComponent.MoleculeVisualizer
-
setGL
public void setGL(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu) Sets drawing related variable.- Specified by:
setGL
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
setGL
in classGraphicComponent
- Parameters:
gl
- Interface to OpenGLglu
- Interface to OpenGL
-
getColor
Description copied from class:GraphicComponent
Returns the constant color of the component.- Specified by:
getColor
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Specified by:
getColor
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
getColor
in classGraphicComponent
-
getColorF
public float[] getColorF()- Specified by:
getColorF
in interfaceMacroMoleculeComponent.MoleculeVisualizer
-
setColor
Sets the constant color of the component.- Specified by:
setColor
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
setColor
in classGraphicComponent
-
setColor
public void setColor(float[] color) Sets the constant color of the component.- Overrides:
setColor
in classGraphicComponent
-
setColor
public void setColor(float r, float g, float b) Sets the constant color of the component.- Overrides:
setColor
in classGraphicComponent
-
getBoundingBox
Returns theBoundingBox
that is the smallest container box of the component. Either hydrogens are displayed or not they are always considered.- Specified by:
getBoundingBox
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
getBoundingBox
in classGraphicComponent
- Returns:
- BoundingBox
-
getMolecule
Returns theMolecule
of theMoleculeComponent
.- Specified by:
getMolecule
in interfaceMacroMoleculeComponent.MoleculeVisualizer
-
setMolecule
Sets theMolecule
of theMoleculeComponent
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. SeeMoleculeIterators.AtomIteratorInterface
for details.- Specified by:
getAtomIterator
in interfacechemaxon.struc.MoleculeIterators.MoleculeInterface
- Parameters:
enumerateHydrogens
- enable/disable enumeration of hydrogens
-
getAtomProperty
public chemaxon.struc.MoleculeIterators.AtomPropertyInterface getAtomProperty()SeeMoleculeIterators.AtomPropertyInterface
for details.- Specified by:
getAtomProperty
in interfacechemaxon.struc.MoleculeIterators.MoleculeInterface
-
getBondIterator
public chemaxon.struc.MoleculeIterators.BondIteratorInterface getBondIterator(boolean enumerateHydrogens) Returns the iterator of the atoms of the molecule. SeeMoleculeIterators.BondIteratorInterface
for details.- Specified by:
getBondIterator
in interfacechemaxon.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 interfacechemaxon.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 interfacechemaxon.struc.MoleculeIterators.MoleculeInterface
-
translate
public void translate(float[] v) Translates the molecule with the parameter as a vector.- Overrides:
translate
in classGraphicComponent
- 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 classGraphicComponent
- Parameters:
v
- measure of rotation around the 3 axescenter
- 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
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 classGraphicComponent
- 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 byMacroMoleculeComponent
, becauseGraphicComponents
would get GL2 from theGraphicCell
during initialization, butMacroMoleculeComponent
has to pass it to its visualizers.- Specified by:
initDraw
in interfaceMacroMoleculeComponent.MoleculeVisualizer
-
reCreate
public void reCreate()- Specified by:
reCreate
in interfaceMacroMoleculeComponent.MoleculeVisualizer
-
draw
public void draw()Called byGraphicCell
from the Jogl rendering thread and draws the molecule. SeeGraphicComponent.draw()
.- Specified by:
draw
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
draw
in classGraphicComponent
-
drawTransparentPart
public void drawTransparentPart()Draws the molecule if the drawing type was wire.- Specified by:
drawTransparentPart
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
drawTransparentPart
in classGraphicComponent
-
getComponentElement
Returns the previously picked but unprocessedComponentElement
or the whole component as aComponentElement
, if no picking happened.- Overrides:
getComponentElement
in classGraphicComponent
- Returns:
- picked part of the component
-
getCoordinates
Sets the coordinates of the given element in the given preallocated array.- Overrides:
getCoordinates
in classGraphicComponent
- Parameters:
element
- specific part of the componentc
- allocated array where coordinates will be put
-
getDescription
Returs the short description of the given part of the component.- Specified by:
getDescription
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
getDescription
in classGraphicComponent
- Parameters:
element
- specific part of the component- Returns:
- short description string
-
isLigand
public boolean isLigand() -
getLabelInformation
Labels will be created associated to this MoleculeComponent if the labeltype is "atom", "extraatomlabel" or "molecule".- Overrides:
getLabelInformation
in classGraphicComponent
- Parameters:
onlyOnHeavyAtoms
- label info needed only for heavy atoms.- Returns:
- array of ComponentElements to create labels to
-
getLabelInformation
- Specified by:
getLabelInformation
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
getLabelInformation
in classGraphicComponent
-
isSelectedAtom
public boolean isSelectedAtom(int atomIndex) Returns true if the atom with the given index is selected.- Specified by:
isSelectedAtom
in interfaceMacroMoleculeComponent.MoleculeVisualizer
-
getSelectedAtom
-
getAtomSelections
public boolean[] getAtomSelections() -
selectAtom
public void selectAtom(int i) Sets the atom with the given index to be selected.- Specified by:
selectAtom
in interfaceMacroMoleculeComponent.MoleculeVisualizer
-
unSelectAtom
public void unSelectAtom(int i) Sets the atom with the given index to be unselected.- Specified by:
unSelectAtom
in interfaceMacroMoleculeComponent.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 ofGraphicComponent
, because in case of visualizing a ligand of a macromolecule, theBoundingBox
should be refreshed.- Specified by:
setVisible
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Specified by:
setVisible
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
setVisible
in classGraphicComponent
- Parameters:
v
- of visibility
-
showFaded
public void showFaded()Faded atoms will be fully visible again.- Specified by:
showFaded
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
showFaded
in classGraphicComponent
-
hideSelected
public void hideSelected()The selected atoms will be hidden.- Specified by:
hideSelected
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
hideSelected
in classGraphicComponent
-
hideUnselected
public void hideUnselected()The unselected atoms will be hidden.- Specified by:
hideUnselected
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
hideUnselected
in classGraphicComponent
-
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 interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
fadeSelected
in classGraphicComponent
-
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 interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
fadeUnselected
in classGraphicComponent
-
isHighlighted
public boolean isHighlighted()This functionality is currently unavailable.- Specified by:
isHighlighted
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Returns:
- whether the component is highlighted
-
setHighlighted
public void setHighlighted(boolean v) This functionality is currently unavailable.- Specified by:
setHighlighted
in interfaceMacroMoleculeComponent.MoleculeVisualizer
-
isVisible
public boolean isVisible()Returns true if this component is allowed to be drawn.- Specified by:
isVisible
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Specified by:
isVisible
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
isVisible
in classGraphicComponent
- Returns:
- visibility of the component
-
isVisible
Returns true if the given item is visible.- Overrides:
isVisible
in classGraphicComponent
- 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 interfaceMacroMoleculeComponent.MoleculeVisualizer
- Parameters:
i
- atom index given byMoleculeIterators.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 interfaceMacroMoleculeComponent.MoleculeVisualizer
- Parameters:
i
- atom index given byMoleculeIterators.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 interfaceMacroMoleculeComponent.MoleculeVisualizer
- Returns:
- number of atoms except explicitly hidden atoms
-
hasTransparentPart
public boolean hasTransparentPart()Returns true if antialiased lines are drawn, that is inDRAW_TYPE_WIRE
orDRAW_TYPE_BALL_AND_WIRE
mode.- Specified by:
hasTransparentPart
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
hasTransparentPart
in classGraphicComponent
- Returns:
- will the component draw with transparency
-
select
public void select()Sets the whole component to be selected.- Specified by:
select
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Specified by:
select
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
select
in classGraphicComponent
-
unSelect
public void unSelect()Unselects the component, say sets all parts to be unselected.- Specified by:
unSelect
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Specified by:
unSelect
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
unSelect
in classGraphicComponent
-
selectComponentElementsInside
Atoms lying in the given box will be selected.- Specified by:
selectComponentElementsInside
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Overrides:
selectComponentElementsInside
in classGraphicComponent
- Parameters:
bb
- given box represented by aBoundingBox
-
isSelected
Returns true if the given item is selected.- Overrides:
isSelected
in classGraphicComponent
- 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 interfaceMacroMoleculeComponent.MoleculeVisualizer
- Specified by:
isSelected
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
isSelected
in classGraphicComponent
- Returns:
- selection state of the component
-
hasSelectedElements
public boolean hasSelectedElements()Returns true if the component has any selected part.- Overrides:
hasSelectedElements
in classGraphicComponent
- Returns:
- is any part of the component selected
-
selectedAtomCount
public int selectedAtomCount()Returns the number of atoms being selected.- Specified by:
selectedAtomCount
in interfaceMacroMoleculeComponent.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 classGraphicComponent
-
extendSelection
public void extendSelection()Sets the previously picked but unprocessed element to be selected, and leaves other parts as they are.- Overrides:
extendSelection
in classGraphicComponent
-
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 classGraphicComponent
-
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 classGraphicComponent
- Parameters:
mode
-GL_RENDER
orGL_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 interfaceMacroMoleculeComponent.MoleculeVisualizer
-
pickObject
protected void pickObject(int offset, double[] maxZ, float[] modelview) Description copied from class:GraphicComponent
SetsGraphicComponent.pickedItem
to be the picked part of the component.- Overrides:
pickObject
in classGraphicComponent
- 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 interfaceMacroMoleculeComponent.MoleculeVisualizer
- Returns:
- identifier of the color type
-
setDrawProperty
Sets adraw property
.
Accepts the PropertyName -- PropertyValue (Meaning) pairs below:- "DrawType", "Ligand.DrawType" -- "Wire", "Stick", "Ball", "BallAndStick", "StickAndBall", "BallAndWire", "WireAndBall", "Spacefill"
- "Quality", "Ligand.Quality" -- "High", "Medium", "Low"
- "ColorType", "Ligand.ColorType" -- "Constant", "CPK"
- "Ligand.Hydrogens" -- Boolean value as
String
- "Ligand.BallRadius" -- Double value as
String
(Radius of displayed balls in angstroms) - "Ligand.BondRadius" -- Double value as
String
(Radius of bond cylinders in ball&stick mode in angstroms) - "Ligand.StickRadius" -- Double value as
String
(Radius of bond cylinders in stick mode in angstroms) - "Ligand.LineWidth" -- Double value as
String
(Width of displayed lines in wire mode in pixels) - "Ligand.BondDistance" -- Integer value as
String
(Gap between two lines/sticks representing a double bond. It is determined as a percentage of Bond radius.) - "Ligand.BondWidth" -- Integer value as
String
(Thickness of line/stick representing a double bond. It is expressed relative to the thcikness of a single bond.) - "Ligand.SmoothStickStyle" -- Boolean value as
String
(Smooth, shaded display of two colored bonds) - "Ligand.ScaledBalls" -- Boolean value as
String
(Are balls scaled according to vdW radius or have uniform size in ball mode or not) - "Ligand.DisplayBondOrder" -- Boolean value as
String
(Double, aromatic bonds are displayed or not) - "Ligand.Color" -- java.awt.Color value as
String
- "CarbonColorStyle" -- Integer value as
String
(Carbon color is 0: lightgray, 1: darkgray, 2: green, 3:cyan)
- Specified by:
setDrawProperty
in interfaceMacroMoleculeComponent.MoleculeVisualizer
- Specified by:
setDrawProperty
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
setDrawProperty
in classGraphicComponent
- Parameters:
propertyName
- identifier of the draw propertypropertyValue
- value of the draw property as aString
-