]> OCCT Git - occt-copy.git/commitdiff
0025354: Intersection operation
authorpkv <pkv@opencascade.com>
Thu, 23 Oct 2014 11:11:39 +0000 (15:11 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 23 Oct 2014 12:20:54 +0000 (16:20 +0400)
I. New features:
I.1 class BOPAlgo_Section
     The class clontains the algorithm to build a result of Secton between the arguments.
     The result of Section consists of vertices and edges.
     The result of Section contains:
     1. new vertices that are subjects of V/V, E/E, E/F, F/F interferences
     2. vertices that are subjects of V/E, V/F interferences
     3. new edges that are subjects of F/F interferences
     4. edges that are Common Blocks
     5.a vertex is included in result of Section only when it is not shared
     between the edges of the result of Section

The class BOPAlgo_Section inherits the functionality of root class BOPAlgo_Builder

1.2 class BOPTest_Objects
method:
BOPAlgo_Section& BOPTest_Objects::Section()
has been added to get access to BOPAlgo_Section object

II. Changes:
II.1. class BOPAlgo_BOP
method:
void BOPAlgo_BOP::BuildSection()
has been removed
methods:
void BOPAlgo_BOP::CheckData()
void BOPAlgo_BOP::Prepare()
void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
const TopTools_ListOfShape& BOPAlgo_BOP::Generated
  (const TopoDS_Shape& theS)
have been modified to eliminate references on Section operation

II.2. class BOPAlgo_PaveFiller
method:
void BOPAlgo_PaveFiller::UpdateFaceInfo
  (BOPDS_DataMapOfPaveBlockListOfPaveBlock& theDME)
modified to prevent the usage of negative index in Data Structure

II.3. class BOPTest_Objects
static function:
Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char** a)
has been modified to use BOPAlgo_Section object instead of BOPAlgo_BOP object

static function:
Standard_Integer bbop(Draw_Interpretor& di,
                      Standard_Integer n,
                      const char** a)
has been modified to use BOPAlgo_Section object instea of BOPAlgo_BOP object

II.4. class BRepAlgoAPI_BooleanOperation
field:
myBuilder
the type has been changed from BOPAlgo_BOP* to BOPAlgo_Builder*
method:
void BRepAlgoAPI_BooleanOperation::Build()
has been modified  to use BOPAlgo_Section object

II.5. class QANewModTopOpe_Tools
method:
Standard_Boolean QANewModTopOpe_Tools::HasSameDomain(
                                                   const BOPAlgo_PBOP& theBuilder,
                                                     const TopoDS_Shape& theFace)

void QANewModTopOpe_Tools::SameDomain(
                                      const BOPAlgo_PBOP&   theBuilder,
                                      const TopoDS_Shape&   theFace,
                                      TopTools_ListOfShape& theResultList)

the type of the parameter <theBuilder> has been modified
to use BOPAlgo_Builder* instead of BOPAlgo_BOP*

II.6. The method:
const TopTools_ListOfShape& BOPAlgo_BOP::Generated
  (const TopoDS_Shape& theS)
has been removed

16 files changed:
src/BOPAlgo/BOPAlgo.cdl
src/BOPAlgo/BOPAlgo_BOP.cdl
src/BOPAlgo/BOPAlgo_BOP.cxx
src/BOPAlgo/BOPAlgo_BOP_1.cxx [deleted file]
src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx
src/BOPAlgo/BOPAlgo_Section.cdl [new file with mode: 0644]
src/BOPAlgo/BOPAlgo_Section.cxx [new file with mode: 0644]
src/BOPAlgo/FILES
src/BOPTest/BOPTest_BOPCommands.cxx
src/BOPTest/BOPTest_Objects.cdl
src/BOPTest/BOPTest_Objects.cxx
src/BOPTest/BOPTest_PartitionCommands.cxx
src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cdl
src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx
src/QANewModTopOpe/QANewModTopOpe_Tools.cdl
src/QANewModTopOpe/QANewModTopOpe_Tools.cxx

index 15a6c037f2d68da297c8b07d24d5c48c178e7bc7..567bb832ad0efe219904e2ef06ca5799abc0528c 100644 (file)
@@ -62,7 +62,8 @@ is
     deferred class BuilderShape; 
     class PaveFiller;
     class Builder; 
-    class BOP; 
+    class BOP;   
+    class Section;   
     -- 
     deferred class BuilderArea;
     class BuilderFace;
@@ -80,7 +81,8 @@ is
     --  pointers
     --
     pointer PPaveFiller to PaveFiller from BOPAlgo; 
-    pointer PWireEdgeSet to WireEdgeSet from BOPAlgo; 
+    pointer PWireEdgeSet to WireEdgeSet from BOPAlgo;  
+    pointer PSection to Section from BOPAlgo;   
     pointer PBOP to BOP from BOPAlgo;  
     pointer PBuilder to Builder from BOPAlgo;  
     pointer PArgumentAnalyzer to ArgumentAnalyzer from BOPAlgo;  
index 1fe72071994b41424c1e8f5d0890132e8e30b5d6..7fa98aef44144d6e89279ff2e6519f268a9f83f0 100644 (file)
@@ -12,7 +12,6 @@
 -- Alternatively, this file may be used under the terms of Open CASCADE
 -- commercial license or contractual agreement. 
 
---BOPAlgo_BOP.cdl
  
 class BOP from BOPAlgo  
     inherits Builder from BOPAlgo
@@ -71,13 +70,13 @@ is
     ---Purpose:  Provides preparing actions 
 
     PerformInternal1(me:out; 
-        thePF:PaveFiller from BOPAlgo) 
+            thePF:PaveFiller from BOPAlgo) 
         is redefined protected;   
     ---Purpose:  Performs calculations using prepared Filler 
     --           object <thePF>                 
      
     BuildResult(me:out; 
-        theType: ShapeEnum from TopAbs) 
+            theType: ShapeEnum from TopAbs) 
         is redefined protected;     
      
     BuildShape(me:out) 
@@ -88,26 +87,13 @@ is
  
     BuildSolid(me:out) 
         is protected; 
-        
-    BuildSection(me:out) 
-        is protected;  
  
     IsBoundSplits(me:out; 
             theS:Shape from TopoDS; 
             theMEF:out IndexedDataMapOfShapeListOfShape from BOPCol)  
         returns Boolean from Standard
         is protected;
-
-    Generated (me:out;  
-            theS : Shape from TopoDS) 
-        returns ListOfShape from TopTools
-        is redefined; 
-    ---C++: return const & 
-    ---Purpose: Returns the  list of shapes generated from the
-    --          shape theS. 
-   
-      
-
 fields 
     myOperation : Operation from BOPAlgo   is protected; 
     myDims      : Integer from Standard[2] is protected;  
index c8e7a75df58402a63bb048e1f9921a13849aebf9..3f94e9b183ca30a0471c0d699213c53186e64004 100644 (file)
@@ -140,15 +140,26 @@ void BOPAlgo_BOP::CheckData()
   //
   myErrorStatus=0;
   //
+  if (!(myOperation==BOPAlgo_COMMON ||
+        myOperation==BOPAlgo_FUSE || 
+        myOperation==BOPAlgo_CUT|| 
+        myOperation==BOPAlgo_CUT21)) {
+    // non-licit operation
+    myErrorStatus=14;
+    return;
+  }
+  //
   aNbArgs=myArguments.Extent();
   if (!aNbArgs) {
-    myErrorStatus=100; // invalid number of Arguments
+    // invalid number of Arguments
+    myErrorStatus=100; 
     return;
   }
   //
   aNbTools=myTools.Extent();
-  if (!aNbTools) {
-    myErrorStatus=100; // invalid number of Tools
+  if (!aNbTools) { 
+    // invalid number of Tools
+    myErrorStatus=100;
     return;
   }
   //
@@ -162,6 +173,9 @@ void BOPAlgo_BOP::CheckData()
     return;
   }
   //
+  // myDims
+  myDims[0]=-1;
+  myDims[1]=-1;
   for (i=0; i<2; ++i) {
     const BOPCol_ListOfShape& aLS=(!i)? myArguments : myTools;
     aItLS.Initialize(aLS);
@@ -174,7 +188,8 @@ void BOPAlgo_BOP::CheckData()
       //
       iDim=BOPTools_AlgoTools::Dimension(aS);
       if (iDim<0) {
-        myErrorStatus=13; // non-homogenious argument
+        // non-homogenious argument
+        myErrorStatus=13; 
         return;
       }
       //
@@ -183,28 +198,27 @@ void BOPAlgo_BOP::CheckData()
         continue;
       }
       //
-      if (iDim!=myDims[i]) {
-        myErrorStatus=13; // non-homogenious argument
+      if (iDim!=myDims[i]) { 
+        // non-homogenious argument
+        myErrorStatus=13;
         return;
       }
     }
   }
   //
-  if (myOperation==BOPAlgo_UNKNOWN) {
-    myErrorStatus=14; // non-licit operation
-    return;
-  }
-  else if (myDims[0]<myDims[1]) {
+  if (myDims[0]<myDims[1]) {
     if (myOperation==BOPAlgo_FUSE ||
-        myOperation==BOPAlgo_CUT21) {
-      myErrorStatus=14; // non-licit operation for the arguments
+        myOperation==BOPAlgo_CUT21) { 
+      // non-licit operation for the arguments
+      myErrorStatus=14;
       return;
     }
   }
   else if (myDims[0]>myDims[1]) {
     if (myOperation==BOPAlgo_FUSE ||
         myOperation==BOPAlgo_CUT) {
-      myErrorStatus=14; // non-licit operation for the arguments
+      // non-licit operation for the arguments
+      myErrorStatus=14; 
       return;
     }
   }
@@ -258,8 +272,6 @@ void BOPAlgo_BOP::Prepare()
       }
         break;
         //
-      case BOPAlgo_COMMON:
-      case BOPAlgo_SECTION:
       default:
         break;
       }
@@ -388,31 +400,23 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
   if (myErrorStatus) {
     return;
   }
-  
+  //
   BuildResult(TopAbs_EDGE);
   if (myErrorStatus) {
     return;
   }
-  //-------------------------------- SECTION 
-  if (myOperation==BOPAlgo_SECTION) {
-    BuildSection();
-    PrepareHistory();
-    PostTreat();
-    return;
-  }
-  //-------------------------------- 
   //
   // 3.3 Wires
   FillImagesContainers(TopAbs_WIRE);
   if (myErrorStatus) {
     return;
   }
-  
+  //
   BuildResult(TopAbs_WIRE);
   if (myErrorStatus) {
     return;
   }
-  
+  //
   // 3.4 Faces
   FillImagesFaces();
   if (myErrorStatus) {
@@ -423,43 +427,46 @@ void BOPAlgo_BOP::PerformInternal1(const BOPAlgo_PaveFiller& theFiller)
   if (myErrorStatus) {
     return;
   }
+  //
   // 3.5 Shells
-  
   FillImagesContainers(TopAbs_SHELL);
   if (myErrorStatus) {
     return;
   }
-  
+  //
   BuildResult(TopAbs_SHELL);
   if (myErrorStatus) {
     return;
   }
+  //
   // 3.6 Solids
   FillImagesSolids();
   if (myErrorStatus) {
     return;
   }
-  
+  //
   BuildResult(TopAbs_SOLID);
   if (myErrorStatus) {
     return;
   }
+  //
   // 3.7 CompSolids
   FillImagesContainers(TopAbs_COMPSOLID);
   if (myErrorStatus) {
     return;
   }
-  
+  //
   BuildResult(TopAbs_COMPSOLID);
   if (myErrorStatus) {
     return;
   }
+  //
   // 3.8 Compounds
   FillImagesCompounds();
   if (myErrorStatus) {
     return;
   }
-  
+  //
   BuildResult(TopAbs_COMPOUND);
   if (myErrorStatus) {
     return;
@@ -964,7 +971,7 @@ void BOPAlgo_BOP::BuildSolid()
   myShape=aRC;
 }
 //=======================================================================
-//function : IsBoundImages
+//function : IsBoundSplits
 //purpose  : 
 //=======================================================================
 Standard_Boolean BOPAlgo_BOP::IsBoundSplits
diff --git a/src/BOPAlgo/BOPAlgo_BOP_1.cxx b/src/BOPAlgo/BOPAlgo_BOP_1.cxx
deleted file mode 100644 (file)
index 0134e44..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-// Created by: Peter KURNEV
-// Copyright (c) 1999-2014 OPEN CASCADE SAS
-//
-// This file is part of Open CASCADE Technology software library.
-//
-// This library is free software; you can redistribute it and/or modify it under
-// the terms of the GNU Lesser General Public License version 2.1 as published
-// by the Free Software Foundation, with special exception defined in the file
-// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-// distribution for complete text of the license and disclaimer of any warranty.
-//
-// Alternatively, this file may be used under the terms of Open CASCADE
-// commercial license or contractual agreement.
-
-#include <BOPAlgo_BOP.ixx>
-
-#include <BOPDS_DS.hxx>
-#include <BOPDS_PaveBlock.hxx>
-#include <BOPDS_CommonBlock.hxx>
-#include <BOPDS_FaceInfo.hxx>
-#include <BOPDS_ListOfPaveBlock.hxx>
-#include <BOPDS_MapOfPaveBlock.hxx>
-#include <BOPDS_VectorOfListOfPaveBlock.hxx>
-#include <BOPDS_VectorOfFaceInfo.hxx>
-
-#include <BOPTools.hxx>
-#include <BOPTools_AlgoTools.hxx>
-
-#include <BOPCol_MapOfShape.hxx>
-
-#include <BRep_Builder.hxx>
-#include <TopExp_Explorer.hxx>
-
-
-//=======================================================================
-//function : BuildSection
-//purpose  : 
-//=======================================================================
-void BOPAlgo_BOP::BuildSection()
-{
-
-  Standard_Integer i, j, k, nE, nF1, nF2, aNbPB, aNbFF;
-  Standard_Boolean bFlag;
-  TopoDS_Shape aRC;
-  BRep_Builder aBB;
-  BOPCol_MapOfShape aME;
-  BOPCol_IndexedMapOfShape aME1, aME2;
-  //
-  myErrorStatus=0;
-  //
-  BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);  
-  BOPDS_VectorOfInterfFF& aFFs=myDS->InterfFF();
-  aNbFF=aFFs.Extent();
-  //
-  for (i=0; i<aNbFF; ++i) {
-    BOPDS_InterfFF& aFF=aFFs(i);
-    aFF.Indices(nF1, nF2);
-    const BOPDS_FaceInfo& aFI1=myDS->FaceInfo(nF1);
-    const BOPDS_FaceInfo& aFI2=myDS->FaceInfo(nF2);
-    //
-    const BOPDS_IndexedMapOfPaveBlock& aMPBIn1=aFI1.PaveBlocksIn();
-    const BOPDS_IndexedMapOfPaveBlock& aMPBOn1=aFI1.PaveBlocksOn();
-    const BOPDS_IndexedMapOfPaveBlock& aMPBSc1=aFI1.PaveBlocksSc();
-    //
-    const BOPDS_IndexedMapOfPaveBlock& aMPBIn2=aFI2.PaveBlocksIn();
-    const BOPDS_IndexedMapOfPaveBlock& aMPBOn2=aFI2.PaveBlocksOn();
-    //
-    //1. Section edges
-    aNbPB = aMPBSc1.Extent();
-    for (j=1; j<=aNbPB; ++j) {
-      const Handle(BOPDS_PaveBlock)& aPB=aMPBSc1(j);
-      nE=aPB->Edge();
-      const TopoDS_Shape& aE=myDS->Shape(nE);
-      if (aME.Add(aE)) {
-        aBB.Add(aRC, aE);
-      }
-    }
-    //2. Common edges
-    BOPDS_IndexedMapOfPaveBlock aMPB[4] = {aMPBOn2, aMPBIn1, aMPBIn2, aMPBOn1};
-    for (k = 0; k < 3; ++k) {
-      aNbPB = aMPB[k].Extent();
-      for (j=1; j<=aNbPB; ++j) {
-        const Handle(BOPDS_PaveBlock)& aPB=aMPB[k](j);
-        bFlag = (k==0) ? aMPB[3].Contains(aPB) :
-          (aMPB[k-1].Contains(aPB) || aMPB[k+1].Contains(aPB));
-        if (bFlag) {
-          nE=aPB->Edge();
-          const TopoDS_Shape& aE=myDS->Shape(nE);
-          if (aME.Add(aE)) {
-            aBB.Add(aRC, aE);
-          }
-        }
-      }
-    }
-    //3. Shared edges
-    aME1.Clear();
-    aME2.Clear();
-    //
-    const TopoDS_Face& aF1=(*(TopoDS_Face *)(&myDS->Shape(nF1)));
-    const TopoDS_Face& aF2=(*(TopoDS_Face *)(&myDS->Shape(nF2)));
-    //
-    BOPTools::MapShapes(aF1, TopAbs_EDGE, aME1);
-    BOPTools::MapShapes(aF2, TopAbs_EDGE, aME2);
-    //
-    aNbPB = aME1.Extent();
-    for (j=1; j<=aNbPB; ++j) {
-      const TopoDS_Shape& aE = aME1(j);
-      if (aME2.Contains(aE)) {
-        if (aME.Add(aE)) {
-          aBB.Add(aRC, aE);
-        }
-      }
-    }
-  }
-  //
-  myShape=aRC;
-}
-//=======================================================================
-//function : Generated
-//purpose  : 
-//=======================================================================
-const TopTools_ListOfShape& BOPAlgo_BOP::Generated
-  (const TopoDS_Shape& theS)
-{
-  myHistShapes.Clear();
-  if (theS.IsNull() || (myOperation != BOPAlgo_SECTION)) {
-    return myHistShapes;
-  }
-  //
-  TopAbs_ShapeEnum aType = theS.ShapeType();
-  if (aType != TopAbs_FACE) {
-    return myHistShapes;
-  }
-  //
-  Standard_Integer nS = myDS->Index(theS);
-  if (nS < 0) {
-    return myHistShapes;
-  }
-  //
-  if (!myDS->HasFaceInfo(nS)) {
-    return myHistShapes;
-  }
-  //
-  //collect section edges of the face theS
-  Standard_Integer i, aNb, nSp;
-  //
-  const BOPDS_FaceInfo& aFI = myDS->FaceInfo(nS);
-  const BOPDS_IndexedMapOfPaveBlock& aMPBSc = aFI.PaveBlocksSc();
-  aNb = aMPBSc.Extent();
-  for (i = 1; i <= aNb; ++i) {
-    const Handle(BOPDS_PaveBlock)& aPB = aMPBSc(i);
-    nSp = aPB->Edge();
-    const TopoDS_Shape& aSp = myDS->Shape(nSp);
-    myHistShapes.Append(aSp);
-  }
-  //
-  return myHistShapes;
-}
-
index 9807828d365b9520e1dc65a1c57f93980e85addf..116160be9c01e497fd6cf21163ff5b676cb6acea 100644 (file)
@@ -698,7 +698,6 @@ Standard_Integer BOPAlgo_PaveFiller::PostTreatFF
   aPF.Perform();
   iErr=aPF.ErrorStatus();
   if (iErr) {
-    //iRet=1; //PKVft
     return iRet;
   }
   aPDS=aPF.PDS();
@@ -940,6 +939,9 @@ void BOPAlgo_PaveFiller::UpdateFaceInfo
     for (j=0; j<aNbP; ++j) {
       const BOPDS_Point& aNP=aVNP(j);
       nV1=aNP.Index();
+      if (nV1<0) {
+        continue;
+      }
       aFI1.ChangeVerticesSc().Add(nV1);
       aFI2.ChangeVerticesSc().Add(nV1);
     }
diff --git a/src/BOPAlgo/BOPAlgo_Section.cdl b/src/BOPAlgo/BOPAlgo_Section.cdl
new file mode 100644 (file)
index 0000000..177cf81
--- /dev/null
@@ -0,0 +1,75 @@
+-- Created by: Peter KURNEV
+-- Copyright (c) 1999-2014 OPEN CASCADE SAS
+--
+-- This file is part of Open CASCADE Technology software library.
+--
+-- This library is free software; you can redistribute it and/or modify it under
+-- the terms of the GNU Lesser General Public License version 2.1 as published
+-- by the Free Software Foundation, with special exception defined in the file
+-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+-- distribution for complete text of the license and disclaimer of any warranty.
+--
+-- Alternatively, this file may be used under the terms of Open CASCADE
+-- commercial license or contractual agreement. 
+
+class Section from BOPAlgo  
+    inherits Builder from BOPAlgo
+    ---Purpose: 
+    -- The algorithm to build a Secton between the arguments. 
+    -- The Section consists of vertices and edges. 
+    -- The Section contains:
+    -- 1. new vertices that are subjects of V/V, E/E, E/F, F/F interferences
+    -- 2. vertices that are subjects of V/E, V/F interferences
+    -- 3. new edges that are subjects of F/F interferences
+    -- 4. edges that are Common Blocks
+
+    -- The vertex is included in Section only when it is not shared 
+    -- between the edges above
+
+uses 
+    ShapeEnum from TopAbs,
+    Shape from TopoDS,   
+    ListOfShape from TopTools, 
+    BaseAllocator from BOPCol,  
+    PaveFiller from BOPAlgo 
+
+--raises
+
+is
+    Create  
+        returns Section from BOPAlgo;  
+    ---C++: alias "Standard_EXPORT virtual ~BOPAlgo_Section();"  
+    ---Purpose:  Empty constructor    
+    Create (theAllocator: BaseAllocator from BOPCol)
+        returns Section from BOPAlgo; 
+    ---Purpose:  Empty constructor    
+    --
+    --  protected methods 
+    -- 
+    CheckData(me:out) 
+        is redefined protected; 
+    ---Purpose:  
+    
+    PerformInternal1(me:out; 
+        thePF:PaveFiller from BOPAlgo) 
+        is redefined protected;   
+    ---Purpose:  Performs calculations using prepared Filler 
+    --           object <thePF>                 
+     
+    BuildSection(me:out) 
+        is virtual; 
+    --
+    --  History 
+    -- 
+    Generated (me:out;  
+            theS : Shape from TopoDS) 
+        returns ListOfShape from TopTools
+        is redefined; 
+    ---C++: return const & 
+    ---Purpose: Returns the  list of shapes generated from the
+    --          shape theS. 
+    
+end Section;
diff --git a/src/BOPAlgo/BOPAlgo_Section.cxx b/src/BOPAlgo/BOPAlgo_Section.cxx
new file mode 100644 (file)
index 0000000..f7a1f59
--- /dev/null
@@ -0,0 +1,421 @@
+// Created by: Peter KURNEV
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#include <BOPAlgo_Section.ixx>
+
+#include <NCollection_IncAllocator.hxx>
+
+#include <TopAbs_ShapeEnum.hxx>
+
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Edge.hxx>
+
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <TopExp_Explorer.hxx>
+
+#include <BOPCol_ListOfShape.hxx>
+#include <BOPCol_MapOfShape.hxx>
+#include <BOPCol_IndexedMapOfShape.hxx>
+#include <BOPCol_IndexedDataMapOfShapeListOfShape.hxx>
+#include <BOPCol_DataMapOfShapeShape.hxx>
+
+#include <BOPDS_DS.hxx>
+#include <BOPDS_PaveBlock.hxx>
+#include <BOPDS_CommonBlock.hxx>
+#include <BOPDS_FaceInfo.hxx>
+#include <BOPDS_ListOfPaveBlock.hxx>
+#include <BOPDS_MapOfPaveBlock.hxx>
+#include <BOPDS_VectorOfListOfPaveBlock.hxx>
+#include <BOPDS_VectorOfFaceInfo.hxx>
+//
+#include <BOPTools.hxx>
+#include <BOPTools_AlgoTools.hxx>
+#include <BOPTools_AlgoTools3D.hxx>
+#include <BOPTools_AlgoTools.hxx>
+//
+#include <BOPAlgo_BuilderSolid.hxx>
+
+//=======================================================================
+//function : 
+//purpose  : 
+//=======================================================================
+BOPAlgo_Section::BOPAlgo_Section()
+:
+  BOPAlgo_Builder()
+{
+  Clear();
+}
+//=======================================================================
+//function : 
+//purpose  : 
+//=======================================================================
+BOPAlgo_Section::BOPAlgo_Section
+  (const Handle(NCollection_BaseAllocator)& theAllocator)
+:
+  BOPAlgo_Builder(theAllocator)
+{
+  Clear();
+}
+//=======================================================================
+//function : ~
+//purpose  : 
+//=======================================================================
+BOPAlgo_Section::~BOPAlgo_Section()
+{
+}
+//=======================================================================
+//function : CheckData
+//purpose  : 
+//=======================================================================
+void BOPAlgo_Section::CheckData()
+{
+  Standard_Integer aNbArgs;
+  //
+  myErrorStatus=0;
+  //
+  aNbArgs=myArguments.Extent();
+  if (!aNbArgs) {
+    myErrorStatus=100; // invalid number of Arguments
+    return;
+  }
+  //
+  if (!myPaveFiller) {
+    myErrorStatus=101; 
+    return;
+  }
+  //
+  myErrorStatus=myPaveFiller->ErrorStatus();
+  if (myErrorStatus) {
+    return;
+  }
+}
+//=======================================================================
+//function : PerformInternal1
+//purpose  : 
+//=======================================================================
+void BOPAlgo_Section::PerformInternal1
+  (const BOPAlgo_PaveFiller& theFiller)
+{
+  myErrorStatus=0;
+  myWarningStatus=0;
+  //
+  myPaveFiller=(BOPAlgo_PaveFiller*)&theFiller;
+  myDS=myPaveFiller->PDS();
+  myContext=myPaveFiller->Context();
+  //
+  // 1. CheckData
+  CheckData();
+  if (myErrorStatus && !myWarningStatus) {
+    return;
+  }
+  //
+  // 2. Prepare
+  Prepare();
+  if (myErrorStatus) {
+    return;
+  }
+  //
+  if(myWarningStatus == 2) {
+    return;
+  }
+  // 3. Fill Images
+  // 3.1 Vertices
+  FillImagesVertices();
+  if (myErrorStatus) {
+    return;
+  }
+  //
+  BuildResult(TopAbs_VERTEX);
+  if (myErrorStatus) {
+    return;
+  }
+  // 3.2 Edges
+  FillImagesEdges();
+  if (myErrorStatus) {
+    return;
+  }
+  //
+  BuildResult(TopAbs_EDGE);
+  if (myErrorStatus) {
+    return;
+  }
+  // 4. Section
+  BuildSection();
+  //
+  if (myErrorStatus) {
+    return;
+  }
+  // 5.History
+  PrepareHistory();
+  //
+  if (myErrorStatus) {
+    return;
+  } 
+  // 6. Post-treatment
+  PostTreat();
+}
+//=======================================================================
+//function : BuildSection
+//purpose  : 
+//=======================================================================
+void BOPAlgo_Section::BuildSection()
+{
+  Standard_Integer i, aNbMS, aNbLE;
+  Standard_Integer j,  nE, nV, aNb, aNbF, aNbPBSc;
+  TopoDS_Shape aRC, aRC1;
+  BRep_Builder aBB;
+  TopExp_Explorer aExp;
+  BOPCol_ListOfShape aLSA, aLS;
+  BOPCol_ListIteratorOfListOfShape aIt, aItIm, aItLS;
+  BOPCol_IndexedDataMapOfShapeInteger aMSI(100, myAllocator);
+  BOPCol_IndexedMapOfShape aMS(100, myAllocator);
+  BOPCol_MapOfShape aMFence(100, myAllocator);
+  BOPCol_MapIteratorOfMapOfInteger aItMI; 
+  BOPDS_ListIteratorOfListOfPaveBlock aItPB;
+  //
+  myErrorStatus=0;
+  //
+  BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC1);
+  //
+  // 1. aRC1
+  aNb=myDS->NbSourceShapes();
+  for (i=0; i<aNb; ++i) {
+    const BOPDS_ShapeInfo& aSI=myDS->ShapeInfo(i);
+    if (aSI.ShapeType()!=TopAbs_FACE) {
+      continue;
+    }
+    //
+    const BOPDS_FaceInfo& aFI=myDS->FaceInfo(i);
+    //
+    // 1.1 Vertices that are section vertices 
+    const BOPCol_MapOfInteger& aMVSc=aFI.VerticesSc();
+    aItMI.Initialize(aMVSc);
+    for(; aItMI.More(); aItMI.Next()) {
+      nV=aItMI.Key();
+      const TopoDS_Shape& aV=myDS->Shape(nV);
+      aBB.Add(aRC1, aV);
+    }
+    //
+    // 1.2 Vertices that are in a face 
+    const BOPCol_MapOfInteger& aMI=aFI.VerticesIn();
+    aItMI.Initialize(aMI);
+    for(; aItMI.More(); aItMI.Next()) {
+      nV=aItMI.Key();
+      if (nV<0) {
+        continue;
+      }  
+      if (myDS->IsNewShape(nV) || myDS->HasInterf(nV)) { 
+        const TopoDS_Shape& aV=myDS->Shape(nV);
+        aBB.Add(aRC1, aV);
+      }
+    }
+    //
+    // 1.3 Section edges
+    const BOPDS_IndexedMapOfPaveBlock& aMPBSc=aFI.PaveBlocksSc();
+    //
+    aNbPBSc=aMPBSc.Extent();
+    for (j=1; j<=aNbPBSc; ++j) {
+      const Handle(BOPDS_PaveBlock)& aPB=aMPBSc(j);
+      nE=aPB->Edge();
+      const TopoDS_Shape& aE=myDS->Shape(nE);
+      aBB.Add(aRC1, aE);
+    }
+  }
+  //
+  // 2. Common blocks between an edge and a face
+  const BOPDS_VectorOfListOfPaveBlock& aPBP=myDS->PaveBlocksPool();
+  //
+  aNb=aPBP.Size();
+  for (i=0; i<aNb; ++i) {
+    const BOPDS_ListOfPaveBlock& aLPB=aPBP(i); 
+    aItPB.Initialize(aLPB);
+    for (; aItPB.More(); aItPB.Next()) {
+      const Handle(BOPDS_PaveBlock)& aPB=aItPB.Value();
+      Handle(BOPDS_CommonBlock) aCB=myDS->CommonBlock(aPB);
+      if (!aCB.IsNull()) {
+        const BOPCol_ListOfInteger& aLF=aCB->Faces();
+        aNbF=aLF.Extent();
+        if (aNbF) {
+          const Handle(BOPDS_PaveBlock)& aPBR=aCB->PaveBlock1();
+          nE=aPBR->Edge();
+          const TopoDS_Shape& aE=myDS->Shape(nE);
+          aBB.Add(aRC1, aE);
+        }
+      }
+    }
+  }
+  //
+  aIt.Initialize(myArguments);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aSA=aIt.Value();
+    if (aMFence.Add(aSA)) {
+      aLSA.Append(aSA);
+    }
+  }
+  //
+  aMFence.Clear();
+  //
+  // 3. Treatment boundaries of arguments
+  //
+  // 3.1 Set to treat => aLS
+  aIt.Initialize(aLSA);
+  for (; aIt.More(); aIt.Next()) {
+    const TopoDS_Shape& aSA=aIt.Value();
+    //
+    aLS.Clear();
+    aMS.Clear();
+    aMFence.Clear();
+    //
+    aExp.Init (aSA, TopAbs_EDGE);
+    for (; aExp.More(); aExp.Next()) {
+      const TopoDS_Shape& aE=aExp.Current();
+      if (aMFence.Add(aE)) {
+        aLS.Append(aE);
+      }
+    }
+    aExp.Init (aSA, TopAbs_VERTEX);
+    for (; aExp.More(); aExp.Next()) {
+      const TopoDS_Shape& aE=aExp.Current();
+      if (aMFence.Add(aE)) {
+        aLS.Append(aE);
+      }
+    }
+    //
+    // 3.2 aMSI
+    aItLS.Initialize(aLS);
+    for (; aItLS.More(); aItLS.Next()) { 
+      const TopoDS_Shape& aS=aItLS.Value();
+      //
+      if (myImages.IsBound(aS)){
+        const BOPCol_ListOfShape& aLSIm=myImages.Find(aS);
+        aItIm.Initialize(aLSIm);
+        for (; aItIm.More(); aItIm.Next()) {
+          const TopoDS_Shape& aSIm=aItIm.Value();
+          BOPTools::MapShapes(aSIm, TopAbs_VERTEX, aMS);
+          BOPTools::MapShapes(aSIm, TopAbs_EDGE  , aMS);
+        }
+      }// if (myImages.IsBound(aF)){
+      else {
+        BOPTools::MapShapes(aS, TopAbs_VERTEX, aMS);
+        BOPTools::MapShapes(aS, TopAbs_EDGE  , aMS);
+      }
+    }//for (; aItLS.More(); aItLS.Next()) { 
+    //
+    aNbMS=aMS.Extent();
+    for (i=1; i<=aNbMS; ++i) {
+      const TopoDS_Shape& aS=aMS(i);
+      if (aMSI.Contains(aS)) {
+        Standard_Integer& iCnt=aMSI.ChangeFromKey(aS);
+        ++iCnt;
+      }
+      else {
+        aMSI.Add(aS, 1);
+      }
+    }
+  } //for (; aIt.More(); aIt.Next()) {
+  //
+  aMS.Clear();
+  aMFence.Clear();
+  //
+  // 4. Build the result
+  BOPCol_IndexedDataMapOfShapeListOfShape aMVE(100, myAllocator);
+  // 
+  BOPTools::MapShapesAndAncestors(aRC1, 
+                                  TopAbs_VERTEX, 
+                                  TopAbs_EDGE, 
+                                  aMVE);
+  //
+  aNbMS=aMSI.Extent();
+  for (i=1; i<=aNbMS; ++i) {
+    const TopoDS_Shape& aV=aMSI.FindKey(i);
+    const Standard_Integer& iCnt=aMSI.FindFromIndex(i);
+    if (iCnt>1) {
+      BOPTools::MapShapesAndAncestors(aV, 
+                                      TopAbs_VERTEX, 
+                                      TopAbs_EDGE, 
+                                      aMVE);
+    }
+  }
+  //
+  BOPTools_AlgoTools::MakeContainer(TopAbs_COMPOUND, aRC);
+  //
+  aNbMS=aMVE.Extent();
+  for (i=1; i<=aNbMS; ++i) {
+    const TopoDS_Shape& aV=aMVE.FindKey(i);
+    const BOPCol_ListOfShape& aLE=aMVE.FindFromIndex(i);
+    aNbLE=aLE.Extent();
+    if (!aNbLE) {
+      // alone vertices
+      if (aMFence.Add(aV)) {
+        aBB.Add(aRC, aV); 
+      }
+    }
+    else {
+      // edges 
+      aIt.Initialize(aLE);
+      for (; aIt.More(); aIt.Next()) {
+        const TopoDS_Shape& aE=aIt.Value();
+        if (aMFence.Add(aE)) {
+          aBB.Add(aRC, aE);
+        }
+      }
+    }
+  }
+  //
+  myShape=aRC;
+}
+//=======================================================================
+//function : Generated
+//purpose  : 
+//=======================================================================
+const TopTools_ListOfShape& BOPAlgo_Section::Generated
+  (const TopoDS_Shape& theS)
+{
+  myHistShapes.Clear();
+  if (theS.IsNull()) {
+    return myHistShapes;
+  }
+  //
+  TopAbs_ShapeEnum aType = theS.ShapeType();
+  if (aType != TopAbs_FACE) {
+    return myHistShapes;
+  }
+  //
+  Standard_Integer nS = myDS->Index(theS);
+  if (nS < 0) {
+    return myHistShapes;
+  }
+  //
+  if (!myDS->HasFaceInfo(nS)) {
+    return myHistShapes;
+  }
+  //
+  //collect section edges of the face theS
+  Standard_Integer i, aNb, nSp;
+  //
+  const BOPDS_FaceInfo& aFI = myDS->FaceInfo(nS);
+  const BOPDS_IndexedMapOfPaveBlock& aMPBSc = aFI.PaveBlocksSc();
+  aNb = aMPBSc.Extent();
+  for (i = 1; i <= aNb; ++i) {
+    const Handle(BOPDS_PaveBlock)& aPB = aMPBSc(i);
+    nSp = aPB->Edge();
+    const TopoDS_Shape& aSp = myDS->Shape(nSp);
+    myHistShapes.Append(aSp);
+  }
+  //
+  return myHistShapes;
+}
+
index 95396c403e1fd964e35a5a91ec1f824cc880f062..e6c81f7ad7033b32ba8470bcb51260e6682b79d3 100644 (file)
@@ -12,7 +12,6 @@ BOPAlgo_Builder_1.cxx
 BOPAlgo_Builder_2.cxx
 BOPAlgo_Builder_3.cxx
 BOPAlgo_Builder_4.cxx
-BOPAlgo_BOP_1.cxx
 BOPAlgo_WireSplitter_1.cxx
 BOPAlgo_ListOfCheckResult.hxx
 
index 375cad46c6032a0dfadc318421357f94606de1df..8de06dda145b29fcb6ad372832889791a05e8b75 100644 (file)
@@ -45,6 +45,7 @@
 #include <BRepAlgoAPI_Fuse.hxx>
 #include <BRepAlgoAPI_Cut.hxx>
 #include <BRepAlgoAPI_Section.hxx>
+#include <BOPAlgo_Section.hxx>
 
 //
 static BOPAlgo_PaveFiller* pPF=NULL;
@@ -193,14 +194,6 @@ Standard_Integer boptuc(Draw_Interpretor& di, Standard_Integer n, const char** a
   return bopsmt(di, n, a, BOPAlgo_CUT21);
 }
 //=======================================================================
-//function : bopsection
-//purpose  : 
-//=======================================================================
-Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char** a)
-{
-  return bopsmt(di, n, a, BOPAlgo_SECTION);
-}
-//=======================================================================
 //function : bopsmt
 //purpose  : 
 //=======================================================================
@@ -261,6 +254,62 @@ Standard_Integer bopsmt(Draw_Interpretor& di,
   return 0;
 }
 //=======================================================================
+//function : bopsection
+//purpose  : 
+//=======================================================================
+Standard_Integer bopsection(Draw_Interpretor& di, Standard_Integer n, const char** a)
+{
+  if (n<2) {
+    di << " use bopsmt r\n";
+    return 0;
+  }
+  //
+  if (!pPF) {
+    di << " prepare PaveFiller first\n";
+    return 0;
+  }
+  //
+  if (pPF->ErrorStatus()) {
+    di << " PaveFiller has not been done\n";
+    return 0;
+  }
+  //
+  char buf[64];
+  Standard_Integer aNb, iErr;
+  BOPAlgo_Section aBOP;
+  //
+  const BOPCol_ListOfShape& aLC=pPF->Arguments();
+  aNb=aLC.Extent();
+  if (aNb!=2) {
+    Sprintf (buf, " wrong number of arguments %s\n", aNb);
+    di << buf;
+    return 0;
+  }
+  //
+  const TopoDS_Shape& aS1=aLC.First();
+  const TopoDS_Shape& aS2=aLC.Last();
+  //
+  aBOP.AddArgument(aS1);
+  aBOP.AddArgument(aS2);
+  //
+  aBOP.PerformWithFiller(*pPF);
+  iErr=aBOP.ErrorStatus();
+  if (iErr) {
+    Sprintf(buf, " ErrorStatus : %d\n",  iErr);
+    di << buf;
+    return 0;
+  }
+  //
+  const TopoDS_Shape& aR=aBOP.Shape();
+  if (aR.IsNull()) {
+    di << " null shape\n";
+    return 0;
+  }
+  //
+  DBRep::Set(a[1], aR);
+  return 0;
+}
+//=======================================================================
 //function : bcommon
 //purpose  : 
 //=======================================================================
@@ -327,7 +376,10 @@ Standard_Integer  bsection(Draw_Interpretor& di,
     const char* key2 = (n > 5) ? a[5] : NULL;
     const char* pcurveconf = NULL;
 
-    if (key1 && (!strcasecmp(key1,"-n2d") || !strcasecmp(key1,"-n2d1") || !strcasecmp(key1,"-n2d2"))) {
+    if (key1 && 
+        (!strcasecmp(key1,"-n2d") || 
+         !strcasecmp(key1,"-n2d1") || 
+         !strcasecmp(key1,"-n2d2"))) {
       pcurveconf = key1;
     }
     else {
index 9e88fccc7d2125282ff3c932a5a209e7b7dbcb08..23b9a02fac3838c7848416aa33d31eb9c72df804 100644 (file)
 
 class Objects from BOPTest 
 
      ---Purpose: 
+ ---Purpose: 
 
 uses  
-    ListOfShape from BOPCol,
+    ListOfShape from BOPCol, 
+    PDS from BOPDS,
     PaveFiller from BOPAlgo,
     Builder from BOPAlgo, 
     PBuilder from BOPAlgo, 
     BOP from BOPAlgo, 
-    PDS from BOPDS
+    Section from BOPAlgo  
 --raises
 
 is 
     PaveFiller(myclass) 
-       returns PaveFiller from BOPAlgo;  
+     returns PaveFiller from BOPAlgo;  
     ---C++: return &   
 
     Init(myclass); 
@@ -35,26 +37,30 @@ is
     Clear(myclass); 
 
     PDS(myclass) 
-       returns PDS from BOPDS; 
-        
+     returns PDS from BOPDS; 
+  
     Builder(myclass) 
-       returns Builder from BOPAlgo; 
+     returns Builder from BOPAlgo; 
     ---C++: return & 
     
     BOP(myclass) 
-       returns BOP from BOPAlgo; 
+     returns BOP from BOPAlgo; 
     ---C++: return & 
-
+    Section(myclass) 
+     returns Section from BOPAlgo;  
+    ---C++: return &  
     Shapes(myclass)   
-       returns ListOfShape from BOPCol; 
+     returns ListOfShape from BOPCol; 
     ---C++: return &  
      
     Tools(myclass)   
-       returns ListOfShape from BOPCol; 
+     returns ListOfShape from BOPCol; 
     ---C++: return &  
     -- 
     SetBuilder(myclass; 
-           theBuilder:PBuilder from BOPAlgo); 
+         theBuilder:PBuilder from BOPAlgo); 
   
     SetBuilderDefault(myclass); 
  
index a4f84fb1e386e027bfd5d2365ac07e019d64f9df..c7af19da5e28662fbe96ef56628cbab8fd4dfdc1 100644 (file)
@@ -178,6 +178,15 @@ BOPAlgo_BOP& BOPTest_Objects::BOP()
   return sBOP;
 }
 //=======================================================================
+//function : Section
+//purpose  : 
+//=======================================================================
+BOPAlgo_Section& BOPTest_Objects::Section()
+{
+  static BOPAlgo_Section sSection(Allocator1());
+  return sSection;
+}
+//=======================================================================
 //function : Shapes
 //purpose  : 
 //=======================================================================
index 417146eebc009c5cfdc11bb9cb2046ef1387535b..58c3e87f9532d952c7aafed669e9ba7e620ce9f6 100644 (file)
@@ -30,6 +30,7 @@
 #include <BOPAlgo_PaveFiller.hxx>
 #include <BOPAlgo_Operation.hxx>
 #include <BOPAlgo_BOP.hxx>
+#include <BOPAlgo_Section.hxx>
 //
 #include <BOPTest_DrawableShape.hxx>
 #include <BOPTest_Objects.hxx>
@@ -241,7 +242,6 @@ Standard_Integer bbuild(Draw_Interpretor& di,
   DBRep::Set(a[1], aR);
   return 0;
 }
-
 //=======================================================================
 //function : bbop
 //purpose  : 
@@ -288,30 +288,43 @@ Standard_Integer bbop(Draw_Interpretor& di,
   //
   BOPAlgo_PaveFiller& aPF=BOPTest_Objects::PaveFiller();
   //
-  BOPAlgo_BOP& aBOP=BOPTest_Objects::BOP();
-  aBOP.Clear();
+  BOPAlgo_Builder *pBuilder=NULL;
+  
+  if (aOp!=BOPAlgo_SECTION) { 
+    pBuilder=&BOPTest_Objects::BOP();
+  } 
+  else {
+    pBuilder=&BOPTest_Objects::Section();
+  }
+  //
+  pBuilder->Clear();
   //
   BOPCol_ListOfShape& aLSObj=BOPTest_Objects::Shapes();
   aIt.Initialize(aLSObj);
   for (; aIt.More(); aIt.Next()) {
     const TopoDS_Shape& aS=aIt.Value();
-    aBOP.AddArgument(aS);
+    pBuilder->AddArgument(aS);
   }
   //
-  BOPCol_ListOfShape& aLSTools=BOPTest_Objects::Tools();
-  aIt.Initialize(aLSTools);
-  for (; aIt.More(); aIt.Next()) {
-    const TopoDS_Shape& aS=aIt.Value();
-    aBOP.AddTool(aS);
+  if (aOp!=BOPAlgo_SECTION) {
+    BOPAlgo_BOP *pBOP=(BOPAlgo_BOP *)pBuilder;
+    //
+    BOPCol_ListOfShape& aLSTools=BOPTest_Objects::Tools();
+    aIt.Initialize(aLSTools);
+    for (; aIt.More(); aIt.Next()) {
+      const TopoDS_Shape& aS=aIt.Value();
+      pBOP->AddTool(aS);
+    }
+    //
+    pBOP->SetOperation(aOp);
   }
   //
-  aBOP.SetOperation(aOp);
-  aBOP.SetRunParallel(bRunParallel);
+  pBuilder->SetRunParallel(bRunParallel);
   //
   aChrono.Start();
   //
-  aBOP.PerformWithFiller(aPF);
-  iErr=aBOP.ErrorStatus();
+  pBuilder->PerformWithFiller(aPF);
+  iErr=pBuilder->ErrorStatus();
   if (iErr) {
     Sprintf(buf, " error: %d\n",  iErr);
     di << buf;
@@ -328,7 +341,7 @@ Standard_Integer bbop(Draw_Interpretor& di,
     di << buf;
   }
   //
-  const TopoDS_Shape& aR=aBOP.Shape();
+  const TopoDS_Shape& aR=pBuilder->Shape();
   if (aR.IsNull()) {
     di << " null shape\n";
     return 0;
index 1926fc47912ad3a5ce101d51892fe370e5e6596b..b2208d4462427a7100fdc372f55bcc2bec3b9138 100644 (file)
 deferred class BooleanOperation from BRepAlgoAPI
     inherits MakeShape from BRepBuilderAPI
 
-       ---Purpose: The abstract class BooleanOperation is the root
-       -- class of Boolean Operations (see Overview).
-       -- Boolean Operations algorithm is divided onto two parts.
-       -- -      The first one is computing interference between arguments.
-       -- -      The second one is building the result of operation.
-       -- The BooleanOperation class provides execution of both parts
-       -- of the Boolean Operations algorithm. The second part
-       -- (building the result) depends on given type of the Boolean
-       -- Operation (see Constructor).
+     ---Purpose: The abstract class BooleanOperation is the root
+     -- class of Boolean Operations (see Overview).
+     -- Boolean Operations algorithm is divided onto two parts.
+     -- -      The first one is computing interference between arguments.
+     -- -      The second one is building the result of operation.
+     -- The BooleanOperation class provides execution of both parts
+     -- of the Boolean Operations algorithm. The second part
+     -- (building the result) depends on given type of the Boolean
+     -- Operation (see Constructor).
   
 uses
 
     Shape       from TopoDS,
     ListOfShape from TopTools,
-    Operation   from BOPAlgo, 
-    BOP         from BOPAlgo,
-    PBOP        from BOPAlgo, 
+    Operation   from BOPAlgo,  
+    Builder    from BOPAlgo,
+    PBuilder    from BOPAlgo,
     PaveFiller  from BOPAlgo, 
     PPaveFiller from BOPAlgo,
     DataMapOfIntegerListOfShape  from  TopTools, 
@@ -46,146 +46,144 @@ uses
     
 is
 
-    Initialize (S1 :Shape from TopoDS; 
-               S2 :Shape from TopoDS; 
-               anOperation:Operation from BOPAlgo);
-       ---Purpose: Prepares the operations for S1 and S2.
+    Initialize (S1 :Shape from TopoDS;  
+            S2 :Shape from TopoDS; 
+          anOperation:Operation from BOPAlgo);
+    ---Purpose: Prepares the operations for S1 and S2.
      
     Initialize (S1   :Shape from TopoDS; 
-               S2   :Shape from TopoDS; 
-               aDSF :PaveFiller from BOPAlgo;                                                               
-               anOperation:Operation from BOPAlgo); 
-       ---Purpose: Prepares the operations for S1 and S2.
+            S2   :Shape from TopoDS; 
+            aDSF :PaveFiller from BOPAlgo;               
+            anOperation:Operation from BOPAlgo); 
+     ---Purpose: Prepares the operations for S1 and S2.
 
     SetOperation (me:out; 
-           anOp:  Operation from BOPAlgo); 
-       ---Purpose:  Sets the type of Boolean operation to perform      
-       ---          It can be BOPAlgo_SECTION 
-       ---                    BOPAlgo_COMMON 
-       ---                    BOPAlgo_FUSE 
-       ---                    BOPAlgo_CUT 
-       ---                    BOPAlgo_CUT21 
-       --- 
-        
+            anOp:  Operation from BOPAlgo); 
+    ---Purpose:  Sets the type of Boolean operation to perform      
+    ---          It can be BOPAlgo_SECTION 
+    ---                    BOPAlgo_COMMON 
+    ---                    BOPAlgo_FUSE 
+    ---                    BOPAlgo_CUT 
+    ---                    BOPAlgo_CUT21 
+    --- 
+  
 
     Build  (me:out) 
-       is redefined virtual; 
-       ---Purpose: Provides the algorithm of Boolean Operations
-       -- -      Filling interference Data Structure (if it is necessary)
-       -- -      Building the result of the operation.
+        is redefined virtual; 
+    ---Purpose: Provides the algorithm of Boolean Operations
+    -- -      Filling interference Data Structure (if it is necessary)
+    -- -      Building the result of the operation.
     
-    Shape1(me)  
-       returns Shape from TopoDS 
-       is static;
-       ---Purpose: Returns the first shape involved in this Boolean operation.
-       ---C++: return const &
+    Shape1(me)   
+        returns Shape from TopoDS 
+        is static;
+    ---Purpose: Returns the first shape involved in this Boolean operation.
+    ---C++: return const &
 
     Shape2(me)  
-       returns Shape from TopoDS 
-       is static;
-       ---Purpose: Returns the second shape involved in this Boolean operation.
-       ---C++: return const &
+        returns Shape from TopoDS 
+        is static;
+    ---Purpose: Returns the second shape involved in this Boolean operation.
+    ---C++: return const &
      
     Operation  (me) 
-       returns Operation from BOPAlgo;
-       ---Purpose: Returns the type of Boolean Operation that has been performed.  
-        
-    FuseEdges(me)  returns  Boolean  from  Standard;
-       ---Purpose: Returns the flag of edge refining
+        returns Operation from BOPAlgo;
+    ---Purpose: Returns the type of Boolean Operation that has been performed.  
+  
+    FuseEdges(me)   
+        returns  Boolean  from  Standard;
+    ---Purpose: Returns the flag of edge refining
      
     RefineEdges(me:out);
-       ---Purpose: Fuse C1 edges
+    ---Purpose: Fuse C1 edges
 
     PrepareFiller(me:out) 
-       returns Boolean from Standard 
-       is  protected;   
-        
-       ---Category: Querying
+        returns Boolean from Standard 
+        is protected;   
+  
+    ---Category: Querying
     BuilderCanWork(me)  
-       returns Boolean from Standard;
+        returns Boolean from Standard;
 
     ErrorStatus(me) 
-       returns Integer from Standard; 
-       ---Purpose:  Returns the error status of operation.  
-       --- 0 - Ok
-       --- 1 - The Object is created but Nothing is Done 
-       --- 2 - Null source shapes is not allowed
-       --- 3 - Check types of the arguments
-       --- 4 - Can not allocate memory for the DSFiller
-       --- 5 - The Builder can not work with such types of arguments
-       --- 6 - Unknown operation is not allowed 
-       --- 7 - Can not allocate memory for the Builder
-       --  > 100 - See the Builder's  ErrorStatus
+        returns Integer from Standard; 
+    ---Purpose:  Returns the error status of operation.  
+    --- 0 - Ok
+    --- 1 - The Object is created but Nothing is Done 
+    --- 2 - Null source shapes is not allowed
+    --- 3 - Check types of the arguments
+    --- 4 - Can not allocate memory for the DSFiller
+    --- 5 - The Builder can not work with such types of arguments
+    --- 6 - Unknown operation is not allowed 
+    --- 7 - Can not allocate memory for the Builder
+    --  > 100 - See the Builder's  ErrorStatus
 
     Modified (me: in out;  
-           aS : Shape from TopoDS) 
-       returns ListOfShape from TopTools
-       is redefined virtual;
-       ---Purpose: Returns the list  of shapes modified from the shape <S>. 
-       ---C++: return const & 
+            aS : Shape from TopoDS) 
+        returns ListOfShape from TopTools
+        is redefined virtual;
+    ---Purpose: Returns the list  of shapes modified from the shape <S>. 
+    ---C++: return const & 
 
     IsDeleted (me: in out;  
-           aS : Shape from TopoDS)
-       returns Boolean
-       is redefined virtual;
-       ---Purpose: Returns true if the shape S has been deleted. The
-       -- result shape of the operation does not contain the shape S.
+            aS : Shape from TopoDS)
+        returns Boolean
+        is redefined virtual;
+    ---Purpose: Returns true if the shape S has been deleted. The
+    -- result shape of the operation does not contain the shape S.
         
-    Generated (me: in out; S : Shape from TopoDS)
-       returns ListOfShape from TopTools
-       is redefined virtual;
-       ---Purpose: Returns the list  of shapes generated from the shape <S>.
-       ---         For use in BRepNaming.
-       ---C++:  return const &
+    Generated (me: in out;  
+            S : Shape from TopoDS)
+        returns ListOfShape from TopTools
+        is redefined virtual;
+    ---Purpose: Returns the list  of shapes generated from the shape <S>.
+    ---         For use in BRepNaming.
+    ---C++:  return const &
     
-    HasModified (me)
-       returns Boolean from Standard
-       is virtual;
-       ---Purpose: Returns true if there is at least one modified shape.
-       ---         For use in BRepNaming.
+    HasModified (me) 
+        returns Boolean from Standard
+        is virtual;
+    ---Purpose: Returns true if there is at least one modified shape.
+    ---         For use in BRepNaming.
 
     HasGenerated (me)
-       returns Boolean from Standard
-       is virtual;
-       ---Purpose: Returns true if there is at least one generated shape.
-       ---         For use in BRepNaming.
+        returns Boolean from Standard
+        is virtual;
+    ---Purpose: Returns true if there is at least one generated shape.
+    ---         For use in BRepNaming.
 
     HasDeleted (me)
-       returns Boolean from Standard
-       is virtual;
-       ---Purpose: Returns true if there is at least one deleted shape.
-       ---         For use in BRepNaming.
+        returns Boolean from Standard
+        is virtual;
+    ---Purpose: Returns true if there is at least one deleted shape.
+    ---         For use in BRepNaming.
 
     Destroy (me: in out); 
     ---C++: alias "Standard_EXPORT virtual ~BRepAlgoAPI_BooleanOperation(){Destroy();}" 
      
-    --modified by NIZNHY-PKV Wed Mar 20 10:29:30 2002  f
-    
     SectionEdges (me:  in  out)  
-       returns ListOfShape from TopTools;    
-       --- Purpose: Returns a list of section edges.
-       -- The edges represent the result of intersection between arguments of
-       -- Boolean Operation. They are computed during operation execution.
-       ---C++:  return const &  
-    --modified by NIZNHY-PKV Wed Mar 20 10:29:35 2002  t
-
-    RefinedList (me:  in  out; theL : ListOfShape from TopTools)  
-       returns ListOfShape from TopTools
-       is private;
-       ---Purpose: Returns the list  of shapes generated from the shape <S>.
-       ---         For use in BRepNaming.
-       ---C++:  return const &
+        returns ListOfShape from TopTools;    
+    --- Purpose: Returns a list of section edges.
+    -- The edges represent the result of intersection between arguments of
+    -- Boolean Operation. They are computed during operation execution.
+    ---C++:  return const &  
+
+    RefinedList (me:  in  out;  
+            theL : ListOfShape from TopTools)  
+        returns ListOfShape from TopTools
+        is private;
+    ---Purpose: Returns the list  of shapes generated from the shape <S>.
+    ---         For use in BRepNaming.
+    ---C++:  return const &
 
 fields
     myS1             : Shape from TopoDS        is protected;
     myS2             : Shape from TopoDS        is protected;
     myBuilderCanWork : Boolean from Standard    is protected;   
     myOperation      : Operation from BOPAlgo   is protected;  
-    myErrorStatus    : Integer from Standard    is protected;               
-    myDSFiller       : PPaveFiller from BOPAlgo is protected; 
-    myBuilder        : PBOP from BOPAlgo        is protected;
-
+    myErrorStatus    : Integer from Standard    is protected;        
+    myDSFiller       : PPaveFiller from BOPAlgo is protected;  
+    myBuilder        : PBuilder from BOPAlgo    is protected;  
     myEntryType      : Integer     from Standard;   
 
     --    for  edge  refiner
index 9e99c2fccb69db5d80263b408899bf1e2f275f48..28cfa30e66e256ddea55cd3050ed1cb87f633645 100644 (file)
 #include <TopTools_MapOfShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 
+#include <BOPDS_DS.hxx>
+
 #include <BOPAlgo_PaveFiller.hxx>
 #include <BOPAlgo_BOP.hxx>
-#include <BOPDS_DS.hxx>
+#include <BOPAlgo_Section.hxx>
+
 
 //=======================================================================
 //function : BRepAlgoAPI_BooleanOperation
 //purpose  : 
 //=======================================================================
-  BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation(const TopoDS_Shape& aS1, 
-                                                             const TopoDS_Shape& aS2,
-                                                             const BOPAlgo_Operation anOp)
+BRepAlgoAPI_BooleanOperation::BRepAlgoAPI_BooleanOperation
+  (const TopoDS_Shape& aS1, 
+   const TopoDS_Shape& aS2,
+   const BOPAlgo_Operation anOp)
 : 
   myS1(aS1),
   myS2(aS2),
@@ -268,11 +272,21 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
   }
   //
   myShape.Nullify();
-
-  myBuilder=new BOPAlgo_BOP;
-  myBuilder->AddArgument(aS1);
-  myBuilder->AddTool(aS2);
-  myBuilder->SetOperation(myOperation);
+  //
+  if (myOperation==BOPAlgo_SECTION) {
+    myBuilder=new BOPAlgo_Section;
+    myBuilder->AddArgument(aS1);
+    myBuilder->AddArgument(aS2);
+  }
+  else {
+    BOPAlgo_BOP *pBOP;
+    //
+    pBOP=new BOPAlgo_BOP;
+    myBuilder=pBOP;
+    pBOP->AddArgument(aS1);
+    pBOP->AddTool(aS2);
+    pBOP->SetOperation(myOperation);
+  }
   //
   myBuilder->PerformWithFiller(*myDSFiller);
   iErr = myBuilder->ErrorStatus();
@@ -285,7 +299,12 @@ const TopTools_ListOfShape& BRepAlgoAPI_BooleanOperation::Modified(const TopoDS_
       BRepAlgoAPI_Check aCheckRes(myShape);
       isDumpRes = !aCheckRes.IsValid();
       if (isDumpArgs || isDumpRes) {
-        BRepAlgoAPI::DumpOper(aPath, aS1, aS2, myShape, myOperation, isDumpArgs);
+        BRepAlgoAPI::DumpOper(aPath, 
+                              aS1, 
+                              aS2, 
+                              myShape, 
+                              myOperation, 
+                              isDumpArgs);
       }
     }
     //
index 74cfdd401c13a8b4487b9ceab9dc17c5fd668fef..1f8676eb0d1fcbf555cd4508b14c5f87535d81c8 100644 (file)
@@ -20,7 +20,8 @@ uses
     Edge from TopoDS,
     Shape from TopoDS,
     State from TopAbs,
-    PPaveFiller from BOPAlgo, 
+    PPaveFiller from BOPAlgo,  
+    PBuilder from BOPAlgo, 
     PBOP from BOPAlgo,
     ListOfShape from TopTools,
     IndexedDataMapOfShapeListOfShape from TopTools
@@ -28,56 +29,57 @@ uses
 is
 
     NbPoints(myclass; theDSFiller: PPaveFiller from BOPAlgo)
-       returns Integer from Standard;
+     returns Integer from Standard;
 
     NewVertex(myclass; theDSFiller: PPaveFiller from BOPAlgo;
-                      theIndex   : Integer from Standard)
-       returns Shape from TopoDS;
-
-    HasSameDomain(myclass; theBuilder: PBOP from BOPAlgo;
-                          theFace    : Shape from TopoDS)
-       returns Boolean from Standard;
+                 theIndex   : Integer from Standard)
+     returns Shape from TopoDS;
+    HasSameDomain(myclass; theBuilder: PBuilder from BOPAlgo;
+                  theFace    : Shape from TopoDS)
+     returns Boolean from Standard;
     
-    SameDomain(myclass; theBuilder: PBOP from BOPAlgo;
-                       theFace    : Shape from TopoDS;
-                       theResultList: out ListOfShape from TopTools);
+    SameDomain(myclass; theBuilder: PBuilder from BOPAlgo;
+               theFace    : Shape from TopoDS;
+               theResultList: out ListOfShape from TopTools); 
+
 
     IsSplit(myclass; theDSFiller: PPaveFiller from BOPAlgo;
-                    theEdge    : Shape from TopoDS;
-                    theState   : State from TopAbs)
-       returns Boolean from Standard;
      ---Warning: This method could be called only after boolean operation,
      ---         arguments of which was solids or compounds of solids.
      ---
+               theEdge    : Shape from TopoDS;
+               theState   : State from TopAbs)
+     returns Boolean from Standard;
+ ---Warning: This method could be called only after boolean operation,
+ ---         arguments of which was solids or compounds of solids.
+ ---
 
     Splits(myclass; theDSFiller: PPaveFiller from BOPAlgo;
-                   theEdge    : Shape from TopoDS;
-                   theState   : State from TopAbs;
-                   theResultList: out ListOfShape from TopTools);
      ---Warning: This method could be called only after boolean operation,
      ---         arguments of which was solids or compounds of solids.
      ---
+              theEdge    : Shape from TopoDS;
+              theState   : State from TopAbs;
+              theResultList: out ListOfShape from TopTools);
+ ---Warning: This method could be called only after boolean operation,
+ ---         arguments of which was solids or compounds of solids.
+ ---
 
     SplitE(myclass; theEdge  : Edge from TopoDS;
-                   theSplits: out ListOfShape from TopTools)
-       returns Boolean from Standard;
+              theSplits: out ListOfShape from TopTools)
+     returns Boolean from Standard;
 
     EdgeCurveAncestors(myclass; theDSFiller: PPaveFiller from BOPAlgo;
-                               theEdge    : Shape from TopoDS;
-                               theFace1   : out Shape from TopoDS;
-                               theFace2   : out Shape from TopoDS)
-       returns Boolean from Standard;
+                    theEdge    : Shape from TopoDS;
+    theFace1   : out Shape from TopoDS;
+    theFace2   : out Shape from TopoDS)
+     returns Boolean from Standard;
     
     EdgeSectionAncestors(myclass; theDSFiller: PPaveFiller from BOPAlgo;
-                                 theEdge    : Shape from TopoDS;
-                                 LF1,LF2    : out ListOfShape from TopTools;
-                                 LE1,LE2 : out ListOfShape from TopTools)
-       returns Boolean from Standard;
+                      theEdge    : Shape from TopoDS;
+                      LF1,LF2    : out ListOfShape from TopTools;
+      LE1,LE2 : out ListOfShape from TopTools)
+     returns Boolean from Standard;
 
     BoolOpe(myclass; theFace1: Shape from TopoDS;
-                    theFace2: Shape from TopoDS;
-                    IsCommonFound: out Boolean from Standard;
-                    theHistoryMap: out IndexedDataMapOfShapeListOfShape from TopTools)
-       returns Boolean from Standard;
+               theFace2: Shape from TopoDS;
+       IsCommonFound: out Boolean from Standard;
+               theHistoryMap: out IndexedDataMapOfShapeListOfShape from TopTools)
+     returns Boolean from Standard;
 
 end Tools from QANewModTopOpe;
index 1438359b06d34c4d23a77d887c426989a8232c71..aece47ca11d2bb66d5ed9889d9fb5d2fbe4aba90 100644 (file)
@@ -175,8 +175,9 @@ TopoDS_Shape QANewModTopOpe_Tools::NewVertex(const BOPAlgo_PPaveFiller& theDSFil
 // function: HasDomain
 // purpose:
 // ========================================================================================
-Standard_Boolean QANewModTopOpe_Tools::HasSameDomain(const BOPAlgo_PBOP& theBuilder, 
-                                                     const TopoDS_Shape& theFace) 
+Standard_Boolean QANewModTopOpe_Tools::HasSameDomain
+  (const BOPAlgo_PBuilder& theBuilder, 
+   const TopoDS_Shape& theFace) 
 {
   Standard_Integer bRet;
   bRet = Standard_False;
@@ -212,9 +213,10 @@ Standard_Boolean QANewModTopOpe_Tools::HasSameDomain(const BOPAlgo_PBOP& theBuil
 // function: SameDomain
 // purpose:
 // ========================================================================================
-void QANewModTopOpe_Tools::SameDomain(const BOPAlgo_PBOP&   theBuilder, 
-                                      const TopoDS_Shape&   theFace,
-                                      TopTools_ListOfShape& theResultList) 
+void QANewModTopOpe_Tools::SameDomain
+  (const BOPAlgo_PBuilder&   theBuilder, 
+   const TopoDS_Shape&   theFace,
+   TopTools_ListOfShape& theResultList) 
 {
   theResultList.Clear();