From: vsr Date: Mon, 9 Jun 2014 08:56:21 +0000 (+0400) Subject: OCCT dev version porting (6.7.2) X-Git-Tag: V7_5_0a1~54 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=dc562ec459ca37e90b612ce81b0312ce3ff1096b;p=modules%2Fgeom.git OCCT dev version porting (6.7.2) --- diff --git a/src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx b/src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx index 3b550941d..5adf8979d 100755 --- a/src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx +++ b/src/GEOMAlgo/GEOMAlgo_AlgoTools.cxx @@ -25,6 +25,8 @@ #include +#include + #include #include #include @@ -195,7 +197,12 @@ Standard_Integer GEOMAlgo_AlgoTools::BuildPCurveForEdgeOnFace (const TopoDS_Edge& aEold, const TopoDS_Edge& aEnew, 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_Integer iRet, aNbPoints; @@ -426,7 +433,12 @@ void GEOMAlgo_AlgoTools::RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE, Standard_Boolean GEOMAlgo_AlgoTools::IsSplitToReverse (const TopoDS_Edge& aEF1, 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_Real aT1, aT2, aScPr, a, b; @@ -471,7 +483,12 @@ Standard_Boolean GEOMAlgo_AlgoTools::ProjectPointOnShape (const gp_Pnt& aP1, const TopoDS_Shape& aS, 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_Real aT2; @@ -618,7 +635,12 @@ Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes const TopTools_ListOfShape& aLE, const Standard_Real aTol, 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_Real aTol2, aD2; @@ -657,7 +679,12 @@ Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes (const TopTools_ListOfShape& aLE, const Standard_Real aTol, 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; TopTools_ListOfShape aLESD; @@ -725,7 +752,12 @@ Standard_Integer GEOMAlgo_AlgoTools::FindSDShapes Standard_Integer GEOMAlgo_AlgoTools::RefineSDShapes (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMPKLE, 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; TopTools_IndexedDataMapOfShapeListOfShape aMEE, aMSDE, aMEToAdd; diff --git a/src/GEOMAlgo/GEOMAlgo_AlgoTools.hxx b/src/GEOMAlgo/GEOMAlgo_AlgoTools.hxx index 0ba458c45..7fba7d88c 100755 --- a/src/GEOMAlgo/GEOMAlgo_AlgoTools.hxx +++ b/src/GEOMAlgo/GEOMAlgo_AlgoTools.hxx @@ -26,10 +26,18 @@ #ifndef _GEOMAlgo_AlgoTools_HeaderFile #define _GEOMAlgo_AlgoTools_HeaderFile +#include + #include #include #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#include +#else #include +#include +#endif #include #include @@ -43,8 +51,6 @@ #include #include -#include - #include #include #include @@ -88,20 +94,34 @@ class GEOMAlgo_AlgoTools { static Standard_Integer RefineSDShapes (GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape& aMSD, 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 static Standard_Integer FindSDShapes(const TopTools_ListOfShape& aLE, const Standard_Real aTol, 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 static Standard_Integer FindSDShapes(const TopoDS_Shape& aE1, const TopTools_ListOfShape& aLE, const Standard_Real aTol, 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 static void PointOnShape(const TopoDS_Shape& aS, @@ -128,7 +148,12 @@ class GEOMAlgo_AlgoTools { static Standard_Boolean ProjectPointOnShape(const gp_Pnt& aP1, const TopoDS_Shape& aS, 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 static void CorrectTolerances(const TopoDS_Shape& aShape, @@ -146,7 +171,12 @@ class GEOMAlgo_AlgoTools { Standard_EXPORT static Standard_Boolean IsSplitToReverse1 (const TopoDS_Edge& aEF1, 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 static void RefinePCurveForEdgeOnFace(const TopoDS_Edge& aE, const TopoDS_Face& aF, @@ -163,22 +193,42 @@ class GEOMAlgo_AlgoTools { Standard_EXPORT static Standard_Boolean IsSplitToReverse(const TopoDS_Edge& theSplit, 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 static Standard_Boolean IsSplitToReverse (const TopoDS_Face& theFSp, 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 static Standard_Boolean IsSplitToReverse (const TopoDS_Shape& theSp, 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 static Standard_Integer BuildPCurveForEdgeOnFace (const TopoDS_Edge& aEold, const TopoDS_Edge& aEnew, 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 diff --git a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx index 223fb7a97..c255e35b7 100644 --- a/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx +++ b/src/GEOMAlgo/GEOMAlgo_FinderShapeOn2.cxx @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -87,7 +88,11 @@ #include #include #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#else #include +#endif #include #include diff --git a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx index 11fe9e20f..7740b1e9b 100755 --- a/src/GEOMAlgo/GEOMAlgo_Gluer.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Gluer.cxx @@ -27,6 +27,7 @@ // #include +#include #include @@ -77,7 +78,11 @@ #include // #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#else #include +#endif #include #include #include diff --git a/src/GEOMAlgo/GEOMAlgo_GluerAlgo.cxx b/src/GEOMAlgo/GEOMAlgo_GluerAlgo.cxx index 259c3ed6c..257b9b6c9 100644 --- a/src/GEOMAlgo/GEOMAlgo_GluerAlgo.cxx +++ b/src/GEOMAlgo/GEOMAlgo_GluerAlgo.cxx @@ -25,7 +25,11 @@ // // #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#else #include +#endif //======================================================================= @@ -97,7 +101,11 @@ Standard_Boolean GEOMAlgo_GluerAlgo::CheckGeometry() const //function : SetContext //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) +#endif { myContext=theContext; } @@ -105,7 +113,11 @@ void GEOMAlgo_GluerAlgo::SetContext(const Handle(BOPInt_Context)& theContext) //function : Context //purpose : //======================================================================= +#if OCC_VERSION_LARGE > 0x06070100 +const Handle(IntTools_Context)& GEOMAlgo_GluerAlgo::Context() +#else const Handle(BOPInt_Context)& GEOMAlgo_GluerAlgo::Context() +#endif { return myContext; } @@ -141,6 +153,10 @@ void GEOMAlgo_GluerAlgo::Clear() void GEOMAlgo_GluerAlgo::Perform() { if (myContext.IsNull()) { +#if OCC_VERSION_LARGE > 0x06070100 + myContext=new IntTools_Context; +#else myContext=new BOPInt_Context; +#endif } } diff --git a/src/GEOMAlgo/GEOMAlgo_GluerAlgo.hxx b/src/GEOMAlgo/GEOMAlgo_GluerAlgo.hxx index 0c7eb50c9..a1258516b 100644 --- a/src/GEOMAlgo/GEOMAlgo_GluerAlgo.hxx +++ b/src/GEOMAlgo/GEOMAlgo_GluerAlgo.hxx @@ -27,12 +27,18 @@ #ifndef _GEOMAlgo_GluerAlgo_HeaderFile #define _GEOMAlgo_GluerAlgo_HeaderFile +#include + #include #include #include #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#else #include +#endif #include #include @@ -74,10 +80,18 @@ public: virtual void Clear() ; Standard_EXPORT +#if OCC_VERSION_LARGE > 0x06070100 + void SetContext(const Handle(IntTools_Context)&) ; +#else void SetContext(const Handle(BOPInt_Context)&) ; +#endif Standard_EXPORT +#if OCC_VERSION_LARGE > 0x06070100 + const Handle(IntTools_Context)& Context() ; +#else const Handle(BOPInt_Context)& Context() ; +#endif Standard_EXPORT const TopTools_DataMapOfShapeListOfShape& Images() const; @@ -89,7 +103,11 @@ protected: TopoDS_Shape myArgument; Standard_Real myTolerance; Standard_Boolean myCheckGeometry; +#if OCC_VERSION_LARGE > 0x06070100 + Handle(IntTools_Context) myContext; +#else Handle(BOPInt_Context) myContext; +#endif TopTools_DataMapOfShapeListOfShape myImages; TopTools_DataMapOfShapeShape myOrigins; diff --git a/src/GEOMAlgo/GEOMAlgo_RemoverWebs.cxx b/src/GEOMAlgo/GEOMAlgo_RemoverWebs.cxx index 94f14ff85..744017a71 100644 --- a/src/GEOMAlgo/GEOMAlgo_RemoverWebs.cxx +++ b/src/GEOMAlgo/GEOMAlgo_RemoverWebs.cxx @@ -26,6 +26,8 @@ #include #include +#include + #include #include #include @@ -35,7 +37,11 @@ #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#else #include +#endif #include @@ -102,7 +108,11 @@ void GEOMAlgo_RemoverWebs::Perform() if (!myContext.IsNull()) { myContext.Nullify(); } +#if OCC_VERSION_LARGE > 0x06070100 + myContext=new IntTools_Context; +#else myContext=new BOPInt_Context; +#endif // BuildSolid(); // @@ -247,9 +257,11 @@ void GEOMAlgo_RemoverWebs::AddInternalShapes(const BOPCol_ListOfShape& aLSR, TopoDS_Solid aSd; BRep_Builder aBB; BOPCol_ListIteratorOfListOfShape aItLS; - Handle(BOPInt_Context) aCtx; - // - aCtx=new BOPInt_Context; +#if OCC_VERSION_LARGE > 0x06070100 + Handle(IntTools_Context) aCtx=new IntTools_Context; +#else + Handle(BOPInt_Context) aCtx=new BOPInt_Context; +#endif // aNbSI=aMSI.Extent(); for (i=1; i<=aNbSI; ++i) { diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx index 13c0c464e..bc52f37bf 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.cxx @@ -26,7 +26,11 @@ // // #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#else #include +#endif //======================================================================= //function : GEOMAlgo_ShapeAlgo @@ -50,7 +54,11 @@ GEOMAlgo_ShapeAlgo::~GEOMAlgo_ShapeAlgo() //function : SetContext //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) +#endif { myContext=theContext; } @@ -58,7 +66,11 @@ void GEOMAlgo_ShapeAlgo::SetContext(const Handle(BOPInt_Context)& theContext) //function : Context //purpose : //======================================================================= +#if OCC_VERSION_LARGE > 0x06070100 +const Handle(IntTools_Context)& GEOMAlgo_ShapeAlgo::Context()const +#else const Handle(BOPInt_Context)& GEOMAlgo_ShapeAlgo::Context()const +#endif { return myContext; } @@ -109,6 +121,10 @@ const TopoDS_Shape& GEOMAlgo_ShapeAlgo::Result()const void GEOMAlgo_ShapeAlgo::Perform() { if (myContext.IsNull()) { +#if OCC_VERSION_LARGE > 0x06070100 + myContext=new IntTools_Context; +#else myContext=new BOPInt_Context; +#endif } } diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.hxx b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.hxx index a8cef9a63..8144af710 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeAlgo.hxx @@ -28,11 +28,17 @@ #ifndef _GEOMAlgo_ShapeAlgo_HeaderFile #define _GEOMAlgo_ShapeAlgo_HeaderFile +#include + #include #include #include #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#else #include +#endif #include //======================================================================= @@ -45,11 +51,19 @@ class GEOMAlgo_ShapeAlgo : public GEOMAlgo_Algo //! Sets cashed geometrical tools
Standard_EXPORT +#if OCC_VERSION_LARGE > 0x06070100 + void SetContext(const Handle(IntTools_Context)& theContext) ; +#else void SetContext(const Handle(BOPInt_Context)& theContext) ; +#endif //! Returns cashed geometrical tools
Standard_EXPORT +#if OCC_VERSION_LARGE > 0x06070100 + const Handle_IntTools_Context& Context() const; +#else const Handle_BOPInt_Context& Context() const; +#endif Standard_EXPORT void SetShape(const TopoDS_Shape& aS) ; @@ -80,6 +94,10 @@ protected: TopoDS_Shape myShape; Standard_Real myTolerance; TopoDS_Shape myResult; +#if OCC_VERSION_LARGE > 0x06070100 + Handle_IntTools_Context myContext; +#else Handle_BOPInt_Context myContext; +#endif }; #endif diff --git a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx index 454f70fdd..47499114c 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShellSolid.cxx @@ -27,6 +27,8 @@ // #include +#include + #include #include @@ -50,7 +52,11 @@ #include #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#else #include +#endif #include #include @@ -231,7 +237,11 @@ void GEOMAlgo_ShellSolid::Perform() return; } // +#if OCC_VERSION_LARGE > 0x06070100 + Handle(IntTools_Context) aCtx=myDSFiller->Context(); +#else Handle(BOPInt_Context) aCtx=myDSFiller->Context(); +#endif const BOPDS_IndexRange& aRange=pDS->Range(iRank); aRange.Indices(iBeg, iEnd); const TopoDS_Solid& aSolid=(!iRank) ? *((TopoDS_Solid*)&aTool) : *((TopoDS_Solid*)&aObj); diff --git a/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx index b7a6d9251..982e21921 100644 --- a/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_VertexSolid.cxx @@ -27,6 +27,8 @@ // #include +#include + #include #include @@ -46,7 +48,11 @@ #include // #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#else #include +#endif // #include #include @@ -142,7 +148,11 @@ void GEOMAlgo_VertexSolid::BuildResult() const TopoDS_Shape& aTool=aLS.Last(); 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(); +#endif BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid); // aNbRanges=aDS.NbRanges(); diff --git a/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx b/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx index 43de570de..958d4270f 100644 --- a/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_WireSolid.cxx @@ -27,6 +27,8 @@ // #include +#include + #include #include @@ -38,7 +40,11 @@ #include #include #include +#if OCC_VERSION_LARGE > 0x06070100 +#include +#else #include +#endif #include #include #include @@ -144,7 +150,11 @@ void GEOMAlgo_WireSolid::BuildResult() const TopoDS_Solid& aSolid=(iRank==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(); +#endif //BRepClass3d_SolidClassifier& aSC=aCtx->SolidClassifier(aSolid); // const BOPDS_IndexRange& aRange=pDS->Range(iRank); diff --git a/src/GEOMGUI/GEOM_Displayer.cxx b/src/GEOMGUI/GEOM_Displayer.cxx index 0a10553e1..4cd41a6eb 100644 --- a/src/GEOMGUI/GEOM_Displayer.cxx +++ b/src/GEOMGUI/GEOM_Displayer.cxx @@ -172,16 +172,28 @@ namespace const uchar* aImageBytes = anImage.bits(); for ( int aLine = anImage.height() - 1; aLine >= 0; --aLine ) { - Image_ColorBGRA* aPixmapBytes = aPixmap->EditData().ChangeRow(aLine); - +#if OCC_VERSION_LARGE > 0x06070100 // convert pixels from ARGB to renderer-compatible RGBA for ( int aByte = 0; aByte < anImage.width(); ++aByte ) { + Image_ColorBGRA& aPixmapBytes = aPixmap->ChangeValue(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().ChangeRow(aLine); + + // convert pixels from ARGB to renderer-compatible RGBA + for ( int aByte = 0; aByte < anImage.width(); ++aByte ) { aPixmapBytes->b() = (Standard_Byte) *aImageBytes++; aPixmapBytes->g() = (Standard_Byte) *aImageBytes++; aPixmapBytes->r() = (Standard_Byte) *aImageBytes++; aPixmapBytes->a() = (Standard_Byte) *aImageBytes++; aPixmapBytes++; - } + } +#endif } } return aPixmap; diff --git a/src/OCC2VTK/GEOM_EdgeSource.cxx b/src/OCC2VTK/GEOM_EdgeSource.cxx index 2ff7b91c7..0a3a41a0d 100755 --- a/src/OCC2VTK/GEOM_EdgeSource.cxx +++ b/src/OCC2VTK/GEOM_EdgeSource.cxx @@ -18,6 +18,7 @@ // #include "GEOM_EdgeSource.h" +#include "OCC2VTK_internal.h" #include @@ -42,20 +43,32 @@ vtkStandardNewMacro(GEOM_EdgeSource); GEOM_EdgeSource::GEOM_EdgeSource() : myIsVector(false) { + myData = new EdgeSourceInternal; this->SetNumberOfInputPorts(0); } GEOM_EdgeSource::~GEOM_EdgeSource() -{ +{ + delete myData; } void GEOM_EdgeSource::AddEdge (const TopoDS_Edge& theEdge, bool theIsVector) { - myEdgeSet.Add(theEdge); + myData->myEdgeSet.Add(theEdge); myIsVector = theIsVector; } +void GEOM_EdgeSource::Clear() +{ + myData->myEdgeSet.Clear(); +} + +bool GEOM_EdgeSource::IsEmpty() +{ + return myData->myEdgeSet.IsEmpty(); +} + int GEOM_EdgeSource::RequestData(vtkInformation *vtkNotUsed(request), vtkInformationVector **vtkNotUsed(inputVector), vtkInformationVector *outputVector) @@ -69,7 +82,7 @@ int GEOM_EdgeSource::RequestData(vtkInformation *vtkNotUsed(request), aPolyData->SetPoints(aPts); aPts->Delete(); - TEdgeSet::Iterator anIter (myEdgeSet); + TEdgeSet::Iterator anIter (myData->myEdgeSet); for (; anIter.More(); anIter.Next()) { TopoDS_Edge anEdge = anIter.Value(); if ( !myIsVector ) diff --git a/src/OCC2VTK/GEOM_EdgeSource.h b/src/OCC2VTK/GEOM_EdgeSource.h index 5dd753c21..da64b0a52 100755 --- a/src/OCC2VTK/GEOM_EdgeSource.h +++ b/src/OCC2VTK/GEOM_EdgeSource.h @@ -23,25 +23,26 @@ #include "OCC2VTK.h" #include -#include - -typedef NCollection_Set TEdgeSet; #include #include class vtkPolyData; +class EdgeSourceInternal; class OCC2VTK_EXPORT GEOM_EdgeSource: public vtkPolyDataAlgorithm { public: - vtkTypeMacro(GEOM_EdgeSource,vtkPolyDataAlgorithm); + vtkTypeMacro(GEOM_EdgeSource, vtkPolyDataAlgorithm); + static GEOM_EdgeSource* New(); void AddEdge (const TopoDS_Edge& theEdge, bool theIsVector = false); - void Clear(){ myEdgeSet.Clear();} + void Clear(); + bool IsEmpty(); + void SetVectorMode(bool); bool GetVectorMode(); @@ -51,17 +52,14 @@ public: vtkPolyData* thePolyData, vtkPoints* thePts, bool theIsVector = false); - - bool IsEmpty(){return myEdgeSet.IsEmpty();} - protected: - TEdgeSet myEdgeSet; + EdgeSourceInternal* myData; // The flag is common for all edges, because the shape, // representing a vector, can have only one edge. bool myIsVector, myIsVectorMode; - virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); + virtual int RequestData(vtkInformation*, vtkInformationVector**, vtkInformationVector*); GEOM_EdgeSource(); ~GEOM_EdgeSource(); @@ -72,5 +70,4 @@ private: void operator=(const GEOM_EdgeSource&); }; - #endif //GEOM_EDGESOURCE_H diff --git a/src/OCC2VTK/GEOM_FaceSource.cxx b/src/OCC2VTK/GEOM_FaceSource.cxx index 7067a7282..41c4bf547 100755 --- a/src/OCC2VTK/GEOM_FaceSource.cxx +++ b/src/OCC2VTK/GEOM_FaceSource.cxx @@ -18,6 +18,7 @@ // #include "GEOM_FaceSource.h" +#include "OCC2VTK_internal.h" #include @@ -29,19 +30,35 @@ GEOM_FaceSource::GEOM_FaceSource() { + myData = new FaceSourceInternal; this->SetNumberOfInputPorts(0); -} +} GEOM_FaceSource::~GEOM_FaceSource() { -} + delete myData; +} void GEOM_FaceSource:: 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 GEOM_FaceSource:: diff --git a/src/OCC2VTK/GEOM_FaceSource.h b/src/OCC2VTK/GEOM_FaceSource.h index cdbbf623b..8a824f8e0 100755 --- a/src/OCC2VTK/GEOM_FaceSource.h +++ b/src/OCC2VTK/GEOM_FaceSource.h @@ -24,14 +24,12 @@ #include #include -#include - -typedef NCollection_Set TFaceSet; #include #include class vtkPolyData; +class FaceSourceInternal; class OCC2VTK_EXPORT GEOM_FaceSource: public vtkPolyDataAlgorithm { @@ -39,11 +37,11 @@ public: vtkTypeMacro(GEOM_FaceSource,vtkPolyDataAlgorithm); void AddFace(const TopoDS_Face& theFace); - void Clear(){ myFaceSet.Clear();} - bool IsEmpty(){return myFaceSet.IsEmpty();} + void Clear(); + bool IsEmpty(); protected: - TFaceSet myFaceSet; + FaceSourceInternal* myData; static void MoveTo(gp_Pnt thePnt, diff --git a/src/OCC2VTK/GEOM_ShadingFace.cxx b/src/OCC2VTK/GEOM_ShadingFace.cxx index 9b56761ee..a802cbce3 100755 --- a/src/OCC2VTK/GEOM_ShadingFace.cxx +++ b/src/OCC2VTK/GEOM_ShadingFace.cxx @@ -18,6 +18,7 @@ // #include "GEOM_ShadingFace.h" +#include "OCC2VTK_internal.h" #include @@ -57,7 +58,7 @@ int GEOM_ShadingFace::RequestData(vtkInformation *vtkNotUsed(request), aPolyData->SetPoints(aPts); aPts->Delete(); - TFaceSet::Iterator anIter(myFaceSet); + TFaceSet::Iterator anIter(myData->myFaceSet); for(; anIter.More(); anIter.Next()){ const TopoDS_Face& aFace = anIter.Value(); OCC2VTK(aFace,aPolyData,aPts); diff --git a/src/OCC2VTK/GEOM_VertexSource.cxx b/src/OCC2VTK/GEOM_VertexSource.cxx index e313ff865..9df081137 100755 --- a/src/OCC2VTK/GEOM_VertexSource.cxx +++ b/src/OCC2VTK/GEOM_VertexSource.cxx @@ -18,6 +18,7 @@ // #include "GEOM_VertexSource.h" +#include "OCC2VTK_internal.h" #include @@ -34,20 +35,29 @@ vtkStandardNewMacro(GEOM_VertexSource); GEOM_VertexSource::GEOM_VertexSource() -{ +{ + myData = new VertexSourceInternal; this->SetNumberOfInputPorts(0); -} +} GEOM_VertexSource::~GEOM_VertexSource() -{ -} +{ + delete myData; +} void GEOM_VertexSource:: 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), vtkInformationVector **vtkNotUsed(inputVector), @@ -62,7 +72,7 @@ int GEOM_VertexSource::RequestData(vtkInformation *vtkNotUsed(request), aPolyData->SetPoints(aPts); aPts->Delete(); - TVertexSet::Iterator anIter(myVertexSet); + TVertexSet::Iterator anIter(myData->myVertexSet); for(; anIter.More(); anIter.Next()){ const TopoDS_Vertex& aVertex = anIter.Value(); OCC2VTK(aVertex,aPolyData,aPts); diff --git a/src/OCC2VTK/GEOM_VertexSource.h b/src/OCC2VTK/GEOM_VertexSource.h index 56122d26b..d3e64c1c8 100755 --- a/src/OCC2VTK/GEOM_VertexSource.h +++ b/src/OCC2VTK/GEOM_VertexSource.h @@ -23,14 +23,12 @@ #include "OCC2VTK.h" #include -#include - -typedef NCollection_Set TVertexSet; #include #include class vtkPolyData; +class VertexSourceInternal; class OCC2VTK_EXPORT GEOM_VertexSource: public vtkPolyDataAlgorithm { @@ -39,7 +37,7 @@ public: static GEOM_VertexSource* New(); void AddVertex(const TopoDS_Vertex& theVertex); - void Clear(){ myVertexSet.Clear();} + void Clear(); static void OCC2VTK(const TopoDS_Vertex& theVertex, @@ -47,7 +45,7 @@ public: vtkPoints* thePts); protected: - TVertexSet myVertexSet; + VertexSourceInternal* myData; virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *); diff --git a/src/OCC2VTK/GEOM_WireframeFace.cxx b/src/OCC2VTK/GEOM_WireframeFace.cxx index 8c94300f5..cf91f71e6 100755 --- a/src/OCC2VTK/GEOM_WireframeFace.cxx +++ b/src/OCC2VTK/GEOM_WireframeFace.cxx @@ -18,6 +18,7 @@ // #include "GEOM_WireframeFace.h" +#include "OCC2VTK_internal.h" #include @@ -63,7 +64,7 @@ int GEOM_WireframeFace::RequestData(vtkInformation *vtkNotUsed(request), aPolyData->SetPoints(aPts); aPts->Delete(); - TFaceSet::Iterator anIter(myFaceSet); + TFaceSet::Iterator anIter(myData->myFaceSet); for(; anIter.More(); anIter.Next()){ const TopoDS_Face& aFace = anIter.Value(); OCC2VTK(aFace,aPolyData,aPts,NbIso,Discret); diff --git a/src/OCC2VTK/OCC2VTK_internal.h b/src/OCC2VTK/OCC2VTK_internal.h new file mode 100644 index 000000000..32e2869e2 --- /dev/null +++ b/src/OCC2VTK/OCC2VTK_internal.h @@ -0,0 +1,228 @@ +#ifndef OCC2VTK_INTERNAL_H +#define OCC2VTK_INTERNAL_H + +#include +#include +#include +#include + +#include +#include +#include + +template class GEOM_Set + : public NCollection_BaseCollection, + public NCollection_BaseList +{ +public: + typedef NCollection_TListNode SetNode; + typedef NCollection_TListIterator Iterator; + +public: + //! Constructor + GEOM_Set(const Handle(NCollection_BaseAllocator)& theAllocator=0L) : + NCollection_BaseCollection(theAllocator), + NCollection_BaseList() {} + + //! Copy constructor + GEOM_Set (const GEOM_Set& theOther) : + NCollection_BaseCollection(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& theOther) + { + if (this == &theOther) + return; + Clear(); + TYPENAME NCollection_BaseCollection::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::Iterator& + CreateIterator(void) const + { return *(new (this->IterAllocator()) Iterator(*this)); } + +}; + +typedef GEOM_Set TVertexSet; +typedef GEOM_Set TEdgeSet; +typedef GEOM_Set TFaceSet; + +class VertexSourceInternal +{ +public: + TVertexSet myVertexSet; +}; + +class EdgeSourceInternal +{ +public: + TEdgeSet myEdgeSet; +}; + +class FaceSourceInternal +{ +public: + TFaceSet myFaceSet; +}; + +#endif // OCC2VTK_INTERNAL_H