Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osg::SplitGraphOp Class Reference
[Rendering BackendGeometry]

#include <OSGSplitGraphOp.h>

Inheritance diagram for osg::SplitGraphOp:

osg::GraphOp List of all members.

Public Member Functions

Constructors
SplitGraphOp (const char *name="Split", UInt16 max_polygons=1000)
GraphOpcreate ()
Destructors
*virtual ~SplitGraphOp (void)
Main methods
*bool traverse (NodePtr &root)
Parameters
*void setParams (const std::string params)
void setMaxPolygons (UInt16 max_polygons)
std::string usage (void)

Static Public Member Functions

Class Get
*static const char * getClassname (void)

Protected Attributes

std::list< NodePtr_excludeListNodes
std::list< std::string > _excludeListNames

Private Member Functions

bool isLeaf (NodePtr &node)
bool isGroup (NodePtr &node)
bool splitNode (NodePtr &node, std::vector< NodePtr > &split)
Action::ResultE traverseEnter (NodePtr &node)
Action::ResultE traverseLeave (NodePtr &node, Action::ResultE res)

Private Attributes

UInt16 _max_polygons

Detailed Description

SplitGraphOp class

Definition at line 57 of file OSGSplitGraphOp.h.


Constructor & Destructor Documentation

SplitGraphOp::SplitGraphOp const char *  name = "Split",
UInt16  max_polygons = 1000
 

Definition at line 81 of file OSGSplitGraphOp.cpp.

Referenced by create().

00081                                                                : 
00082     GraphOp(name), _max_polygons(max_polygons)
00083 {
00084 }

SplitGraphOp::~SplitGraphOp void   )  [virtual]
 

Definition at line 86 of file OSGSplitGraphOp.cpp.

00087 {
00088 }


Member Function Documentation

* static const char* osg::SplitGraphOp::getClassname void   )  [inline, static]
 

Reimplemented from osg::GraphOp.

Definition at line 66 of file OSGSplitGraphOp.h.

00066 { return "SplitGraphOp"; };

GraphOp * SplitGraphOp::create  )  [virtual]
 

Implements osg::GraphOp.

Definition at line 90 of file OSGSplitGraphOp.cpp.

References SplitGraphOp().

00091 {
00092     SplitGraphOp * inst = new SplitGraphOp();
00093     return inst;
00094 }

bool SplitGraphOp::traverse NodePtr root  )  [virtual]
 

Reimplemented from osg::GraphOp.

Definition at line 96 of file OSGSplitGraphOp.cpp.

References osg::traverse().

00097 {
00098     return GraphOp::traverse(root);
00099 }

void SplitGraphOp::setParams const std::string  params  )  [virtual]
 

Implements osg::GraphOp.

Definition at line 101 of file OSGSplitGraphOp.cpp.

References _max_polygons, and FWARNING.

00102 {
00103     ParamSet ps(params);   
00104     
00105     ps("max_polygons", _max_polygons);
00106     
00107     std::string out = ps.getUnusedParams();
00108     if(out.length())
00109     {
00110         FWARNING(("SplitGraphOp doesn't have parameters '%s'.\n",
00111                 out.c_str()));
00112     }
00113 }

void SplitGraphOp::setMaxPolygons UInt16  max_polygons  ) 
 

Definition at line 123 of file OSGSplitGraphOp.cpp.

References _max_polygons.

00124 {
00125     _max_polygons = max_polygons;
00126 }

std::string SplitGraphOp::usage void   )  [virtual]
 

Implements osg::GraphOp.

Definition at line 115 of file OSGSplitGraphOp.cpp.

00116 {
00117     return 
00118     "Split: Split large geometries into smaller ones\n"
00119     "Params: name (type, default)\n"
00120     "  max_polygons (UInt32, 1000): maximum number of polygons allowed per Geo\n";
00121 }

bool SplitGraphOp::isLeaf NodePtr node  )  [private]
 

Definition at line 739 of file OSGSplitGraphOp.cpp.

Referenced by splitNode(), traverseEnter(), and traverseLeave().

00740 {
00741     if (node->getMFChildren()->getValues().begin()==
00742         node->getMFChildren()->getValues().end()) return true;
00743     else return false;    
00744 }

bool SplitGraphOp::isGroup NodePtr node  )  [private]
 

checks whether a node is a group and nothing else

Definition at line 748 of file OSGSplitGraphOp.cpp.

References osg::BillboardBase::getClassType(), osg::DistanceLODBase::getClassType(), osg::MaterialGroupBase::getClassType(), osg::SwitchBase::getClassType(), osg::ComponentTransformBase::getClassType(), osg::TransformBase::getClassType(), osg::GroupBase::getClassType(), osg::NodePtr::getCore(), osg::NodeCore::getType(), and osg::FieldContainerType::isDerivedFrom().

00749 {
00750     if(  node->getCore()->getType().isDerivedFrom( Group::getClassType()              ) &&
00751         !node->getCore()->getType().isDerivedFrom( Transform::getClassType()          ) &&
00752         !node->getCore()->getType().isDerivedFrom( ComponentTransform::getClassType() ) &&
00753         !node->getCore()->getType().isDerivedFrom( Switch::getClassType()             ) &&
00754         !node->getCore()->getType().isDerivedFrom( MaterialGroup::getClassType()      ) &&
00755         !node->getCore()->getType().isDerivedFrom( DistanceLOD::getClassType()        ) &&
00756         !node->getCore()->getType().isDerivedFrom( Billboard::getClassType()          )) 
00757         return true;
00758     else return false;
00759 }

bool SplitGraphOp::splitNode NodePtr node,
std::vector< NodePtr > &  split
[private]
 

Definition at line 310 of file OSGSplitGraphOp.cpp.

References _max_polygons, addPoints, osg::beginEditCP(), osg::Node::CoreFieldMask, osg::Node::create(), osg::GeometryBase::create(), osg::AttachmentContainerPtr::dcast(), osg::endEditCP(), osg::GeometryBase::getClassType(), osg::NodePtr::getCore(), osg::PrimitiveIterator::getLength(), osg::PrimitiveIterator::getPosition(), osg::PrimitiveIterator::getType(), osg::NodeCore::getType(), osg::PrimitiveIterator::isAtEnd(), osg::FieldContainerType::isDerivedFrom(), osg::GraphOp::isInExcludeList(), isLeaf(), osg::NullFC, osg::PrimitiveIterator::setToBegin(), setupAttr, and SWARNING.

Referenced by traverseLeave().

00311 {
00312     //split it only if it is a non special geometry leaf
00313     if (!isLeaf(node) || isInExcludeList(node) ||
00314         !node->getCore()->getType().isDerivedFrom(Geometry::getClassType())) return false;
00315 
00316     GeometryPtr geo = GeometryPtr::dcast(node->getCore());
00317 
00318     if ( geo->getPositions() == NullFC || geo->getPositions()->size() == 0 ||
00319          geo->getLengths()   == NullFC || geo->getLengths()->size() == 0 ||
00320          geo->getTypes()     == NullFC || geo->getTypes()->size() == 0 ) return false;
00321 
00322     //get all center points
00323     std::vector<Pnt3f> centers;
00324     int ind;
00325 
00326     PrimitiveIterator it(geo);
00327 
00328     while (!it.isAtEnd())
00329     {
00330         switch(it.getType())
00331         {
00332         case GL_POINTS:
00333         case GL_LINES:
00334         case GL_LINE_STRIP:
00335         case GL_LINE_LOOP:
00336         case GL_TRIANGLE_FAN:
00337         case GL_TRIANGLE_STRIP:
00338         case GL_QUAD_STRIP:
00339         case GL_POLYGON:
00340             {
00341                 Pnt3f center(0,0,0);
00342                 for (UInt32 i=0; i<it.getLength(); i++)
00343                     center+=(Vec3f)it.getPosition(i);
00344                 center/=Real32(it.getLength());
00345                 centers.push_back(center);                
00346             } 
00347             break;
00348             
00349         case GL_TRIANGLES:
00350             ind=0;
00351             while(it.getLength()-ind>=3)
00352             {
00353                 Pnt3f center(0,0,0);
00354                 for (UInt32 i=0; i<3; i++, ind++)
00355                     center+=(Vec3f)it.getPosition(ind);
00356                 center/=3;
00357                 centers.push_back(center);
00358             } 
00359             break;
00360             
00361         case GL_QUADS:
00362             ind=0;
00363             while(it.getLength()-ind>=4)
00364             {
00365                 Pnt3f center(0,0,0);
00366                 for (UInt32 i=0; i<4; i++, ind++)
00367                     center+=(Vec3f)it.getPosition(ind);
00368                 center/=4;
00369                 centers.push_back(center);
00370             } 
00371             break;
00372 
00373             
00374         default:
00375             SWARNING << "SplitGraphOp::splitLeave: encountered " 
00376                      << "unknown primitive type " 
00377                      << it.getType()
00378                      << ", ignoring!" << std::endl;
00379             break;
00380         }   
00381         
00382         ++it;        
00383     }    
00384     
00385     std::vector<int> order;    
00386     for (UInt32 i=0; i<centers.size(); i++)
00387         order.push_back(i);
00388 
00389     Pnt3fComparator comp(centers);
00390     std::sort(order.begin(), order.end(), comp);
00391 
00392     //now we need (centers.size()/_max_polygons) amount of new geometries
00393     int ngeos=int(ceil((double)centers.size()/(double)_max_polygons));
00394 
00395     if (ngeos<=1) return false;
00396 
00397     GeometryPtr       *geos    = new GeometryPtr[ngeos];
00398     GeoPTypesPtr      *types   = new GeoPTypesPtr[ngeos];
00399     GeoPLengthsPtr    *lens    = new GeoPLengthsPtr[ngeos];
00400     GeoPositionsPtr   *pnts    = new GeoPositionsPtr[ngeos];
00401     GeoNormalsPtr     *normals = new GeoNormalsPtr[ngeos];
00402     GeoColorsPtr      *colors  = new GeoColorsPtr[ngeos];
00403     GeoColorsPtr      *scolors = new GeoColorsPtr[ngeos];
00404     GeoTexCoordsPtr   *tex     = new GeoTexCoordsPtr[ngeos];
00405     GeoTexCoordsPtr   *tex1    = new GeoTexCoordsPtr[ngeos];
00406     GeoTexCoordsPtr   *tex2    = new GeoTexCoordsPtr[ngeos];
00407     GeoTexCoordsPtr   *tex3    = new GeoTexCoordsPtr[ngeos];
00408     GeoIndicesPtr     *indices = new GeoIndicesPtr[ngeos];
00409 
00410     int **pni  = new int*[ngeos];
00411     int **nni  = new int*[ngeos];
00412     int **cni  = new int*[ngeos];
00413     int **sni  = new int*[ngeos];
00414     int **tni  = new int*[ngeos];
00415     int **t1ni = new int*[ngeos];
00416     int **t2ni = new int*[ngeos];
00417     int **t3ni = new int*[ngeos];
00418 
00419     for (Int32 i=0; i<ngeos; i++)
00420     {
00421         geos[i]  = Geometry::create();
00422 
00423         beginEditCP(geos[i]); // Keep open until the end
00424 
00425         geos[i]->setMaterial(geo->getMaterial());
00426 
00427         if(geo->getMFIndexMapping() != NULL)
00428             geos[i]->getMFIndexMapping()->setValues(*(geo->getMFIndexMapping()));
00429 
00430         types[i]   = GeoPTypesPtr::dcast(geo->getTypes()->getType().createFieldContainer());
00431         lens[i]    = GeoPLengthsPtr::dcast(geo->getLengths()->getType().createFieldContainer());
00432 
00433         if (geo->getIndices()!=NullFC)
00434         {
00435             indices[i]  = GeoIndicesPtr::dcast(geo->getIndices()->getType().createFieldContainer());
00436             beginEditCP(indices[i]); // Keep open until the end
00437         }
00438         else
00439             indices[i]  = NullFC;
00440 
00441         beginEditCP(types[i]); // Keep open until the end
00442         beginEditCP(lens[i]); // Keep open until the end
00443 
00444         setupAttr( GeoPositionsPtr , pnts    , pni  , getPositions       );
00445         setupAttr( GeoNormalsPtr   , normals , nni  , getNormals         );
00446         setupAttr( GeoColorsPtr    , colors  , cni  , getColors          );
00447         setupAttr( GeoColorsPtr    , scolors , sni  , getSecondaryColors );
00448         setupAttr( GeoTexCoordsPtr , tex     , tni  , getTexCoords       );        
00449         setupAttr( GeoTexCoordsPtr , tex1    , t1ni , getTexCoords1      );
00450         setupAttr( GeoTexCoordsPtr , tex2    , t2ni , getTexCoords2      );
00451         setupAttr( GeoTexCoordsPtr , tex3    , t3ni , getTexCoords3      );
00452     }
00453 
00454     ind=0;
00455     it.setToBegin();
00456 
00457     while (!it.isAtEnd())
00458     {
00459         switch(it.getType())
00460         {
00461         case GL_POINTS:
00462         case GL_LINES:
00463         case GL_LINE_STRIP:
00464         case GL_LINE_LOOP:
00465         case GL_TRIANGLE_FAN:
00466         case GL_TRIANGLE_STRIP:
00467         case GL_QUAD_STRIP:
00468         case GL_POLYGON:
00469             {
00470                 int geoIndex=order[ind]/_max_polygons;
00471 
00472                 types[geoIndex]->push_back(it.getType());
00473                 lens[geoIndex]->push_back(it.getLength());
00474 
00475                 addPoints( 0 , it.getLength() );
00476                 ++ind;
00477             } break;
00478             
00479         case GL_TRIANGLES:
00480             {
00481                 UInt32 i=0;                
00482                 while(it.getLength()-i>=3)
00483                 {                    
00484                     i+=3;
00485                     ++ind;
00486                 }
00487             } break;
00488             
00489         case GL_QUADS:
00490             {
00491                 UInt32 i=0;
00492                 while(it.getLength()-i>=4)
00493                 {
00494                     i+=4;
00495                     ++ind;
00496                 }
00497             } break;
00498 
00499             
00500         default:
00501             SWARNING << "SplitGraphOp::splitLeave: encountered " 
00502                      << "unknown primitive type " 
00503                      << it.getType()
00504                      << ", ignoring!" << std::endl;
00505             break;
00506         }
00507         ++it;        
00508     }
00509 
00510     ind=0;
00511     it.setToBegin();
00512 
00513     while (!it.isAtEnd())
00514     {
00515         switch(it.getType())
00516         {
00517         case GL_POINTS:
00518         case GL_LINES:
00519         case GL_LINE_STRIP:
00520         case GL_LINE_LOOP:
00521         case GL_TRIANGLE_FAN:
00522         case GL_TRIANGLE_STRIP:
00523         case GL_QUAD_STRIP:
00524         case GL_POLYGON:
00525             {
00526                 ++ind;
00527             } break;
00528             
00529         case GL_TRIANGLES:
00530             {
00531                 UInt32 i=0;
00532                 int geoIndex;
00533                 while(it.getLength()-i>=3)
00534                 {                    
00535                     geoIndex = order[ind]/_max_polygons;
00536                     if (types[geoIndex]->size()>0 && types[geoIndex]->getValue(types[geoIndex]->size()-1) == GL_TRIANGLES)
00537                     {
00538                         int lind;
00539                         if ((lind=lens[geoIndex]->size()-1)>=0)
00540                             lens[geoIndex]->setValue(lens[geoIndex]->getValue(lind)+3, lind);
00541                         else
00542                             lens[geoIndex]->push_back(3);
00543                     }
00544                     else
00545                     {
00546                         types[geoIndex]->push_back(GL_TRIANGLES);
00547                         lens[geoIndex]->push_back(3);
00548                     }
00549 
00550                     addPoints( i ,3 );
00551                     i+=3;
00552                     ++ind;
00553                 }
00554             } break;
00555             
00556         case GL_QUADS:
00557             {
00558                 UInt32 i=0;
00559                 while(it.getLength()-i>=4)
00560                 {
00561                     i+=4;
00562                     ++ind;
00563                 }
00564             } break;
00565 
00566             
00567         default:
00568             SWARNING << "SplitGraphOp::splitLeave: encountered " 
00569                      << "unknown primitive type " 
00570                      << it.getType()
00571                      << ", ignoring!" << std::endl;
00572             break;
00573         }        
00574         ++it;        
00575     }
00576 
00577     ind=0;
00578     it.setToBegin();
00579 
00580     while (!it.isAtEnd())
00581     {
00582         switch(it.getType())
00583         {
00584         case GL_POINTS:
00585         case GL_LINES:
00586         case GL_LINE_STRIP:
00587         case GL_LINE_LOOP:
00588         case GL_TRIANGLE_FAN:
00589         case GL_TRIANGLE_STRIP:
00590         case GL_QUAD_STRIP:
00591         case GL_POLYGON:
00592             {
00593                 ++ind;
00594             } break;
00595             
00596         case GL_TRIANGLES:
00597             {
00598                 UInt32 i=0;
00599                 while(it.getLength()-i>=3)
00600                 {
00601                     i+=3;
00602                     ++ind;
00603                 }
00604             } break;
00605             
00606         case GL_QUADS:
00607             {
00608                 UInt32 i=0;
00609                 int geoIndex;
00610                 while(it.getLength()-i>=4)
00611                 {                    
00612                     geoIndex = order[ind]/_max_polygons;
00613                     if (types[geoIndex]->size()>0 && types[geoIndex]->getValue(types[geoIndex]->size()-1) == GL_QUADS)
00614                     {
00615                         int lind;
00616                         if ((lind=lens[geoIndex]->size()-1)>=0)
00617                             lens[geoIndex]->setValue(lens[geoIndex]->getValue(lind)+4, lind);
00618                         else
00619                             lens[geoIndex]->push_back(4);
00620                     }
00621                     else
00622                     {
00623                         types[geoIndex]->push_back(GL_QUADS);
00624                         lens[geoIndex]->push_back(4);
00625                     }
00626 
00627                     addPoints( i , 4 );
00628                     i+=4;
00629                     ++ind;
00630                 }
00631             } break;
00632             
00633         default:
00634             SWARNING << "SplitGraphOp::splitLeave: encountered " 
00635                      << "unknown primitive type " 
00636                      << it.getType()
00637                      << ", ignoring!" << std::endl;
00638             break;
00639         }        
00640         ++it;        
00641     }
00642 
00643     for (Int32 i=0; i<ngeos; i++)
00644     {
00645         geos[i]->setTypes(types[i]);
00646         geos[i]->setLengths(lens[i]);
00647         geos[i]->setPositions(pnts[i]);
00648 
00649         // Now close the open FCs
00650         
00651         endEditCP(types[i]);
00652         endEditCP(lens[i]);
00653         endEditCP(pnts[i]);
00654 
00655         if (indices[i]!=NullFC)
00656         {
00657             geos[i]->setIndices(indices[i]);   
00658             endEditCP(indices[i]);
00659         }     
00660 
00661         if (normals[i]!=NullFC)
00662         {
00663             geos[i]->setNormals(normals[i]);
00664             endEditCP(normals[i]);
00665         }     
00666 
00667         if (colors[i]!=NullFC)
00668         {
00669             geos[i]->setColors(colors[i]);
00670             endEditCP(colors[i]);
00671         }     
00672         
00673         if (scolors[i]!=NullFC)
00674         {
00675             geos[i]->setSecondaryColors(scolors[i]);
00676             endEditCP(scolors[i]);
00677         }     
00678         
00679         if (tex[i]!=NullFC)
00680         {
00681             geos[i]->setTexCoords(tex[i]);
00682              endEditCP(tex[i]);
00683         }     
00684        
00685         if (tex1[i]!=NullFC)
00686         {
00687             geos[i]->setTexCoords1(tex1[i]);
00688             endEditCP(tex1[i]);
00689         }     
00690         
00691         if (tex2[i]!=NullFC)
00692         {
00693             geos[i]->setTexCoords2(tex2[i]);
00694             endEditCP(tex2[i]);
00695         }     
00696         
00697         if (tex3[i]!=NullFC)
00698         {
00699             geos[i]->setTexCoords3(tex3[i]);
00700             endEditCP(tex3[i]);
00701         }     
00702 
00703         endEditCP(geos[i]);        
00704         
00705         if (node->getParent()!=NullFC)
00706         {
00707             NodePtr n=Node::create();
00708             beginEditCP(n, Node::CoreFieldMask);
00709             n->setCore(geos[i]);
00710             endEditCP  (n, Node::CoreFieldMask);
00711             split.push_back(n);
00712         }        
00713     }
00714 
00715     for (Int32 i=0; i<ngeos; i++)
00716     {
00717         if (pni[i]) delete [] pni[i];
00718         if (nni[i]) delete [] nni[i];
00719         if (cni[i]) delete [] cni[i];
00720         if (sni[i]) delete [] sni[i];
00721         if (tni[i]) delete [] tni[i];
00722         if (t1ni[i]) delete [] t1ni[i];
00723         if (t2ni[i]) delete [] t2ni[i];
00724         if (t3ni[i]) delete [] t3ni[i];
00725     }
00726 
00727     delete [] pni;
00728     delete [] nni;
00729     delete [] cni;
00730     delete [] sni;
00731     delete [] tni;
00732     delete [] t1ni;
00733     delete [] t2ni;
00734     delete [] t3ni;
00735 
00736     return true;
00737 }

Action::ResultE SplitGraphOp::traverseEnter NodePtr node  )  [private, virtual]
 

Implements osg::GraphOp.

Definition at line 137 of file OSGSplitGraphOp.cpp.

References osg::Action::Continue, osg::AttachmentContainerPtr::dcast(), osg::NodePtr::getCore(), isLeaf(), osg::NullFC, and osg::Action::Skip.

00138 {
00139     if (isLeaf(node)) return Action::Skip;
00140 
00141     SwitchPtr switch_ = SwitchPtr::dcast(node->getCore());
00142     if (switch_!=NullFC) return Action::Skip;
00143     
00144     DistanceLODPtr dlod = DistanceLODPtr::dcast(node->getCore());
00145     if (dlod!=NullFC) return Action::Skip;   
00146     
00147     return Action::Continue;    
00148 }

Action::ResultE SplitGraphOp::traverseLeave NodePtr node,
Action::ResultE  res
[private, virtual]
 

Implements osg::GraphOp.

Definition at line 268 of file OSGSplitGraphOp.cpp.

References osg::addRefCP(), osg::beginEditCP(), osg::Node::ChildrenFieldMask, osg::endEditCP(), osg::GraphOp::isInExcludeList(), isLeaf(), and splitNode().

00269 {
00270     std::vector<NodePtr>::iterator it = node->getMFChildren()->getValues().begin();
00271     std::vector<NodePtr>::iterator en = node->getMFChildren()->getValues().end  ();
00272     std::vector<NodePtr> toAdd;
00273     std::vector<NodePtr> toSub;
00274 
00275     for ( ; it != en; ++it )
00276     {
00277         bool special=isInExcludeList(*it);
00278         bool leaf=isLeaf(*it);
00279         
00280         if (!special && leaf)
00281         {
00282             if (splitNode(*it, toAdd))
00283                 toSub.push_back(*it);
00284         }
00285     }
00286 
00287     it = toAdd.begin();
00288     en = toAdd.end  ();
00289     
00290     for ( ; it != en; ++it )
00291     {
00292         beginEditCP(node, Node::ChildrenFieldMask);
00293         node->addChild(*it);
00294         endEditCP  (node, Node::ChildrenFieldMask);
00295     }
00296     
00297     it = toSub.begin();
00298     en = toSub.end  ();
00299     
00300     for ( ; it != en; ++it )
00301     {
00302         beginEditCP(node, Node::ChildrenFieldMask);
00303         addRefCP(*it);
00304         node->subChild(*it);
00305         endEditCP  (node, Node::ChildrenFieldMask);
00306     }
00307     return res;
00308 }

const std::string & GraphOp::getName void   )  [inherited]
 

Definition at line 112 of file OSGGraphOp.cpp.

References osg::GraphOp::_name.

Referenced by osg::GraphOpFactory::registerOp(), and osg::GraphOpFactory::unRegisterOp().

00113 {
00114     return _name;
00115 };

void GraphOp::setName const char *  name  )  [inherited]
 

Definition at line 117 of file OSGGraphOp.cpp.

References osg::GraphOp::_name.

00118 {
00119     _name = name;
00120 };

void GraphOp::addToExcludeList NodePtr node  )  [inherited]
 

Definition at line 124 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNodes, and osg::GraphOp::isInExcludeListNodes().

Referenced by osg::MergeGraphOp::excludeListLeave(), and osg::GraphOpSeq::setGraphOps().

00125 {
00126     if (!isInExcludeListNodes(node))
00127         _excludeListNodes.push_back(node);
00128 }

void GraphOp::addToExcludeList const std::string &  name  )  [inherited]
 

Definition at line 130 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNames, and osg::GraphOp::isInExcludeListNames().

00131 {
00132     if (!isInExcludeListNames(name))
00133         _excludeListNames.push_back(name);
00134 }

void GraphOp::removeFromExcludeList NodePtr node  )  [inherited]
 

Definition at line 136 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNodes.

00137 {
00138     _excludeListNodes.remove(node);
00139 }

void GraphOp::removeFromExcludeList const std::string &  name  )  [inherited]
 

Definition at line 141 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNames.

00142 {
00143     _excludeListNames.remove(name);
00144 }

void GraphOp::clearExcludeList void   )  [inherited]
 

Definition at line 146 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNames, and osg::GraphOp::_excludeListNodes.

00147 {
00148     _excludeListNames.clear();
00149     _excludeListNodes.clear();
00150 }

bool GraphOp::isInExcludeListNodes NodePtr node  )  [inherited]
 

Definition at line 152 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNodes.

Referenced by osg::GraphOp::addToExcludeList(), and osg::GraphOp::isInExcludeList().

00153 {
00154     std::list<NodePtr>::iterator list_iter;
00155     list_iter = std::find(_excludeListNodes.begin(),_excludeListNodes.end(),node);
00156 
00157     if (list_iter==_excludeListNodes.end()) 
00158         return false;
00159     else 
00160         return true;
00161 }

bool GraphOp::isInExcludeListNames const std::string &  name  )  [inherited]
 

Definition at line 163 of file OSGGraphOp.cpp.

References osg::GraphOp::_excludeListNames.

Referenced by osg::GraphOp::addToExcludeList(), and osg::GraphOp::isInExcludeList().

00164 {
00165     std::list<std::string>::iterator namelist_iter;
00166     namelist_iter = std::find(_excludeListNames.begin(),_excludeListNames.end(),name);
00167 
00168     if (namelist_iter==_excludeListNames.end()) 
00169         return false;
00170     else 
00171         return true;
00172 }

bool GraphOp::isInExcludeList NodePtr node  )  [inherited]
 

Definition at line 174 of file OSGGraphOp.cpp.

References osg::getName(), osg::GraphOp::isInExcludeListNames(), and osg::GraphOp::isInExcludeListNodes().

Referenced by osg::MergeGraphOp::processGeometries(), osg::MergeGraphOp::processGroups(), osg::MergeGraphOp::processTransformations(), splitNode(), and traverseLeave().

00175 {
00176     if (isInExcludeListNodes(node) || (OSG::getName(node)!=NULL && isInExcludeListNames(OSG::getName(node))))
00177         return true;
00178     else
00179         return false;
00180 }


Member Data Documentation

UInt16 osg::SplitGraphOp::_max_polygons [private]
 

Definition at line 109 of file OSGSplitGraphOp.h.

Referenced by setMaxPolygons(), setParams(), and splitNode().

std::list<NodePtr> osg::GraphOp::_excludeListNodes [protected, inherited]
 

Definition at line 161 of file OSGGraphOp.h.

Referenced by osg::GraphOp::addToExcludeList(), osg::GraphOp::clearExcludeList(), osg::GraphOp::isInExcludeListNodes(), osg::MergeGraphOp::mergeOnce(), and osg::GraphOp::removeFromExcludeList().

std::list<std::string> osg::GraphOp::_excludeListNames [protected, inherited]
 

Definition at line 162 of file OSGGraphOp.h.

Referenced by osg::GraphOp::addToExcludeList(), osg::GraphOp::clearExcludeList(), osg::GraphOp::isInExcludeListNames(), and osg::GraphOp::removeFromExcludeList().


The documentation for this class was generated from the following files:
Generated on Thu Aug 25 04:14:11 2005 for OpenSG by  doxygen 1.4.3