Package chemaxon.marvin.space
Class ComponentElement
java.lang.Object
chemaxon.marvin.space.ComponentElement
Class to identify parts of GraphicComponents mainly during selection.
Examples:
- Identify an atom of a molecule
ComponentElement pickedItem = new ComponentElement( this, COMPONENT_TYPE_ATOM, selectBuf.get(offset) );
- Identify the whole molecule
ComponentElement pickedItem = new ComponentElement( this, COMPONENT_TYPE_ENTIRE, 0 );
- Getting the
MolAtom
from aComponentElement
ComponentElement item;
if(item.getType() == COMPONENT_TYPE_ATOM) { chemaxon.struc.MolAtom mola = mol.getAtom( item.getIndex() ); }
- Since:
- Marvin 4.0.2
-
Constructor Summary
ConstructorsConstructorDescriptionComponentElement
(ComponentElement element) Copies the givenComponentElement
.ComponentElement
(GraphicComponent component, int atomicElementType, int atomicElementIndex) Creates a new instance ofComponentElement
of a simple (not structured)GraphicComponent
.ComponentElement
(GraphicComponent component, int componentPartId, int atomicElementType, int atomicElementIndex) Creates a new instance ofComponentElement
of a complex (structured)GraphicComponent
.ComponentElement
(GraphicComponent component, int componentPartId, int atomicElementType, Integer atomicElementIndexObject) Creates a new instance ofComponentElement
.ComponentElement
(GraphicComponent component, int atomicElementType, Integer atomicElementIndexObject) Creates a new instance ofComponentElement
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getColor()
Returns the color that is assigned to the ComponentElement.Returns the component which contains thisComponentElement
.int
In case of complex components thecomponentPartId
identifies a part of the component.void
getCoordinates
(float[] c) Returns the world coordinates of theComponentElement
.Returns the brief description of theComponentElement
, for example type of the atom.int
Returns the internal index of theComponentElement
in theGraphicComponent
.int
Returns the type of theComponentElement
.int
hashCode()
boolean
Returns true if the if the component is a structured component.boolean
Returns true if theComponentElement
is visible in the component.void
Assignes a color to the CompnentElement.void
setCoordinates
(float[] c) Sets the coordinates of the ComponentElement.void
Sets a brief description to theComponentElement
that will be returned by {#getDescription()}.toString()
Returs the indices of theCompnentElement
.
-
Constructor Details
-
ComponentElement
Creates a new instance ofComponentElement
of a simple (not structured)GraphicComponent
.- Parameters:
component
- theGraphicComponent
whose element is thisComponentElement
ofatomicElementType
- identifies the type of theComponentElement
, which can be anything theGraphicComponent
can identifyatomicElementIndex
- the internal index of the atomic element of the component having given type
-
ComponentElement
public ComponentElement(GraphicComponent component, int atomicElementType, Integer atomicElementIndexObject) Creates a new instance ofComponentElement
.- Parameters:
component
- theGraphicComponent
whose element is thisComponentElement
ofatomicElementType
- identifies the type of theComponentElement
, which can be anything theGraphicComponent
can identifyatomicElementIndexObject
- the internal index of the atomic element as an object
-
ComponentElement
public ComponentElement(GraphicComponent component, int componentPartId, int atomicElementType, int atomicElementIndex) Creates a new instance ofComponentElement
of a complex (structured)GraphicComponent
.- Parameters:
component
- theGraphicComponent
whose element is thisComponentElement
ofcomponentPartId
- identifies the specific part of the complexGraphicComponent
atomicElementType
- identifies the type of theComponentElement
, which can be anything theGraphicComponent
can identifyatomicElementIndex
- the internal index of the atomic element of the component having given type
-
ComponentElement
public ComponentElement(GraphicComponent component, int componentPartId, int atomicElementType, Integer atomicElementIndexObject) Creates a new instance ofComponentElement
.- Parameters:
component
- theGraphicComponent
whose element is thisComponentElement
ofcomponentPartId
- identifies the specific part of the complexGraphicComponent
atomicElementType
- identifies the type of theComponentElement
, which can be anything theGraphicComponent
can identifyatomicElementIndexObject
- the internal index of the atomic element as an object
-
ComponentElement
Copies the givenComponentElement
.- Parameters:
element
- to copy
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
isComponentPart
public boolean isComponentPart()Returns true if the if the component is a structured component.- Returns:
- is the component a part of a structured component
-
getComponentPartId
public int getComponentPartId()In case of complex components thecomponentPartId
identifies a part of the component.- Returns:
- id of the part of a structured component
-
getElementType
public int getElementType()Returns the type of theComponentElement
.- Returns:
- identifier of an element type
-
getElementIndex
public int getElementIndex()Returns the internal index of theComponentElement
in theGraphicComponent
.- Returns:
- internal index of the component
-
getCoordinates
public void getCoordinates(float[] c) Returns the world coordinates of theComponentElement
.- Parameters:
c
- allocated array where the coordinates will be put
-
setCoordinates
public void setCoordinates(float[] c) Sets the coordinates of the ComponentElement. Note, that usually it is unnecessary to set the coordinates this way, because they will be got byGraphicComponent.getCoordinates(ComponentElement, float[])
. Setting the coordinates explicitly prevents the calling of the above method.- Parameters:
c
-
-
getDescription
Returns the brief description of theComponentElement
, for example type of the atom.- Returns:
- description of the component
-
setDescription
Sets a brief description to theComponentElement
that will be returned by {#getDescription()}.- Parameters:
d
- description String or null to get the description given by the component
-
isVisible
public boolean isVisible()Returns true if theComponentElement
is visible in the component.- Returns:
- is the component visible or not
-
getComponent
Returns the component which contains thisComponentElement
.- Returns:
- the component
-
getColor
Returns the color that is assigned to the ComponentElement. E.g. residue color of a residue label, cpk color of an atom, constant color of a component. -
setColor
Assignes a color to the CompnentElement.- Parameters:
c
-
-
toString
Returs the indices of theCompnentElement
.
-