Salome HOME
aa85b1fec559ba82fc91cca2f3cb34c1529f2338
[modules/geom.git] / NMTTools_PCurveMaker.cxx
1 // File:        NMTTools_PCurveMaker.cxx
2 // Created:     
3 // Author:      Peter KURNEV
4 //              <pkv@irinox>
5
6
7 #include <NMTTools_PCurveMaker.ixx>
8
9 #include <gp_Pnt2d.hxx>
10
11 #include <Precision.hxx>
12
13 #include <Geom_Curve.hxx>
14 #include <Geom_TrimmedCurve.hxx>
15 #include <Geom2d_Curve.hxx>
16 #include <GeomAdaptor_Curve.hxx>
17 #include <GeomAdaptor_HCurve.hxx>
18
19 #include <TopoDS.hxx>
20 #include <TopoDS_Face.hxx>
21 #include <TopoDS_Edge.hxx>
22 #include <TopoDS_Vertex.hxx>
23
24 #include <TopExp.hxx>
25 #include <TopTools_IndexedMapOfShape.hxx>
26
27 #include <BRep_Tool.hxx>
28 #include <BRep_Builder.hxx>
29 #include <BRepAdaptor_HSurface.hxx>
30
31 #include <NMTDS_ShapesDataStructure.hxx>
32 #include <NMTTools_DSFiller.hxx>
33
34 #include <IntTools_Curve.hxx>
35
36 #include <BOPTools_InterferencePool.hxx>
37 #include <BOPTools_CArray1OfSSInterference.hxx>
38 #include <BOPTools_SSInterference.hxx>
39 #include <BOPTools_ListOfPaveBlock.hxx>
40 #include <BOPTools_ListIteratorOfListOfPaveBlock.hxx>
41 #include <BOPTools_PaveBlock.hxx>
42 #include <BOPTools_Tools2D.hxx>
43 #include <NMTTools_PaveFiller.hxx>
44
45
46 //=======================================================================
47 // function: NMTTools_PCurveMaker
48 // purpose: 
49 //=======================================================================
50   NMTTools_PCurveMaker::NMTTools_PCurveMaker(NMTTools_PDSFiller& pDSFiller)
51 :
52   myIsDone(Standard_False)
53 {
54   myDSFiller=pDSFiller;
55 }
56 //=======================================================================
57 // function: IsDone
58 // purpose: 
59 //=======================================================================
60   Standard_Boolean NMTTools_PCurveMaker::IsDone() const
61 {
62   return myIsDone;
63 }
64 //=======================================================================
65 // function: Do
66 // purpose: 
67 //=======================================================================
68   void NMTTools_PCurveMaker::Do()
69 {
70   Standard_Integer i, aNb,  nF1, nF2, nE;
71   BOPTools_ListIteratorOfListOfPaveBlock anIt;
72   TopoDS_Face aF1FWD, aF2FWD;
73   //
74   NMTTools_PaveFiller *pFiller=(NMTTools_PaveFiller*) &(myDSFiller->PaveFiller());
75   NMTDS_ShapesDataStructure *pDS=pFiller->DS();
76   //
77   BOPTools_CArray1OfSSInterference& aFFs=(pFiller->InterfPool())->SSInterferences();
78   //
79   aNb=aFFs.Extent();
80   for (i=1; i<=aNb; ++i) {
81     BOPTools_SSInterference& aFF=aFFs(i);
82     // Faces
83     aFF.Indices(nF1, nF2);
84     const TopoDS_Face& aF1=TopoDS::Face(pDS->Shape(nF1));
85     const TopoDS_Face& aF2=TopoDS::Face(pDS->Shape(nF2));
86     //
87     // 1.Forwarding the Faces
88     aF1FWD=aF1;
89     aF1FWD.Orientation(TopAbs_FORWARD);
90     aF2FWD=aF2;
91     aF2FWD.Orientation(TopAbs_FORWARD);
92     //
93     // 2. In, On parts processing
94     const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks();
95     anIt.Initialize(aLPBInOn);
96     for (; anIt.More(); anIt.Next()) {
97       const BOPTools_PaveBlock& aPB=anIt.Value();
98       const BOPTools_PaveBlock& aPBInOn=pFiller->RealPaveBlock(aPB);
99       //
100       nE=aPBInOn.Edge();
101       const TopoDS_Edge& aE=TopoDS::Edge(pDS->Shape(nE));
102       
103       BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD);
104       BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD);
105     }
106   } //  for (i=1; i<=aNb; i++)
107   myIsDone=Standard_True;
108 }
109