1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: GEOMAlgo_WireSolid.cxx
21 // Created: Wed Jan 12 10:19:31 2005
22 // Author: Peter KURNEV
26 #include <GEOMAlgo_WireSolid.ixx>
28 #include <Standard_Failure.hxx>
30 #include <TopAbs_ShapeEnum.hxx>
32 #include <TopTools_ListIteratorOfListOfShape.hxx>
34 #include <BOPTColStd_Dump.hxx>
36 #include <BooleanOperations_ShapesDataStructure.hxx>
37 #include <BooleanOperations_StateOfShape.hxx>
39 #include <BOPTools_PaveFiller.hxx>
40 #include <BOPTools_SplitShapesPool.hxx>
41 #include <BOPTools_PaveBlock.hxx>
42 #include <BOPTools_ListOfPaveBlock.hxx>
43 #include <BOPTools_DSFiller.hxx>
44 #include <BOPTools_WireStateFiller.hxx>
46 //=======================================================================
47 //function : GEOMAlgo_WireSolid
49 //=======================================================================
50 GEOMAlgo_WireSolid::GEOMAlgo_WireSolid()
55 //=======================================================================
58 //=======================================================================
59 GEOMAlgo_WireSolid::~GEOMAlgo_WireSolid()
62 //=======================================================================
65 //=======================================================================
66 void GEOMAlgo_WireSolid::Perform()
71 if (myDSFiller==NULL) {
75 if(!myDSFiller->IsDone()) {
80 Standard_Boolean bIsNewFiller;
82 bIsNewFiller=myDSFiller->IsNewFiller();
86 myDSFiller->SetNewFiller(!bIsNewFiller);
91 catch (Standard_Failure) {
95 //=======================================================================
98 //=======================================================================
99 void GEOMAlgo_WireSolid::Prepare()
101 const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
103 BOPTools_WireStateFiller aStateFiller(aPaveFiller);
107 //=======================================================================
108 // function: BuildResult
110 //=======================================================================
111 void GEOMAlgo_WireSolid::BuildResult()
113 const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
114 const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
115 const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool();
117 Standard_Integer i, aNbPB, nSp, iBeg, iEnd;
118 TopAbs_ShapeEnum aType;
119 BooleanOperations_StateOfShape aState;
126 iEnd=aDS.NumberOfShapesOfTheObject();
127 if (aDS.Tool().ShapeType()==TopAbs_WIRE) {
129 iEnd=aDS.NumberOfSourceShapes();
132 for (i=iBeg; i<=iEnd; ++i) {
133 aType=aDS.GetShapeType(i);
134 if (aType==TopAbs_EDGE) {
135 const TopoDS_Shape& aE=aDS.Shape(i);
136 const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(i));
140 aState=aDS.GetState(i);
142 if (aState==BooleanOperations_IN) {
145 else if (aState==BooleanOperations_OUT) {
148 else if (aState==BooleanOperations_ON) {
154 const BOPTools_PaveBlock& aPB=aLPB.First();
156 const TopoDS_Shape& aSp=aDS.Shape(nSp);
157 aState=aDS.GetState(nSp);
159 if (aState==BooleanOperations_IN) {
162 else if (aState==BooleanOperations_OUT) {
165 else if (aState==BooleanOperations_ON) {