Package chemaxon.marvin.space
Class ComponentElement
- java.lang.Object
-
- chemaxon.marvin.space.ComponentElement
-
@PublicAPI public class ComponentElement extends Object
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
- Identify an atom of a molecule
-
-
Constructor Summary
Constructors Constructor Description ComponentElement(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
Color
getColor()
Returns the color that is assigned to the ComponentElement.GraphicComponent
getComponent()
Returns the component which contains thisComponentElement
.int
getComponentPartId()
In case of complex components thecomponentPartId
identifies a part of the component.void
getCoordinates(float[] c)
Returns the world coordinates of theComponentElement
.String
getDescription()
Returns the brief description of theComponentElement
, for example type of the atom.int
getElementIndex()
Returns the internal index of theComponentElement
in theGraphicComponent
.int
getElementType()
Returns the type of theComponentElement
.int
hashCode()
boolean
isComponentPart()
Returns true if the if the component is a structured component.boolean
isVisible()
Returns true if theComponentElement
is visible in the component.void
setColor(Color c)
Assignes a color to the CompnentElement.void
setCoordinates(float[] c)
Sets the coordinates of the ComponentElement.void
setDescription(String d)
Sets a brief description to theComponentElement
that will be returned by {#getDescription()}.String
toString()
Returs the indices of theCompnentElement
.
-
-
-
Constructor Detail
-
ComponentElement
public ComponentElement(GraphicComponent component, int atomicElementType, int atomicElementIndex)
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
public ComponentElement(ComponentElement element)
Copies the givenComponentElement
.- Parameters:
element
- to copy
-
-
Method Detail
-
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
public String getDescription()
Returns the brief description of theComponentElement
, for example type of the atom.- Returns:
- description of the component
-
setDescription
public void setDescription(String d)
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
public GraphicComponent getComponent()
Returns the component which contains thisComponentElement
.- Returns:
- the component
-
getColor
public Color 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
public void setColor(Color c)
Assignes a color to the CompnentElement.- Parameters:
c
-
-
-