Salome HOME
Fix documentation problems (reported as doxygen warnings)
[modules/geom.git] / src / NMTTools / NMTTools_PCurveMaker.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File:        NMTTools_PCurveMaker.cxx
23 // Created:     
24 // Author:      Peter KURNEV
25 //              <pkv@irinox>
26 //
27 #include <NMTTools_PCurveMaker.ixx>
28
29 #include <gp_Pnt2d.hxx>
30
31 #include <Precision.hxx>
32
33 #include <Geom_Curve.hxx>
34 #include <Geom_TrimmedCurve.hxx>
35 #include <Geom2d_Curve.hxx>
36 #include <GeomAdaptor_Curve.hxx>
37 #include <GeomAdaptor_HCurve.hxx>
38
39 #include <TopoDS.hxx>
40 #include <TopoDS_Face.hxx>
41 #include <TopoDS_Edge.hxx>
42 #include <TopoDS_Vertex.hxx>
43
44 #include <TopExp.hxx>
45 #include <TopTools_IndexedMapOfShape.hxx>
46
47 #include <BRep_Tool.hxx>
48 #include <BRep_Builder.hxx>
49 #include <BRepAdaptor_HSurface.hxx>
50
51 #include <NMTDS_ShapesDataStructure.hxx>
52 #include <NMTTools_DSFiller.hxx>
53
54 #include <IntTools_Curve.hxx>
55
56 #include <BOPTools_InterferencePool.hxx>
57 #include <BOPTools_CArray1OfSSInterference.hxx>
58 #include <BOPTools_SSInterference.hxx>
59 #include <BOPTools_ListOfPaveBlock.hxx>
60 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
61 #include <BOPTools_PaveBlock.hxx>
62 #include <BOPTools_Tools2D.hxx>
63 #include <NMTTools_PaveFiller.hxx>
64
65
66 //=======================================================================
67 // function: NMTTools_PCurveMaker
68 // purpose: 
69 //=======================================================================
70   NMTTools_PCurveMaker::NMTTools_PCurveMaker(NMTTools_PDSFiller& pDSFiller)
71 :
72   myIsDone(Standard_False)
73 {
74   myDSFiller=pDSFiller;
75 }
76 //=======================================================================
77 // function: IsDone
78 // purpose: 
79 //=======================================================================
80   Standard_Boolean NMTTools_PCurveMaker::IsDone() const
81 {
82   return myIsDone;
83 }
84 //=======================================================================
85 // function: Do
86 // purpose: 
87 //=======================================================================
88   void NMTTools_PCurveMaker::Do()
89 {
90   Standard_Integer i, aNb,  nF1, nF2, nE;
91   BOPTools_ListIteratorOfListOfPaveBlock anIt;
92   TopoDS_Face aF1FWD, aF2FWD;
93   //
94   NMTTools_PaveFiller *pFiller=(NMTTools_PaveFiller*) &(myDSFiller->PaveFiller());
95   NMTDS_ShapesDataStructure *pDS=pFiller->DS();
96   //
97   BOPTools_CArray1OfSSInterference& aFFs=(pFiller->InterfPool())->SSInterferences();
98   //
99   aNb=aFFs.Extent();
100   for (i=1; i<=aNb; ++i) {
101     BOPTools_SSInterference& aFF=aFFs(i);
102     // Faces
103     aFF.Indices(nF1, nF2);
104     const TopoDS_Face& aF1=TopoDS::Face(pDS->Shape(nF1));
105     const TopoDS_Face& aF2=TopoDS::Face(pDS->Shape(nF2));
106     //
107     // 1.Forwarding the Faces
108     aF1FWD=aF1;
109     aF1FWD.Orientation(TopAbs_FORWARD);
110     aF2FWD=aF2;
111     aF2FWD.Orientation(TopAbs_FORWARD);
112     //
113     // 2. In, On parts processing
114     const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks();
115     anIt.Initialize(aLPBInOn);
116     for (; anIt.More(); anIt.Next()) {
117       const BOPTools_PaveBlock& aPB=anIt.Value();
118       const BOPTools_PaveBlock& aPBInOn=pFiller->RealPaveBlock(aPB);
119       //
120       nE=aPBInOn.Edge();
121       const TopoDS_Edge& aE=TopoDS::Edge(pDS->Shape(nE));
122       
123       BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD);
124       BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD);
125     }
126   } //  for (i=1; i<=aNb; i++)
127   myIsDone=Standard_True;
128 }
129