1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
40 #ifndef _OSGVERIFYGRAPHOP_H_
41 #define _OSGVERIFYGRAPHOP_H_
46 #include "OSGGraphOp.h"
47 #include "OSGUtilDef.h"
48 #include "OSGGeometry.h"
52 /*! \ingroup GrpUtilGraphOp
53 \ingroup GrpLibOSGUtil
56 class OSG_UTIL_DLLMAPPING VerifyGraphOp
: public GraphOp
58 /*========================== PUBLIC =================================*/
62 /*---------------------------------------------------------------------*/
66 typedef GraphOp Inherited
;
67 typedef VerifyGraphOp Self
;
69 OSG_GEN_INTERNAL_MEMOBJPTR(VerifyGraphOp
);
72 /*---------------------------------------------------------------------*/
73 /*! \name Classname */
76 static const char *getClassname(void) { return "VerifyGraphOp"; };
79 /*---------------------------------------------------------------------*/
80 /*! \name Constructors */
83 static ObjTransitPtr
create(bool repair
= true,
84 bool verbose
= true );
86 virtual GraphOpTransitPtr
clone (void );
89 /*---------------------------------------------------------------------*/
90 /*! \name Main methods */
93 virtual bool traverse(Node
*node
);
95 void setVerbose(bool verbose
);
96 void setRepair (bool repair
);
98 void setParams(const std::string params
);
99 std::string
usage ( void );
102 /*========================= PROTECTED ===============================*/
106 Action::ResultE
traverseEnter(Node
* const node
);
107 Action::ResultE
traverseLeave(Node
* const node
, Action::ResultE res
);
109 /*---------------------------------------------------------------------*/
110 /*! \name Destructors */
113 VerifyGraphOp( bool repair
= true,
114 bool verbose
= false,
115 const char *name
= "Verify");
116 virtual ~VerifyGraphOp(void );
119 /*========================== PRIVATE ================================*/
123 /* Some internal helper methods */
125 Action::ResultE
verifyGeometry(Node
* const node
);
126 bool verifyIndexMap(Geometry
*geo
, bool &repair
);
127 bool repairGeometry(void);
129 /* Configuration variables */
134 /* Traversal variables */
136 UInt32 _numErrors
; /**< The running total of errors found. */
138 std::vector
<OSG::Geometry
*> _corruptedGeos
;
139 std::vector
<OSG::Node
*> _corruptedNodes
;
143 OSG_GEN_MEMOBJPTR(VerifyGraphOp
);
148 #endif /* _OSGVERIFYGRAPHOP_H_ */