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

      protected static 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 float[] color
  • Constructor Details

    • 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 Details

    • 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(com.jogamp.opengl.GL2 gl, com.jogamp.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 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
    • getColorF

      public float[] getColorF()
      Specified by:
      getColorF in interface MacroMoleculeComponent.MoleculeVisualizer
    • setColor

      public void setColor(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[] color)
      Sets the constant color of the component.
      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.
      Specified by:
      getMolecule in interface MacroMoleculeComponent.MoleculeVisualizer
    • 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(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 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(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:
      onlyOnHeavyAtoms - label info needed only for heavy atoms.
      Returns:
      array of ComponentElements to create labels to
    • getLabelInformation

      public ComponentElement[] getLabelInformation(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(String propertyName, String propertyValue)
      Sets a draw 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 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