1 // Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: GEOMAlgo_WireSolid.cxx
24 // Created: Wed Jan 12 10:19:31 2005
25 // Author: Peter KURNEV
28 #include <GEOMAlgo_WireSolid.ixx>
30 #include <Standard_Failure.hxx>
32 #include <TopAbs_ShapeEnum.hxx>
34 #include <TopTools_ListIteratorOfListOfShape.hxx>
36 #include <BOPTColStd_Dump.hxx>
38 #include <BooleanOperations_ShapesDataStructure.hxx>
39 #include <BooleanOperations_StateOfShape.hxx>
41 #include <BOPTools_PaveFiller.hxx>
42 #include <BOPTools_SplitShapesPool.hxx>
43 #include <BOPTools_PaveBlock.hxx>
44 #include <BOPTools_ListOfPaveBlock.hxx>
45 #include <BOPTools_DSFiller.hxx>
46 #include <BOPTools_WireStateFiller.hxx>
48 //=======================================================================
49 //function : GEOMAlgo_WireSolid
51 //=======================================================================
52 GEOMAlgo_WireSolid::GEOMAlgo_WireSolid()
57 //=======================================================================
60 //=======================================================================
61 GEOMAlgo_WireSolid::~GEOMAlgo_WireSolid()
64 //=======================================================================
67 //=======================================================================
68 void GEOMAlgo_WireSolid::Perform()
73 if (myDSFiller==NULL) {
77 if(!myDSFiller->IsDone()) {
82 Standard_Boolean bIsNewFiller;
84 bIsNewFiller=myDSFiller->IsNewFiller();
88 myDSFiller->SetNewFiller(!bIsNewFiller);
93 catch (Standard_Failure) {
97 //=======================================================================
100 //=======================================================================
101 void GEOMAlgo_WireSolid::Prepare()
103 const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
105 BOPTools_WireStateFiller aStateFiller(aPaveFiller);
109 //=======================================================================
110 // function: BuildResult
112 //=======================================================================
113 void GEOMAlgo_WireSolid::BuildResult()
115 const BooleanOperations_ShapesDataStructure& aDS=myDSFiller->DS();
116 const BOPTools_PaveFiller& aPaveFiller=myDSFiller->PaveFiller();
117 const BOPTools_SplitShapesPool& aSplitShapesPool=aPaveFiller.SplitShapesPool();
119 Standard_Integer i, aNbPB, nSp, iBeg, iEnd;
120 TopAbs_ShapeEnum aType;
121 BooleanOperations_StateOfShape aState;
128 iEnd=aDS.NumberOfShapesOfTheObject();
129 if (aDS.Tool().ShapeType()==TopAbs_WIRE) {
131 iEnd=aDS.NumberOfSourceShapes();
134 for (i=iBeg; i<=iEnd; ++i) {
135 aType=aDS.GetShapeType(i);
136 if (aType==TopAbs_EDGE) {
137 const TopoDS_Shape& aE=aDS.Shape(i);
138 const BOPTools_ListOfPaveBlock& aLPB=aSplitShapesPool(aDS.RefEdge(i));
142 aState=aDS.GetState(i);
144 if (aState==BooleanOperations_IN) {
147 else if (aState==BooleanOperations_OUT) {
150 else if (aState==BooleanOperations_ON) {
156 const BOPTools_PaveBlock& aPB=aLPB.First();
158 const TopoDS_Shape& aSp=aDS.Shape(nSp);
159 aState=aDS.GetState(nSp);
161 if (aState==BooleanOperations_IN) {
164 else if (aState==BooleanOperations_OUT) {
167 else if (aState==BooleanOperations_ON) {