1 // Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License.
9 // This library is distributed in the hope that it will be useful
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 // File: GEOMAlgo_Gluer.cxx
21 // Created: Sat Dec 04 12:45:53 2004
22 // Author: Peter KURNEV
26 #include <GEOMAlgo_Gluer.ixx>
28 #include <TColStd_ListOfInteger.hxx>
29 #include <TColStd_ListIteratorOfListOfInteger.hxx>
35 #include <Geom_Curve.hxx>
36 #include <Geom_Surface.hxx>
38 #include <Bnd_Box.hxx>
39 #include <Bnd_HArray1OfBox.hxx>
40 #include <Bnd_BoundSortBox.hxx>
42 #include <TopLoc_Location.hxx>
43 #include <TopAbs_ShapeEnum.hxx>
44 #include <TopAbs_Orientation.hxx>
47 #include <TopoDS_Edge.hxx>
48 #include <TopoDS_Vertex.hxx>
49 #include <TopoDS_Shape.hxx>
50 #include <TopoDS_Compound.hxx>
51 #include <TopoDS_Wire.hxx>
52 #include <TopoDS_Shell.hxx>
53 #include <TopoDS_Solid.hxx>
54 #include <TopoDS_Iterator.hxx>
56 #include <TopTools_IndexedMapOfShape.hxx>
57 #include <TopTools_ListOfShape.hxx>
58 #include <TopTools_ListIteratorOfListOfShape.hxx>
59 #include <TopTools_DataMapIteratorOfDataMapOfShapeListOfShape.hxx>
60 #include <TopTools_MapOfShape.hxx>
61 #include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
64 #include <TopExp_Explorer.hxx>
66 #include <BRep_Tool.hxx>
67 #include <BRep_Builder.hxx>
68 #include <BRepLib.hxx>
69 #include <BRepTools.hxx>
70 #include <BRepBndLib.hxx>
72 #include <IntTools_Context.hxx>
73 #include <BOPTools_Tools.hxx>
74 #include <BOPTools_Tools3D.hxx>
75 #include <BOPTools_Tools2D.hxx>
76 #include <BOP_CorrectTolerances.hxx>
78 #include <GEOMAlgo_IndexedDataMapOfIntegerShape.hxx>
79 #include <GEOMAlgo_IndexedDataMapOfShapeBox.hxx>
80 #include <GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape.hxx> //qft
81 #include <GEOMAlgo_PassKeyShape.hxx>//qft
82 #include <GEOMAlgo_Tools.hxx>
86 void GetSubShapes(const TopoDS_Shape& aS,
87 TopTools_IndexedMapOfShape& aMSS);
89 //=======================================================================
90 //function : GEOMAlgo_Gluer
92 //=======================================================================
93 GEOMAlgo_Gluer::GEOMAlgo_Gluer()
99 myCheckGeometry=Standard_True;
102 //=======================================================================
103 //function : ~GEOMAlgo_Gluer
105 //=======================================================================
106 GEOMAlgo_Gluer::~GEOMAlgo_Gluer()
109 //=======================================================================
110 //function : SetCheckGeometry
112 //=======================================================================
113 void GEOMAlgo_Gluer::SetCheckGeometry(const Standard_Boolean aFlag)
115 myCheckGeometry=aFlag;
117 //=======================================================================
118 //function : CheckGeometry
120 //=======================================================================
121 Standard_Boolean GEOMAlgo_Gluer::CheckGeometry() const
123 return myCheckGeometry;
125 //=======================================================================
126 //function : AloneShapes
128 //=======================================================================
129 Standard_Integer GEOMAlgo_Gluer::AloneShapes()const
133 //=======================================================================
136 //=======================================================================
137 const TopTools_DataMapOfShapeListOfShape& GEOMAlgo_Gluer::Images()const
141 //=======================================================================
144 //=======================================================================
145 const TopTools_DataMapOfShapeShape& GEOMAlgo_Gluer::Origins()const
149 //=======================================================================
152 //=======================================================================
153 void GEOMAlgo_Gluer::Perform()
159 const Standard_Integer aNb=8;
160 void (GEOMAlgo_Gluer::* pF[aNb])()={
161 &GEOMAlgo_Gluer::CheckData, &GEOMAlgo_Gluer::InnerTolerance,
162 &GEOMAlgo_Gluer::MakeVertices, &GEOMAlgo_Gluer::MakeEdges,
163 &GEOMAlgo_Gluer::MakeFaces, &GEOMAlgo_Gluer::MakeShells,
164 &GEOMAlgo_Gluer::MakeSolids, &GEOMAlgo_Gluer::CheckResult
167 for (i=0; i<aNb; ++i) {
174 //=======================================================================
175 //function : MakeVertices
177 //=======================================================================
178 void GEOMAlgo_Gluer::MakeVertices()
182 Standard_Integer j, i, aNbV, aIndex, aNbVSD;
183 TColStd_ListIteratorOfListOfInteger aIt;
184 Handle(Bnd_HArray1OfBox) aHAB;
185 Bnd_BoundSortBox aBSB;
186 TopoDS_Shape aSTmp, aVF;
188 TopTools_IndexedMapOfShape aMV, aMVProcessed;
189 TopTools_ListIteratorOfListOfShape aItS;
190 TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
191 TopTools_DataMapOfShapeListOfShape aMVV;
192 GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
193 GEOMAlgo_IndexedDataMapOfShapeBox aMSB;
195 TopExp::MapShapes(myShape, TopAbs_VERTEX, aMV);
198 myErrorStatus=2; // no vertices in source shape
202 aHAB=new Bnd_HArray1OfBox(1, aNbV);
204 for (i=1; i<=aNbV; ++i) {
205 const TopoDS_Shape& aV=aMV(i);
209 BRepBndLib::Add(aV, aBox);
210 aHAB->SetValue(i, aBox);
215 aBSB.Initialize(aHAB);
217 for (i=1; i<=aNbV; ++i) {
218 const TopoDS_Shape& aV=aMV(i);
220 if (aMVProcessed.Contains(aV)) {
224 const Bnd_Box& aBoxV=aMSB.FindFromKey(aV);
225 const TColStd_ListOfInteger& aLI=aBSB.Compare(aBoxV);
228 myErrorStatus=3; // it must not be
234 TopTools_ListOfShape aLVSD;
237 for (j=0; aIt.More(); aIt.Next(), ++j) {
239 const TopoDS_Shape& aVx=aMIS.FindFromKey(aIndex);
244 aMVProcessed.Add(aVx);
247 myImages.Bind(aVF, aLVSD);
252 aItIm.Initialize(myImages);
253 for (; aItIm.More(); aItIm.Next()) {
254 const TopoDS_Shape& aV=aItIm.Key();
255 const TopTools_ListOfShape& aLVSD=aItIm.Value();
256 aNbVSD=aLVSD.Extent();
259 MakeVertex(aLVSD, aVnew);
260 aMVV.Bind(aVnew, aLVSD);
264 // UnBind old vertices
266 for (i=1; i<=aNbV; ++i) {
267 const TopoDS_Shape& aV=aMV(i);
272 aItIm.Initialize(aMVV);
273 for (; aItIm.More(); aItIm.Next()) {
274 const TopoDS_Shape& aV=aItIm.Key();
275 const TopTools_ListOfShape& aLVSD=aItIm.Value();
276 myImages.Bind(aV, aLVSD);
280 aItIm.Initialize(myImages);
281 for (; aItIm.More(); aItIm.Next()) {
282 const TopoDS_Shape& aV=aItIm.Key();
283 const TopTools_ListOfShape& aLVSD=aItIm.Value();
285 aItS.Initialize(aLVSD);
286 for (; aItS.More(); aItS.Next()) {
287 const TopoDS_Shape& aVSD=aItS.Value();
288 if (!myOrigins.IsBound(aVSD)) {
289 myOrigins.Bind(aVSD, aV);
294 //=======================================================================
295 //function : MakeSolids
297 //=======================================================================
298 void GEOMAlgo_Gluer::MakeSolids()
302 Standard_Integer aNbS;
303 TopAbs_Orientation anOr;
304 TopoDS_Compound aCmp;
305 TopoDS_Solid aNewSolid;
306 TopTools_IndexedMapOfShape aMS;
307 TopExp_Explorer aExpS, aExp;
310 aBB.MakeCompound(aCmp);
313 aExpS.Init(myShape, TopAbs_SOLID);
314 for (; aExpS.More(); aExpS.Next()) {
315 const TopoDS_Solid& aSolid=TopoDS::Solid(aExpS.Current());
316 if (aMS.Contains(aSolid)) {
321 anOr=aSolid.Orientation();
323 aBB.MakeSolid(aNewSolid);
324 aNewSolid.Orientation(anOr);
326 aExp.Init(aSolid, TopAbs_SHELL);
327 for (; aExp.More(); aExp.Next()) {
328 const TopoDS_Shape& aShell=aExp.Current();
329 const TopoDS_Shape& aShellR=myOrigins.Find(aShell);
330 aBB.Add(aNewSolid, aShellR);
333 TopTools_ListOfShape aLS;
336 myImages.Bind(aNewSolid, aLS);
337 myOrigins.Bind(aSolid, aNewSolid);
339 aBB.Add(aCmp, aNewSolid);
346 Standard_Real aTol=1.e-7;
347 BOP_CorrectTolerances::CorrectCurveOnSurface(myResult);
350 //=======================================================================
351 //function : MakeShells
353 //=======================================================================
354 void GEOMAlgo_Gluer::MakeShells()
358 Standard_Boolean bIsToReverse;
359 Standard_Integer i, aNbS;
360 TopAbs_Orientation anOr;
361 TopoDS_Shell aNewShell;
363 TopTools_IndexedMapOfShape aMS;
364 TopExp_Explorer aExp;
367 TopExp::MapShapes(myShape, TopAbs_SHELL, aMS);
370 for (i=1; i<=aNbS; ++i) {
371 const TopoDS_Shell& aShell=TopoDS::Shell(aMS(i));
372 anOr=aShell.Orientation();
374 aBB.MakeShell(aNewShell);
375 aNewShell.Orientation(anOr);
376 aExp.Init(aShell, TopAbs_FACE);
377 for (; aExp.More(); aExp.Next()) {
378 const TopoDS_Face& aF=TopoDS::Face(aExp.Current());
379 aFR=TopoDS::Face(myOrigins.Find(aF));
380 if (aFR.IsSame(aF)) {
381 aBB.Add(aNewShell, aF);
384 bIsToReverse=IsToReverse(aFR, aF);
388 aBB.Add(aNewShell, aFR);
391 TopTools_ListOfShape aLS;
394 myImages.Bind(aNewShell, aLS);
395 myOrigins.Bind(aShell, aNewShell);
398 //=======================================================================
399 //function : MakeFaces
401 //=======================================================================
402 void GEOMAlgo_Gluer::MakeFaces()
404 MakeShapes(TopAbs_FACE);
406 //=======================================================================
407 //function : MakeEdges
409 //=======================================================================
410 void GEOMAlgo_Gluer::MakeEdges()
412 MakeShapes(TopAbs_EDGE);
414 //=======================================================================
415 //function : MakeShapes
417 //=======================================================================
418 void GEOMAlgo_Gluer::MakeShapes(const TopAbs_ShapeEnum aType)
422 Standard_Boolean bHasNewSubShape;
423 Standard_Integer i, aNbF, aNbSDF, iErr;
424 TopoDS_Shape aNewShape;
425 TopTools_IndexedMapOfShape aMF;
426 TopTools_ListIteratorOfListOfShape aItS;
427 GEOMAlgo_PassKeyShape aPKF;//qft
428 GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;//qft
430 TopExp::MapShapes(myShape, aType, aMF);
433 for (i=1; i<=aNbF; ++i) {
434 const TopoDS_Shape& aS=aMF(i);
437 if (aType==TopAbs_FACE) {
438 const TopoDS_Face& aF=TopoDS::Face(aS);
439 FacePassKey(aF, aPKF);
441 else if (aType==TopAbs_EDGE) {
442 const TopoDS_Edge& aE=TopoDS::Edge(aS);
443 EdgePassKey(aE, aPKF);
450 if (aMPKLF.Contains(aPKF)) {
451 TopTools_ListOfShape& aLSDF=aMPKLF.ChangeFromKey(aPKF);
455 TopTools_ListOfShape aLSDF;
458 aMPKLF.Add(aPKF, aLSDF);
461 // check geometric coincidence
462 if (myCheckGeometry) {
463 iErr=GEOMAlgo_Tools::RefineSDShapes(aMPKLF, myTol, myContext);
472 aNbF=aMPKLF.Extent();
473 for (i=1; i<=aNbF; ++i) {
474 const TopTools_ListOfShape& aLSDF=aMPKLF(i);
475 aNbSDF=aLSDF.Extent();
477 myErrorStatus=4; // it must not be
480 const TopoDS_Shape& aS1=aLSDF.First();
482 bHasNewSubShape=Standard_True;
483 // prevent creation of a new shape if there are not
484 // new subshapes of aSS among the originals
486 bHasNewSubShape=HasNewSubShape(aS1);
487 if (!bHasNewSubShape) {
489 aNewShape.Orientation(TopAbs_FORWARD);
493 if (bHasNewSubShape) {
494 if (aType==TopAbs_FACE) {
495 TopoDS_Face aNewFace;
497 const TopoDS_Face& aF1=TopoDS::Face(aS1);
498 MakeFace(aF1, aNewFace);
501 else if (aType==TopAbs_EDGE) {
502 TopoDS_Edge aNewEdge;
504 const TopoDS_Edge& aE1=TopoDS::Edge(aS1);
505 MakeEdge(aE1, aNewEdge);
510 myImages.Bind(aNewShape, aLSDF);
512 aItS.Initialize(aLSDF);
513 for (; aItS.More(); aItS.Next()) {
514 const TopoDS_Shape& aFSD=aItS.Value();
515 if (!myOrigins.IsBound(aFSD)) {
516 myOrigins.Bind(aFSD, aNewShape);
521 //=======================================================================
522 //function : CheckResult
524 //=======================================================================
525 void GEOMAlgo_Gluer::CheckResult()
529 if (myResult.IsNull()) {
534 Standard_Boolean bFound;
535 Standard_Integer i, j, aNbS, aNbFS, aNbSx;
536 TopTools_IndexedMapOfShape aMS, aMFS;
537 TopTools_IndexedDataMapOfShapeListOfShape aMFR;
539 TopExp::MapShapesAndAncestors(myResult, TopAbs_FACE, TopAbs_SOLID, aMFR);
540 TopExp::MapShapes(myResult, TopAbs_SOLID, aMS);
545 for (i=1; i<=aNbS; ++i) {
546 const TopoDS_Shape& aSolid=aMS(i);
549 TopExp::MapShapes(aSolid, TopAbs_FACE, aMFS);
551 bFound=Standard_False;
553 for (j=1; j<=aNbFS; ++j) {
554 const TopoDS_Shape& aFS=aMFS(j);
555 if (aMFR.Contains(aFS)) {
556 const TopTools_ListOfShape& aLSx=aMFR.FindFromKey(aFS);
572 //=======================================================================
573 //function : CheckData
575 //=======================================================================
576 void GEOMAlgo_Gluer::CheckData()
580 if (myShape.IsNull()) {
585 //=======================================================================
586 //function : InnerTolerance
588 //=======================================================================
589 void GEOMAlgo_Gluer::InnerTolerance()
595 Standard_Real aX[3][2], dH, dHmin, aCoef, aTolTresh;
598 BRepBndLib::Add(myShape, aBox);
599 aBox.Get(aX[0][0], aX[1][0], aX[2][0], aX[0][1], aX[1][1], aX[2][1]);
601 dHmin=aX[0][1]-aX[0][0];
602 for (i=1; i<3; ++i) {
603 dH=aX[i][1]-aX[i][0];
611 aTolTresh=aCoef*dHmin;
612 if (myTol>aTolTresh) {
618 //=======================================================================
619 //function : FacePassKey
621 //=======================================================================
622 void GEOMAlgo_Gluer::FacePassKey(const TopoDS_Face& aF,
623 GEOMAlgo_PassKeyShape& aPK)
625 Standard_Integer i, aNbE;//, aNbMax;//qft
626 TopTools_ListOfShape aLE;
627 TopTools_IndexedMapOfShape aME;
629 TopExp::MapShapes(aF, TopAbs_EDGE, aME);
634 if (!aNbE || aNbE>aNbMax) {
635 myErrorStatus=101; // temprorary
641 for (i=1; i<=aNbE; ++i) {
642 const TopoDS_Shape& aE=aME(i);
643 if (!myOrigins.IsBound(aE)) {
647 const TopoDS_Shape& aER=myOrigins.Find(aE);
655 //=======================================================================
656 //function : EdgePassKey
658 //=======================================================================
659 void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE,
660 GEOMAlgo_PassKeyShape& aPK)
662 TopoDS_Vertex aV1, aV2;
664 TopExp::Vertices(aE, aV1, aV2);
666 if (!myOrigins.IsBound(aV1) || !myOrigins.IsBound(aV2) ) {
670 const TopoDS_Shape& aVR1=myOrigins.Find(aV1);
671 const TopoDS_Shape& aVR2=myOrigins.Find(aV2);
673 //aPK.SetIds(aVR1, aVR2);
674 aPK.SetShapes(aVR1, aVR2);
677 //=======================================================================
678 //function : MakeVertex
680 //=======================================================================
681 void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
682 TopoDS_Vertex& aNewVertex)
684 Standard_Integer aNbV;
685 Standard_Real aTolV, aD, aDmax;
690 TopTools_ListIteratorOfListOfShape aIt;
698 aGC.SetCoord(0.,0.,0.);
700 for (; aIt.More(); aIt.Next()) {
701 aVx=TopoDS::Vertex(aIt.Value());
702 aP3D=BRep_Tool::Pnt(aVx);
705 aGC/=(Standard_Real)aNbV;
711 for (; aIt.More(); aIt.Next()) {
712 aVx=TopoDS::Vertex(aIt.Value());
713 aP3D=BRep_Tool::Pnt(aVx);
714 aTolV=BRep_Tool::Tolerance(aVx);
715 aD=aPGC.Distance(aP3D)+aTolV;
721 aBB.MakeVertex (aNewVertex, aPGC, aDmax);
723 //=======================================================================
724 //function : MakeEdge
726 //=======================================================================
727 void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
728 TopoDS_Edge& aNewEdge)
732 Standard_Boolean bIsDE;
733 Standard_Real aT1, aT2;
734 TopoDS_Vertex aV1, aV2, aVR1, aVR2;
737 bIsDE=BRep_Tool::Degenerated(aE);
740 aEx.Orientation(TopAbs_FORWARD);
742 TopExp::Vertices(aEx, aV1, aV2);
744 aT1=BRep_Tool::Parameter(aV1, aEx);
745 aT2=BRep_Tool::Parameter(aV2, aEx);
747 aVR1=TopoDS::Vertex(myOrigins.Find(aV1));
748 aVR1.Orientation(TopAbs_FORWARD);
749 aVR2=TopoDS::Vertex(myOrigins.Find(aV2));
750 aVR2.Orientation(TopAbs_REVERSED);
756 TopAbs_Orientation anOrE;
758 anOrE=aE.Orientation();
759 aTol=BRep_Tool::Tolerance(aE);
766 aBB.Range(E, aT1, aT2);
767 aBB.Degenerated(E, Standard_True);
768 aBB.UpdateEdge(E, aTol);
774 BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
778 //=======================================================================
779 //function : MakeFace
781 //=======================================================================
782 void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
783 TopoDS_Face& aNewFace)
787 Standard_Boolean bIsToReverse, bIsUPeriodic;
788 Standard_Real aTol, aUMin, aUMax, aVMin, aVMax;
791 TopoDS_Face aFFWD, newFace;
792 TopLoc_Location aLoc;
793 Handle(Geom_Surface) aS;
794 Handle(Geom2d_Curve) aC2D;
795 TopExp_Explorer aExpW, aExpE;
799 aFFWD.Orientation(TopAbs_FORWARD);
801 aS=BRep_Tool::Surface(aFFWD, aLoc);
802 bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS);
803 aTol=BRep_Tool::Tolerance(aFFWD);
804 BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
806 aBB.MakeFace (newFace, aS, aLoc, aTol);
808 aExpW.Init(aFFWD, TopAbs_WIRE);
809 for (; aExpW.More(); aExpW.Next()) {
810 aBB.MakeWire(newWire);
811 const TopoDS_Wire& aW=TopoDS::Wire(aExpW.Current());
812 aExpE.Init(aW, TopAbs_EDGE);
813 for (; aExpE.More(); aExpE.Next()) {
814 const TopoDS_Edge& aE=TopoDS::Edge(aExpE.Current());
815 aER=TopoDS::Edge(myOrigins.Find(aE));
817 aER.Orientation(TopAbs_FORWARD);
818 if (!BRep_Tool::Degenerated(aER)) {
821 GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
823 BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
826 bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext);
832 aER.Orientation(aE.Orientation());
835 aBB.Add(newWire, aER);
837 //modified by NIZNHY-PKV Mon Jan 31 17:26:36 2005f
839 TopTools_ListOfShape aLW;
842 myImages.Bind(newWire, aLW);
843 myOrigins.Bind(aW, newWire);
845 //modified by NIZNHY-PKV Mon Jan 31 17:26:41 2005 t
846 aBB.Add(newFace, newWire);
850 //=======================================================================
851 //function : IsToReverse
853 //=======================================================================
854 Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
855 const TopoDS_Face& aF)
857 Standard_Boolean bRet;
858 Standard_Real aT, aT1, aT2, aTR, aScPr;
859 TopExp_Explorer aExp;
860 Handle(Geom_Curve)aC3D;
866 aExp.Init(aF, TopAbs_EDGE);
867 for (; aExp.More(); aExp.Next()) {
868 const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
870 if (BRep_Tool::Degenerated(aE)) {
874 const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE));
876 aC3D=BRep_Tool::Curve(aE, aT1, aT2);
877 aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
879 myContext.ProjectPointOnEdge(aP, aER, aTR);
881 BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
882 if (aF.Orientation()==TopAbs_REVERSED) {
886 BOPTools_Tools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR);
887 if (aFR.Orientation()==TopAbs_REVERSED) {
896 //=======================================================================
897 //function : HasNewSubShape
899 //=======================================================================
900 Standard_Boolean GEOMAlgo_Gluer::HasNewSubShape(const TopoDS_Shape& aS)const
902 Standard_Boolean bRet;
903 Standard_Integer i, aNbSS;
904 TopTools_IndexedMapOfShape aMSS;
906 GetSubShapes(aS, aMSS);
910 for (i=1; i<=aNbSS; ++i) {
911 const TopoDS_Shape& aSS=aMSS(i);
912 if (aSS.ShapeType()==TopAbs_WIRE) {
916 bRet=!myOrigins.IsBound(aSS);
921 const TopoDS_Shape& aSSIm=myOrigins.Find(aSS);
922 bRet=!aSSIm.IsSame(aSS);
929 //=======================================================================
930 //function : GetSubShapes
932 //=======================================================================
933 void GetSubShapes(const TopoDS_Shape& aS,
934 TopTools_IndexedMapOfShape& aMSS)
937 TopAbs_ShapeEnum aType;
940 aType=aS.ShapeType();
941 aR=(Standard_Integer)aType+1;
942 if (aR>TopAbs_VERTEX) {
947 for (; aIt.More(); aIt.Next()) {
948 const TopoDS_Shape& aSS=aIt.Value();
950 GetSubShapes(aSS, aMSS);
953 //=======================================================================
954 //function : Modified
956 //=======================================================================
957 const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS)
959 TopAbs_ShapeEnum aType;
963 aType=aS.ShapeType();
964 if (aType==TopAbs_VERTEX ||
965 aType==TopAbs_EDGE ||
966 aType==TopAbs_WIRE || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft
967 aType==TopAbs_FACE ||
968 aType==TopAbs_SHELL || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft
969 aType==TopAbs_SOLID) { //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft
970 if(myOrigins.IsBound(aS)) {
971 const TopoDS_Shape& aSnew=myOrigins.Find(aS);
972 if (!aSnew.IsSame(aS)) {
973 myGenerated.Append(aSnew);
980 //=======================================================================
981 //function : Generated
983 //=======================================================================
984 const TopTools_ListOfShape& GEOMAlgo_Gluer::Generated(const TopoDS_Shape& )
989 //=======================================================================
990 //function : IsDeleted
992 //=======================================================================
993 Standard_Boolean GEOMAlgo_Gluer::IsDeleted (const TopoDS_Shape& aS)
995 Standard_Boolean bRet=Standard_False;
997 const TopTools_ListOfShape& aL=Modified(aS);
1005 // 1 - the object is just initialized
1006 // 2 - no vertices found in source shape
1007 // 3 - nb same domain vertices for the vertex Vi =0
1008 // 4 - nb same domain edges(faces) for the edge Ei(face Fi) =0
1009 // 5 - source shape is Null
1010 // 6 - result shape is Null
1011 // 101 - nb edges > PassKey.NbMax() in FacesPassKey()
1012 // 102 - the edge Ei can not be found in myOrigins Map
1013 // 100 - the vertex Vi can not be found in myOrigins Map
1017 // 1 - some shapes can not be glued by faces