本文整理汇总了C++中Bond::getFirstAtom方法的典型用法代码示例。如果您正苦于以下问题:C++ Bond::getFirstAtom方法的具体用法?C++ Bond::getFirstAtom怎么用?C++ Bond::getFirstAtom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bond
的用法示例。
在下文中一共展示了Bond::getFirstAtom方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pickParent_
void PickingMode::pickParent_(const QPoint& p)
{
ignore_pick_ = true;
list<GeometricObject*> objects;
scene_->pickObjects(p, objects);
if (objects.empty()) return;
Composite* composite = (Composite*)(**objects.begin()).getComposite();
if (composite == 0) return;
Composite* to_select = 0;
Atom* atom = dynamic_cast<Atom*>(composite);
if (atom != 0)
{
to_select = atom->getParent();
}
else
{
Bond* bond = dynamic_cast<Bond*>(composite);
if (bond!= 0)
{
to_select = (Composite*)bond->getFirstAtom()->getParent();
}
else
{
to_select = composite;
}
}
if (to_select != 0)
{
if (to_select->isSelected())
{
getMainControl()->deselectCompositeRecursive(to_select, true);
}
else
{
getMainControl()->selectCompositeRecursive(to_select, true);
}
getMainControl()->update(*to_select, true);
}
}
示例2: throw
CHECK(Bond() throw())
b = new Bond;
TEST_NOT_EQUAL(b, 0)
RESULT
CHECK(~Bond() throw())
delete b;
RESULT
CHECK(Bond(const Bond& bond, bool deep = true) throw())
Atom a1;
Atom a2;
Bond b1, b2;
b1.setFirstAtom(&a1);
TEST_EQUAL(b1.getFirstAtom(), &a1);
b1.setFirstAtom(&a2);
TEST_EQUAL(b1.getFirstAtom(), &a2);
RESULT
CHECK(Bond(const String& name, Atom& first, Atom& second, Order order = BALL_BOND_DEFAULT_ORDER, Type type = BALL_BOND_DEFAULT_TYPE) throw(TooManyBonds))
Atom a1;
Atom a2;
Bond b1("name", a1, a2, 1, 2);
TEST_EQUAL(b1.getName(), "name")
TEST_EQUAL(b1.getFirstAtom(), &a1)
TEST_EQUAL(b1.getSecondAtom(), &a2)
TEST_EQUAL(b1.getOrder(), 1)
TEST_EQUAL(b1.getType(), 2)
RESULT
示例3: getName_
void MolecularInformation::getName_(Composite& composite)
{
String temp = "UNKNOWN";
switch(type_)
{
case TYPE__BOND:
{
temp.clear();
Bond* bond = RTTI::castTo<Bond>(composite);
Atom* a1 = (Atom*) bond->getFirstAtom();
Atom* a2 = (Atom*) bond->getSecondAtom();
temp = getBondAtomName_(a1) + " -> " + getBondAtomName_(a2);
}
break;
case TYPE__SYSTEM:
{
System* system = RTTI::castTo<System>(composite);
temp = system->getName();
}
break;
case TYPE__RESIDUE:
{
Residue* residue = RTTI::castTo<Residue>(composite);
temp = residue->getName();
temp += " ";
temp += residue->getID();
}
break;
case TYPE__MOLECULE:
case TYPE__PROTEIN:
case TYPE__CHAIN:
case TYPE__FRAGMENT:
case TYPE__SECONDARY_STRUCTURE:
{
AtomContainer* atom_container = RTTI::castTo<AtomContainer>(composite);
temp = atom_container->getName();
}
break;
case TYPE__ATOM:
{
Atom* atom = RTTI::castTo<Atom>(composite);
temp = atom->getName();
}
break;
default:
break;
}
if (type_ == TYPE__SECONDARY_STRUCTURE)
{
const SecondaryStructure* ss = dynamic_cast<SecondaryStructure*>(&composite);
if (ss != 0)
{
switch (ss->getType())
{
case SecondaryStructure::HELIX:
temp += " Helix";
break;
case SecondaryStructure::TURN:
temp += " Turn";
break;
case SecondaryStructure::STRAND:
temp += " Strand";
break;
case SecondaryStructure::COIL:
temp += " Coil";
break;
default:
temp += " Unknown";
}
}
else
{
temp += " Unknown";
}
}
else
{
if (temp == "")
{
temp = "<";
temp += type_name_;
temp += ">";
}
}
name_ = temp;
}