本文整理汇总了C++中Bond::setOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ Bond::setOrder方法的具体用法?C++ Bond::setOrder怎么用?C++ Bond::setOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bond
的用法示例。
在下文中一共展示了Bond::setOrder方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: redo
void SetBondOrderCommand::redo()
{
Bond *bond = editor()->bond(m_atomId1, m_atomId2);
Q_ASSERT(bond != 0);
bond->setOrder(m_finalOrder);
}
示例2: readEDGE_
bool KCFFile::readEDGE_(KCFFile::IndexAtomMap& index_to_atom)
{
if (!getLine().hasPrefix(EDGE_TAG))
{
throw Exception::ParseError(__FILE__, __LINE__,
String("'") + getLine() + "' (line " + String(getLineNumber()) + " of " + getName() + "'",
String("Expected EDGE tag: "));
}
Size number_of_edges = getLine().getField(1).toInt();
bool ok = true;
for (Position i = 0; ok && (i < number_of_edges); i++)
{
// Get the next line
readLine();
// Make sure the line starts with a blank
ok &= getLine().hasPrefix(CONTINUED_LINE);
// ??? Comments still mising
Position first = getLine().getField(1).toInt();
Position second = getLine().getField(2).toInt();
Position order = getLine().getField(3).toInt();
// Make sure the indices refered to do exist
ok &= index_to_atom.has(first) && index_to_atom.has(second);
if (ok)
{
Bond* bond = index_to_atom[first]->createBond(*index_to_atom[second]);
bond->setOrder(order);
}
}
return (ok && readLine());
}
示例3: undo
void SetBondOrderCommand::undo()
{
Bond *bond = editor()->bond(m_atomId1, m_atomId2);
assert(bond != 0);
bond->setOrder(m_initialOrder);
}
示例4:
FOR_BONDS_OF_MOL(obBond, obMol)
{
Bond *bond = new Bond;
bond->setOrder(obBond->GetBondOrder());
bond->setFromAtom(atomMap.value(obBond->GetBeginAtomIdx()));
bond->setToAtom(atomMap.value(obBond->GetEndAtomIdx()));
m_molecule->addBond(bond);
}
示例5: appendMoiety_
void RGroupAssembler::appendMoiety_(AtomContainer* molecule, AtomContainer* moiety, String pm_atom)
{
AtomContainer* moiety_copy = new AtomContainer;
*moiety_copy = *moiety;
molecule->insert(*moiety_copy);
vector<Atom*> conn_atoms;
for (AtomIterator atom_it = molecule->beginAtom(); +atom_it; atom_it++)
{
if (atom_it->getName() == pm_atom)
{
// find placemark atom ..
conn_atoms.push_back(atom_it->beginBond()->getPartner(*atom_it));
// ... and select placemark atom's partner
atom_it->select();
}
else atom_it->deselect();
}
// remove placemark atoms
molecule->removeSelected();
// create bond between both R-atoms
Bond* bnd = conn_atoms[0]->createBond(*conn_atoms[1]);
bnd->setOrder(1);
}
示例6: createBond_
void EditMode::createBond_()
{
// this functionality shall be independent from the edit mode
// check if two atoms are selected
HashSet<Composite*> selection = scene_->getMainControl()->getSelection();
// by switching into the edit mode recursive selection
// has already cleaned up
Atom* first_atom = 0;
Atom* second_atom = 0;
// case 1: one system with exactly two atoms
if (selection.size() == 1)
{
if (RTTI::isKindOf<AtomContainer>(**selection.begin()))
{
AtomContainer* ac = reinterpret_cast<AtomContainer*>(*selection.begin());
if (ac->countAtoms() == 2)
{
AtomIterator atom_it = ac->beginAtom();
for(; +atom_it; ++atom_it)
{
if (!first_atom)
{
first_atom = &*atom_it;
}
else if (!second_atom)
{
second_atom = &*atom_it;
}
else
{
Log.error() << (String)tr("Internal error! Too many atoms selected.") << std::endl;
}
}
}
else
{
scene_->setStatusbarText(tr("Please select exactly two atoms."), true);
}
}
else
{
scene_->setStatusbarText(tr("Please select exactly two atoms."), true);
}
}
// case 2: two selected atoms with unselected in
// either distinct atom containers
// or with unselected in the same container
else if (selection.size() == 2)
{
HashSet<Composite*>::Iterator it = selection.begin();
for (; +it; ++it)
{
if (RTTI::isKindOf<Atom>(**it))
{
if (!first_atom)
{
first_atom = reinterpret_cast<Atom*>(*it);
}
else if (!second_atom)
{
second_atom = reinterpret_cast<Atom*>(*it);
}
}
// case 3: a single atom in selected atomcontainer
else if (RTTI::isKindOf<AtomContainer>(**it))
{
AtomContainer* ac = reinterpret_cast<AtomContainer*>(*it);
if (ac->countAtoms() == 1)
{
if (!first_atom)
{
first_atom = &*ac->beginAtom();
}
else if (!second_atom)
{
second_atom = &*ac->beginAtom();
}
}
else
{
Log.error() << (String)tr("Scene: Internal error! ") << __LINE__ << std::endl;
}
}
}
}
// we found two atoms
if (first_atom && second_atom)
{
// create a bond
Bond* bond = first_atom->createBond(*second_atom);
bond->setOrder(Bond::ORDER__SINGLE); //TODO single bond or current edit mode default bond order?
// TODO:for undo -operation
// EditOperation eo(0, bond, "Added bond of type single" , EditOperation::ADDED__BOND);
// undo_.push_back(eo);
//
// // tell about the new undo operation
//.........这里部分代码省略.........