本文整理汇总了C++中ChildIterator类的典型用法代码示例。如果您正苦于以下问题:C++ ChildIterator类的具体用法?C++ ChildIterator怎么用?C++ ChildIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChildIterator类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveToXML
bool PanelCreator::SaveToXML( GuiObjectCPtr _spObject, CFoundation::XMLDocumentPtr _spDoc, CFoundation::XMLElementPtr _spXMLElement ) const
{
GuiObjectCreator::SaveToXML( _spObject, _spDoc, _spXMLElement );
PanelCPtr spPanel = static_pointer_cast< const Panel >( _spObject );
// save children
ChildIterator clIterator = spPanel->GetChildIterator();
GuiObjectPtr pChild = clIterator.GetFirst();
while( !clIterator.IsDone() )
{
// Create new XML node
CFoundation::XMLElementPtr spChildXMLElement = _spDoc->CreateElement( pChild->GetTypeId() );
// Add as child
_spXMLElement->InsertChildLast( spChildXMLElement );
// Save child
GuiMain::GetInstance().SaveToXML( pChild, _spDoc, spChildXMLElement );
pChild = clIterator.GetNext();
}
return true;
}
示例2: getChildIterator
OverlayElement* OverlayContainer::findElementAt(Real x, Real y) // relative to parent
{
OverlayElement* ret = NULL;
int currZ = -1;
if (mVisible)
{
ret = OverlayElement::findElementAt(x,y); //default to the current container if no others are found
if (ret && mChildrenProcessEvents)
{
ChildIterator it = getChildIterator();
while (it.hasMoreElements())
{
OverlayElement* currentOverlayElement = it.getNext();
if (currentOverlayElement->isVisible() && currentOverlayElement->isEnabled())
{
int z = currentOverlayElement->getZOrder();
if (z > currZ)
{
OverlayElement* elementFound = currentOverlayElement->findElementAt(x ,y );
if (elementFound)
{
currZ = z;
ret = elementFound;
}
}
}
}
}
}
return ret;
}
示例3: removeChild
void SymbolNode::removeChild(const SymbolInfo &inf)
{
ChildIterator pChild = m_childList.find(inf);
if (pChild != m_childList.end())
{
pChild.value()->m_parent = WeakPtr();
m_childList.remove(inf);
}
}
示例4: recursivelyMarkIf
void recursivelyMarkIf(Node* start, const NodeConditional& nc) {
if (nc(&*start)) {
start->mark |= MARK_KEEP | MARK_KEEP_KIDS;
for (ChildIterator ci = childBegin(start); !ci.done(); ++ci) {
recursivelyMarkIf(&*ci, nc);
}
} else {
start->mark |= MARK_KEEP;
}
}
示例5: getChildIterator
//---------------------------------------------------------------------
void OverlayContainer::_notifyZOrder(ushort newZOrder)
{
OverlayElement::_notifyZOrder(newZOrder);
// Update children
ChildIterator it = getChildIterator();
while (it.hasMoreElements())
{
// Give children ZOrder 1 higher than this
it.getNext()->_notifyZOrder(newZOrder + 1);
}
}
示例6: children
int ProtoNode::childrenCount() const
{
if (!node_) return 0;
int row_count = 0;
ChildIterator kids = children();
while ( kids.element().isValid() )
{
row_count++;
kids.next();
}
return row_count;
}
示例7: getChildIterator
/** Overridden from OverlayContainer */
void cCompassOverlay::_updateRenderQueue(RenderQueue* queue) {
if (mVisible)
{
if (!mTransparent && !mpMaterial.isNull())
{
OverlayElement::_updateRenderQueue(queue);
}
// Also add children
ChildIterator it = getChildIterator();
while (it.hasMoreElements())
{
// Give children ZOrder 1 higher than this
it.getNext()->_updateRenderQueue(queue);
}
}
}
示例8: eraseChildrenOfUnmarkedNodes
/*!
Destroys children of nodes that are not marked,
defragments the node array
always keeps the root
Note: invalidates all pointers to nodes of the tree, and all
iterators.
*/
void eraseChildrenOfUnmarkedNodes() {
unsigned int write = 0;
nodes[root_index].mark = MARK_KEEP;
assert(root_index < allocation_index);
for (unsigned int read = root_index; read != allocation_index; read++) {
Node *node = &nodes[read];
char mark = node->mark;
if (mark) {
// TODO: could handle read == write as a special case
Node *write_node = &nodes[write];
*write_node = *node; // copy
write_node->mark = 0; // clear mark
if (mark & MARK_KEEP_KIDS) {
// adjust children's parent pointers
for (ChildIterator it = childBegin(write_node); !it.done(); ++it) {
it->parent = write;
}
} else {
write_node->num_children = 0;
}
// adjust parent's first_child "pointer" if this is its first child
if (read != root_index) {
Node* parent_node = getParent(node);
if (write < parent_node->first_child) {
parent_node->first_child = write;
}
}
write++;
}
}
root_index = 0;
nodes[root_index].parent = 0;
allocation_index = write;
}
示例9: scriptNode
void Box::exportForReference( const std::string &fileName ) const
{
const ScriptNode *script = scriptNode();
if( !script )
{
throw IECore::Exception( "Box::exportForReference called without ScriptNode" );
}
// we only want to save out our child nodes and plugs that are visible in the UI, so we build a filter
// to specify just the things to export.
boost::regex invisiblePlug( "^__.*$" );
StandardSetPtr toExport = new StandardSet;
for( ChildIterator it = children().begin(), eIt = children().end(); it != eIt; ++it )
{
if( (*it)->isInstanceOf( Node::staticTypeId() ) )
{
toExport->add( *it );
}
else if( const Plug *plug = IECore::runTimeCast<Plug>( it->get() ) )
{
if( !boost::regex_match( plug->getName().c_str(), invisiblePlug ) )
{
toExport->add( *it );
}
}
}
ContextPtr context = new Context;
context->set( "valuePlugSerialiser:resetParentPlugDefaults", true );
context->set( "serialiser:includeParentMetadata", true );
context->set( "serialiser:includeVersionMetadata", true );
Context::Scope scopedContext( context.get() );
script->serialiseToFile( fileName, this, toExport.get() );
}