本文整理汇总了C++中ObjectPtr::beginRend方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPtr::beginRend方法的具体用法?C++ ObjectPtr::beginRend怎么用?C++ ObjectPtr::beginRend使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectPtr
的用法示例。
在下文中一共展示了ObjectPtr::beginRend方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasCenter
bool RendGroup::hasCenter() const
{
ObjectPtr pObj = getClientObj();
Object::RendIter iter = pObj->beginRend();
Object::RendIter eiter = pObj->endRend();
for (;iter!=eiter;++iter) {
RendererPtr pRend = iter->second;
if (!pRend->getGroupName().equals(getName()))
continue;
if (pRend->hasCenter()) {
return true;
}
}
// none of the renderers in this group has valid center
return false;
}
示例2: getClientObj
qlib::Vector4D RendGroup::getCenter() const
{
// Calc COM of renderers in this group
Vector4D resvec;
int nsum = 0;
ObjectPtr pObj = getClientObj();
Object::RendIter iter = pObj->beginRend();
Object::RendIter eiter = pObj->endRend();
for (;iter!=eiter;++iter) {
RendererPtr pRend = iter->second;
if (!pRend->getGroupName().equals(getName()))
continue;
if (pRend->hasCenter()) {
resvec += pRend->getCenter();
++nsum;
}
}
if (nsum>0)
return resvec.divide(nsum);
else
return qlib::Vector4D();
}
示例3: convToLWScene
void LWViewerManager::convToLWScene(qsys::ScenePtr pScene, qsys::ScenePtr pNewScene)
{
#ifndef QM_BUILD_LW
qsys::AutoStyleCtxt(pScene->getUID());
Scene::ObjIter iter = pScene->beginObj();
Scene::ObjIter eiter = pScene->endObj();
std::deque<ObjectPtr> newobjs;
LString objname, rendname;
for (; iter!=eiter; ++iter) {
ObjectPtr pObj = iter->second;
LWObjPtr pNewObj(new LWObject);
objname = pObj->getName();
pNewObj->setName(objname);
pNewObj->setDefaultPropFlag("name", false);
if (!pObj->isVisible()) {
pNewObj->setVisible(false);
pNewObj->setDefaultPropFlag("visible", false);
}
pNewObj->startBuild();
Object::RendIter riter = pObj->beginRend();
Object::RendIter reiter = pObj->endRend();
for (; riter!=reiter; ++riter) {
RendererPtr pRend = riter->second;
// ignore selection renderer
if (qlib::LChar::equals(pRend->getTypeName(), "*selection"))
continue;
LWRendPtr pNewRend = pNewObj->createRenderer("lwrend");
// set name
rendname = pRend->getName();
if (rendname.isEmpty())
rendname = LString("(") + pRend->getTypeName() + LString(")");
pNewRend->setName(rendname);
pNewRend->setDefaultPropFlag("name", false);
if (!pRend->isVisible()) {
pNewRend->setVisible(false);
pNewRend->setDefaultPropFlag("visible", false);
}
// Set Data ID of LWRend
pNewRend->setDataID(pNewRend->getUID());
pNewRend->setDefaultPropFlag("data_id", false);
LWRendDisplayContext *pdc = MB_NEW LWRendDisplayContext();
pdc->init(pNewRend.get(), pNewObj.get());
pdc->setAlpha(pRend->getDefaultAlpha());
pdc->startRender();
pdc->startSection(objname+":"+rendname);
pRend->display(pdc);
pRend->displayLabels(pdc);
pdc->endSection();
pdc->endRender();
// make hittest data
if (pRend->isHitTestSupported()) {
pdc->startHit(pRend->getUID());
pRend->displayHit(pdc);
pdc->endHit();
}
delete pdc;
}
pNewObj->endBuild();
newobjs.push_back(pNewObj);
}
BOOST_FOREACH (ObjectPtr pElem, newobjs) {
pNewScene->addObject(pElem);
}