OEAddLabel¶
Adds label to an image or molecule display.
Link |
Description |
---|---|
adding label to an image |
|
adding label to atoms of a match |
|
adding label to set of atoms |
|
adding label to atoms specified by a predicate |
Note
When adding label associated with atoms it is recommended to use the
OEAddLabel
along with the OEAddHighlighting
function for visual clarity.
void OEAddLabel(OEImageBase& image, const OE2DPoint& center,
const OEHighlightLabel& label)
- image
The image in which the label is drawn.
- center
The center of the label on the image.
- label
The OEHighlightLabel object that stores properties that determine the styles of the label along with the text of the label itself.
Example:
def OEAddLabel_OEImage(image):
label = oedepict.OEHighlightLabel("Hello!")
oedepict.OEAddLabel(image, oedepict.OE2DPoint(50, 50), label)
label.SetBoundingBoxPen(oedepict.OETransparentPen)
oedepict.OEAddLabel(image, oedepict.OE2DPoint(100, 50), label)
label.SetBoundingBoxPen(oedepict.OELightGreyPen)
oedepict.OEAddLabel(image, oedepict.OE2DPoint(150, 50), label)
void OEAddLabel(OE2DMolDisplay &disp,
const OEHighlightLabel &label,
const OEChem::OEMatchBase &match)
Adds label to atoms of an OEMatchBase object that can be initialized by substructure search or maximum common substructure search.
- disp
The OE2DMolDisplay object on which the label is going to be positioned.
- label
The OEHighlightLabel object that stores properties that determine the styles of the label along with the text of the label itself.
- match
The label is positioned based on the target atoms of the OEMatchBase object.
Example:
def OEAddLabel_OEMatch(disp):
subs = oechem.OESubSearch("a1aaaaa1")
unique = True
highlightstyle = oedepict.OEHighlightByBallAndStick(oechem.OELightGreen)
for match in subs.Match(disp.GetMolecule(), unique):
oedepict.OEAddHighlighting(disp, highlightstyle, match)
label = oedepict.OEHighlightLabel("aromatic", oechem.OELightGreen)
oedepict.OEAddLabel(disp, label, match)
void OEAddLabel(OE2DMolDisplay &disp,
const OEHighlightLabel &label,
const OEChem::OEAtomBondSet &abset)
Adds label to atoms stored in the OEAtomBondSet object.
- disp
The OE2DMolDisplay object on which the label is going to be positioned.
- label
The OEHighlightLabel object that stores properties that determine the styles of the label along with the text of the label itself.
- abset
The label is positioned based on the atoms stored in the OEAtomBondSet object.
Example:
def OEAddLabel_OEAtomBondSet(disp):
mol = disp.GetMolecule()
ringset = oechem.OEAtomBondSet(mol.GetAtoms(oechem.OEAtomIsInRing()),
mol.GetBonds(oechem.OEBondIsInRing()))
ringhighlight = oedepict.OEHighlightByBallAndStick(oechem.OELightGreen)
oedepict.OEAddHighlighting(disp, ringhighlight, ringset)
ringlabel = oedepict.OEHighlightLabel("ring", oechem.OELightGreen)
oedepict.OEAddLabel(disp, ringlabel, ringset)
chainset = oechem.OEAtomBondSet(mol.GetAtoms(oechem.OEAtomIsInChain()),
mol.GetBonds(oechem.OEBondIsInChain()))
chainhighlight = oedepict.OEHighlightByBallAndStick(oechem.OEBlueTint)
oedepict.OEAddHighlighting(disp, chainhighlight, chainset)
chainlabel = oedepict.OEHighlightLabel("chain", oechem.OEBlueTint)
oedepict.OEAddLabel(disp, chainlabel, chainset)
void OEAddLabel(OE2DMolDisplay &disp,
const OEHighlightLabel &label,
const OESystem::OEUnaryPredicate<OEChem::OEAtomBase> &atompred)
Adds label to atoms for which the given atom predicate returns true.
- disp
The OE2DMolDisplay object on which the label is going to be positioned.
- label
The OEHighlightLabel object that stores properties that determine the styles of the label along with the text of the label itself.
- atompred
The label is positioned based on the atoms for which the given atom predicate returns true.
Example:
def OEAddLabel_Predicate(disp):
ringhighlight = oedepict.OEHighlightByBallAndStick(oechem.OELightGreen)
oedepict.OEAddHighlighting(disp, ringhighlight,
oechem.OEAtomIsInRing(), oechem.OEBondIsInRing())
ringlabel = oedepict.OEHighlightLabel("ring", oechem.OELightGreen)
oedepict.OEAddLabel(disp, ringlabel, oechem.OEAtomIsInRing())
chainhighlight = oedepict.OEHighlightByBallAndStick(oechem.OEBlueTint)
oedepict.OEAddHighlighting(disp, chainhighlight,
oechem.OEAtomIsInChain(), oechem.OEBondIsInChain())
chainlabel = oedepict.OEHighlightLabel("chain", oechem.OEBlueTint)
oedepict.OEAddLabel(disp, chainlabel, oechem.OEAtomIsInChain())