// Created on: 1996-03-07 // Created by: Jean Yves LEBEY // Copyright (c) 1996-1999 Matra Datavision // Copyright (c) 1999-2014 OPEN CASCADE SAS // // This file is part of Open CASCADE Technology software library. // // This library is free software; you can redistribute it and/or modify it under // the terms of the GNU Lesser General Public License version 2.1 as published // by the Free Software Foundation, with special exception defined in the file // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT // distribution for complete text of the license and disclaimer of any warranty. // // Alternatively, this file may be used under the terms of Open CASCADE // commercial license or contractual agreement. #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef DRAW Standard_IMPORT void FUN_draw(const TopoDS_Shape& s); Standard_IMPORT void FUN_draw2de (const TopoDS_Shape& ed,const TopoDS_Shape& fa); #endif #ifdef OCCT_DEBUG extern void* GFABUMAKEFACEPWES_DEB; #define DEBSHASET(sarg,meth,shaset,str) TCollection_AsciiString sarg((meth));(sarg)=(sarg)+(shaset).DEBNumber()+(str); Standard_Integer GLOBAL_iexE = 0; Standard_EXPORT void debfillw(const Standard_Integer /*i*/) {} Standard_EXPORT void debfille(const Standard_Integer /*i*/) {} Standard_EXPORT void debffwesON(const Standard_Integer i) {cout<<"++ debffwesON "<DS(); const TopOpeBRepDS_ListOfInterference& LI = BDS.ShapeInterferences(E); Standard_Integer IE = BDS.Shape(E); Standard_Integer IF = BDS.Shape(F); Standard_Integer rkF = BDS.AncestorRank(F); Standard_Boolean hasspE = BU.IsSplit(E,TopAbs_ON); if (hasspE) hasspE = (BU.Splits(E,TopAbs_ON).Extent() > 0); TopTools_MapOfShape Ffound; TopTools_ListOfShape Fsdm; TopTools_ListIteratorOfListOfShape itf(BDS.ShapeSameDomain(F)); for (; itf.More(); itf.Next()){ const TopoDS_Shape& f = itf.Value(); Standard_Integer rkf = BDS.AncestorRank(f); if (rkf == rkF) continue; Fsdm.Append(f); } for (TopOpeBRepDS_ListIteratorOfListOfInterference itI(LI); itI.More(); itI.Next()){ const Handle(TopOpeBRepDS_Interference)& I = itI.Value(); // const TopOpeBRepDS_Transition& T = I->Transition(); TopAbs_ShapeEnum SB,SA;Standard_Integer IB,IA;TopOpeBRepDS_Kind GT,ST;Standard_Integer G,S; FDS_Idata(I,SB,IB,SA,IA,GT,G,ST,S); if (ST != TopOpeBRepDS_EDGE) return Standard_False; TopoDS_Face FTRA; Standard_Integer ITRA = IB; if (SB == TopAbs_FACE) FTRA = TopoDS::Face(BDS.Shape(IB)); else if (SB == TopAbs_EDGE) { Standard_Boolean ok = FUN_tool_findAncestor(Fsdm,TopoDS::Edge(BDS.Shape(S)),FTRA); ITRA = BDS.Shape(FTRA); if (!ok) return Standard_False; } Standard_Boolean found = Ffound.Contains(FTRA); // prequesitory : F and FTRA are SDSO // ------------- // attached to E : I = (T(FTRA),G,ES), // ES : support edge // GP : geometric point // recall : rankE = rankF // rankTRA = rankS != rankE Standard_Real parE = FDS_Parameter(I); const TopoDS_Edge& ES = TopoDS::Edge(BDS.Shape(S)); Standard_Boolean hasspES = BU.IsSplit(ES,TopAbs_ON); if (hasspES) hasspE = (BU.Splits(ES,TopAbs_ON).Extent() > 0); Standard_Boolean sdm = FUN_ds_sdm(BDS,E,ES); Standard_Boolean mkTonEsdm = sdm && hasspE && !found; Standard_Boolean hasfeiF_E_FTRA = FUN_ds_hasFEI(pDS2d,F,IE,ITRA); //xpu120698 mkTonEsdm = mkTonEsdm && !hasfeiF_E_FTRA; //xpu120698 if (mkTonEsdm) { Ffound.Add(FTRA); TopoDS_Edge dummy; TopOpeBRepDS_Transition newT; Standard_Boolean ok = FUN_ds_mkTonFsdm(BU.DataStructure(),IF,ITRA,S,IE,parE,dummy,Standard_True,newT); if (ok) { newT.Index(ITRA); TopOpeBRepDS_Config C = TopOpeBRepDS_SAMEORIENTED; Handle(TopOpeBRepDS_Interference) newI = TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInterference(newT,ITRA,IE,Standard_True,C); pDS2d->AddShapeInterference(F,newI); } } Standard_Boolean mkTonESsdm = sdm && hasspES; Standard_Boolean hasfeiFRA_E_F = FUN_ds_hasFEI(pDS2d,FTRA,IE,IF); //xpu120698 mkTonESsdm = mkTonESsdm && !hasfeiFRA_E_F; //xpu120698 if (mkTonESsdm) { // ff1, IE=3 has interferences, S=8 has none TopoDS_Edge dummy; TopOpeBRepDS_Transition newT; Standard_Real parES; Standard_Boolean ok = FUN_tool_parE(E,parE,ES,parES); if (!ok) continue; ok = FUN_ds_mkTonFsdm(BU.DataStructure(),ITRA,IF,IE,S,parES,dummy,Standard_True,newT); if (ok) { newT.Index(IF); TopOpeBRepDS_Config C = TopOpeBRepDS_SAMEORIENTED; Handle(TopOpeBRepDS_Interference) newI = TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInterference(newT,IF,IE,Standard_False,C); pDS2d->AddShapeInterference(FTRA,newI); } ok = FUN_ds_mkTonFsdm(BU.DataStructure(),ITRA,IF,IE,IE,parE,dummy,Standard_True,newT); if (ok) { newT.Index(IF); TopOpeBRepDS_Config C = TopOpeBRepDS_SAMEORIENTED; Handle(TopOpeBRepDS_Interference) newI = TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInterference(newT,IF,S,Standard_True,C); pDS2d->AddShapeInterference(FTRA,newI); } } Standard_Boolean mkTonES = hasspES; Standard_Boolean hasfeiF_S_FTRA = FUN_ds_hasFEI(pDS2d,F,S,ITRA); //xpu120698 mkTonES = mkTonES && !hasfeiF_S_FTRA; if (mkTonES) { Standard_Real parES; Standard_Boolean ok = FUN_tool_parE(E,parE,ES,parES); if (!ok) continue; TopoDS_Edge dummy; TopOpeBRepDS_Transition newT; ok = FUN_ds_mkTonFsdm(BU.DataStructure(),IF,ITRA,S,S,parES,dummy,Standard_True,newT); if (ok) { newT.Index(ITRA); TopOpeBRepDS_Config C = TopOpeBRepDS_SAMEORIENTED; Handle(TopOpeBRepDS_Interference) newI = TopOpeBRepDS_InterferenceTool::MakeFaceEdgeInterference(newT,ITRA,S,Standard_False,C); pDS2d->AddShapeInterference(F,newI); } } } // itI(LI) return Standard_True; } //======================================================================= //function :FUN_computeLIFfaces2d //purpose : //======================================================================= Standard_Boolean FUN_computeLIFfaces2d(const TopOpeBRepBuild_Builder& BU, const TopoDS_Face& F, TopOpeBRepDS_PDataStructure& pDS2d) { TopExp_Explorer ex(F, TopAbs_EDGE); for (; ex.More(); ex.Next()){ const TopoDS_Edge& E = TopoDS::Edge(ex.Current()); Standard_Boolean ok = FUN_computeLIFfaces2d(BU,F,E,pDS2d); if (!ok) return Standard_False; } return Standard_True; } //======================================================================= //variable : Standard_EXPORT TopOpeBRepDS_PDataStructure GLOBAL_DS2d //purpose : //======================================================================= Standard_EXPORT TopOpeBRepDS_PDataStructure GLOBAL_DS2d = NULL; //======================================================================= //function : GMergeFaces //purpose : //======================================================================= void TopOpeBRepBuild_Builder::GMergeFaces(const TopTools_ListOfShape& LF1, const TopTools_ListOfShape& LF2, const TopOpeBRepBuild_GTopo& G1) { if ( LF1.IsEmpty() ) return; if (GLOBAL_DS2d == NULL) GLOBAL_DS2d = (TopOpeBRepDS_PDataStructure)new TopOpeBRepDS_DataStructure(); GLOBAL_DS2d->Init(); TopAbs_State TB1,TB2; G1.StatesON(TB1,TB2); const TopoDS_Shape& F1 = LF1.First(); #ifdef OCCT_DEBUG Standard_Integer iF; Standard_Boolean tSPS = GtraceSPS(F1,iF); if(tSPS){ cout<AddShape(itF1.Value(),1); TopTools_ListIteratorOfListOfShape itF1(LF1) ; for ( ; itF1.More(); itF1.Next()) GLOBAL_DS2d->AddShape(itF1.Value(),1); // for (TopTools_ListIteratorOfListOfShape itF2(LF2); itF2.More(); itF2.Next()) GLOBAL_DS2d->AddShape(itF2.Value(),2); TopTools_ListIteratorOfListOfShape itF2(LF2) ; for ( ; itF2.More(); itF2.Next()) GLOBAL_DS2d->AddShape(itF2.Value(),2); // for (itF1.Initialize(LF1); itF1.More(); itF1.Next()){ itF1.Initialize(LF1) ; for ( ; itF1.More(); itF1.Next()){ const TopoDS_Face& FF1 = TopoDS::Face(itF1.Value()); FUN_computeLIFfaces2d((*this),TopoDS::Face(FF1),GLOBAL_DS2d); } // for (itF2.Initialize(LF2); itF2.More(); itF2.Next()){ itF2.Initialize(LF2) ; for ( ; itF2.More(); itF2.Next()){ const TopoDS_Face& FF2 = TopoDS::Face(itF2.Value()); FUN_computeLIFfaces2d((*this),TopoDS::Face(FF2),GLOBAL_DS2d); } // xpu070598 { for (Standard_Integer ii=1; ii<=GLOBAL_DS2d->NbShapes(); ii++) { TopOpeBRepDS_ListOfInterference& LI = GLOBAL_DS2d->ChangeShapeInterferences(ii); FUN_reducedoublons(LI,(*GLOBAL_DS2d),ii); } } myFaceReference = TopoDS::Face(F1); TopOpeBRepBuild_WireEdgeSet WES(F1,this); GLOBAL_faces2d = Standard_True; Standard_Integer K1=1; GFillFacesWESK(LF1,LF2,G1,WES,K1); Standard_Integer K3=3; GFillFacesWESK(LF1,LF2,G1,WES,K3); // xpu060598 GLOBAL_faces2d = Standard_False; // Create a face builder FABU TopoDS_Shape F1F = LF1.First(); F1F.Orientation(TopAbs_FORWARD); Standard_Boolean ForceClass = Standard_True; TopOpeBRepBuild_FaceBuilder FABU; FABU.InitFaceBuilder(WES,F1F,ForceClass); // Build new faces LFM TopTools_ListOfShape LFM; #ifdef OCCT_DEBUG GFABUMAKEFACEPWES_DEB = (void*)&WES; #endif TopTools_DataMapOfShapeInteger MWisOld; GFABUMakeFaces(F1F,FABU,LFM,MWisOld); // xpu281098 : regularisation after GFABUMakeFaces TopTools_ListOfShape newLFM; RegularizeFaces(F1F,LFM,newLFM); LFM.Clear(); LFM.Assign(newLFM); // connect new faces as faces built TB1 on LF1 faces TopTools_ListIteratorOfListOfShape it1; for (it1.Initialize(LF1); it1.More(); it1.Next()) { const TopoDS_Shape& F1x = it1.Value(); Standard_Boolean tomerge = !IsMerged(F1x,TB1); if (tomerge) { ChangeMerged(F1x, TB1) = LFM; } } // connect new faces as faces built TB2 on LF2 faces TopTools_ListIteratorOfListOfShape it2; for (it2.Initialize(LF2); it2.More(); it2.Next()) { const TopoDS_Shape& F2 = it2.Value(); Standard_Boolean tomerge = !IsMerged(F2,TB2); if (tomerge) ChangeMerged(F2,TB2) = LFM; } } // GMergeFaces //======================================================================= //function : GFillFacesWES //purpose : //======================================================================= void TopOpeBRepBuild_Builder::GFillFacesWES(const TopTools_ListOfShape& , const TopTools_ListOfShape& , const TopOpeBRepBuild_GTopo& , TopOpeBRepBuild_WireEdgeSet& ) { } // GFillFacesWES static Standard_Boolean FUN_validF1edge(const TopoDS_Shape& F) { Standard_Integer nE = 0; TopTools_IndexedMapOfShape mEt; TopExp_Explorer exE(F, TopAbs_EDGE); // for ( exE ; exE.More(); exE.Next()) { for ( ; exE.More(); exE.Next()) { const TopoDS_Shape& e = exE.Current(); if (mEt.Contains(e)) continue; mEt.Add(e); nE++; if (nE > 2) break; } if (nE > 1) return Standard_True; if (nE == 1) { exE.Init(F, TopAbs_EDGE); const TopoDS_Edge& e = TopoDS::Edge(exE.Current()); TopoDS_Vertex dummy; Standard_Boolean closed = TopOpeBRepTool_TOOL::ClosedE(e,dummy); return closed; } return Standard_False; } //======================================================================= //function : GFillFacesWESMakeFaces //purpose : //======================================================================= void TopOpeBRepBuild_Builder::GFillFacesWESMakeFaces(const TopTools_ListOfShape& LLF1, const TopTools_ListOfShape& LF2, const TopTools_ListOfShape& ,//LSO, const TopOpeBRepBuild_GTopo& GM) { TopAbs_State TB1,TB2; GM.StatesON(TB1,TB2); if (LLF1.IsEmpty()) return; // xpu270898 : cto905E2 split(fref6,f33,f16) must be built on fref6 TopTools_ListOfShape LF1; TopTools_ListIteratorOfListOfShape itf(LLF1); const TopOpeBRepDS_DataStructure& BDS = myDataStructure->DS(); Standard_Integer iref = 0; for (; itf.More(); itf.Next()){ const TopoDS_Shape& fcur = itf.Value(); Standard_Integer icur = BDS.Shape(fcur); iref = BDS.SameDomainRef(fcur); if (icur == iref) LF1.Prepend(fcur); else LF1.Append(fcur); } // xpu270898 : cto905I1 split(f6,f30,fref14) must be built on fref6, f6 is in LFDO1 // Standard_Boolean FFinDO1 = (iFF == iref); // const TopoDS_Shape& FF = BDS.Shape(iref); const TopoDS_Shape& FF = LF1.First().Oriented(TopAbs_FORWARD); Standard_Integer iFF = BDS.Shape(FF); TopOpeBRepBuild_WireEdgeSet WES(FF,this); #ifdef OCCT_DEBUG Standard_Integer iF; Standard_Boolean tSPS = GtraceSPS(FF,iF); if(tSPS) GdumpSHASTA(iF,TB1,WES,"\n--- GFillFacesWESMakeFaces"); if(tSPS) debfillf(iF); if(tSPS) debffwesmf(iF); #endif Standard_Integer n1 = 0; GLOBAL_faces2d = Standard_True; Standard_Integer K1=1; GFillFacesWESK(LF1,LF2,GM,WES,K1); GLOBAL_faces2d = Standard_False; n1 = WES.StartElements().Extent(); Standard_Integer K2=2; GFillFacesWESK(LF1,LF2,GM,WES,K2); n1 = WES.StartElements().Extent(); Standard_Integer K3=3; GFillFacesWESK(LF1,LF2,GM,WES,K3); n1 = WES.StartElements().Extent(); Standard_Integer n2 = WES.StartElements().Extent(); myEdgeAvoid.Clear(); // Start edges dues a GFillCurveTopologyWES GCopyList(WES.StartElements(),(n1+1),n2,myEdgeAvoid); TopTools_ListOfShape LOF; // LOF : toutes les faces construites sur WES GWESMakeFaces(FF,WES,LOF); // xpu290498 //cto 001 F2 : spIN(f18) TopTools_ListIteratorOfListOfShape itF(LOF); while (itF.More()){ const TopoDS_Shape& F = itF.Value(); Standard_Boolean valid = ::FUN_validF1edge(F); if (!valid) LOF.Remove(itF); else itF.Next(); } // xpu290498 TopTools_ListOfShape LOFS; // LOFS : LOF faces situees TB1/LSO2 GKeepShapes(FF,myEmptyShapeList,TB1,LOF,LOFS); // les faces construites (LOFS) prennent l'orientation originale de FF TopAbs_Orientation odsFF = myDataStructure->Shape(iFF).Orientation(); for(TopTools_ListIteratorOfListOfShape itt(LOFS);itt.More();itt.Next()) itt.Value().Orientation(odsFF); TopTools_ListIteratorOfListOfShape it1; for (it1.Initialize(LF1); it1.More(); it1.Next()) { const TopoDS_Shape& S = it1.Value(); #ifdef OCCT_DEBUG Standard_Integer iS; GtraceSPS(S,iS); #endif MarkSplit(S,TB1); TopTools_ListOfShape& LS1 = ChangeSplit(S,TB1); GCopyList(LOFS,LS1); } TopTools_ListIteratorOfListOfShape it2; for (it2.Initialize(LF2); it2.More(); it2.Next()) { const TopoDS_Shape& S = it2.Value(); #ifdef OCCT_DEBUG Standard_Integer iS; GtraceSPS(S,iS); #endif MarkSplit(S,TB2); TopTools_ListOfShape& LS2 = ChangeSplit(S,TB2); GCopyList(LOFS,LS2); } } // GFillFacesWESMakeFaces //======================================================================= //function : GFillFaceWES //purpose : //======================================================================= void TopOpeBRepBuild_Builder::GFillFaceWES(const TopoDS_Shape& FOR1, const TopTools_ListOfShape& LFclass, const TopOpeBRepBuild_GTopo& G1, TopOpeBRepBuild_WireEdgeSet& WES) { TopAbs_State TB1,TB2; G1.StatesON(TB1,TB2); Standard_Boolean RevOri1 = G1.IsToReverse1(); #ifdef OCCT_DEBUG Standard_Integer iF; Standard_Boolean tSPS = GtraceSPS(FOR1,iF); if(tSPS) GdumpSHASTA(iF,TB1,WES,"--- GFillFaceWES","START"); if(tSPS) debfillf(iF); #endif // xpu200598 bcl1;bcl2; tsp(f9) Standard_Boolean opeCut = Opec12() || Opec21(); //xpu200598 Standard_Boolean ComOfCut = opeCut && (TB1 == TB2) && (TB1 == TopAbs_IN); //xpu200598 Standard_Boolean hsdm = myDataStructure->HasSameDomain(FOR1);//xpu200598 if (hsdm && ComOfCut) return; //xpu200598 // work on a FORWARD face FF TopoDS_Shape FF = FOR1; FF.Orientation(TopAbs_FORWARD); myFaceToFill = TopoDS::Face(FF); TopOpeBRepTool_ShapeExplorer exWire(FF,TopAbs_WIRE); for (; exWire.More(); exWire.Next()) { TopoDS_Shape W = exWire.Current(); Standard_Boolean hasshape = myDataStructure->HasShape(W); if ( ! hasshape ) { // wire W is not in DS : classify it with LFclass faces TopAbs_State pos; Standard_Boolean keep = GKeepShape1(W,LFclass,TB1,pos); if (keep) { TopAbs_Orientation oriW = W.Orientation(); TopAbs_Orientation neworiW = Orient(oriW,RevOri1); W.Orientation(neworiW); WES.AddShape(W); } else if (myProcessON && pos == TopAbs_ON) myONElemMap.Add(W); } else { // wire W has edges(s) with geometry : split W edges GFillWireWES(W,LFclass,G1,WES); } } #ifdef OCCT_DEBUG if(tSPS) GdumpSHASTA(iF,TB1,WES,"--- GFillFaceWES","END"); #endif return; } // GFillFaceWES //======================================================================= //function : GFillWireWES //purpose : //======================================================================= void TopOpeBRepBuild_Builder::GFillWireWES(const TopoDS_Shape& W, const TopTools_ListOfShape& LSclass, const TopOpeBRepBuild_GTopo& G1, TopOpeBRepBuild_WireEdgeSet& WES) { TopAbs_State TB1,TB2; G1.StatesON(TB1,TB2); #ifdef OCCT_DEBUG Standard_Integer iW; Standard_Boolean tSPS = GtraceSPS(W,iW); if(tSPS){ cout<DS(); TopAbs_Orientation oEinF; Standard_Integer Oinref = 0; Standard_Boolean hsdm = myDataStructure->HasSameDomain(myFaceToFill); Standard_Boolean hsdmE = myDataStructure->HasSameDomain(EOR); Standard_Integer ifil = myDataStructure->Shape(myFaceToFill); Standard_Integer iref = myDataStructure->Shape(myFaceReference); if (hsdm) { Oinref = FUN_ds_oriEinF(BDS,TopoDS::Edge(EOR),myFaceReference,oEinF); //xpu060598 // xpu150998 : cto900P6 : e35ou added to fref34,f53, oEinF=REVERSED, oEinfill=FORWARD TopAbs_Orientation oEinfill; Standard_Integer Oinfill = FUN_ds_oriEinF(BDS,TopoDS::Edge(EOR),myFaceToFill,oEinfill); if (Oinref == Oinfill) { Standard_Boolean reverse = Standard_False; if (iref != ifil) { // xpu230299 : FRA60275 (e6,fref4,ffill7) + PRO16297 TopAbs_Orientation oref = myFaceReference.Orientation(); Standard_Boolean samegeomori; FUN_samgeomori(BDS,iref,ifil,samegeomori); reverse = (!samegeomori); if (oref == TopAbs_REVERSED) reverse = !reverse; } // TopAbs_Orientation oref=myFaceReference.Orientation(), ofill=myFaceToFill.Orientation(); // Standard_Boolean reverse = (oref != ofill); TopAbs_Orientation oEinfillTOref = reverse ? TopAbs::Complement(oEinfill) : oEinfill; Standard_Boolean same = (oEinF == oEinfillTOref); if (!same && (oEinF!=TopAbs_INTERNAL) && (oEinF!=TopAbs_EXTERNAL)) oEinF = oEinfillTOref; } } else Oinref = FUN_ds_oriEinF(BDS,TopoDS::Edge(EOR),myFaceToFill,oEinF); //xpu060598 Standard_Boolean newO = (Oinref == ONSAMESHA) || (Oinref == ONOPPOSHA); //xpu060598 Standard_Boolean isfafa = (myIsKPart == 3); if (isfafa) newO = Standard_False;// xpu110598 // if (fus) : faces are SDSO : we keep original edge's orientation // if (com) : faces are SDSO : we keep original edge's orientation // if (cut && TBToFill==OUT) : myFaceToFill is the reference face, // we keep original edge's orientation #ifdef OCCT_DEBUG Standard_Integer iEOR; Standard_Boolean tSPS = GtraceSPS(EOR,iEOR); Standard_Integer iWESF; /*Standard_Boolean tSPSW = */GtraceSPS(WES.Face(),iWESF); if(tSPS) GdumpSHASTA(iEOR,TB1,WES,"\n--- GSplitEdgeWES","START"); if(tSPS) cout<<" RevOri1 : "<HasShape(EOR); Standard_Boolean hg = myDataStructure->HasGeometry(EOR); Standard_Boolean add = Standard_False; Standard_Boolean addON = Standard_False; Standard_Boolean isstart = Standard_False; isstart = hs; if (se) { Standard_Boolean ftg = !LSclass.IsEmpty(); TopAbs_ShapeEnum tclass = LSclass.First().ShapeType(); ftg = ftg && (tclass == TopAbs_FACE); if (!ftg) { TopAbs_State pos; Standard_Boolean keepse = GKeepShape1(EOR,LSclass,TB1,pos); if (keepse) add = Standard_True; else if (myProcessON && pos == TopAbs_ON) addON = Standard_True; } #ifdef OCCT_DEBUG cout<<"o-o GridFF ffil F"< "; GKeepShape(EOR,LSclass,TB1);cout.flush();} else {cout<<" : ftg --> non gardee"<DS(); TopAbs_State TB1,TB2; G1.StatesON(TB1,TB2); Standard_Boolean RevOri1 = G1.IsToReverse1(); TopAbs_Orientation oriE = EOR.Orientation(); TopAbs_Orientation neworiE = Orient(oriE,RevOri1); Standard_Boolean hassame = myDataStructure->HasSameDomain(EOR); if (!hassame) return; Standard_Boolean Eisref = Standard_False; if (hassame) { Standard_Integer iEref = myDataStructure->SameDomainReference(EOR); const TopoDS_Shape& Eref = myDataStructure->Shape(iEref); Eisref = EOR.IsSame(Eref); } TopAbs_State TBEOR = (Eisref) ? TB1 : TB2; if (TBEOR == TopAbs_OUT) return; //xpu040598 Standard_Boolean ismerged = IsMerged(EOR,TBEOR); if (ismerged) { if (!Eisref) return; const TopTools_ListOfShape& ME = Merged(EOR,TBEOR); TopTools_ListIteratorOfListOfShape it(ME); for(; it.More(); it.Next()) { TopoDS_Shape newE = it.Value(); newE.Orientation(neworiE); #ifdef OCCT_DEBUG if (tSPS) debaddpwes(iWESF,TB1,iEOR,neworiE,(TopOpeBRepBuild_Builder* const)this,&WES,"GMergeEdgeWES " ,"WES+ Emerge "); #endif WES.AddStartElement(newE); } return; } ChangeMerged(EOR,TBEOR) = myEmptyShapeList; TopAbs_State stspEOR; // if (isfafa) stspEOR = TBEOR; // xpu110598 // else stspEOR = (TBEOR == TopAbs_IN) ? TopAbs_ON : TopAbs_OUT; stspEOR = TBEOR; // xpu120598 Standard_Boolean issplit = IsSplit(EOR,stspEOR); if (!issplit) return; ChangeMerged(EOR,TBEOR) = Splits(EOR,stspEOR); const TopTools_ListOfShape& ME = Merged(EOR,TBEOR); #ifdef OCCT_DEBUG if(tSPS){ DEBSHASET(s,"GMergeEdgeWES(1) ",WES," WES+ Merged "); GdumpSHA(EOR,(Standard_Address)s.ToCString()); cout<<" ";TopAbs::Print(TBEOR,cout); cout<<" : "< TopoDS_Shape EF = EOR; EF.Orientation(TopAbs_FORWARD); #ifdef OCCT_DEBUG Standard_Integer iE; Standard_Boolean tSPS = GtraceSPS(EOR,iE); if (tSPS) GdumpSHASTA(EOR,TB1,"--- GSplitEdge ","\n"); if (tSPS) GdumpEDG(EF); if (tSPS) debsplite(iE); #endif const TopoDS_Edge& EEF = TopoDS::Edge(EF); Standard_Boolean isse = myDataStructure->DS().IsSectionEdge(EEF); Standard_Boolean issplitON = IsSplit(EEF,TopAbs_ON); Standard_Boolean takeON = (TB1 == TopAbs_IN) && (isse) && (issplitON); takeON = Standard_False; #ifdef OCCT_DEBUG if (tSPS) cout<<"---- takeON mis a 0"< //======================================================================= //function : ClassifyEdgeToSolidByOnePoint //purpose : //======================================================================= TopAbs_State ClassifyEdgeToSolidByOnePoint(const TopoDS_Edge& E, const TopoDS_Shape& Ref) { const Standard_Real PAR_T = 0.43213918;//10.*e^-PI Standard_Real f2 = 0., l2 = 0., par = 0.; Handle(Geom_Curve) C3D = BRep_Tool::Curve(E, f2, l2); gp_Pnt aP3d; if(C3D.IsNull()) { //it means that we are in degenerated edge const TopoDS_Vertex& fv = TopExp::FirstVertex(E); if(fv.IsNull()) return TopAbs_UNKNOWN; aP3d = BRep_Tool::Pnt(fv); } else {//usual case par = f2*PAR_T + (1 - PAR_T)*l2; C3D -> D0(par, aP3d); } BRepClass3d_SolidClassifier SC(Ref); SC.Perform(aP3d, 1e-7); return SC.State(); } //modified by NIZNHY-PKV Mon Mar 19 16:50:36 2001 t