1 // file: TopOpeBRepBuild_makeedges.cxx
2 // Created: Thu Mar 7 10:49:33 1996
3 // Author: Jean Yves LEBEY
6 #include <TopOpeBRepBuild_Builder.ixx>
10 #include <BRep_Tool.hxx>
11 #include <TopOpeBRepTool_TOOL.hxx>
12 #include <TopOpeBRepDS_EXPORT.hxx>
13 #include <TopOpeBRepBuild_define.hxx>
16 Standard_IMPORT void debfillp(const Standard_Integer i);
17 Standard_EXPORT void debedbu(const Standard_Integer i) {cout<<"++ debedbu "<<i<<endl;}
21 #include <TopOpeBRepTool_DRAW.hxx>
24 //=======================================================================
25 //function : GPVSMakeEdges
27 //=======================================================================
28 void TopOpeBRepBuild_Builder::GPVSMakeEdges
29 (const TopoDS_Shape& EF,TopOpeBRepBuild_PaveSet& PVS,TopTools_ListOfShape& LOE) const
32 Standard_Integer iE; Standard_Boolean tSPS = GtraceSPS(EF,iE);
33 if (tSPS) debfillp(iE);
36 TopOpeBRepBuild_PaveClassifier VCL(EF);
37 Standard_Boolean equalpar = PVS.HasEqualParameters();
38 if (equalpar) VCL.SetFirstParameter(PVS.EqualParameters());
41 Standard_Boolean novertex = ( ! PVS.MoreLoop() );
43 if(tSPS&&novertex)cout<<"#--- GPVSMakeEdges : no vertex from edge "<<iE<<endl;
47 TopOpeBRepBuild_EdgeBuilder EDBU;
48 Standard_Boolean ForceClass = Standard_False;
49 EDBU.InitEdgeBuilder(PVS,VCL,ForceClass);
50 GEDBUMakeEdges(EF,EDBU,LOE);
54 //=======================================================================
55 //function : GEDBUMakeEdges
57 //=======================================================================
58 void TopOpeBRepBuild_Builder::GEDBUMakeEdges
59 (const TopoDS_Shape& EF,TopOpeBRepBuild_EdgeBuilder& EDBU,TopTools_ListOfShape& LOE) const
62 Standard_Integer iE; Standard_Boolean tSPS = GtraceSPS(EF,iE);
63 if(tSPS){cout<<endl;GdumpSHA(EF, (char *) "#--- GEDBUMakeEdges ");cout<<endl;}
64 if(tSPS){GdumpEDBU(EDBU);}
65 if(tSPS){debedbu(iE);}
69 for (EDBU.InitEdge(); EDBU.MoreEdge(); EDBU.NextEdge()) {
71 Standard_Integer nloop = 0;
72 Standard_Boolean tosplit = Standard_False;
73 for (EDBU.InitVertex(); EDBU.MoreVertex(); EDBU.NextVertex()) nloop++;
74 // 0 ou 1 vertex sur edge courante => suppression edge
75 if ( nloop <= 1 ) continue;
77 myBuildTool.CopyEdge(EF,newEdge);
79 Standard_Integer nVF = 0, nVR = 0; // nb vertex FORWARD,REVERSED
81 TopoDS_Shape VF,VR; // gestion du bit Closed
85 for (EDBU.InitVertex(); EDBU.MoreVertex(); EDBU.NextVertex()) {
86 TopoDS_Shape V = EDBU.Vertex();
87 TopAbs_Orientation Vori = V.Orientation();
89 Standard_Boolean hassd = myDataStructure->HasSameDomain(V);
90 if (hassd) { // on prend le vertex reference de V
91 Standard_Integer iref = myDataStructure->SameDomainReference(V);
92 V = myDataStructure->Shape(iref);
96 TopAbs_Orientation oriV = V.Orientation();
97 if ( oriV == TopAbs_EXTERNAL ) continue;
99 Standard_Boolean equafound = Standard_False;
100 TopExp_Explorer exE(newEdge,TopAbs_VERTEX);
101 for (; exE.More(); exE.Next() ) {
102 const TopoDS_Shape& VE = exE.Current();
103 TopAbs_Orientation oriVE = VE.Orientation();
105 if ( V.IsEqual(VE) ) {
106 equafound = Standard_True;
109 else if (oriVE == TopAbs_FORWARD || oriVE == TopAbs_REVERSED) {
111 equafound = Standard_True;
115 else if (oriVE == TopAbs_INTERNAL || oriVE == TopAbs_EXTERNAL) {
116 Standard_Real parV = EDBU.Parameter();
117 Standard_Real parVE = BRep_Tool::Parameter(TopoDS::Vertex(VE),TopoDS::Edge(newEdge));
118 if ( parV == parVE ) {
119 equafound = Standard_True;
125 if (Vori == TopAbs_FORWARD) {
127 if (nVF == 1) VF = V;
129 if (Vori == TopAbs_REVERSED) {
131 if (nVR == 1) VR = V;
133 if (oriV == TopAbs_INTERNAL) tosplit = Standard_True;
134 Standard_Real parV = EDBU.Parameter();
135 myBuildTool.AddEdgeVertex(newEdge,V);
136 myBuildTool.Parameter(newEdge,V,parV);
139 } // EDBUloop.InitVertex : on vertices of new edge newEdge
141 Standard_Boolean addedge = (nVF == 1 && nVR == 1);
142 Standard_Boolean bitclosed = Standard_False;
143 if (nVF == 1 && nVR == 1) {
144 bitclosed = VF.IsSame(VR);
145 newEdge.Closed(bitclosed);
149 TopTools_ListOfShape loe; Standard_Boolean ok = TopOpeBRepTool_TOOL::SplitE(TopoDS::Edge(newEdge),loe);
150 if (!ok) tosplit = Standard_False;
151 else LOE.Append(loe);
153 if (!tosplit) LOE.Append(newEdge);
155 } // EDBU.InitEdge : loop on EDBU edges
160 TCollection_AsciiString str1; str1 = "e";
161 TCollection_AsciiString str2; str2 = iE;
162 FDRAW_DINLOE("",LOE,str1,str2);