本文整理汇总了C++中AtomList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomList::begin方法的具体用法?C++ AtomList::begin怎么用?C++ AtomList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomList
的用法示例。
在下文中一共展示了AtomList::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
MP4::Tag::updateParents(const AtomList &path, long delta, int ignore)
{
if(static_cast<int>(path.size()) <= ignore)
return;
AtomList::ConstIterator itEnd = path.end();
std::advance(itEnd, 0 - ignore);
for(AtomList::ConstIterator it = path.begin(); it != itEnd; ++it) {
d->file->seek((*it)->offset);
long size = d->file->readBlock(4).toUInt();
// 64-bit
if (size == 1) {
d->file->seek(4, File::Current); // Skip name
long long longSize = d->file->readBlock(8).toLongLong();
// Seek the offset of the 64-bit size
d->file->seek((*it)->offset + 8);
d->file->writeBlock(ByteVector::fromLongLong(longSize + delta));
}
// 32-bit
else {
d->file->seek((*it)->offset);
d->file->writeBlock(ByteVector::fromUInt(size + delta));
}
}
}
示例2: drawLabels
void Viewer::drawLabels(GLObjectList const& objects)
{
AtomList atomList;
Layer::Atom* atom;
Layer::Charge* charge;
bool selectedOnly = (m_selectedObjects.count() > 0);
GLObjectList::const_iterator object;
for (object = objects.begin(); object!= objects.end(); ++object) {
if ( (atom = qobject_cast<Layer::Atom*>(*object)) ) {
atom->drawLabel(*this, m_labelType, s_labelFontMetrics);
if ( !selectedOnly || atom->isSelected() ) atomList.append(atom);
}else if ( (m_labelType == Layer::Atom::Charge) &&
(charge = qobject_cast<Layer::Charge*>(*object)) ) {
charge->drawLabel(*this, s_labelFontMetrics);
}
}
glDisable(GL_LIGHTING);
qglColor(foregroundColor());
QString mesg = selectedOnly ? "Selection " : "Total ";
AtomList::const_iterator iter;
double value(0.0);
if (m_labelType == Layer::Atom::Mass) {
for (iter= atomList.begin(); iter != atomList.end(); ++iter) {
value += (*iter)->getMass();
}
mesg += "mass: " + QString::number(value,'f', 3);
drawText(width()-s_labelFontMetrics.width(mesg), height()-10, mesg);
}else if (m_labelType == Layer::Atom::Charge) {
for (iter = atomList.begin(); iter != atomList.end(); ++iter) {
value += (*iter)->getCharge();
}
mesg += "charge: " + QString::number(value,'f', 2);
drawText(width()-s_labelFontMetrics.width(mesg), height()-10, mesg);
}else if (m_labelType == Layer::Atom::Spin) {
for (iter = atomList.begin(); iter != atomList.end(); ++iter) {
value += (*iter)->getSpin();
}
mesg += "spin: " + QString::number(value,'f', 2);
drawText(width()-s_labelFontMetrics.width(mesg), height()-10, mesg);
}
glEnable(GL_LIGHTING);
}
示例3: addAtoms
void Group::addAtoms(AtomList const& atoms)
{
AtomList::const_iterator atom;
for (atom = atoms.begin(); atom != atoms.end(); ++atom) {
(*atom)->setReferenceFrame(&m_frame);
m_atoms.append(*atom);
}
}
示例4: atoms
AtomList atoms(const AtomList& atom_list, const String& expression)
{
AtomList result;
// iterate over all atoms
AtomList::const_iterator it = atom_list.begin();
Expression match(expression);
for (; it != atom_list.end(); ++it)
{
if (match(**it))
{
// store the atom pointer in the list
result.push_back(const_cast<Atom*>(*it));
}
}
return result;
}