chemaxon.marvin.space
Class MacroMoleculeComponent

java.lang.Object
  extended by chemaxon.marvin.space.GraphicComponent
      extended by chemaxon.marvin.space.MacroMoleculeComponent
All Implemented Interfaces:
chemaxon.marvin.space.UsableObject

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
Version:
MarvinSpace 1.0
Author:
Judit Papp

Nested Class Summary
static interface MacroMoleculeComponent.MoleculeVisualizer
           
 
Field Summary
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
protected MacroMoleculeComponent()
          Creates a new instance of MacroMoleculeComponent
  MacroMoleculeComponent(chemaxon.struc.MacroMolecule mol)
          Creates a new instance of MacroMoleculeComponent
 
Method Summary
 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 a ComponentElement.
 java.util.Iterator<MacroMoleculeComponent.MoleculeVisualizer> getComponentIterator()
          Returns the Iterator of its visualizers.
 java.util.ArrayList<MacroMoleculeComponent.MoleculeVisualizer> getComponents()
          Returns its visualizers.
 void getCoordinates(ComponentElement element, float[] c)
          Sets the coordinates of the given ComponentElement in the given array.
 java.lang.String getDescription(ComponentElement element)
          Returns the short description of the given element.
 ComponentElement[] getLabelInformation(java.lang.String labelType)
          Collects the label information of the visualizers.
 chemaxon.struc.MacroMolecule getMacroMolecule()
          Returns the MacroMolecule this component visualizes.
 Molecule getMolecule()
          Returns the Molecule representation of the MacroMolecule.
 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(java.lang.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 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(java.lang.String propertyName, java.lang.String propertyValue)
          Sets a draw property.
 void setDrawProperty(java.lang.String propertyName, java.lang.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, 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, setDrawProperties, setMotionMode, setName, setRenderingQuality, setRotateMatrix, storeDrawProperty, toString, unSelect
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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
Constructor Detail

MacroMoleculeComponent

protected MacroMoleculeComponent()
Creates a new instance of MacroMoleculeComponent


MacroMoleculeComponent

public MacroMoleculeComponent(chemaxon.struc.MacroMolecule mol)
Creates a new instance of MacroMoleculeComponent

Method Detail

onRemoveGraphicComponent

public void onRemoveGraphicComponent()
Overrides:
onRemoveGraphicComponent in class GraphicComponent

setProgressBar

public void setProgressBar(chemaxon.marvin.space.ProgressBarInterface progressBar)
Overrides:
setProgressBar in class GraphicComponent

getMolecule

public Molecule getMolecule()
Returns the Molecule representation of the MacroMolecule. 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 the MacroMolecule this component visualizes. It stores the information about chains, ligands, water, ions, etc. To get it in simple Molecule representation see {#getMolecule()}.

Returns:
the macromolecule

draw

public void draw()
Draws the MacroMolecule as letting its visualizers draw its parts.

Overrides:
draw in class GraphicComponent

has2DPart

public boolean has2DPart()
Returns true if any of its visualizers have 2D part.

Overrides:
has2DPart in class GraphicComponent
Returns:
will the component draw in plane

draw2DPart

public void draw2DPart()
Draws the 2D parts of its visualizers.

Overrides:
draw2DPart in class GraphicComponent

hasTransparentPart

public boolean hasTransparentPart()
Returns true if any of its visualizers have transparent part.

Overrides:
hasTransparentPart in class GraphicComponent
Returns:
will the component draw with transparency

drawTransparentPart

public void drawTransparentPart()
Draws the transparent parts of its visualizers.

Overrides:
drawTransparentPart in class GraphicComponent

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 java.util.Iterator<MacroMoleculeComponent.MoleculeVisualizer> getComponentIterator()
Returns the Iterator of its visualizers.


getComponents

public java.util.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 class GraphicComponent
Parameters:
gl - Interface to OpenGL
glu - Interface to OpenGL

drawSelection

protected void drawSelection(int mode)
Draws the component in the given mode (usually in selection mode).

Overrides:
drawSelection in class GraphicComponent
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 class GraphicComponent
Parameters:
element - specific part of the component
c - 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 class GraphicComponent
Returns:
picked part of the component

getComponentElement

public ComponentElement getComponentElement(MacroMoleculeComponent.MoleculeVisualizer mv)
Returns the visualizer as a ComponentElement. 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 type ComponentElement

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 class GraphicComponent
Parameters:
id - identifier of the component or a part of the component
Returns:
the component or the specific part of the component

getDescription

public java.lang.String getDescription(ComponentElement element)
Returns the short description of the given element.

Overrides:
getDescription in class GraphicComponent
Parameters:
element - specific part of the component
Returns:
short description as String

getLabelInformation

public ComponentElement[] getLabelInformation(java.lang.String labelType)
Collects the label information of the visualizers.

Overrides:
getLabelInformation in class GraphicComponent
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 interface chemaxon.marvin.space.UsableObject
Overrides:
isVisible in class GraphicComponent
Returns:
visibility of the component

isVisible

public boolean isVisible(ComponentElement element)
Returns true if the gien ComponentElement is visible.

Overrides:
isVisible in class GraphicComponent
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 interface chemaxon.marvin.space.UsableObject
Overrides:
setVisible in class GraphicComponent
Parameters:
state - of visibility

showFaded

public void showFaded()
The faded visualizers will be fully visible again.

Overrides:
showFaded in class GraphicComponent

hideSelected

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

Overrides:
hideSelected in class GraphicComponent

hideUnselected

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

Overrides:
hideUnselected in class GraphicComponent

fadeSelected

public void fadeSelected()
The selected visualizers will be hidden.

Overrides:
fadeSelected in class GraphicComponent

fadeUnselected

public void fadeUnselected()
The unselected visualizers will be hidden.

Overrides:
fadeUnselected in class GraphicComponent

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 previously picked but unprocessed element to be selected if it was not set and vice versa.

Overrides:
invertSelection in class GraphicComponent

select

public void select()
Sets all visualizers to be selected. See also unSelect().

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

unSelect

public void unSelect()
Sets all parts of all visualizers not to be selected.

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

selectComponentElementsInside

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

Overrides:
selectComponentElementsInside in class GraphicComponent
Parameters:
bb - given box represented by a BoundingBox

hasSelectedElements

public boolean hasSelectedElements()
Returns true if any of its visualizers have any selected part.

Overrides:
hasSelectedElements in class GraphicComponent
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 class GraphicComponent
Parameters:
hits - Number of hits at the previous hit.
Returns:
z coordinate of the nearest picked object

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 controlled if any of its visualizers is allowed.

Overrides:
isControllable in class GraphicComponent
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 class GraphicComponent
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 class GraphicComponent
Parameters:
vector - Measurement of the rotation around the 3 axis, x, y, z.
center - Center of the rotation.

setDrawProperty

public void setDrawProperty(java.lang.String propertyName,
                            java.lang.String propertyValue)
Sets a draw property.
Gives all proper draw properties to its visualizers.
Accepts the properties below:

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

setDrawProperty

public void setDrawProperty(java.lang.String propertyName,
                            java.lang.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