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>
81 #include <GEOMAlgo_PassKeyShape.hxx>
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;
428 GEOMAlgo_IndexedDataMapOfPassKeyShapeListOfShape aMPKLF;
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;
626 TopTools_ListOfShape aLE;
627 TopTools_IndexedMapOfShape aME;
629 TopExp::MapShapes(aF, TopAbs_EDGE, aME);
632 if (!aNbE || aNbE>aNbMax) {
633 myErrorStatus=101; // temprorary
637 for (i=1; i<=aNbE; ++i) {
638 const TopoDS_Shape& aE=aME(i);
639 if (!myOrigins.IsBound(aE)) {
643 const TopoDS_Shape& aER=myOrigins.Find(aE);
648 //=======================================================================
649 //function : EdgePassKey
651 //=======================================================================
652 void GEOMAlgo_Gluer::EdgePassKey(const TopoDS_Edge& aE,
653 GEOMAlgo_PassKeyShape& aPK)
655 TopoDS_Vertex aV1, aV2;
657 TopExp::Vertices(aE, aV1, aV2);
659 if (!myOrigins.IsBound(aV1) || !myOrigins.IsBound(aV2) ) {
663 const TopoDS_Shape& aVR1=myOrigins.Find(aV1);
664 const TopoDS_Shape& aVR2=myOrigins.Find(aV2);
665 aPK.SetIds(aVR1, aVR2);
667 //=======================================================================
668 //function : MakeVertex
670 //=======================================================================
671 void GEOMAlgo_Gluer::MakeVertex(const TopTools_ListOfShape& aLV,
672 TopoDS_Vertex& aNewVertex)
674 Standard_Integer aNbV;
675 Standard_Real aTolV, aD, aDmax;
680 TopTools_ListIteratorOfListOfShape aIt;
688 aGC.SetCoord(0.,0.,0.);
690 for (; aIt.More(); aIt.Next()) {
691 aVx=TopoDS::Vertex(aIt.Value());
692 aP3D=BRep_Tool::Pnt(aVx);
695 aGC/=(Standard_Real)aNbV;
701 for (; aIt.More(); aIt.Next()) {
702 aVx=TopoDS::Vertex(aIt.Value());
703 aP3D=BRep_Tool::Pnt(aVx);
704 aTolV=BRep_Tool::Tolerance(aVx);
705 aD=aPGC.Distance(aP3D)+aTolV;
711 aBB.MakeVertex (aNewVertex, aPGC, aDmax);
713 //=======================================================================
714 //function : MakeEdge
716 //=======================================================================
717 void GEOMAlgo_Gluer::MakeEdge(const TopoDS_Edge& aE,
718 TopoDS_Edge& aNewEdge)
722 Standard_Boolean bIsDE;
723 Standard_Real aT1, aT2;
724 TopoDS_Vertex aV1, aV2, aVR1, aVR2;
727 bIsDE=BRep_Tool::Degenerated(aE);
730 aEx.Orientation(TopAbs_FORWARD);
732 TopExp::Vertices(aEx, aV1, aV2);
734 aT1=BRep_Tool::Parameter(aV1, aEx);
735 aT2=BRep_Tool::Parameter(aV2, aEx);
737 aVR1=TopoDS::Vertex(myOrigins.Find(aV1));
738 aVR1.Orientation(TopAbs_FORWARD);
739 aVR2=TopoDS::Vertex(myOrigins.Find(aV2));
740 aVR2.Orientation(TopAbs_REVERSED);
746 TopAbs_Orientation anOrE;
748 anOrE=aE.Orientation();
749 aTol=BRep_Tool::Tolerance(aE);
756 aBB.Range(E, aT1, aT2);
757 aBB.Degenerated(E, Standard_True);
758 aBB.UpdateEdge(E, aTol);
764 BOPTools_Tools::MakeSplitEdge(aEx, aVR1, aT1, aVR2, aT2, aNewEdge);
768 //=======================================================================
769 //function : MakeFace
771 //=======================================================================
772 void GEOMAlgo_Gluer::MakeFace(const TopoDS_Face& aF,
773 TopoDS_Face& aNewFace)
777 Standard_Boolean bIsToReverse, bIsUPeriodic;
778 Standard_Real aTol, aUMin, aUMax, aVMin, aVMax;
781 TopoDS_Face aFFWD, newFace;
782 TopLoc_Location aLoc;
783 Handle(Geom_Surface) aS;
784 Handle(Geom2d_Curve) aC2D;
785 TopExp_Explorer aExpW, aExpE;
789 aFFWD.Orientation(TopAbs_FORWARD);
791 aS=BRep_Tool::Surface(aFFWD, aLoc);
792 bIsUPeriodic=GEOMAlgo_Tools::IsUPeriodic(aS);
793 aTol=BRep_Tool::Tolerance(aFFWD);
794 BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
796 aBB.MakeFace (newFace, aS, aLoc, aTol);
798 aExpW.Init(aFFWD, TopAbs_WIRE);
799 for (; aExpW.More(); aExpW.Next()) {
800 aBB.MakeWire(newWire);
801 const TopoDS_Wire& aW=TopoDS::Wire(aExpW.Current());
802 aExpE.Init(aW, TopAbs_EDGE);
803 for (; aExpE.More(); aExpE.Next()) {
804 const TopoDS_Edge& aE=TopoDS::Edge(aExpE.Current());
805 aER=TopoDS::Edge(myOrigins.Find(aE));
807 aER.Orientation(TopAbs_FORWARD);
808 if (!BRep_Tool::Degenerated(aER)) {
811 GEOMAlgo_Tools::RefinePCurveForEdgeOnFace(aER, aFFWD, aUMin, aUMax);
813 BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aER, aFFWD);
816 bIsToReverse=BOPTools_Tools3D::IsSplitToReverse1(aER, aE, myContext);
822 aER.Orientation(aE.Orientation());
825 aBB.Add(newWire, aER);
827 //modified by NIZNHY-PKV Mon Jan 31 17:26:36 2005f
829 TopTools_ListOfShape aLW;
832 myImages.Bind(newWire, aLW);
833 myOrigins.Bind(aW, newWire);
835 //modified by NIZNHY-PKV Mon Jan 31 17:26:41 2005 t
836 aBB.Add(newFace, newWire);
840 //=======================================================================
841 //function : IsToReverse
843 //=======================================================================
844 Standard_Boolean GEOMAlgo_Gluer::IsToReverse(const TopoDS_Face& aFR,
845 const TopoDS_Face& aF)
847 Standard_Boolean bRet;
848 Standard_Real aT, aT1, aT2, aTR, aScPr;
849 TopExp_Explorer aExp;
850 Handle(Geom_Curve)aC3D;
856 aExp.Init(aF, TopAbs_EDGE);
857 for (; aExp.More(); aExp.Next()) {
858 const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current());
860 if (BRep_Tool::Degenerated(aE)) {
864 const TopoDS_Edge& aER=TopoDS::Edge(myOrigins.Find(aE));
866 aC3D=BRep_Tool::Curve(aE, aT1, aT2);
867 aT=BOPTools_Tools2D::IntermediatePoint(aT1, aT2);
869 myContext.ProjectPointOnEdge(aP, aER, aTR);
871 BOPTools_Tools3D::GetNormalToFaceOnEdge (aE, aF, aT, aDNF);
872 if (aF.Orientation()==TopAbs_REVERSED) {
876 BOPTools_Tools3D::GetNormalToFaceOnEdge (aER, aFR, aTR, aDNFR);
877 if (aFR.Orientation()==TopAbs_REVERSED) {
886 //=======================================================================
887 //function : HasNewSubShape
889 //=======================================================================
890 Standard_Boolean GEOMAlgo_Gluer::HasNewSubShape(const TopoDS_Shape& aS)const
892 Standard_Boolean bRet;
893 Standard_Integer i, aNbSS;
894 TopTools_IndexedMapOfShape aMSS;
896 GetSubShapes(aS, aMSS);
900 for (i=1; i<=aNbSS; ++i) {
901 const TopoDS_Shape& aSS=aMSS(i);
902 if (aSS.ShapeType()==TopAbs_WIRE) {
906 bRet=!myOrigins.IsBound(aSS);
911 const TopoDS_Shape& aSSIm=myOrigins.Find(aSS);
912 bRet=!aSSIm.IsSame(aSS);
919 //=======================================================================
920 //function : GetSubShapes
922 //=======================================================================
923 void GetSubShapes(const TopoDS_Shape& aS,
924 TopTools_IndexedMapOfShape& aMSS)
927 TopAbs_ShapeEnum aType;
930 aType=aS.ShapeType();
931 aR=(Standard_Integer)aType+1;
932 if (aR>TopAbs_VERTEX) {
937 for (; aIt.More(); aIt.Next()) {
938 const TopoDS_Shape& aSS=aIt.Value();
940 GetSubShapes(aSS, aMSS);
943 //=======================================================================
944 //function : Modified
946 //=======================================================================
947 const TopTools_ListOfShape& GEOMAlgo_Gluer::Modified (const TopoDS_Shape& aS)
949 TopAbs_ShapeEnum aType;
953 aType=aS.ShapeType();
954 if (aType==TopAbs_VERTEX ||
955 aType==TopAbs_EDGE ||
956 aType==TopAbs_WIRE || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft
957 aType==TopAbs_FACE ||
958 aType==TopAbs_SHELL || //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft
959 aType==TopAbs_SOLID) { //modified by NIZNHY-PKV Mon Jan 31 17:18:36 2005ft
960 if(myOrigins.IsBound(aS)) {
961 const TopoDS_Shape& aSnew=myOrigins.Find(aS);
962 if (!aSnew.IsSame(aS)) {
963 myGenerated.Append(aSnew);
970 //=======================================================================
971 //function : Generated
973 //=======================================================================
974 const TopTools_ListOfShape& GEOMAlgo_Gluer::Generated(const TopoDS_Shape& )
979 //=======================================================================
980 //function : IsDeleted
982 //=======================================================================
983 Standard_Boolean GEOMAlgo_Gluer::IsDeleted (const TopoDS_Shape& aS)
985 Standard_Boolean bRet=Standard_False;
987 const TopTools_ListOfShape& aL=Modified(aS);
995 // 1 - the object is just initialized
996 // 2 - no vertices found in source shape
997 // 3 - nb same domain vertices for the vertex Vi =0
998 // 4 - nb same domain edges(faces) for the edge Ei(face Fi) =0
999 // 5 - source shape is Null
1000 // 6 - result shape is Null
1001 // 101 - nb edges > PassKey.NbMax() in FacesPassKey()
1002 // 102 - the edge Ei can not be found in myOrigins Map
1003 // 100 - the vertex Vi can not be found in myOrigins Map
1007 // 1 - some shapes can not be glued by faces