Iterating over Nodes in a Layer

Given a layer you can iterate over all of the nodes, by retrieving a pointer to an ILayerProperties interface and calling the method ILayerProperties::Nodes().

 
ILayerProperties* GetLayerPropertiesFromNode(INode* node)
{
   ILayer* layer = GetLayerFromNode(node);
   return layer->GetInterface(LAYERPROPERTIES_INTERFACE);
}
 
void ProcessNodesOnLayer(ILayer* layer)
{
   ILayerProperties* props = layer->GetInterface(LAYERPROPERTIES_INTERFACE);
   Tab<INode*> nodes;
   props->Nodes(nodes);
   for (int i=0; i < nodes.Count(); ++i)
   {
      INode* node = nodes[i];
     
      // custom processing.
   }
}
 

See Also