Class GraphicComponent

java.lang.Object
chemaxon.marvin.space.GraphicComponent
All Implemented Interfaces:
chemaxon.marvin.space.UsableObject
Direct Known Subclasses:
MacroMoleculeComponent, MolecularSurfaceComponent, MoleculeComponent, Monitor, PharmacophoreArrow, PharmacophorePoint, SurfaceComponent

@PublicAPI public abstract class GraphicComponent extends Object implements chemaxon.marvin.space.UsableObject
GraphicComponents are the basic objects what MarvinSpace can visualize and handle. A component is displayed in a GraphicCell, its view is transformed by the cell.

Important concepts related to GraphicComponents:

  • selection
    Each component can either be in selected or in unselected state. By the selection of components various settings can be restricted, for example changing of color can be restricted to specific components. Components can also be shown/hidden/deleted separately by the use of selection.
  • draw property
    Each component receives every properties set in GraphicScene, and must handle those that are releated to itself. For example if draw quality (one of the draw properties) is changed by the user to High, every component in the scene receives a "Quality" "H" property pair. Each component can ignore it or change its visualization settings appropriately, e.g. increasing the number of triangles displayed.
  • bounding box
    Setting the camera position and locating components is easier if the bounding box of components is defined, see BoundingBox.
  • associated components
    Association provides a strong dependency relationship between components. If a component depends on an other, e.g. a molecular surface depends on the related molecule, they can be associated with each other. This relationship can be used arbitrarily, but there is a predefined behaviour. When a component is deleted, every dependant components will also be deleted. When a component is selected/unselected, shown/hidden or its coordinates change it will notify every associated components about this action.
  • picking
    Picking refers to the selection of a component or a part of a component with the mouse. The GraphicComponent class provides basic mechanisms for its derived classes to implement picking. By default, a GraphicComponent can indicate whether it was picked or not.
Since:
Marvin 4.0.2
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Is this component selected or not.
    protected ArrayList
    Strores components that depend on this component.
    protected BoundingBox
    The smallest box containing the graphic component.
    protected float[]
     
    protected static final int
    Indicates if the entire component is selected by picking.
    protected Properties
    Common drawing related properties that affect all three quality modes.
    protected int
    The actual drawing type of the component.
    protected com.jogamp.opengl.GL2
    must be accessible in derived classes
    protected com.jogamp.opengl.glu.GLU
     
    protected GraphicCell
    which cell of the scene is this component displayed in
    protected int
    Inverse of the Rotation matrix represented by a GeomCalc matrix.
    protected boolean
    Tells whether this component modifies the transformation center of the cell or not.
    protected int
    Indicates if the component is in standing or in moving mode.
    protected int
    Mouse position in picking mode.
    protected int
    Mouse position in picking mode.
    protected String
     
    Identifies the most recently selected element
    static final int
    Highest though slowest drawing quality indicator.
    static final int
    Lowest but fastest drawing quality indicator.
    static final int
    Medium drawing quality indicator.
    protected int
    The actual rendering quality.
    protected int
    Rotation matrix as a GeomCalc matrix.
    protected chemaxon.marvin.space.UOID
    internal index of the component
    protected boolean
    Indicates if component is visible or hidden.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates an empty object.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addDrawProperties(Properties drawProperties)
    Forces the component to set all drawing property stored in drawProperties, and leaves the old settings which are not overidden.
    void
    The given component will depend on this component.
    void
     
    void
    Draws the coordinate system of the component.
    void
    A component which draws (partly) in plane should overwrite this method.
    protected void
    Vizualises the bounding box.
    protected void
    Draws the local coordinate axes, the origin is the transformation center
    protected void
    drawSelection(int mode)
    Draws the component in the given mode (usually in selection mode), the rendering mode is for checking.
    void
    A component having transparent parts should override this method, drawing the transparent parts here.
    void
    Sets the previously picked but unprocessed element to be selected, and sets every other parts not to be selected.
    void
    Sets the the given part of the component 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
    Sets the the given part of the component to be selected, and leaves other parts as they are.
    void
    A descendant should overwrite this method to have its selection became faded.
    void
    A descendant should overwrite this method to have all but its selection became faded.
    Returns an Iterator that can enumerate the components associated to (depending on) this component.
    Returns the smallest box containing the graphic component.
    double
    Returns the radius of the bounding sphere of the component.
    Returns the container cell of the component.
    Returns the constant color of the component.
    Returns the previously picked but unprocessed ComponentElement or the whole component as a ComponentElement, if no picking happened.
    void
    getCoordinates(float[] c)
    Gets the coordinates of the previously picked but not yet processed part if there is any in the given preallocated array.
    void
    getCoordinates(ComponentElement element, float[] c)
    Gets the coordinates of the given ComponentElement in the given preallocated array.
    Returs the short description of the component or of the previously picked but not yet processed part if there is any or the description of the whole component.
    Returs the short description of the given part of the component.
    Returns the set draw properties of the component.
    getDrawProperty(String propertyName)
    Returns the value of a draw property.
     
    chemaxon.marvin.space.UOID
    Returns the id of the component.
     
    getLabelInformation(String labeltype, boolean onlyOnHeavyAtoms)
    Labels will be created associated to this GraphicComponent if the component supports the given labeltype, and returns arbitrary numbers of ComponentElements with correct coordinates and description to create a label.
    Returns the name of the component.
    int
    Returns the actual rendering quality of the component.
    chemaxon.marvin.space.UsableObject
    getUsableObject(chemaxon.marvin.space.UOID id)
    Returns the component that the given UOID identifies.
    float
    Returns a third, z coordinate in order to display 2D parts in proper order.
    protected void
    Sets the default/constant color of the component for drawing.
    boolean
    Returns true, if the component resets the projection matrix in its draw method, so that the component is drawn in plane.
    boolean
    Tells whether the component has some selected parts.
    boolean
    Returns true if a component has transparent part to draw.
    void
    If the component is selected it will become hidden.
    void
    If the component is unselected it will become hidden.
    void
    Sets the previously picked but unprocessed element to be selected if it was not set and vice versa.
    void
    Sets the the given part of the component to be selected if it was not set and vice versa.
    boolean
    A component must return true if it allows itself to be controlled by the given type controller.
    boolean
     
    boolean
    Tells whether the component is being selected or not.
    boolean
    Tells whether a part of the component is selected.
    boolean
    Returns true if this component is allowed to be drawn.
    boolean
    Returns true if the specified part of the component is allowed to be drawn.
    double
    locateObject(int x, int y)
    Picking action at x, y coordinates, returns the z coordinate of the nearest picked item, or -1.
    void
    Notifies the associated components of changing coodinates.
    void
    Notifies the associated components of being invisible.
    void
    Notifies the associated components of being selected.
    void
    Notifies the associated components of being unselected.
    void
    Notifies the associated components of being visible.
    void
     
    protected void
    pickObject(int offset, double[] maxZ, float[] modelview)
    Sets pickedItem to be the picked part of the component.
    void
    projectVector(float[] vector3)
    Projects a vector from the scene to the viewport.
    void
    Notifies the current object that the coordinates of the given component have been changed.
    void
    Notifies the current object that the given component is not visible.
    void
    Notifies the current object that the given component became selected.
    void
    Notifies the current object that the given component became unselected.
    void
    Notifies the current object that the given component became visible.
    void
    Removes the dependency of the given component from this component.
    void
    resize(double x, double y, double z)
    Resizes the component according to the given factors in each directions.
    void
    rotate(float[] v, float[] center)
    Rotates the component by changing its coordinates, and not just the view.
    void
    rotate(float[] p, float[] v, float[] center)
    Rotates the given p point by changing its coordinates.
    void
    rotate(int p, float[] v, float[] center)
    Rotates the given p point by changing its coordinates.
    void
    Sets the component to be selected.
    void
    Sets the specific part of the component to be selected.
    void
    The component will be selected if it is inside the given box.
    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
    setColor(int r, int g, int b)
    Sets the constant color of the component.
    void
    setColor(Color color)
    Sets the constant color of the component.
    void
    setDrawProperties(Properties drawProperties)
    Forces the component to set all drawing property stored in drawProperties, and loose every old setting.
    void
    setDrawProperty(String propertyName, String propertyValue)
    This is the gate of draw properties from outside to the component.
    void
    setGL(com.jogamp.opengl.GL2 gl, com.jogamp.opengl.glu.GLU glu)
    Sets the GL2 rendering environment.
    void
    setMotionMode(int mode)
    Sets the motion state of the component.
    void
    Sets the name of the component.
    void
    setProgressBar(chemaxon.marvin.space.ProgressBarInterface progressBar)
     
    void
    setRenderingQuality(int quality)
    Sets the rendering quality.
    void
    setRotateMatrix(float[] rotateMatrix)
    Sets the rotation matrix in order to get the proper mapping of a vector to the viewing plane.
    void
    setVisible(boolean state)
    Indicates whether the component will appear on the graphic scene at the next draw or not.
    void
    A descendant should overwrite this method to have its faded part become visible.
    protected void
    storeDrawProperty(String propertyName, String propertyValue)
    Stores the given property.
     
    protected double
    touchObject(int hits)
    Returns the z coordinate of the nearest component.
    void
    translate(float[] v)
    Translates the component by changing its coordinates, and not just the view.
    void
    Sets the component not to be selected.
    void
    Sets the specific part of the component not to be selected.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • RENDERING_QUALITY_LOW

      public static final int RENDERING_QUALITY_LOW
      Lowest but fastest drawing quality indicator.
      See Also:
    • RENDERING_QUALITY_MEDIUM

      public static final int RENDERING_QUALITY_MEDIUM
      Medium drawing quality indicator.
      See Also:
    • RENDERING_QUALITY_HIGH

      public static final int RENDERING_QUALITY_HIGH
      Highest though slowest drawing quality indicator.
      See Also:
    • COMPONENT_TYPE_ENTIRE

      protected static final int COMPONENT_TYPE_ENTIRE
      Indicates if the entire component is selected by picking. Required by subclasses which implement custom picking/selection procedures.
      See Also:
    • graphicCell

      protected GraphicCell graphicCell
      which cell of the scene is this component displayed in
    • uoid

      protected chemaxon.marvin.space.UOID uoid
      internal index of the component
    • name

      protected String name
    • color

      protected float[] color
    • associatedComponents

      protected ArrayList associatedComponents
      Strores components that depend on this component. E.g. they will be deleted when this component is deleted.
    • gl

      protected com.jogamp.opengl.GL2 gl
      must be accessible in derived classes
    • glu

      protected com.jogamp.opengl.glu.GLU glu
    • visible

      protected boolean visible
      Indicates if component is visible or hidden.
    • renderingQuality

      protected int renderingQuality
      The actual rendering quality. It can be low, medium or high. The default is medium.
    • drawType

      protected int drawType
      The actual drawing type of the component. Usually various draw types are available for a GraphicComponent.
    • drawProperties

      protected Properties drawProperties
      Common drawing related properties that affect all three quality modes. These properties are handled in a uniform way coming through the GraphicScene API. Properties are set by setDrawProperty(String propertyName, String propertyValue). All properties are delivered to every components and it is the responsibility of the particular GraphicComponent to pick relevant properties to be processed.
    • modifiesOrigin

      protected boolean modifiesOrigin
      Tells whether this component modifies the transformation center of the cell or not. Most components modify the transformation center when they are added to the cell. Exceptions are for example monitors and surfaces.
    • boundingBox

      protected BoundingBox boundingBox
      The smallest box containing the graphic component. In the simplest case the transformation center of the cell containing the GraphicComponent is the center of the bounding box.
    • rm

      protected int rm
      Rotation matrix as a GeomCalc matrix. It is used during picking.
    • irm

      protected int irm
      Inverse of the Rotation matrix represented by a GeomCalc matrix. It is used during picking.
    • active

      protected boolean active
      Is this component selected or not.
    • pickedItem

      protected ComponentElement pickedItem
      Identifies the most recently selected element
    • mousex

      protected int mousex
      Mouse position in picking mode. Derived classes may use it (e.g. Monitor and Label).
    • mousey

      protected int mousey
      Mouse position in picking mode. Derived classes may use it (e.g. Monitor and Label).
    • motionMode

      protected int motionMode
      Indicates if the component is in standing or in moving mode. The GraphicComponent may behave differently in the different motion modes.
  • Constructor Details

    • GraphicComponent

      protected GraphicComponent()
      Creates an empty object. This constructor is protected to prevent direct instantiation of base class, only derived classes can be instantiated.
  • Method Details

    • onRemoveGraphicComponent

      public void onRemoveGraphicComponent()
    • setProgressBar

      public void setProgressBar(chemaxon.marvin.space.ProgressBarInterface progressBar)
    • getId

      public chemaxon.marvin.space.UOID getId()
      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
      Returns:
      id of the component
    • isGraphicComponent

      public boolean isGraphicComponent()
      Specified by:
      isGraphicComponent in interface chemaxon.marvin.space.UsableObject
    • getGraphicComponent

      public GraphicComponent getGraphicComponent()
      Specified by:
      getGraphicComponent in interface chemaxon.marvin.space.UsableObject
    • getName

      public String getName()
      Returns the name of the component.
      Specified by:
      getName in interface chemaxon.marvin.space.UsableObject
      Returns:
      name that is getClass.getName() by default.
    • toString

      public String toString()
      Specified by:
      toString in interface chemaxon.marvin.space.UsableObject
      Overrides:
      toString in class Object
    • setName

      public void setName(String n)
      Sets the name of the component.
      Specified by:
      setName in interface chemaxon.marvin.space.UsableObject
    • getColor

      public Color getColor()
      Returns the constant color of the component.
      Specified by:
      getColor in interface chemaxon.marvin.space.UsableObject
    • setColor

      public void setColor(Color color)
      Sets the constant color of the component.
      Specified by:
      setColor in interface chemaxon.marvin.space.UsableObject
    • setColor

      public void setColor(float[] color)
      Sets the constant color of the component.
    • setColor

      public void setColor(int r, int g, int b)
      Sets the constant color of the component.
    • setColor

      public void setColor(float r, float g, float b)
      Sets the constant color of the component.
    • getCell

      public GraphicCell getCell()
      Returns the container cell of the component.
      Returns:
      container cell
    • getAssociatedComponents

      public Iterator getAssociatedComponents()
      Returns an Iterator that can enumerate the components associated to (depending on) this component.
      Returns:
      Iterator pointing to the first element
    • associate

      public void associate(GraphicComponent gc)
      The given component will depend on this component.
      Parameters:
      gc - associated component
    • removeAssociation

      public void removeAssociation(GraphicComponent gc)
      Removes the dependency of the given component from this component.
      Parameters:
      gc - component will no longer depend of this component
    • receiveNotificationOnSelection

      public void receiveNotificationOnSelection(GraphicComponent gc)
      Notifies the current object that the given component became selected.
      Parameters:
      gc - selected component
    • receiveNotificationOnUnSelection

      public void receiveNotificationOnUnSelection(GraphicComponent gc)
      Notifies the current object that the given component became unselected.
      Parameters:
      gc - unselected component
    • receiveNotificationOnVisibility

      public void receiveNotificationOnVisibility(GraphicComponent gc)
      Notifies the current object that the given component became visible.
      Parameters:
      gc - visible component
    • receiveNotificationOnInvisibility

      public void receiveNotificationOnInvisibility(GraphicComponent gc)
      Notifies the current object that the given component is not visible.
      Parameters:
      gc - invisible component
    • receiveNotificationOnCoordinateChange

      public void receiveNotificationOnCoordinateChange(GraphicComponent gc)
      Notifies the current object that the coordinates of the given component have been changed.
      Parameters:
      gc - component changing coordinates
    • notifySelection

      public void notifySelection()
      Notifies the associated components of being selected.
    • notifyUnSelection

      public void notifyUnSelection()
      Notifies the associated components of being unselected.
    • notifyVisibility

      public void notifyVisibility()
      Notifies the associated components of being visible.
    • notifyInvisibility

      public void notifyInvisibility()
      Notifies the associated components of being invisible.
    • notifyCoordinateChange

      public void notifyCoordinateChange()
      Notifies the associated components of changing coodinates.
    • setMotionMode

      public void setMotionMode(int mode)
      Sets the motion state of the component.
      Parameters:
      mode - either GraphicScene.MODE_STANDING or GraphicScene.MODE_MOVING
    • setGL

      public void setGL(com.jogamp.opengl.GL2 gl, com.jogamp.opengl.glu.GLU glu)
      Sets the GL2 rendering environment. Without this being set the component cannot draw itself.
      Parameters:
      gl - Interface to OpenGL
      glu - Interface to OpenGL
    • setRenderingQuality

      public void setRenderingQuality(int quality)
      Sets the rendering quality.
      Parameters:
      quality - rendering quality, see RENDERING_* constants
    • storeDrawProperty

      protected void storeDrawProperty(String propertyName, String propertyValue)
      Stores the given property. It is called from overriden setDrawProperty functions.
      Parameters:
      propertyName - identifier of the draw property
      propertyValue - value of the draw property as a String
    • setDrawProperty

      public void setDrawProperty(String propertyName, String propertyValue) throws Exception
      This is the gate of draw properties from outside to the component. A component processes the draw property only if it can identify it, but every component will get it. Every subclasses must call the storeDrawProperty() in the overriden setDrawProperty function if it identifies the property.
      Specified by:
      setDrawProperty in interface chemaxon.marvin.space.UsableObject
      Parameters:
      propertyName - identifier of the draw property
      propertyValue - value of the draw property as a String
      Throws:
      Exception
    • getDrawProperty

      public String getDrawProperty(String propertyName)
      Returns the value of a draw property.
      Returns:
      value of the draw property as String
    • getDrawProperties

      public Properties getDrawProperties()
      Returns the set draw properties of the component.
      Returns:
      collection of previously set draw properties
    • setDrawProperties

      public void setDrawProperties(Properties drawProperties) throws Exception
      Forces the component to set all drawing property stored in drawProperties, and loose every old setting.
      Parameters:
      drawProperties - collection of draw properties to set
      Throws:
      Exception
    • addDrawProperties

      public void addDrawProperties(Properties drawProperties) throws Exception
      Forces the component to set all drawing property stored in drawProperties, and leaves the old settings which are not overidden.
      Parameters:
      drawProperties - collection of draw properties to set
      Throws:
      Exception
    • setRotateMatrix

      public void setRotateMatrix(float[] rotateMatrix)
      Sets the rotation matrix in order to get the proper mapping of a vector to the viewing plane.
      Parameters:
      rotateMatrix - float array having 16 elements representing a 4 by 4 rotation matrix
    • projectVector

      public void projectVector(float[] vector3)
      Projects a vector from the scene to the viewport.
      Parameters:
      vector3 - preallocated array containing 3 float coordinates
    • draw

      public void draw()
      Draws the coordinate system of the component. It can be called by GraphicScene when it is time for drawing, and everything is set properly. This function is not public, becaue it cannot be ensured that in the moment of calling from outside we are int the Jogl rendering thread, and everything is set properly (buffers, viewport, matrices, and so on).
    • glColor

      protected void glColor()
      Sets the default/constant color of the component for drawing.
    • drawCoordinateAxes

      protected void drawCoordinateAxes()
      Draws the local coordinate axes, the origin is the transformation center
    • drawBoundingBox

      protected void drawBoundingBox()
      Vizualises the bounding box.
    • drawSelection

      protected void drawSelection(int mode)
      Draws the component in the given mode (usually in selection mode), the rendering mode is for checking.
      Parameters:
      mode - GL_RENDER or GL_SELECT
    • isVisible

      public boolean isVisible()
      Returns true if this component is allowed to be drawn.
      Specified by:
      isVisible in interface chemaxon.marvin.space.UsableObject
      Returns:
      visibility of the component
    • isVisible

      public boolean isVisible(ComponentElement element)
      Returns true if the specified part of the component is allowed to be drawn.
      Parameters:
      element - part of the component
      Returns:
      visibility of the part of the component
    • setVisible

      public void setVisible(boolean state)
      Indicates whether the component will appear on the graphic scene at the next draw or not.
      Specified by:
      setVisible in interface chemaxon.marvin.space.UsableObject
      Parameters:
      state - of visibility
    • hideSelected

      public void hideSelected()
      If the component is selected it will become hidden.
    • hideUnselected

      public void hideUnselected()
      If the component is unselected it will become hidden.
    • showFaded

      public void showFaded()
      A descendant should overwrite this method to have its faded part become visible.
    • fadeSelected

      public void fadeSelected()
      A descendant should overwrite this method to have its selection became faded.
    • fadeUnselected

      public void fadeUnselected()
      A descendant should overwrite this method to have all but its selection became faded.
    • hasTransparentPart

      public boolean hasTransparentPart()
      Returns true if a component has transparent part to draw. If this is true, drawTransparentPart() will be called during draw. Components with transparent parts should overload this function and return true, and overload the drawTransparentPart() method. This is necessary because for the correct display, opaque components have to be drawn first, and transparents after them.
      Returns:
      will the component draw with transparency
    • drawTransparentPart

      public void drawTransparentPart()
      A component having transparent parts should override this method, drawing the transparent parts here. Antialiased lines and transparent filled polygons are considered transparent. To draw transparent objects enable GL_BLEND.
    • has2DPart

      public boolean has2DPart()
      Returns true, if the component resets the projection matrix in its draw method, so that the component is drawn in plane. These components are drawn after the rest.
      Returns:
      will the component draw in plane
    • draw2DPart

      public void draw2DPart()
      A component which draws (partly) in plane should overwrite this method.
    • getZCoordinateTo2DPart

      public float getZCoordinateTo2DPart()
      Returns a third, z coordinate in order to display 2D parts in proper order.
      Returns:
      a pseudo 'z' cordinate
    • translate

      public void translate(float[] v)
      Translates the component by changing its coordinates, and not just the view. This function is usually called by a translation monitor, if and only if the component returns true to the {#isControllable("Shift")} call. This funcion translates the bounding box, and notifies the associated components (e.g. the translation monitor) about the change. It does not change any coordinates of the component itself.
      Parameters:
      v - The translation vector.
    • rotate

      public void rotate(float[] v, float[] center)
      Rotates the component by changing its coordinates, and not just the view.
      Parameters:
      v - Measurement of the rotation around the 3 axis, x, y, z.
      center - Center of the rotation.
    • rotate

      public void rotate(float[] p, float[] v, float[] center)
      Rotates the given p point by changing its coordinates.
      Parameters:
      p - A point/vector to rotate.
      v - Measurement of the rotation around the 3 axis, x, y, z.
      center - Center of the rotation.
    • rotate

      public void rotate(int p, float[] v, float[] center)
      Rotates the given p point by changing its coordinates.
      Parameters:
      p - A point/vector to rotate given as a GeomCalc vector.
      v - Measurement of the rotation around the 3 axis, x, y, z.
      center - Center of the rotation.
    • resize

      public void resize(double x, double y, double z)
      Resizes the component according to the given factors in each directions.
    • isControllable

      public boolean isControllable(String type)
      A component must return true if it allows itself to be controlled by the given type controller.
      Parameters:
      type - "Shift", "Rotate", "Resize"
      Returns:
      is the component aloowed to be controlled or not
    • getBoundingBox

      public BoundingBox getBoundingBox()
      Returns the smallest box containing the graphic component.
      Returns:
      BoundingBox
    • getBoundingSphereRadius

      public double getBoundingSphereRadius()
      Returns the radius of the bounding sphere of the component.
      Returns:
      radius in Angstroms
    • getRenderingQuality

      public int getRenderingQuality()
      Returns the actual rendering quality of the component.
      Returns:
      RENDERING_QUALITY_HIGH, RENDERING_QUALITY_MEDIUM, or RENDERING_QUALITY_LOW
    • getCoordinates

      public void getCoordinates(float[] c)
      Gets the coordinates of the previously picked but not yet processed part if there is any in the given preallocated array.
      Parameters:
      c - allocated array where coordinates will be put
    • getCoordinates

      public void getCoordinates(ComponentElement element, float[] c)
      Gets the coordinates of the given ComponentElement in the given preallocated array.
      Parameters:
      element - specific part of the component
      c - allocated array where coordinates will be put
    • getDescription

      public String getDescription()
      Returs the short description of the component or of the previously picked but not yet processed part if there is any or the description of the whole component.
      Returns:
      short description as String
    • getDescription

      public String getDescription(ComponentElement element)
      Returs the short description of the given part of the component.
      Parameters:
      element - specific part of the component
      Returns:
      short description as String
    • getLabelInformation

      public ComponentElement[] getLabelInformation(String labeltype, boolean onlyOnHeavyAtoms)
      Labels will be created associated to this GraphicComponent if the component supports the given labeltype, and returns arbitrary numbers of ComponentElements with correct coordinates and description to create a label.
      Parameters:
      onlyOnHeavyAtoms - label info needed only for heavy atoms.
      Returns:
      array of ComponentElements to create labels to
    • getLabelInformation

      public ComponentElement[] getLabelInformation(String labeltype)
    • getComponentElement

      public ComponentElement getComponentElement()
      Returns the previously picked but unprocessed ComponentElement or the whole component as a ComponentElement, if no picking happened.
      Returns:
      picked part of the component
    • getUsableObject

      public chemaxon.marvin.space.UsableObject getUsableObject(chemaxon.marvin.space.UOID id)
      Returns the component that the given UOID identifies.
      Parameters:
      id - identifier of the component or a part of the component
      Returns:
      the component or the specific part of the component
    • locateObject

      public double locateObject(int x, int y)
      Picking action at x, y coordinates, returns the z coordinate of the nearest picked item, or -1.
      Parameters:
      x - window coordinate of the mouse
      y - window coordinate of the mouse
      Returns:
      z coordinate of the nearest picked object
    • touchObject

      protected double touchObject(int hits)
      Returns the z coordinate of the nearest component. This is exactly the component having the maximum z coordinate, because we are looking down the negative z axis.
      Parameters:
      hits - Number of hits at the previous hit.
      Returns:
      z coordinate of the nearest picked object
    • pickObject

      protected void pickObject(int offset, double[] maxZ, float[] modelview)
      Sets pickedItem to be the picked part of the component.
      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.
    • isSelected

      public boolean isSelected()
      Tells whether the component is being selected or not.
      Specified by:
      isSelected in interface chemaxon.marvin.space.UsableObject
      Returns:
      selection state of the component
    • isSelected

      public boolean isSelected(ComponentElement element)
      Tells whether a part of the component is selected. By default, works the same as isSelected().
      Parameters:
      element - specific part of the component
      Returns:
      selection state of the element
    • hasSelectedElements

      public boolean hasSelectedElements()
      Tells whether the component has some selected parts. By default, works the same as isSelected()
      Returns:
      is any part of the component selected
    • select

      public void select()
      Sets the component to be selected. See also unSelect().
      Specified by:
      select in interface chemaxon.marvin.space.UsableObject
    • select

      public void select(ComponentElement element)
      Sets the specific part of the component to be selected. Note, that the whole component can also be selected with this, and this is the default behaviour as well.
      Parameters:
      element - specific part of the component
    • selectComponentElementsInside

      public void selectComponentElementsInside(BoundingBox bb)
      The component will be selected if it is inside the given box.
      Parameters:
      bb - given box represented by a BoundingBox
    • unSelect

      public void unSelect()
      Sets the component not to be selected.
      Specified by:
      unSelect in interface chemaxon.marvin.space.UsableObject
    • unSelect

      public void unSelect(ComponentElement element)
      Sets the specific part of the component not to be selected. Note, that the whole component can also be unselected with this, and this is the default behaviour as well.
      Parameters:
      element - specific part of the component
    • invertSelection

      public void invertSelection()
      Sets the previously picked but unprocessed element to be selected if it was not set and vice versa.
    • invertSelection

      public void invertSelection(ComponentElement element)
      Sets the the given part of the component to be selected if it was not set and vice versa. By default it works the same as invertSelection().
      Parameters:
      element - specific part of the component
    • extendSelection

      public void extendSelection()
      Sets the previously picked but unprocessed element to be selected, and leaves other parts as they are.
    • extendSelection

      public void extendSelection(ComponentElement element)
      Sets the the given part of the component to be selected, and leaves other parts as they are. By default it works the same as select().
      Parameters:
      element - specific part of the component
    • exclusiveSelection

      public void exclusiveSelection()
      Sets the previously picked but unprocessed element to be selected, and sets every other parts not to be selected.
    • exclusiveSelection

      public void exclusiveSelection(ComponentElement element)
      Sets the the given part of the component to be selected, and sets every other parts not to be selected. By default it works the same as select().
      Parameters:
      element - specific part of the component
    • cleanup

      public void cleanup()