Package chemaxon.marvin.space
Class MacroMoleculeComponent
- java.lang.Object
-
- chemaxon.marvin.space.GraphicComponent
-
- chemaxon.marvin.space.MacroMoleculeComponent
-
- All Implemented Interfaces:
chemaxon.marvin.space.UsableObject
@PublicAPI public class MacroMoleculeComponent extends GraphicComponent
MacroMoleculeComponent is a visualizer of complex structures. It can individually display and handle protein chains, ligands, water and ions.- Since:
- Marvin 4.0.2
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MacroMoleculeComponent.MoleculeVisualizer
-
Field Summary
Fields Modifier and Type Field Description static int
B_FACTOR_MODE
protected static int
COMPONENT_TYPE_ATOM
protected static int
COMPONENT_TYPE_BOND
protected static int
COMPONENT_TYPE_MOLECULE
protected static int
COMPONENT_TYPE_RESIDUE
protected boolean
initialised
static int
RAINBOW_MODE
-
Fields inherited from class chemaxon.marvin.space.GraphicComponent
active, associatedComponents, boundingBox, color, COMPONENT_TYPE_ENTIRE, drawProperties, drawType, 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
Constructors Modifier Constructor Description protected
MacroMoleculeComponent()
Creates a new instance of MacroMoleculeComponentMacroMoleculeComponent(chemaxon.struc.MacroMolecule mol)
Creates a new instance of MacroMoleculeComponent
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
draw()
Draws the MacroMolecule as letting its visualizers draw its parts.void
draw2DPart()
Draws the 2D parts of its visualizers.protected void
drawSelection(int mode)
Draws the component in the given mode (usually in selection mode).void
drawTransparentPart()
Draws the transparent parts of its visualizers.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 visualizers will be hidden.void
fadeUnselected()
The unselected visualizers will be hidden.chemaxon.marvin.space.util.Palette
getBFactorPalette()
Returns the palette that is used when the coloring mode of the component is b-factor coloring.MacroMoleculeComponent.MoleculeVisualizer
getComponent(int cIdx)
Returns its visualizer with the given index.ComponentElement
getComponentElement()
Returns the previously picked but unprocessed ComponentElement or the whole component as a ComponentElement, if no picking happened.ComponentElement
getComponentElement(MacroMoleculeComponent.MoleculeVisualizer mv)
Returns the visualizer as aComponentElement
.Iterator<MacroMoleculeComponent.MoleculeVisualizer>
getComponentIterator()
Returns the Iterator of its visualizers.ArrayList<MacroMoleculeComponent.MoleculeVisualizer>
getComponents()
Returns its visualizers.void
getCoordinates(ComponentElement element, float[] c)
Sets the coordinates of the given ComponentElement in the given array.String
getDescription(ComponentElement element)
Returns the short description of the given element.ComponentElement[]
getLabelInformation(String labelType)
Collects the label information of the visualizers.chemaxon.struc.MacroMolecule
getMacroMolecule()
Returns theMacroMolecule
this component visualizes.Molecule
getMolecule()
Returns theMolecule
representation of theMacroMolecule
.chemaxon.marvin.space.util.Palette
getRainbowPalette()
Returns the color palette that is used when the coloring mode of the component is rainbow coloring.chemaxon.marvin.space.UsableObject
getUsableObject(chemaxon.marvin.space.UOID id)
Returns the component that the given UOID identifies.chemaxon.marvin.space.UOID
getUsableObjectId(MacroMoleculeComponent.MoleculeVisualizer mv)
boolean
has2DPart()
Returns true if any of its visualizers have 2D part.boolean
hasSelectedElements()
Returns true if any of its visualizers have any selected part.boolean
hasTransparentPart()
Returns true if any of its visualizers have transparent part.void
hideSelected()
The selected visualizers will be hidden.void
hideUnselected()
The unselected visualizers will be hidden.void
invertSelection()
Sets the previously picked but unprocessed element to be selected if it was not set and vice versa.boolean
isControllable(String type)
Returns whether controling by the given type of controller is allowed to the component.boolean
isVisible()
Returns true if any of its visualizers is visible.boolean
isVisible(ComponentElement element)
Returns true if the gien ComponentElement is visible.void
onRemoveGraphicComponent()
void
removeGraphicComponent(MacroMoleculeComponent.MoleculeVisualizer mv)
void
rotate(float[] vector, float[] center)
Rotates its selected ligand by changing its coordinates, and not just the view.void
select()
Sets all visualizers to be selected.void
selectComponentElementsInside(BoundingBox bb)
Visualizers lying in the given box will be selected.void
setDrawProperty(String propertyName, String propertyValue)
Sets adraw property
.void
setDrawProperty(String propertyName, String propertyValue, MacroMoleculeComponent.MoleculeVisualizer mmv)
Sets the given draw property to the given visualizer.void
setGL(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu)
Sets GL2 in all of its visualizers.void
setProgressBar(chemaxon.marvin.space.ProgressBarInterface progressBar)
void
setVisible(boolean state)
Sets all of the visualizers to visible/invisible.void
showFaded()
The faded visualizers will be fully visible again.protected double
touchObject(int hits)
Returns the z coordinate of the component being nearest to the viewing point.void
translate(float[] vector)
Translates its selected ligand by changing its coordinates, and not just the view.void
unSelect()
Sets all parts of all visualizers not to be selected.-
Methods inherited from class chemaxon.marvin.space.GraphicComponent
addDrawProperties, associate, cleanup, drawBoundingBox, drawCoordinateAxes, exclusiveSelection, extendSelection, getAssociatedComponents, getBoundingBox, getBoundingSphereRadius, getCell, getColor, getCoordinates, getDescription, getDrawProperties, getDrawProperty, getGraphicComponent, getId, getLabelInformation, getName, getRenderingQuality, getZCoordinateTo2DPart, glColor, invertSelection, isGraphicComponent, isSelected, isSelected, locateObject, notifyCoordinateChange, notifyInvisibility, notifySelection, notifyUnSelection, notifyVisibility, pickObject, projectVector, receiveNotificationOnCoordinateChange, receiveNotificationOnInvisibility, receiveNotificationOnSelection, receiveNotificationOnUnSelection, receiveNotificationOnVisibility, removeAssociation, resize, rotate, rotate, select, setColor, setColor, setColor, setColor, setDrawProperties, setMotionMode, setName, setRenderingQuality, setRotateMatrix, storeDrawProperty, toString, unSelect
-
-
-
-
Field Detail
-
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
-
COMPONENT_TYPE_RESIDUE
protected static final int COMPONENT_TYPE_RESIDUE
- See Also:
- Constant Field Values
-
initialised
protected boolean initialised
-
RAINBOW_MODE
public static final int RAINBOW_MODE
- See Also:
- Constant Field Values
-
B_FACTOR_MODE
public static final int B_FACTOR_MODE
- See Also:
- Constant Field Values
-
-
Method Detail
-
removeGraphicComponent
public void removeGraphicComponent(MacroMoleculeComponent.MoleculeVisualizer mv)
-
onRemoveGraphicComponent
public void onRemoveGraphicComponent()
- Overrides:
onRemoveGraphicComponent
in classGraphicComponent
-
setProgressBar
public void setProgressBar(chemaxon.marvin.space.ProgressBarInterface progressBar)
- Overrides:
setProgressBar
in classGraphicComponent
-
getMolecule
public Molecule getMolecule()
Returns theMolecule
representation of theMacroMolecule
. For example it can be necessary at copying molecules. Note that information about molecule parts such as chains, ligands, water, ions, etc will be lost. To have a more complex representation see {#getMacroMolecule()}.- Returns:
Molecule
-
getMacroMolecule
public chemaxon.struc.MacroMolecule getMacroMolecule()
Returns theMacroMolecule
this component visualizes. It stores the information about chains, ligands, water, ions, etc. To get it in simpleMolecule
representation see {#getMolecule()}.- Returns:
- the macromolecule
-
draw
public void draw()
Draws the MacroMolecule as letting its visualizers draw its parts.- Overrides:
draw
in classGraphicComponent
-
has2DPart
public boolean has2DPart()
Returns true if any of its visualizers have 2D part.- Overrides:
has2DPart
in classGraphicComponent
- Returns:
- will the component draw in plane
-
draw2DPart
public void draw2DPart()
Draws the 2D parts of its visualizers.- Overrides:
draw2DPart
in classGraphicComponent
-
hasTransparentPart
public boolean hasTransparentPart()
Returns true if any of its visualizers have transparent part.- Overrides:
hasTransparentPart
in classGraphicComponent
- Returns:
- will the component draw with transparency
-
drawTransparentPart
public void drawTransparentPart()
Draws the transparent parts of its visualizers.- Overrides:
drawTransparentPart
in classGraphicComponent
-
getRainbowPalette
public chemaxon.marvin.space.util.Palette getRainbowPalette()
Returns the color palette that is used when the coloring mode of the component is rainbow coloring. Note that this palette is configured to this macromolecule, because colors are get from atom indices.- Returns:
Palette
with properly set colors, minimum and maximum values
-
getBFactorPalette
public chemaxon.marvin.space.util.Palette getBFactorPalette()
Returns the palette that is used when the coloring mode of the component is b-factor coloring.- Returns:
Palette
with properly set colors, minimum and maximum values
-
getComponentIterator
public Iterator<MacroMoleculeComponent.MoleculeVisualizer> getComponentIterator()
Returns the Iterator of its visualizers.
-
getComponents
public ArrayList<MacroMoleculeComponent.MoleculeVisualizer> getComponents()
Returns its visualizers.
-
getComponent
public MacroMoleculeComponent.MoleculeVisualizer getComponent(int cIdx)
Returns its visualizer with the given index.
-
setGL
public void setGL(javax.media.opengl.GL2 gl, javax.media.opengl.glu.GLU glu)
Sets GL2 in all of its visualizers.- Overrides:
setGL
in classGraphicComponent
- Parameters:
gl
- Interface to OpenGLglu
- Interface to OpenGL
-
drawSelection
protected void drawSelection(int mode)
Draws the component in the given mode (usually in selection mode).- Overrides:
drawSelection
in classGraphicComponent
- Parameters:
mode
- GL_RENDER or GL_SELECT
-
getCoordinates
public void getCoordinates(ComponentElement element, float[] c)
Sets the coordinates of the given ComponentElement in the given array.- Overrides:
getCoordinates
in classGraphicComponent
- Parameters:
element
- specific part of the componentc
- allocated array where coordinates will be put
-
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 classGraphicComponent
- Returns:
- picked part of the component
-
getComponentElement
public ComponentElement getComponentElement(MacroMoleculeComponent.MoleculeVisualizer mv)
Returns the visualizer as aComponentElement
. This is useful for the visualizers themselves thence they can figure out their index inside the macromolecule.- Parameters:
mv
- visualizer of the macromolecule- Returns:
- the visualizer as a
COMPONENT_TYPE_MOLECULE
typeComponentElement
-
getUsableObjectId
public chemaxon.marvin.space.UOID getUsableObjectId(MacroMoleculeComponent.MoleculeVisualizer mv)
-
getUsableObject
public chemaxon.marvin.space.UsableObject getUsableObject(chemaxon.marvin.space.UOID id)
Description copied from class:GraphicComponent
Returns the component that the given UOID identifies.- Overrides:
getUsableObject
in classGraphicComponent
- Parameters:
id
- identifier of the component or a part of the component- Returns:
- the component or the specific part of the component
-
getDescription
public String getDescription(ComponentElement element)
Returns the short description of the given element.- Overrides:
getDescription
in classGraphicComponent
- Parameters:
element
- specific part of the component- Returns:
- short description as
String
-
getLabelInformation
public ComponentElement[] getLabelInformation(String labelType)
Collects the label information of the visualizers.- Overrides:
getLabelInformation
in classGraphicComponent
- Parameters:
labelType
-- Returns:
- all label information merged into one array
-
isVisible
public boolean isVisible()
Returns true if any of its visualizers is visible.- Specified by:
isVisible
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
isVisible
in classGraphicComponent
- Returns:
- visibility of the component
-
isVisible
public boolean isVisible(ComponentElement element)
Returns true if the gien ComponentElement is visible.- Overrides:
isVisible
in classGraphicComponent
- Parameters:
element
- part of the component- Returns:
- visibility of the part of the component
-
setVisible
public void setVisible(boolean state)
Sets all of the visualizers to visible/invisible.- Specified by:
setVisible
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
setVisible
in classGraphicComponent
- Parameters:
state
- of visibility
-
showFaded
public void showFaded()
The faded visualizers will be fully visible again.- Overrides:
showFaded
in classGraphicComponent
-
hideSelected
public void hideSelected()
The selected visualizers will be hidden.- Overrides:
hideSelected
in classGraphicComponent
-
hideUnselected
public void hideUnselected()
The unselected visualizers will be hidden.- Overrides:
hideUnselected
in classGraphicComponent
-
fadeSelected
public void fadeSelected()
The selected visualizers will be hidden.- Overrides:
fadeSelected
in classGraphicComponent
-
fadeUnselected
public void fadeUnselected()
The unselected visualizers will be hidden.- Overrides:
fadeUnselected
in classGraphicComponent
-
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 previously picked but unprocessed element to be selected if it was not set and vice versa.- Overrides:
invertSelection
in classGraphicComponent
-
select
public void select()
Sets all visualizers to be selected. See alsounSelect()
.- Specified by:
select
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
select
in classGraphicComponent
-
unSelect
public void unSelect()
Sets all parts of all visualizers not to be selected.- Specified by:
unSelect
in interfacechemaxon.marvin.space.UsableObject
- Overrides:
unSelect
in classGraphicComponent
-
selectComponentElementsInside
public void selectComponentElementsInside(BoundingBox bb)
Visualizers lying in the given box will be selected.- Overrides:
selectComponentElementsInside
in classGraphicComponent
- Parameters:
bb
- given box represented by aBoundingBox
-
hasSelectedElements
public boolean hasSelectedElements()
Returns true if any of its visualizers have any selected part.- Overrides:
hasSelectedElements
in classGraphicComponent
- Returns:
- is any part of the component selected
-
touchObject
protected double touchObject(int hits)
Returns the z coordinate of the component being nearest to the viewing point. This equals with the maximum z coordinate, because we are looking down the negative z axis.- Overrides:
touchObject
in classGraphicComponent
- Parameters:
hits
- Number of hits at the previous hit.- Returns:
- z coordinate of the nearest picked object
-
isControllable
public boolean isControllable(String type)
Returns whether controling by the given type of controller is allowed to the component. This component is allowed to be controlled if any of its visualizers is allowed.- Overrides:
isControllable
in classGraphicComponent
- Parameters:
type
- "Shift", "Rotate", "Resize"- Returns:
- is the component aloowed to be controlled or not
-
translate
public void translate(float[] vector)
Translates its selected ligand by changing its coordinates, and not just the view.- Overrides:
translate
in classGraphicComponent
- Parameters:
vector
- The translation vector.
-
rotate
public void rotate(float[] vector, float[] center)
Rotates its selected ligand by changing its coordinates, and not just the view.- Overrides:
rotate
in classGraphicComponent
- Parameters:
vector
- Measurement of the rotation around the 3 axis, x, y, z.center
- Center of the rotation.
-
setDrawProperty
public void setDrawProperty(String propertyName, String propertyValue)
Sets adraw property
.
Gives all proper draw properties to its visualizers.
Accepts the properties below:- "DrawType" -- "Wire", "Stick", "Ball", "BallAndStick", "StickAndBall", "BallAndWire", "WireAndBall", "Spacefill"
- "ColorType" -- "Constant", "CPK"
- "Quality" -- "High", "Medium", "Low"
- Hierarchical properties e.g. "Ligand.DrawType", "Water.Quality"
- "Ligand.*"
- "MacroMolecule.*"
- "Water.*"
- "Ion.*"
- 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
-
setDrawProperty
public void setDrawProperty(String propertyName, String propertyValue, MacroMoleculeComponent.MoleculeVisualizer mmv)
Sets the given draw property to the given visualizer.- Parameters:
propertyName
- Name of the property to pass.propertyValue
- Value of the property to pass.mmv
- Visualizer of a certain part of the MacroMolecule
-
-