| |||||||||
| 
             
  | 
             
  | 
             
  | |||||||
| 
             
  | 
            
  | ||||||||
| 
             
  | |||||||||
| 
                     
 #include "vg.h"           // Required for the standard Vega classes
 
 int getNumberPfGeoSetsInVegaPart( vgPart *obj ) { // ############################################ // # Public Function // # // # Returns the number of pfGeoSets with // # in a vgPart by traversing the pfNode // # tree of the vgPart // # // ############################################ int numGeoSets = 0; 
 // // Sanity check we need an part // if( obj == NULL ) return 0; 
 // // Retrieve the Part root pfNode // pfNode *node = vgGetPartPfNode( obj ); if( node == NULL ) return 0; 
 // // Now we can traverse the Nodes tree and count // numGeoSets = getNumberPfGeoSetsInNode ( node, numGeoSets ); 
 return numGeoSets; 
 } // findNamedDCSNodeInVgPart 
 
 
 
 int getNumberPfGeoSetsInNode( pfNode *node, int geoSetTotal ) { // ######################################################## // # // # Public Function // # // # A simple Recursive function that will traverse the given // # nodes tree and count all the pfGeoSet it encounters // # // ######################################################## 
 
 // // Sanity check we need a Node // if( node == NULL ) return geoSetTotal; 
 // // Check to see if the Node is of the type pfGeode // which is the Performer node that parents pfGeoSets // if( pfIsOfType( node, pfGetGeodeClassType() )) { 
 // // Get the number of pfGeoSets attached to the pfGeode // int numGeosets = pfGetNumGSets ( node ); 
 geoSetTotal += numGeosets; 
 } 
 else { 
 // // Cycle through the children for this node // int numChildren = pfGetNumChildren ( node ); 
 for ( int idx = 0; idx < numChildren; idx++ ) { 
 // // Get the child node and recurse in to them // pfNode *childNode = pfGetChild ( node, idx ); 
 geoSetTotal = getNumberPfGeoSetsInNode ( childNode, geoSetTotal ); 
 } } 
 
 return geoSetTotal; 
 } // getNumberPfGeoSetsInNode 
 
 
  | ||
| 
              
 
 © Copyright 2004 Gordon Tomlinson All Rights Reserved. All logos, trademarks and copyrights in this site are property of their respective owner.  | ||