OCCT dev version porting (6.7.2)

This commit is contained in:
vsr 2014-06-09 12:56:21 +04:00
parent 191621acbe
commit dc562ec459
22 changed files with 539 additions and 62 deletions

View File

@ -25,6 +25,8 @@
#include <GEOMAlgo_AlgoTools.hxx> #include <GEOMAlgo_AlgoTools.hxx>
#include <Basics_OCCTVersion.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
#include <gp_Dir2d.hxx> #include <gp_Dir2d.hxx>
@ -195,7 +197,12 @@ Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace
(const TopoDS_Edge& aEold, (const TopoDS_Edge& aEold,
const TopoDS_Edge& aEnew, const TopoDS_Edge& aEnew,
const TopoDS_Face& aF, const TopoDS_Face& aF,
const Handle(BOPInt_Context)& aCtx) #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
)
{ {
Standard_Boolean bIsClosed, bUClosed, bHasOld; Standard_Boolean bIsClosed, bUClosed, bHasOld;
Standard_Integer iRet, aNbPoints; Standard_Integer iRet, aNbPoints;
@ -426,7 +433,12 @@ void GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse
(const TopoDS_Edge& aEF1, (const TopoDS_Edge& aEF1,
const TopoDS_Edge& aEF2, const TopoDS_Edge& aEF2,
const Handle(BOPInt_Context)& aContext) #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aContext
#else
const Handle(BOPInt_Context)& aContext
#endif
)
{ {
Standard_Boolean aFlag; Standard_Boolean aFlag;
Standard_Real aT1, aT2, aScPr, a, b; Standard_Real aT1, aT2, aScPr, a, b;
@ -471,7 +483,12 @@ Standard_Boolean GEOMAlgo_AlgoTools::ProjectPointOnShape
(const gp_Pnt& aP1, (const gp_Pnt& aP1,
const TopoDS_Shape& aS, const TopoDS_Shape& aS,
gp_Pnt& aP2, gp_Pnt& aP2,
const Handle(BOPInt_Context)& aCtx) #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
)
{ {
Standard_Boolean bIsDone = Standard_False; Standard_Boolean bIsDone = Standard_False;
Standard_Real aT2; Standard_Real aT2;
@ -618,7 +635,12 @@ Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
const TopTools_ListOfShape& aLE, const TopTools_ListOfShape& aLE,
const Standard_Real aTol, const Standard_Real aTol,
TopTools_ListOfShape& aLESD, TopTools_ListOfShape& aLESD,
const Handle(BOPInt_Context)& aCtx) #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
)
{ {
Standard_Boolean bIsDone; Standard_Boolean bIsDone;
Standard_Real aTol2, aD2; Standard_Real aTol2, aD2;
@ -657,7 +679,12 @@ Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
(const TopTools_ListOfShape& aLE, (const TopTools_ListOfShape& aLE,
const Standard_Real aTol, const Standard_Real aTol,
TopTools_IndexedDataMapOfShapeListOfShape& aMEE, TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
const Handle(BOPInt_Context)& aCtx) #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
)
{ {
Standard_Integer aNbE, aNbEProcessed, aNbESD, iErr; Standard_Integer aNbE, aNbEProcessed, aNbESD, iErr;
TopTools_ListOfShape aLESD; TopTools_ListOfShape aLESD;
@ -725,7 +752,12 @@ Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes
Standard_Integer GEOMAlgo_AlgoTools::RefineSDShapes Standard_Integer GEOMAlgo_AlgoTools::RefineSDShapes
(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMPKLE, (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMPKLE,
const Standard_Real aTol, const Standard_Real aTol,
const Handle(BOPInt_Context)& aCtx) #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
)
{ {
Standard_Integer i, aNbE, iErr, j, aNbEE, aNbToAdd; Standard_Integer i, aNbE, iErr, j, aNbEE, aNbToAdd;
TopTools_IndexedDataMapOfShapeListOfShape aMEE, aMSDE, aMEToAdd; TopTools_IndexedDataMapOfShapeListOfShape aMEE, aMSDE, aMEToAdd;

View File

@ -26,10 +26,18 @@
#ifndef _GEOMAlgo_AlgoTools_HeaderFile #ifndef _GEOMAlgo_AlgoTools_HeaderFile
#define _GEOMAlgo_AlgoTools_HeaderFile #define _GEOMAlgo_AlgoTools_HeaderFile
#include <Basics_OCCTVersion.hxx>
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_Macro.hxx> #include <Standard_Macro.hxx>
#include <Standard_Boolean.hxx> #include <Standard_Boolean.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <Handle_IntTools_Context.hxx>
#include <IntTools_Context.hxx>
#else
#include <Handle_BOPInt_Context.hxx> #include <Handle_BOPInt_Context.hxx>
#include <BOPInt_Context.hxx>
#endif
#include <Standard_Integer.hxx> #include <Standard_Integer.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
@ -43,8 +51,6 @@
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <BOPInt_Context.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx> #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_ListOfShape.hxx> #include <TopTools_ListOfShape.hxx>
@ -88,20 +94,34 @@ class GEOMAlgo_AlgoTools {
static Standard_Integer RefineSDShapes static Standard_Integer RefineSDShapes
(GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD, (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD,
const Standard_Real aTol, const Standard_Real aTol,
const Handle(BOPInt_Context)& aCtx) ; #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
) ;
Standard_EXPORT Standard_EXPORT
static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE, static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE,
const Standard_Real aTol, const Standard_Real aTol,
TopTools_IndexedDataMapOfShapeListOfShape& aMEE, TopTools_IndexedDataMapOfShapeListOfShape& aMEE,
const Handle(BOPInt_Context)& aCtx) ; #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
) ;
Standard_EXPORT Standard_EXPORT
static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1, static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1,
const TopTools_ListOfShape& aLE, const TopTools_ListOfShape& aLE,
const Standard_Real aTol, const Standard_Real aTol,
TopTools_ListOfShape& aLESD, TopTools_ListOfShape& aLESD,
const Handle(BOPInt_Context)& aCtx) ; #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
) ;
Standard_EXPORT Standard_EXPORT
static void PointOnShape(const TopoDS_Shape& aS, static void PointOnShape(const TopoDS_Shape& aS,
@ -128,7 +148,12 @@ class GEOMAlgo_AlgoTools {
static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1, static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1,
const TopoDS_Shape& aS, const TopoDS_Shape& aS,
gp_Pnt& aP2, gp_Pnt& aP2,
const Handle(BOPInt_Context)& aCtx) ; #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
) ;
Standard_EXPORT Standard_EXPORT
static void CorrectTolerances(const TopoDS_Shape& aShape, static void CorrectTolerances(const TopoDS_Shape& aShape,
@ -146,7 +171,12 @@ class GEOMAlgo_AlgoTools {
Standard_EXPORT Standard_EXPORT
static Standard_Boolean IsSplitToReverse1 (const TopoDS_Edge& aEF1, static Standard_Boolean IsSplitToReverse1 (const TopoDS_Edge& aEF1,
const TopoDS_Edge& aEF2, const TopoDS_Edge& aEF2,
const Handle(BOPInt_Context)& aContext); #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
) ;
Standard_EXPORT Standard_EXPORT
static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE, static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE,
const TopoDS_Face& aF, const TopoDS_Face& aF,
@ -163,22 +193,42 @@ class GEOMAlgo_AlgoTools {
Standard_EXPORT Standard_EXPORT
static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit, static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit,
const TopoDS_Edge& theEdge, const TopoDS_Edge& theEdge,
const Handle(BOPInt_Context)& theContext); #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& theCtx
#else
const Handle(BOPInt_Context)& theCtx
#endif
) ;
Standard_EXPORT Standard_EXPORT
static Standard_Boolean IsSplitToReverse (const TopoDS_Face& theFSp, static Standard_Boolean IsSplitToReverse (const TopoDS_Face& theFSp,
const TopoDS_Face& theFSr, const TopoDS_Face& theFSr,
const Handle(BOPInt_Context)& theContext); #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& theCtx
#else
const Handle(BOPInt_Context)& theCtx
#endif
) ;
Standard_EXPORT Standard_EXPORT
static Standard_Boolean IsSplitToReverse (const TopoDS_Shape& theSp, static Standard_Boolean IsSplitToReverse (const TopoDS_Shape& theSp,
const TopoDS_Shape& theSr, const TopoDS_Shape& theSr,
const Handle(BOPInt_Context)& theCtx); #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& theCtx
#else
const Handle(BOPInt_Context)& theCtx
#endif
) ;
Standard_EXPORT Standard_EXPORT
static Standard_Integer BuildPCurveForEdgeOnFace (const TopoDS_Edge& aEold, static Standard_Integer BuildPCurveForEdgeOnFace (const TopoDS_Edge& aEold,
const TopoDS_Edge& aEnew, const TopoDS_Edge& aEnew,
const TopoDS_Face& aF, const TopoDS_Face& aF,
const Handle(BOPInt_Context)& aCtx); #if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& aCtx
#else
const Handle(BOPInt_Context)& aCtx
#endif
) ;
// //
Standard_EXPORT Standard_EXPORT

View File

@ -28,6 +28,7 @@
#include <GEOMAlgo_FinderShapeOn2.hxx> #include <GEOMAlgo_FinderShapeOn2.hxx>
#include <math.h> #include <math.h>
#include <Basics_OCCTVersion.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <TColStd_Array1OfInteger.hxx> #include <TColStd_Array1OfInteger.hxx>
@ -87,7 +88,11 @@
#include <TColStd_ListIteratorOfListOfInteger.hxx> #include <TColStd_ListIteratorOfListOfInteger.hxx>
#include <HatchGen_Domain.hxx> #include <HatchGen_Domain.hxx>
#include <Geom2dHatch_Hatcher.hxx> #include <Geom2dHatch_Hatcher.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <IntTools_Context.hxx>
#else
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#endif
#include <BRepTools.hxx> #include <BRepTools.hxx>
#include <IntTools_Tools.hxx> #include <IntTools_Tools.hxx>

View File

@ -27,6 +27,7 @@
// //
#include <GEOMAlgo_Gluer.hxx> #include <GEOMAlgo_Gluer.hxx>
#include <Basics_OCCTVersion.hxx>
#include <NCollection_UBTreeFiller.hxx> #include <NCollection_UBTreeFiller.hxx>
@ -77,7 +78,11 @@
#include <BRepBndLib.hxx> #include <BRepBndLib.hxx>
// //
#include <IntTools_Tools.hxx> #include <IntTools_Tools.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <IntTools_Context.hxx>
#else
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#endif
#include <BOPTools_AlgoTools.hxx> #include <BOPTools_AlgoTools.hxx>
#include <BOPTools_AlgoTools3D.hxx> #include <BOPTools_AlgoTools3D.hxx>
#include <BOPTools_AlgoTools2D.hxx> #include <BOPTools_AlgoTools2D.hxx>

View File

@ -25,7 +25,11 @@
// <peter@PREFEX> // <peter@PREFEX>
// //
#include <GEOMAlgo_GluerAlgo.hxx> #include <GEOMAlgo_GluerAlgo.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <IntTools_Context.hxx>
#else
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#endif
//======================================================================= //=======================================================================
@ -97,7 +101,11 @@ Standard_Boolean GEOMAlgo_GluerAlgo::CheckGeometry() const
//function : SetContext //function : SetContext
//purpose : //purpose :
//======================================================================= //=======================================================================
#if OCC_VERSION_LARGE > 0x06070100
void GEOMAlgo_GluerAlgo::SetContext(const Handle(IntTools_Context)& theContext)
#else
void GEOMAlgo_GluerAlgo::SetContext(const Handle(BOPInt_Context)& theContext) void GEOMAlgo_GluerAlgo::SetContext(const Handle(BOPInt_Context)& theContext)
#endif
{ {
myContext=theContext; myContext=theContext;
} }
@ -105,7 +113,11 @@ void GEOMAlgo_GluerAlgo::SetContext(const Handle(BOPInt_Context)& theContext)
//function : Context //function : Context
//purpose : //purpose :
//======================================================================= //=======================================================================
#if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& GEOMAlgo_GluerAlgo::Context()
#else
const Handle(BOPInt_Context)& GEOMAlgo_GluerAlgo::Context() const Handle(BOPInt_Context)& GEOMAlgo_GluerAlgo::Context()
#endif
{ {
return myContext; return myContext;
} }
@ -141,6 +153,10 @@ void GEOMAlgo_GluerAlgo::Clear()
void GEOMAlgo_GluerAlgo::Perform() void GEOMAlgo_GluerAlgo::Perform()
{ {
if (myContext.IsNull()) { if (myContext.IsNull()) {
#if OCC_VERSION_LARGE > 0x06070100
myContext=new IntTools_Context;
#else
myContext=new BOPInt_Context; myContext=new BOPInt_Context;
#endif
} }
} }

View File

@ -27,12 +27,18 @@
#ifndef _GEOMAlgo_GluerAlgo_HeaderFile #ifndef _GEOMAlgo_GluerAlgo_HeaderFile
#define _GEOMAlgo_GluerAlgo_HeaderFile #define _GEOMAlgo_GluerAlgo_HeaderFile
#include <Basics_OCCTVersion.hxx>
#include <Standard_Macro.hxx> #include <Standard_Macro.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <Standard_Real.hxx> #include <Standard_Real.hxx>
#include <Standard_Boolean.hxx> #include <Standard_Boolean.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <IntTools_Context.hxx>
#else
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#endif
#include <TopTools_DataMapOfShapeListOfShape.hxx> #include <TopTools_DataMapOfShapeListOfShape.hxx>
#include <TopTools_DataMapOfShapeShape.hxx> #include <TopTools_DataMapOfShapeShape.hxx>
@ -74,10 +80,18 @@ public:
virtual void Clear() ; virtual void Clear() ;
Standard_EXPORT Standard_EXPORT
#if OCC_VERSION_LARGE > 0x06070100
void SetContext(const Handle(IntTools_Context)&) ;
#else
void SetContext(const Handle(BOPInt_Context)&) ; void SetContext(const Handle(BOPInt_Context)&) ;
#endif
Standard_EXPORT Standard_EXPORT
#if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& Context() ;
#else
const Handle(BOPInt_Context)& Context() ; const Handle(BOPInt_Context)& Context() ;
#endif
Standard_EXPORT Standard_EXPORT
const TopTools_DataMapOfShapeListOfShape& Images() const; const TopTools_DataMapOfShapeListOfShape& Images() const;
@ -89,7 +103,11 @@ protected:
TopoDS_Shape myArgument; TopoDS_Shape myArgument;
Standard_Real myTolerance; Standard_Real myTolerance;
Standard_Boolean myCheckGeometry; Standard_Boolean myCheckGeometry;
#if OCC_VERSION_LARGE > 0x06070100
Handle(IntTools_Context) myContext;
#else
Handle(BOPInt_Context) myContext; Handle(BOPInt_Context) myContext;
#endif
TopTools_DataMapOfShapeListOfShape myImages; TopTools_DataMapOfShapeListOfShape myImages;
TopTools_DataMapOfShapeShape myOrigins; TopTools_DataMapOfShapeShape myOrigins;

View File

@ -26,6 +26,8 @@
#include <GEOMAlgo_RemoverWebs.hxx> #include <GEOMAlgo_RemoverWebs.hxx>
#include <GEOMAlgo_ShapeAlgo.hxx> #include <GEOMAlgo_ShapeAlgo.hxx>
#include <Basics_OCCTVersion.hxx>
#include <TopoDS_Iterator.hxx> #include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx> #include <TopoDS_Solid.hxx>
@ -35,7 +37,11 @@
#include <BRepClass3d_SolidClassifier.hxx> #include <BRepClass3d_SolidClassifier.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <IntTools_Context.hxx>
#else
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#endif
#include <BOPAlgo_BuilderSolid.hxx> #include <BOPAlgo_BuilderSolid.hxx>
@ -102,7 +108,11 @@ void GEOMAlgo_RemoverWebs::Perform()
if (!myContext.IsNull()) { if (!myContext.IsNull()) {
myContext.Nullify(); myContext.Nullify();
} }
#if OCC_VERSION_LARGE > 0x06070100
myContext=new IntTools_Context;
#else
myContext=new BOPInt_Context; myContext=new BOPInt_Context;
#endif
// //
BuildSolid(); BuildSolid();
// //
@ -247,9 +257,11 @@ void GEOMAlgo_RemoverWebs::AddInternalShapes(const BOPCol_ListOfShape& aLSR,
TopoDS_Solid aSd; TopoDS_Solid aSd;
BRep_Builder aBB; BRep_Builder aBB;
BOPCol_ListIteratorOfListOfShape aItLS; BOPCol_ListIteratorOfListOfShape aItLS;
Handle(BOPInt_Context) aCtx; #if OCC_VERSION_LARGE > 0x06070100
// Handle(IntTools_Context) aCtx=new IntTools_Context;
aCtx=new BOPInt_Context; #else
Handle(BOPInt_Context) aCtx=new BOPInt_Context;
#endif
// //
aNbSI=aMSI.Extent(); aNbSI=aMSI.Extent();
for (i=1; i<=aNbSI; ++i) { for (i=1; i<=aNbSI; ++i) {

View File

@ -26,7 +26,11 @@
// <pkv@irinox> // <pkv@irinox>
// //
#include <GEOMAlgo_ShapeAlgo.hxx> #include <GEOMAlgo_ShapeAlgo.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <IntTools_Context.hxx>
#else
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#endif
//======================================================================= //=======================================================================
//function : GEOMAlgo_ShapeAlgo //function : GEOMAlgo_ShapeAlgo
@ -50,7 +54,11 @@ GEOMAlgo_ShapeAlgo::~GEOMAlgo_ShapeAlgo()
//function : SetContext //function : SetContext
//purpose : //purpose :
//======================================================================= //=======================================================================
#if OCC_VERSION_LARGE > 0x06070100
void GEOMAlgo_ShapeAlgo::SetContext(const Handle(IntTools_Context)& theContext)
#else
void GEOMAlgo_ShapeAlgo::SetContext(const Handle(BOPInt_Context)& theContext) void GEOMAlgo_ShapeAlgo::SetContext(const Handle(BOPInt_Context)& theContext)
#endif
{ {
myContext=theContext; myContext=theContext;
} }
@ -58,7 +66,11 @@ void GEOMAlgo_ShapeAlgo::SetContext(const Handle(BOPInt_Context)& theContext)
//function : Context //function : Context
//purpose : //purpose :
//======================================================================= //=======================================================================
#if OCC_VERSION_LARGE > 0x06070100
const Handle(IntTools_Context)& GEOMAlgo_ShapeAlgo::Context()const
#else
const Handle(BOPInt_Context)& GEOMAlgo_ShapeAlgo::Context()const const Handle(BOPInt_Context)& GEOMAlgo_ShapeAlgo::Context()const
#endif
{ {
return myContext; return myContext;
} }
@ -109,6 +121,10 @@ const TopoDS_Shape& GEOMAlgo_ShapeAlgo::Result()const
void GEOMAlgo_ShapeAlgo::Perform() void GEOMAlgo_ShapeAlgo::Perform()
{ {
if (myContext.IsNull()) { if (myContext.IsNull()) {
#if OCC_VERSION_LARGE > 0x06070100
myContext=new IntTools_Context;
#else
myContext=new BOPInt_Context; myContext=new BOPInt_Context;
#endif
} }
} }

View File

@ -28,11 +28,17 @@
#ifndef _GEOMAlgo_ShapeAlgo_HeaderFile #ifndef _GEOMAlgo_ShapeAlgo_HeaderFile
#define _GEOMAlgo_ShapeAlgo_HeaderFile #define _GEOMAlgo_ShapeAlgo_HeaderFile
#include <Basics_OCCTVersion.hxx>
#include <Standard.hxx> #include <Standard.hxx>
#include <Standard_Macro.hxx> #include <Standard_Macro.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <Standard_Real.hxx> #include <Standard_Real.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <Handle_IntTools_Context.hxx>
#else
#include <Handle_BOPInt_Context.hxx> #include <Handle_BOPInt_Context.hxx>
#endif
#include <GEOMAlgo_Algo.hxx> #include <GEOMAlgo_Algo.hxx>
//======================================================================= //=======================================================================
@ -45,11 +51,19 @@ class GEOMAlgo_ShapeAlgo : public GEOMAlgo_Algo
//! Sets cashed geometrical tools <br> //! Sets cashed geometrical tools <br>
Standard_EXPORT Standard_EXPORT
#if OCC_VERSION_LARGE > 0x06070100
void SetContext(const Handle(IntTools_Context)& theContext) ;
#else
void SetContext(const Handle(BOPInt_Context)& theContext) ; void SetContext(const Handle(BOPInt_Context)& theContext) ;
#endif
//! Returns cashed geometrical tools <br> //! Returns cashed geometrical tools <br>
Standard_EXPORT Standard_EXPORT
#if OCC_VERSION_LARGE > 0x06070100
const Handle_IntTools_Context& Context() const;
#else
const Handle_BOPInt_Context& Context() const; const Handle_BOPInt_Context& Context() const;
#endif
Standard_EXPORT Standard_EXPORT
void SetShape(const TopoDS_Shape& aS) ; void SetShape(const TopoDS_Shape& aS) ;
@ -80,6 +94,10 @@ protected:
TopoDS_Shape myShape; TopoDS_Shape myShape;
Standard_Real myTolerance; Standard_Real myTolerance;
TopoDS_Shape myResult; TopoDS_Shape myResult;
#if OCC_VERSION_LARGE > 0x06070100
Handle_IntTools_Context myContext;
#else
Handle_BOPInt_Context myContext; Handle_BOPInt_Context myContext;
#endif
}; };
#endif #endif

View File

@ -27,6 +27,8 @@
// //
#include <GEOMAlgo_ShellSolid.hxx> #include <GEOMAlgo_ShellSolid.hxx>
#include <Basics_OCCTVersion.hxx>
#include <Standard_Failure.hxx> #include <Standard_Failure.hxx>
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
@ -50,7 +52,11 @@
#include <BOPCol_DataMapOfShapeListOfShape.hxx> #include <BOPCol_DataMapOfShapeListOfShape.hxx>
#include <BOPCol_ListOfShape.hxx> #include <BOPCol_ListOfShape.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <IntTools_Context.hxx>
#else
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#endif
#include <BOPDS_DS.hxx> #include <BOPDS_DS.hxx>
#include <BOPAlgo_Builder.hxx> #include <BOPAlgo_Builder.hxx>
@ -231,7 +237,11 @@ void GEOMAlgo_ShellSolid::Perform()
return; return;
} }
// //
#if OCC_VERSION_LARGE > 0x06070100
Handle(IntTools_Context) aCtx=myDSFiller->Context();
#else
Handle(BOPInt_Context) aCtx=myDSFiller->Context(); Handle(BOPInt_Context) aCtx=myDSFiller->Context();
#endif
const BOPDS_IndexRange& aRange=pDS->Range(iRank); const BOPDS_IndexRange& aRange=pDS->Range(iRank);
aRange.Indices(iBeg, iEnd); aRange.Indices(iBeg, iEnd);
const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj); const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj);

View File

@ -27,6 +27,8 @@
// //
#include <GEOMAlgo_VertexSolid.hxx> #include <GEOMAlgo_VertexSolid.hxx>
#include <Basics_OCCTVersion.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <TopAbs_ShapeEnum.hxx> #include <TopAbs_ShapeEnum.hxx>
@ -46,7 +48,11 @@
#include <BRepClass3d_SolidClassifier.hxx> #include <BRepClass3d_SolidClassifier.hxx>
// //
#include <BOPCol_ListOfShape.hxx> #include <BOPCol_ListOfShape.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <IntTools_Context.hxx>
#else
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#endif
// //
#include <BOPDS_DS.hxx> #include <BOPDS_DS.hxx>
#include <BOPDS_IndexRange.hxx> #include <BOPDS_IndexRange.hxx>
@ -142,7 +148,11 @@ void GEOMAlgo_VertexSolid::BuildResult()
const TopoDS_Shape& aTool=aLS.Last(); const TopoDS_Shape& aTool=aLS.Last();
const TopoDS_Solid& aSolid=(myRank==0) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj); const TopoDS_Solid& aSolid=(myRank==0) ? TopoDS::Solid(aTool) : TopoDS::Solid(aObj);
// //
#if OCC_VERSION_LARGE > 0x06070100
Handle(IntTools_Context) aCtx=myDSFiller->Context();
#else
Handle(BOPInt_Context) aCtx=myDSFiller->Context(); Handle(BOPInt_Context) aCtx=myDSFiller->Context();
#endif
BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid); BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
// //
aNbRanges=aDS.NbRanges(); aNbRanges=aDS.NbRanges();

View File

@ -27,6 +27,8 @@
// //
#include <GEOMAlgo_WireSolid.hxx> #include <GEOMAlgo_WireSolid.hxx>
#include <Basics_OCCTVersion.hxx>
#include <Standard_Failure.hxx> #include <Standard_Failure.hxx>
#include <TopAbs_ShapeEnum.hxx> #include <TopAbs_ShapeEnum.hxx>
@ -38,7 +40,11 @@
#include <BOPDS_ListOfPaveBlock.hxx> #include <BOPDS_ListOfPaveBlock.hxx>
#include <BOPDS_PaveBlock.hxx> #include <BOPDS_PaveBlock.hxx>
#include <TopoDS_Solid.hxx> #include <TopoDS_Solid.hxx>
#if OCC_VERSION_LARGE > 0x06070100
#include <IntTools_Context.hxx>
#else
#include <BOPInt_Context.hxx> #include <BOPInt_Context.hxx>
#endif
#include <BRepClass3d_SolidClassifier.hxx> #include <BRepClass3d_SolidClassifier.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BOPTools_AlgoTools.hxx> #include <BOPTools_AlgoTools.hxx>
@ -144,7 +150,11 @@ void GEOMAlgo_WireSolid::BuildResult()
const TopoDS_Solid& aSolid=(iRank==0) ? *((TopoDS_Solid*)&aTool) : const TopoDS_Solid& aSolid=(iRank==0) ? *((TopoDS_Solid*)&aTool) :
*((TopoDS_Solid*)&aObj); *((TopoDS_Solid*)&aObj);
// //
#if OCC_VERSION_LARGE > 0x06070100
Handle(IntTools_Context) aCtx=myDSFiller->Context();
#else
Handle(BOPInt_Context) aCtx=myDSFiller->Context(); Handle(BOPInt_Context) aCtx=myDSFiller->Context();
#endif
//BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid); //BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid);
// //
const BOPDS_IndexRange& aRange=pDS->Range(iRank); const BOPDS_IndexRange& aRange=pDS->Range(iRank);

View File

@ -172,16 +172,28 @@ namespace
const uchar* aImageBytes = anImage.bits(); const uchar* aImageBytes = anImage.bits();
for ( int aLine = anImage.height() - 1; aLine >= 0; --aLine ) { for ( int aLine = anImage.height() - 1; aLine >= 0; --aLine ) {
Image_ColorBGRA* aPixmapBytes = aPixmap->EditData<Image_ColorBGRA>().ChangeRow(aLine); #if OCC_VERSION_LARGE > 0x06070100
// convert pixels from ARGB to renderer-compatible RGBA // convert pixels from ARGB to renderer-compatible RGBA
for ( int aByte = 0; aByte < anImage.width(); ++aByte ) { for ( int aByte = 0; aByte < anImage.width(); ++aByte ) {
Image_ColorBGRA& aPixmapBytes = aPixmap->ChangeValue<Image_ColorBGRA>(aLine, aByte);
aPixmapBytes.b() = (Standard_Byte) *aImageBytes++;
aPixmapBytes.g() = (Standard_Byte) *aImageBytes++;
aPixmapBytes.r() = (Standard_Byte) *aImageBytes++;
aPixmapBytes.a() = (Standard_Byte) *aImageBytes++;
}
#else
Image_ColorBGRA* aPixmapBytes = aPixmap->EditData<Image_ColorBGRA>().ChangeRow(aLine);
// convert pixels from ARGB to renderer-compatible RGBA
for ( int aByte = 0; aByte < anImage.width(); ++aByte ) {
aPixmapBytes->b() = (Standard_Byte) *aImageBytes++; aPixmapBytes->b() = (Standard_Byte) *aImageBytes++;
aPixmapBytes->g() = (Standard_Byte) *aImageBytes++; aPixmapBytes->g() = (Standard_Byte) *aImageBytes++;
aPixmapBytes->r() = (Standard_Byte) *aImageBytes++; aPixmapBytes->r() = (Standard_Byte) *aImageBytes++;
aPixmapBytes->a() = (Standard_Byte) *aImageBytes++; aPixmapBytes->a() = (Standard_Byte) *aImageBytes++;
aPixmapBytes++; aPixmapBytes++;
} }
#endif
} }
} }
return aPixmap; return aPixmap;

View File

@ -18,6 +18,7 @@
// //
#include "GEOM_EdgeSource.h" #include "GEOM_EdgeSource.h"
#include "OCC2VTK_internal.h"
#include <vtkObjectFactory.h> #include <vtkObjectFactory.h>
@ -42,20 +43,32 @@ vtkStandardNewMacro(GEOM_EdgeSource);
GEOM_EdgeSource::GEOM_EdgeSource() : GEOM_EdgeSource::GEOM_EdgeSource() :
myIsVector(false) myIsVector(false)
{ {
myData = new EdgeSourceInternal;
this->SetNumberOfInputPorts(0); this->SetNumberOfInputPorts(0);
} }
GEOM_EdgeSource::~GEOM_EdgeSource() GEOM_EdgeSource::~GEOM_EdgeSource()
{ {
delete myData;
} }
void GEOM_EdgeSource::AddEdge (const TopoDS_Edge& theEdge, void GEOM_EdgeSource::AddEdge (const TopoDS_Edge& theEdge,
bool theIsVector) bool theIsVector)
{ {
myEdgeSet.Add(theEdge); myData->myEdgeSet.Add(theEdge);
myIsVector = theIsVector; myIsVector = theIsVector;
} }
void GEOM_EdgeSource::Clear()
{
myData->myEdgeSet.Clear();
}
bool GEOM_EdgeSource::IsEmpty()
{
return myData->myEdgeSet.IsEmpty();
}
int GEOM_EdgeSource::RequestData(vtkInformation *vtkNotUsed(request), int GEOM_EdgeSource::RequestData(vtkInformation *vtkNotUsed(request),
vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector **vtkNotUsed(inputVector),
vtkInformationVector *outputVector) vtkInformationVector *outputVector)
@ -69,7 +82,7 @@ int GEOM_EdgeSource::RequestData(vtkInformation *vtkNotUsed(request),
aPolyData->SetPoints(aPts); aPolyData->SetPoints(aPts);
aPts->Delete(); aPts->Delete();
TEdgeSet::Iterator anIter (myEdgeSet); TEdgeSet::Iterator anIter (myData->myEdgeSet);
for (; anIter.More(); anIter.Next()) { for (; anIter.More(); anIter.Next()) {
TopoDS_Edge anEdge = anIter.Value(); TopoDS_Edge anEdge = anIter.Value();
if ( !myIsVector ) if ( !myIsVector )

View File

@ -23,24 +23,25 @@
#include "OCC2VTK.h" #include "OCC2VTK.h"
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <NCollection_Set.hxx>
typedef NCollection_Set<TopoDS_Edge> TEdgeSet;
#include <vtkPoints.h> #include <vtkPoints.h>
#include <vtkPolyDataAlgorithm.h> #include <vtkPolyDataAlgorithm.h>
class vtkPolyData; class vtkPolyData;
class EdgeSourceInternal;
class OCC2VTK_EXPORT GEOM_EdgeSource: public vtkPolyDataAlgorithm class OCC2VTK_EXPORT GEOM_EdgeSource: public vtkPolyDataAlgorithm
{ {
public: public:
vtkTypeMacro(GEOM_EdgeSource,vtkPolyDataAlgorithm); vtkTypeMacro(GEOM_EdgeSource, vtkPolyDataAlgorithm);
static GEOM_EdgeSource* New(); static GEOM_EdgeSource* New();
void AddEdge (const TopoDS_Edge& theEdge, void AddEdge (const TopoDS_Edge& theEdge,
bool theIsVector = false); bool theIsVector = false);
void Clear(){ myEdgeSet.Clear();} void Clear();
bool IsEmpty();
void SetVectorMode(bool); void SetVectorMode(bool);
@ -52,16 +53,13 @@ public:
vtkPoints* thePts, vtkPoints* thePts,
bool theIsVector = false); bool theIsVector = false);
bool IsEmpty(){return myEdgeSet.IsEmpty();}
protected: protected:
TEdgeSet myEdgeSet; EdgeSourceInternal* myData;
// The <myIsVector> flag is common for all edges, because the shape, // The <myIsVector> flag is common for all edges, because the shape,
// representing a vector, can have only one edge. // representing a vector, can have only one edge.
bool myIsVector, myIsVectorMode; bool myIsVector, myIsVectorMode;
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*);
GEOM_EdgeSource(); GEOM_EdgeSource();
~GEOM_EdgeSource(); ~GEOM_EdgeSource();
@ -72,5 +70,4 @@ private:
void operator=(const GEOM_EdgeSource&); void operator=(const GEOM_EdgeSource&);
}; };
#endif //GEOM_EDGESOURCE_H #endif //GEOM_EDGESOURCE_H

View File

@ -18,6 +18,7 @@
// //
#include "GEOM_FaceSource.h" #include "GEOM_FaceSource.h"
#include "OCC2VTK_internal.h"
#include <vtkObjectFactory.h> #include <vtkObjectFactory.h>
@ -29,18 +30,34 @@
GEOM_FaceSource::GEOM_FaceSource() GEOM_FaceSource::GEOM_FaceSource()
{ {
myData = new FaceSourceInternal;
this->SetNumberOfInputPorts(0); this->SetNumberOfInputPorts(0);
} }
GEOM_FaceSource::~GEOM_FaceSource() GEOM_FaceSource::~GEOM_FaceSource()
{ {
delete myData;
} }
void void
GEOM_FaceSource:: GEOM_FaceSource::
AddFace(const TopoDS_Face& theFace) AddFace(const TopoDS_Face& theFace)
{ {
myFaceSet.Add(theFace); myData->myFaceSet.Add(theFace);
}
void
GEOM_FaceSource::
Clear()
{
myData->myFaceSet.Clear();
}
bool
GEOM_FaceSource::
IsEmpty()
{
return myData->myFaceSet.IsEmpty();
} }
void void

View File

@ -24,14 +24,12 @@
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <NCollection_Set.hxx>
typedef NCollection_Set<TopoDS_Face> TFaceSet;
#include <vtkPoints.h> #include <vtkPoints.h>
#include <vtkPolyDataAlgorithm.h> #include <vtkPolyDataAlgorithm.h>
class vtkPolyData; class vtkPolyData;
class FaceSourceInternal;
class OCC2VTK_EXPORT GEOM_FaceSource: public vtkPolyDataAlgorithm class OCC2VTK_EXPORT GEOM_FaceSource: public vtkPolyDataAlgorithm
{ {
@ -39,11 +37,11 @@ public:
vtkTypeMacro(GEOM_FaceSource,vtkPolyDataAlgorithm); vtkTypeMacro(GEOM_FaceSource,vtkPolyDataAlgorithm);
void AddFace(const TopoDS_Face& theFace); void AddFace(const TopoDS_Face& theFace);
void Clear(){ myFaceSet.Clear();} void Clear();
bool IsEmpty(){return myFaceSet.IsEmpty();} bool IsEmpty();
protected: protected:
TFaceSet myFaceSet; FaceSourceInternal* myData;
static static
void MoveTo(gp_Pnt thePnt, void MoveTo(gp_Pnt thePnt,

View File

@ -18,6 +18,7 @@
// //
#include "GEOM_ShadingFace.h" #include "GEOM_ShadingFace.h"
#include "OCC2VTK_internal.h"
#include <vtkObjectFactory.h> #include <vtkObjectFactory.h>
@ -57,7 +58,7 @@ int GEOM_ShadingFace::RequestData(vtkInformation *vtkNotUsed(request),
aPolyData->SetPoints(aPts); aPolyData->SetPoints(aPts);
aPts->Delete(); aPts->Delete();
TFaceSet::Iterator anIter(myFaceSet); TFaceSet::Iterator anIter(myData->myFaceSet);
for(; anIter.More(); anIter.Next()){ for(; anIter.More(); anIter.Next()){
const TopoDS_Face& aFace = anIter.Value(); const TopoDS_Face& aFace = anIter.Value();
OCC2VTK(aFace,aPolyData,aPts); OCC2VTK(aFace,aPolyData,aPts);

View File

@ -18,6 +18,7 @@
// //
#include "GEOM_VertexSource.h" #include "GEOM_VertexSource.h"
#include "OCC2VTK_internal.h"
#include <vtkObjectFactory.h> #include <vtkObjectFactory.h>
@ -35,18 +36,27 @@ vtkStandardNewMacro(GEOM_VertexSource);
GEOM_VertexSource::GEOM_VertexSource() GEOM_VertexSource::GEOM_VertexSource()
{ {
myData = new VertexSourceInternal;
this->SetNumberOfInputPorts(0); this->SetNumberOfInputPorts(0);
} }
GEOM_VertexSource::~GEOM_VertexSource() GEOM_VertexSource::~GEOM_VertexSource()
{ {
delete myData;
} }
void void
GEOM_VertexSource:: GEOM_VertexSource::
AddVertex(const TopoDS_Vertex& theVertex) AddVertex(const TopoDS_Vertex& theVertex)
{ {
myVertexSet.Add(theVertex); myData->myVertexSet.Add(theVertex);
}
void
GEOM_VertexSource::
Clear()
{
myData->myVertexSet.Clear();
} }
int GEOM_VertexSource::RequestData(vtkInformation *vtkNotUsed(request), int GEOM_VertexSource::RequestData(vtkInformation *vtkNotUsed(request),
@ -62,7 +72,7 @@ int GEOM_VertexSource::RequestData(vtkInformation *vtkNotUsed(request),
aPolyData->SetPoints(aPts); aPolyData->SetPoints(aPts);
aPts->Delete(); aPts->Delete();
TVertexSet::Iterator anIter(myVertexSet); TVertexSet::Iterator anIter(myData->myVertexSet);
for(; anIter.More(); anIter.Next()){ for(; anIter.More(); anIter.Next()){
const TopoDS_Vertex& aVertex = anIter.Value(); const TopoDS_Vertex& aVertex = anIter.Value();
OCC2VTK(aVertex,aPolyData,aPts); OCC2VTK(aVertex,aPolyData,aPts);

View File

@ -23,14 +23,12 @@
#include "OCC2VTK.h" #include "OCC2VTK.h"
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <NCollection_Set.hxx>
typedef NCollection_Set<TopoDS_Vertex> TVertexSet;
#include <vtkPoints.h> #include <vtkPoints.h>
#include <vtkPolyDataAlgorithm.h> #include <vtkPolyDataAlgorithm.h>
class vtkPolyData; class vtkPolyData;
class VertexSourceInternal;
class OCC2VTK_EXPORT GEOM_VertexSource: public vtkPolyDataAlgorithm class OCC2VTK_EXPORT GEOM_VertexSource: public vtkPolyDataAlgorithm
{ {
@ -39,7 +37,7 @@ public:
static GEOM_VertexSource* New(); static GEOM_VertexSource* New();
void AddVertex(const TopoDS_Vertex& theVertex); void AddVertex(const TopoDS_Vertex& theVertex);
void Clear(){ myVertexSet.Clear();} void Clear();
static static
void OCC2VTK(const TopoDS_Vertex& theVertex, void OCC2VTK(const TopoDS_Vertex& theVertex,
@ -47,7 +45,7 @@ public:
vtkPoints* thePts); vtkPoints* thePts);
protected: protected:
TVertexSet myVertexSet; VertexSourceInternal* myData;
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);

View File

@ -18,6 +18,7 @@
// //
#include "GEOM_WireframeFace.h" #include "GEOM_WireframeFace.h"
#include "OCC2VTK_internal.h"
#include <GEOMUtils_Hatcher.hxx> #include <GEOMUtils_Hatcher.hxx>
@ -63,7 +64,7 @@ int GEOM_WireframeFace::RequestData(vtkInformation *vtkNotUsed(request),
aPolyData->SetPoints(aPts); aPolyData->SetPoints(aPts);
aPts->Delete(); aPts->Delete();
TFaceSet::Iterator anIter(myFaceSet); TFaceSet::Iterator anIter(myData->myFaceSet);
for(; anIter.More(); anIter.Next()){ for(; anIter.More(); anIter.Next()){
const TopoDS_Face& aFace = anIter.Value(); const TopoDS_Face& aFace = anIter.Value();
OCC2VTK(aFace,aPolyData,aPts,NbIso,Discret); OCC2VTK(aFace,aPolyData,aPts,NbIso,Discret);

View File

@ -0,0 +1,228 @@
#ifndef OCC2VTK_INTERNAL_H
#define OCC2VTK_INTERNAL_H
#include <NCollection_BaseCollection.hxx>
#include <NCollection_BaseList.hxx>
#include <NCollection_TListNode.hxx>
#include <NCollection_TListIterator.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
template <class TheItemType> class GEOM_Set
: public NCollection_BaseCollection<TheItemType>,
public NCollection_BaseList
{
public:
typedef NCollection_TListNode<TheItemType> SetNode;
typedef NCollection_TListIterator<TheItemType> Iterator;
public:
//! Constructor
GEOM_Set(const Handle(NCollection_BaseAllocator)& theAllocator=0L) :
NCollection_BaseCollection<TheItemType>(theAllocator),
NCollection_BaseList() {}
//! Copy constructor
GEOM_Set (const GEOM_Set& theOther) :
NCollection_BaseCollection<TheItemType>(theOther.myAllocator),
NCollection_BaseList()
{ *this = theOther; }
//! Size - Number of items
virtual Standard_Integer Size (void) const
{ return Extent(); }
//! Replace this list by the items of theOther collection
virtual void Assign (const NCollection_BaseCollection<TheItemType>& theOther)
{
if (this == &theOther)
return;
Clear();
TYPENAME NCollection_BaseCollection<TheItemType>::Iterator& anIter =
theOther.CreateIterator();
for (; anIter.More(); anIter.Next())
{
SetNode* pNew = new (this->myAllocator) SetNode(anIter.Value());
PAppend (pNew);
}
}
//! Replace this list by the items of theOther Set
GEOM_Set& operator= (const GEOM_Set& theOther)
{
if (this == &theOther)
return *this;
Clear ();
SetNode * pCur = (SetNode *) theOther.PFirst();
while (pCur)
{
SetNode* pNew = new (this->myAllocator) SetNode(pCur->Value());
PAppend (pNew);
pCur = (SetNode *) pCur->Next();
}
return *this;
}
//! Clear this set
void Clear (void)
{ PClear (SetNode::delNode, this->myAllocator); }
//! Add item
Standard_Boolean Add (const TheItemType& theItem)
{
Iterator anIter(*this);
while (anIter.More())
{
if (anIter.Value() == theItem)
return Standard_False;
anIter.Next();
}
SetNode * pNew = new (this->myAllocator) SetNode(theItem);
PPrepend (pNew);
return Standard_True;
}
//! Remove item
Standard_Boolean Remove (const TheItemType& theItem)
{
Iterator anIter(*this);
while (anIter.More())
{
if (anIter.Value() == theItem)
{
PRemove (anIter, SetNode::delNode, this->myAllocator);
return Standard_True;
}
anIter.Next();
}
return Standard_False;
}
//! Remove - wrapper against 'hiding' warnings
void Remove (Iterator& theIter)
{ NCollection_BaseList::PRemove (theIter,
SetNode::delNode,
this->myAllocator); }
//! Contains - item inclusion query
Standard_Boolean Contains (const TheItemType& theItem) const
{
Iterator anIter(*this);
for (; anIter.More(); anIter.Next())
if (anIter.Value() == theItem)
return Standard_True;
return Standard_False;
}
//! IsASubset
Standard_Boolean IsASubset (const GEOM_Set& theOther)
{
if (this == &theOther)
return Standard_True;
Iterator anIter(theOther);
for (; anIter.More(); anIter.Next())
if (!Contains(anIter.Value()))
return Standard_False;
return Standard_True;
}
//! IsAProperSubset
Standard_Boolean IsAProperSubset (const GEOM_Set& theOther)
{
if (myLength <= theOther.Extent())
return Standard_False;
Iterator anIter(theOther);
for (; anIter.More(); anIter.Next())
if (!Contains(anIter.Value()))
return Standard_False;
return Standard_True;
}
//! Union
void Union (const GEOM_Set& theOther)
{
if (this == &theOther)
return;
Iterator anIter(theOther);
Iterator aMyIter;
Standard_Integer i, iLength=myLength;
for (; anIter.More(); anIter.Next())
{
Standard_Boolean isIn=Standard_False;
const TheItemType& theItem = anIter.Value();
for (aMyIter.Init(*this), i=1;
i<=iLength;
aMyIter.Next(), i++)
if (theItem == aMyIter.Value())
isIn = Standard_True;
if (!isIn)
{
SetNode * pNew = new (this->myAllocator) SetNode(theItem);
PAppend (pNew);
}
}
}
//! Intersection
void Intersection (const GEOM_Set& theOther)
{
if (this == &theOther)
return;
Iterator anIter(*this);
while (anIter.More())
if (theOther.Contains(anIter.Value()))
anIter.Next();
else
NCollection_BaseList::PRemove (anIter, SetNode::delNode, this->myAllocator);
}
//! Difference (Subtraction)
void Difference (const GEOM_Set& theOther)
{
if (this == &theOther)
return;
Iterator anIter(*this);
while (anIter.More())
if (theOther.Contains(anIter.Value()))
NCollection_BaseList::PRemove (anIter, SetNode::delNode, this->myAllocator);
else
anIter.Next();
}
//! Destructor - clears the List
~GEOM_Set (void)
{ Clear(); }
private:
//! Creates Iterator for use on BaseCollection
virtual TYPENAME NCollection_BaseCollection<TheItemType>::Iterator&
CreateIterator(void) const
{ return *(new (this->IterAllocator()) Iterator(*this)); }
};
typedef GEOM_Set<TopoDS_Vertex> TVertexSet;
typedef GEOM_Set<TopoDS_Edge> TEdgeSet;
typedef GEOM_Set<TopoDS_Face> TFaceSet;
class VertexSourceInternal
{
public:
TVertexSet myVertexSet;
};
class EdgeSourceInternal
{
public:
TEdgeSet myEdgeSet;
};
class FaceSourceInternal
{
public:
TFaceSet myFaceSet;
};
#endif // OCC2VTK_INTERNAL_H