Class MarkedElement
java.lang.Object
org.openscience.cdk.renderer.elements.MarkedElement
- All Implemented Interfaces:
IRenderingElement
A marked element adds meta-data (id and tags) to a CDK rendering
element (or group of elements). The id should be unique per depiction.
The primary use case it to be able to set the 'id' and 'class'
attributes in SVG.
To set the mol, atom, or bond id set a String property to
ID_KEY
.
Similarly, the CLASS_KEY
can be used to set the classes.
IAtomContainer mol;
atom.setProperty(MarkedElement.ID_KEY, "my_atm_id");
atom.setProperty(MarkedElement.CLASS_KEY, "h_donor");
atom.setProperty(MarkedElement.CLASS_KEY, "h_acceptor");
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(IRenderingVisitor visitor) Converts thisTextElement
into widget specific objects.element()
Access the element of which the id and classes apply.Access the classes of the element.getId()
Access the id of the element.static MarkedElement
markup
(IRenderingElement elem, String... classes) Markup a rendering element with the specified classes.static MarkedElement
markupAtom
(IRenderingElement elem, IAtom atom) Markup a atom with the class 'atom' and optionally the ids/classes from it's properties.static MarkedElement
markupBond
(IRenderingElement elem, IBond bond) Markup a bond with the class 'bond' and optionally the ids/classes from it's properties.static MarkedElement
markupMol
(IRenderingElement elem, IAtomContainer mol) Markup a molecule with the class 'mol' and optionally the ids/classes from it's properties.
-
Field Details
-
ID_KEY
-
CLASS_KEY
-
-
Method Details
-
getId
Access the id of the element.- Returns:
- id, null if none
-
getClasses
Access the classes of the element.- Returns:
- id, empty if none
-
accept
Converts thisTextElement
into widget specific objects.- Specified by:
accept
in interfaceIRenderingElement
- Parameters:
visitor
- Toolkit specific widget factory.
-
element
Access the element of which the id and classes apply.- Returns:
- rendering element
-
markup
Markup a rendering element with the specified classes.- Parameters:
elem
- rendering elementclasses
- classes- Returns:
- the marked element
-
markupMol
Markup a molecule with the class 'mol' and optionally the ids/classes from it's properties.- Parameters:
elem
- rendering elementmol
- molecule- Returns:
- the marked element
-
markupAtom
Markup a atom with the class 'atom' and optionally the ids/classes from it's properties.- Parameters:
elem
- rendering elementatom
- atom- Returns:
- the marked element
-
markupBond
Markup a bond with the class 'bond' and optionally the ids/classes from it's properties.- Parameters:
elem
- rendering elementbond
- bond- Returns:
- the marked element
-