1 // Created on: 1993-06-14
2 // Created by: Jean Yves LEBEY
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _TopOpeBRepBuild_Fill_HeaderFile
18 #define _TopOpeBRepBuild_Fill_HeaderFile
20 //=======================================================================
21 //function : FillShape
23 //=======================================================================
24 void TopOpeBRepBuild_Builder::FillShape(const TopoDS_Shape& S1,
25 const TopAbs_State ToBuild1,
26 const TopTools_ListOfShape& LS2,
27 const TopAbs_State ToBuild2,
28 TopOpeBRepBuild_ShapeSet& aSet,
29 const Standard_Boolean In_RevOri)
31 Standard_Boolean RevOri = In_RevOri;
32 TopAbs_ShapeEnum t = S1.ShapeType();
33 TopAbs_ShapeEnum t1=TopAbs_COMPOUND,t11=TopAbs_COMPOUND;
35 if (t == TopAbs_FACE ) {
39 else if (t == TopAbs_SOLID || t == TopAbs_SHELL) {
44 // if the shape S1 is a SameDomain one, get its orientation compared
45 // with the shape taken as reference for all of the SameDomain shape of S1.
46 Standard_Boolean hsd = myDataStructure->HasSameDomain(S1);
48 TopOpeBRepDS_Config ssc = myDataStructure->SameDomainOrientation(S1);
49 if ( ssc == TopOpeBRepDS_DIFFORIENTED ) {
52 // Standard_Integer iFace = myDataStructure->Shape(S1);
53 // cout<<endl<<"********** ";
54 // cout<<"retournement d'orientation de ";TopAbs::Print(t,cout);
55 // cout<<" "<<iFace<<endl;
60 // work on a FORWARD shape <aShape>
61 TopoDS_Shape aShape = S1;
62 myBuildTool.Orientation(aShape,TopAbs_FORWARD);
64 TopoDS_Shape aSubShape;
65 TopAbs_Orientation newori;
67 // Explore the SubShapes of type <t1>
68 for (TopOpeBRepTool_ShapeExplorer ex1(aShape,t1); ex1.More(); ex1.Next()) {
69 aSubShape = ex1.Current();
71 if ( ! myDataStructure->HasShape(aSubShape) ) {
72 // SubShape is not in DS : classify it with shapes of LS2
73 Standard_Boolean keep = KeepShape(aSubShape,LS2,ToBuild1);
75 newori = Orient(myBuildTool.Orientation(aSubShape),RevOri);
76 myBuildTool.Orientation(aSubShape,newori);
77 aSet.AddShape(aSubShape);
81 // SubShape has geometry : split the <t11> SubShapes of the SubShape
82 TopOpeBRepTool_ShapeExplorer ex11(aSubShape,t11);
83 SplitShapes(ex11,ToBuild1,ToBuild2,aSet,RevOri);
85 } // exploration ot SubShapes of type <t1> of shape <S1>
90 //=======================================================================
93 //=======================================================================
94 void TopOpeBRepBuild_Builder::FillFace(const TopoDS_Shape& F1,
95 const TopAbs_State ToBuild1,
96 const TopTools_ListOfShape& LF2,
97 const TopAbs_State ToBuild2,
98 TopOpeBRepBuild_WireEdgeSet& WES,
99 const Standard_Boolean RevOri)
102 Standard_Boolean tSPF = TopOpeBRepBuild_GettraceSPF();
103 // Standard_Integer iFace = myDataStructure->Shape(F1);
104 if(tSPF){cout<<endl;}
105 if(tSPF){GdumpSHASTA(F1,ToBuild1,"=-= FillFace ");}
108 FillShape(F1,ToBuild1,LF2,ToBuild2,WES,RevOri);
109 myListOfFace.Clear();
113 //=======================================================================
114 //function : FillSolid
115 //purpose : load shells and faces from the solid in the ShellFaceSet <aSet>
116 //=======================================================================
117 void TopOpeBRepBuild_Builder::FillSolid(const TopoDS_Shape& S1,
118 const TopAbs_State ToBuild1,
119 const TopTools_ListOfShape& LS2,
120 const TopAbs_State ToBuild2,
121 TopOpeBRepBuild_ShapeSet& aSet,
122 const Standard_Boolean RevOri)
124 FillShape(S1,ToBuild1,LS2,ToBuild2,aSet,RevOri);
128 //=======================================================================
129 //function : FillVertexSet
131 //=======================================================================
132 void TopOpeBRepBuild_Builder::FillVertexSet(TopOpeBRepDS_PointIterator& IT,
133 const TopAbs_State ToBuild,
134 TopOpeBRepBuild_PaveSet& PVS) const
136 for (; IT.More(); IT.Next()) {
137 FillVertexSetOnValue(IT,ToBuild,PVS);
142 //=======================================================================
143 //function : FillVertexSetOnValue
145 //=======================================================================
146 void TopOpeBRepBuild_Builder::FillVertexSetOnValue
147 (const TopOpeBRepDS_PointIterator& IT,
148 const TopAbs_State ToBuild,
149 TopOpeBRepBuild_PaveSet& PVS) const
153 // ind = index of new point or existing vertex
154 Standard_Integer ind = IT.Current();
155 Standard_Boolean ispoint = IT.IsPoint();
157 //if (ispoint) V = NewVertex(ind);
158 if (ispoint && ind <= myDataStructure->NbPoints()) V = NewVertex(ind);
160 else V = myDataStructure->Shape(ind);
161 Standard_Real par = IT.Parameter();
162 TopAbs_Orientation ori = IT.Orientation(ToBuild);
164 Standard_Boolean keep = Standard_True;
165 // if (ori==TopAbs_EXTERNAL || ori==TopAbs_INTERNAL) keep = Standard_False;
168 myBuildTool.Orientation(V,ori);
169 Handle(TopOpeBRepBuild_Pave) PV = new TopOpeBRepBuild_Pave(V,par,Standard_False);
174 const TopoDS_Edge& EDEB = PVS.Edge();
175 Standard_Integer iE; Standard_Boolean tSPS = GtraceSPS(EDEB,iE);
177 if (keep) cout<<"+"; else cout<<"-";
178 if (ispoint) cout<<" PDS "; else cout<<" VDS ";
179 cout<<ind<<" : "; GdumpORIPARPNT(ori,par,BRep_Tool::Pnt(TopoDS::Vertex(V)));
185 //#ifndef _TopOpeBRepBuild_Fill_HeaderFile