本文整理汇总了C++中openbabel::OBAtom::GetIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ OBAtom::GetIndex方法的具体用法?C++ OBAtom::GetIndex怎么用?C++ OBAtom::GetIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openbabel::OBAtom
的用法示例。
在下文中一共展示了OBAtom::GetIndex方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: paint
void StereoCenterItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Molecule *mol = molecule();
painter->save();
painter->setPen(Qt::green);
if (!mol) {
// not connected: default behaviour (draw connectable box)
MolInputItem::paint(painter, option, widget);
painter->restore();
return;
}
const QList<Atom*> &atoms = mol->atoms();
OpenBabel::OBMol *obmol = mol->OBMol();
QPointF offset(-5.0, 5.0);
#ifdef OPENBABEL2_TRUNK
// need to calculate symmetry first
std::vector<unsigned int> symmetry_classes;
OpenBabel::OBGraphSym graphsym(obmol);
graphsym.GetSymmetry(symmetry_classes);
//std::vector<unsigned long> atomIds = FindTetrahedralAtoms(obmol, symmetry_classes);
std::vector<OpenBabel::StereogenicUnit> units = FindStereogenicUnits(obmol, symmetry_classes);
for (unsigned int i = 0; i < units.size(); ++i) {
if (units.at(i).type == OpenBabel::OBStereo::Tetrahedral) {
OpenBabel::OBAtom *obatom = obmol->GetAtomById(units.at(i).id);
painter->drawEllipse(mapFromItem(mol, atoms[obatom->GetIndex()]->pos()), 10, 10);
} else
if (units.at(i).type == OpenBabel::OBStereo::CisTrans) {
OpenBabel::OBBond *obbond = obmol->GetBondById(units.at(i).id);
OpenBabel::OBAtom *obatom1 = obbond->GetBeginAtom();
OpenBabel::OBAtom *obatom2 = obbond->GetEndAtom();
painter->drawEllipse(mapFromItem(mol, atoms[obatom1->GetIndex()]->pos()), 10, 10);
painter->drawEllipse(mapFromItem(mol, atoms[obatom2->GetIndex()]->pos()), 10, 10);
}
}
#else
using OpenBabel::OBMolAtomIter;
FOR_ATOMS_OF_MOL(atom, obmol)
if (atom->IsChiral())
painter->drawEllipse(mapFromItem(mol, atoms[atom->GetIdx()-1]->pos()), 10, 10);
#endif
// default behavious (draw the label())
MolInputItem::paint(painter, option, widget);
painter->restore();
}