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

      • 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
      • 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
      • 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
      • 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
      • 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 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
      • 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
      • 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
      • 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​(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​(String propertyName,
                                    String propertyValue)
        Sets a draw 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 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​(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