1 // Copyright (c) 2013 OPEN CASCADE SAS
3 // The content of this file is subject to the Open CASCADE Technology Public
4 // License Version 6.5 (the "License"). You may not use the content of this file
5 // except in compliance with the License. Please obtain a copy of the License
6 // at http://www.opencascade.org and read it completely before using this file.
8 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
11 // The Original Code and all software distributed under the License is
12 // distributed on an "AS IS" basis, without warranty of any kind, and the
13 // Initial Developer hereby disclaims all such warranties, including without
14 // limitation, any warranties of merchantability, fitness for a particular
15 // purpose or non-infringement. Please see the License for the specific terms
16 // and conditions governing the rights and limitations under the License.
18 #include <Prs3d_WFShape.hxx>
20 #include <Bnd_Box.hxx>
21 #include <BRepAdaptor_HSurface.hxx>
22 #include <BRepAdaptor_Curve.hxx>
23 #include <BRepBndLib.hxx>
24 #include <BRep_Tool.hxx>
25 #include <Graphic3d_Group.hxx>
26 #include <Graphic3d_AspectLine3d.hxx>
27 #include <Graphic3d_ArrayOfPolylines.hxx>
28 #include <Graphic3d_Array1OfVertex.hxx>
30 #include <Poly_Connect.hxx>
31 #include <Poly_Triangulation.hxx>
32 #include <Poly_Array1OfTriangle.hxx>
33 #include <Poly_Polygon3D.hxx>
34 #include <Poly_PolygonOnTriangulation.hxx>
35 #include <Prs3d_Drawer.hxx>
36 #include <Prs3d_IsoAspect.hxx>
37 #include <Prs3d_PointAspect.hxx>
38 #include <Prs3d_NListIteratorOfListOfSequenceOfPnt.hxx>
39 #include <Prs3d_ShapeTool.hxx>
40 #include <Standard_ErrorHandler.hxx>
41 #include <TColgp_Array1OfPnt.hxx>
42 #include <TColgp_SequenceOfPnt.hxx>
43 #include <TopoDS_Edge.hxx>
45 #include <TopTools_HSequenceOfShape.hxx>
46 #include <TopTools_ListOfShape.hxx>
47 #include <TopTools_ListIteratorOfListOfShape.hxx>
52 //! Compare two aspects
53 inline Standard_Boolean IsSame (const Handle(Graphic3d_AspectLine3d)& theUAspect,
54 const Handle(Graphic3d_AspectLine3d)& theVAspect)
56 Quantity_Color aCU, aCV;
57 Aspect_TypeOfLine aTlU, aTlV;
58 Standard_Real aWU, aWV;
59 theUAspect->Values (aCU, aTlU, aWU);
60 theVAspect->Values (aCV, aTlV, aWV);
68 // =========================================================================
69 // function: AddPolygon
71 // =========================================================================
72 Standard_Boolean Prs3d_WFShape::AddPolygon (const TopoDS_Edge& theEdge,
73 const Standard_Real theDeflection,
74 TColgp_SequenceOfPnt& thePoints)
76 TopLoc_Location aLocation;
77 Standard_Real aFirst, aLast;
78 Handle(Geom_Curve) aCurve3d = BRep_Tool::Curve (theEdge, aFirst, aLast);
79 Handle(Poly_Polygon3D) aPolygon = BRep_Tool::Polygon3D (theEdge, aLocation);
80 if (!aPolygon.IsNull())
82 if ((aPolygon->Deflection() <= theDeflection) || aCurve3d.IsNull())
84 const TColgp_Array1OfPnt& aPoints = aPolygon->Nodes();
85 Standard_Integer anIndex = aPoints.Lower();
86 if (aLocation.IsIdentity())
88 for (; anIndex <= aPoints.Upper(); ++anIndex)
90 thePoints.Append (aPoints.Value (anIndex));
95 for (; anIndex <= aPoints.Upper(); ++anIndex)
97 thePoints.Append (aPoints.Value (anIndex).Transformed (aLocation));
100 return Standard_True;
104 Handle(Poly_Triangulation) aTriangulation;
105 Handle(Poly_PolygonOnTriangulation) aHIndices;
106 BRep_Tool::PolygonOnTriangulation (theEdge, aHIndices, aTriangulation, aLocation);
107 if (!aHIndices.IsNull())
109 if ((aHIndices->Deflection() <= theDeflection) || aCurve3d.IsNull())
111 const TColStd_Array1OfInteger& anIndices = aHIndices->Nodes();
112 const TColgp_Array1OfPnt& aNodes = aTriangulation->Nodes();
114 Standard_Integer anIndex = anIndices.Lower();
115 if (aLocation.IsIdentity())
117 for (; anIndex <= anIndices.Upper(); ++anIndex)
119 thePoints.Append (aNodes (anIndices (anIndex)));
124 for (; anIndex <= anIndices.Upper(); ++anIndex)
126 thePoints.Append (aNodes (anIndices (anIndex)).Transformed (aLocation));
129 return Standard_True;
132 return Standard_False;
135 // =========================================================================
138 // =========================================================================
139 void Prs3d_WFShape::Add (const Handle (Prs3d_Presentation)& thePresentation,
140 const TopoDS_Shape& theShape,
141 const Handle (Prs3d_Drawer)& theDrawer)
143 if (theShape.IsNull())
148 Prs3d_ShapeTool aTool (theShape);
149 TopTools_ListOfShape aLFree, aLUnFree, aLWire;
150 for (aTool.InitCurve(); aTool.MoreCurve(); aTool.NextCurve())
152 const TopoDS_Edge& anEdge = aTool.GetCurve();
153 switch (aTool.Neighbours())
155 case 0: aLWire.Append (anEdge); break;
156 case 1: aLFree.Append (anEdge); break;
157 default: aLUnFree.Append (anEdge); break;
161 Standard_Real aDeflection = theDrawer->MaximalChordialDeviation();
162 if (theDrawer->TypeOfDeflection() == Aspect_TOD_RELATIVE)
164 // The arrow calculation is based on the global min max
166 BRepBndLib::Add (theShape, aBndBox);
167 if (!aBndBox.IsVoid())
169 Standard_Real aXmin, aYmin, aZmin, aXmax, aYmax, aZmax;
170 aBndBox.Get (aXmin, aYmin, aZmin, aXmax, aYmax, aZmax);
171 aDeflection = Max (aXmax-aXmin, Max (aYmax-aYmin, aZmax-aZmin))
172 * theDrawer->DeviationCoefficient();
176 Handle(Graphic3d_Group) aGroup = Prs3d_Root::CurrentGroup (thePresentation);
178 Prs3d_NListOfSequenceOfPnt anUIsoCurves;
179 Prs3d_NListOfSequenceOfPnt aVIsoCurves;
180 Prs3d_NListOfSequenceOfPnt aWireCurves;
181 Prs3d_NListOfSequenceOfPnt aFreeCurves;
182 Prs3d_NListOfSequenceOfPnt anUnFreeCurves;
183 TColgp_SequenceOfPnt aShapePoints;
185 const Standard_Integer anIsoU = theDrawer->UIsoAspect()->Number();
186 const Standard_Integer anIsoV = theDrawer->VIsoAspect()->Number();
188 Standard_Boolean hasIsoU = anIsoU > 0;
189 Standard_Boolean hasIsoV = anIsoV > 0;
191 if (IsSame (theDrawer->UIsoAspect()->Aspect(),
192 theDrawer->VIsoAspect()->Aspect()))
194 if (hasIsoU || hasIsoV)
196 BRepAdaptor_Surface aSurface;
197 for (aTool.InitFace(); aTool.MoreFace(); aTool.NextFace())
199 if (aTool.HasSurface())
201 if (!aTool.IsPlanarFace() || theDrawer->IsoOnPlane())
203 aSurface.Initialize (aTool.GetFace());
204 Handle(BRepAdaptor_HSurface) aHSurface = new BRepAdaptor_HSurface (aSurface);
208 Prs3d_NListOfSequenceOfPnt aCurUIsoCurves;
209 myFaceAlgo.Add (thePresentation, aHSurface,
215 Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
216 for (anIt.Init (aCurUIsoCurves); anIt.More(); anIt.Next())
218 anUIsoCurves.Append (anIt.Value());
221 catch (Standard_Failure)
233 BRepAdaptor_Surface aSurface;
234 for (aTool.InitFace(); aTool.MoreFace(); aTool.NextFace())
236 if (aTool.HasSurface())
238 if (!aTool.IsPlanarFace() || theDrawer->IsoOnPlane())
240 aSurface.Initialize (aTool.GetFace());
241 Handle(BRepAdaptor_HSurface) aHSurface = new BRepAdaptor_HSurface (aSurface);
245 Prs3d_NListOfSequenceOfPnt aCurUIsoCurves;
246 myFaceAlgo.Add (thePresentation, aHSurface,
247 hasIsoU, Standard_False,
253 catch (Standard_Failure)
256 const TopoDS_Face& aFace = aSurface.Face();
257 std::cout << "Problem with the face " << (void* ) &(*(aFace).TShape()) << std::endl;
266 BRepAdaptor_Surface aSurface;
267 for (aTool.InitFace(); aTool.MoreFace(); aTool.NextFace())
269 if (aTool.HasSurface())
271 if (!aTool.IsPlanarFace() || theDrawer->IsoOnPlane())
273 aSurface.Initialize (aTool.GetFace());
274 Handle(BRepAdaptor_HSurface) aHSurface = new BRepAdaptor_HSurface (aSurface);
278 Prs3d_NListOfSequenceOfPnt aCurUIsoCurves;
279 myFaceAlgo.Add (thePresentation, aHSurface,
280 Standard_False, hasIsoV,
286 catch (Standard_Failure)
289 const TopoDS_Face& aFace = aSurface.Face();
290 std::cout << "Problem with the face " << (void* ) &(*(aFace).TShape()) << std::endl;
299 Standard_Integer aNbVertices = 0, aNbBounds = 0;
300 if (anUIsoCurves.Size() > 0)
302 aNbBounds = anUIsoCurves.Size();
303 Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
304 for (anIt.Init (anUIsoCurves); anIt.More(); anIt.Next())
306 aNbVertices += anIt.Value().Length();
308 Handle(Graphic3d_ArrayOfPolylines) anUIsoArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
309 for (anIt.Init (anUIsoCurves); anIt.More(); anIt.Next())
311 TColgp_SequenceOfPnt aPoints;
312 aPoints.Assign (anIt.Value());
313 anUIsoArray->AddBound (aPoints.Length());
314 for (Standard_Integer anI = 1; anI <= aPoints.Length(); ++anI)
316 anUIsoArray->AddVertex (aPoints.Value (anI));
319 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
320 aGroup->SetPrimitivesAspect (theDrawer->UIsoAspect()->Aspect());
321 aGroup->AddPrimitiveArray (anUIsoArray);
324 if (aVIsoCurves.Size() > 0)
326 aNbBounds = aVIsoCurves.Size();
327 Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
328 for (anIt.Init (aVIsoCurves); anIt.More(); anIt.Next())
330 aNbVertices += anIt.Value().Length();
332 Handle(Graphic3d_ArrayOfPolylines) VIsoArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
333 for (anIt.Init (aVIsoCurves); anIt.More(); anIt.Next())
335 TColgp_SequenceOfPnt aPoints;
336 aPoints.Assign (anIt.Value());
337 VIsoArray->AddBound (aPoints.Length());
338 for (int anI = 1; anI <= aPoints.Length(); anI++)
340 VIsoArray->AddVertex (aPoints.Value (anI));
343 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
344 aGroup->SetPrimitivesAspect (theDrawer->VIsoAspect()->Aspect());
345 aGroup->AddPrimitiveArray (VIsoArray);
348 TopLoc_Location aLocation;
349 Standard_Integer anI, aJ, aN[3];
351 TColgp_SequenceOfPnt aSurfPoints;
352 for (aTool.InitFace(); aTool.MoreFace(); aTool.NextFace())
354 if (!aTool.HasSurface())
356 Handle(Poly_Triangulation) T = aTool.CurrentTriangulation (aLocation);
359 const TColgp_Array1OfPnt& aNodes = T->Nodes();
360 // Build the connect tool
361 Poly_Connect aPolyConnect (T);
363 Standard_Integer aNbTriangles = T->NbTriangles();
364 Standard_Integer aT[3];
366 // Count the free edges
367 Standard_Integer aNbFree = 0;
368 for (anI = 1; anI <= aNbTriangles; ++anI)
370 aPolyConnect.Triangles (anI, aT[0], aT[1], aT[2]);
371 for (aJ = 0; aJ < 3; ++aJ)
380 // Allocate the arrays
381 TColStd_Array1OfInteger aFree (1, 2 * aNbFree);
382 Standard_Integer aNbInternal = (3 * aNbTriangles - aNbFree) / 2;
383 TColStd_Array1OfInteger anInternal (0, 2 * aNbInternal);
385 Standard_Integer aFreeIndex = 1, anIntIndex = 1;
386 const Poly_Array1OfTriangle& aTriangles = T->Triangles();
387 for (anI = 1; anI <= aNbTriangles; ++anI)
389 aPolyConnect.Triangles (anI, aT[0], aT[1], aT[2]);
390 aTriangles (anI).Get (aN[0], aN[1], aN[2]);
391 for (aJ = 0; aJ < 3; aJ++)
393 Standard_Integer k = (aJ + 1) % 3;
396 aFree (aFreeIndex) = aN[aJ];
397 aFree (aFreeIndex + 1) = aN[k];
400 // internal edge if this triangle has a lower index than the adjacent
401 else if (anI < aT[aJ])
403 anInternal (anIntIndex) = aN[aJ];
404 anInternal (anIntIndex + 1) = aN[k];
410 if (!aTool.HasSurface())
413 Standard_Integer aFreeHalfNb = aFree.Length() / 2;
414 for (anI = 1; anI <= aFreeHalfNb; ++anI)
416 gp_Pnt aPoint1 = aNodes (aFree (2 * anI - 1)).Transformed (aLocation);
417 gp_Pnt aPoint2 = aNodes (aFree (2 * anI )).Transformed (aLocation);
418 aSurfPoints.Append (aPoint1);
419 aSurfPoints.Append (aPoint2);
425 if (aSurfPoints.Length() > 0)
427 aNbVertices = aSurfPoints.Length();
428 aNbBounds = (Standard_Integer)aNbVertices / 2;
429 Handle(Graphic3d_ArrayOfPolylines) aSurfArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
430 for (anI = 1; anI <= aNbVertices; anI += 2)
432 aSurfArray->AddBound (2);
433 aSurfArray->AddVertex (aSurfPoints.Value (anI));
434 aSurfArray->AddVertex (aSurfPoints.Value (anI + 1));
436 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
437 aGroup->SetPrimitivesAspect (theDrawer->FreeBoundaryAspect()->Aspect());
438 aGroup->AddPrimitiveArray (aSurfArray);
441 TopTools_ListIteratorOfListOfShape anIt;
442 if (theDrawer->WireDraw())
444 // Wire (without any neighbour)
445 aGroup->SetPrimitivesAspect (theDrawer->WireAspect()->Aspect());
446 for (anIt.Initialize(aLWire); anIt.More(); anIt.Next())
448 const TopoDS_Edge& anEdge = TopoDS::Edge (anIt.Value());
452 TColgp_SequenceOfPnt aPoints;
453 if (!AddPolygon (anEdge, aDeflection, aPoints))
455 if (BRep_Tool::IsGeometric (anEdge))
457 BRepAdaptor_Curve aCurve (anEdge);
458 myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer,
459 aPoints, Standard_False);
460 aWireCurves.Append (aPoints);
465 aWireCurves.Append (aPoints);
468 catch (Standard_Failure)
471 std::cout << "probleme sur aLocation'edge " << (void* ) &(*(anEdge).TShape()) << std::endl;
477 if (theDrawer->FreeBoundaryDraw())
480 for (anIt.Initialize (aLFree); anIt.More(); anIt.Next())
482 const TopoDS_Edge& anEdge = TopoDS::Edge (anIt.Value());
483 if (!BRep_Tool::Degenerated (anEdge))
488 TColgp_SequenceOfPnt aPoints;
489 if (!AddPolygon (anEdge, aDeflection, aPoints))
491 if (BRep_Tool::IsGeometric (anEdge))
493 BRepAdaptor_Curve aCurve (anEdge);
494 myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer,
495 aPoints, Standard_False);
496 aFreeCurves.Append (aPoints);
501 aFreeCurves.Append (aPoints);
504 catch (Standard_Failure)
507 std::cout << "probleme sur aLocation'edge " << (void* ) &(*(anEdge).TShape()) << std::endl;
514 if (theDrawer->UnFreeBoundaryDraw())
516 // Unfree boundaries;
517 for (anIt.Initialize (aLUnFree); anIt.More(); anIt.Next())
519 const TopoDS_Edge& anEdge = TopoDS::Edge (anIt.Value());
523 TColgp_SequenceOfPnt aPoints;
524 if (!AddPolygon (anEdge, aDeflection, aPoints))
526 if (BRep_Tool::IsGeometric (anEdge))
528 BRepAdaptor_Curve aCurve (anEdge);
529 myCurveAlgo.Add (thePresentation, aCurve, aDeflection, theDrawer, aPoints, Standard_False);
530 anUnFreeCurves.Append (aPoints);
535 anUnFreeCurves.Append (aPoints);
538 catch (Standard_Failure)
541 std::cout << "probleme sur aLocation'edge " << (void* ) &(*(anEdge).TShape()) << std::endl;
547 if (aWireCurves.Size() > 0)
549 aNbBounds = aWireCurves.Size();
550 Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
551 for (anIt.Init (aWireCurves); anIt.More(); anIt.Next())
553 aNbVertices += anIt.Value().Length();
555 Handle(Graphic3d_ArrayOfPolylines) WireArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
556 for (anIt.Init (aWireCurves); anIt.More(); anIt.Next())
558 TColgp_SequenceOfPnt aPoints;
559 aPoints.Assign (anIt.Value());
560 WireArray->AddBound (aPoints.Length());
561 for (anI = 1; anI <= aPoints.Length(); ++anI)
563 WireArray->AddVertex (aPoints.Value (anI));
566 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
567 aGroup->SetPrimitivesAspect (theDrawer->WireAspect()->Aspect());
568 aGroup->AddPrimitiveArray (WireArray);
571 if (aFreeCurves.Size() > 0)
573 aNbBounds = aFreeCurves.Size();
574 Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
575 for (anIt.Init (aFreeCurves); anIt.More(); anIt.Next())
577 aNbVertices += anIt.Value().Length();
579 Handle(Graphic3d_ArrayOfPolylines) aFreeArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
580 for (anIt.Init(aFreeCurves); anIt.More(); anIt.Next())
582 TColgp_SequenceOfPnt aPoints;
583 aPoints.Assign (anIt.Value());
584 aFreeArray->AddBound (aPoints.Length());
585 for (anI = 1; anI <= aPoints.Length(); ++anI)
587 aFreeArray->AddVertex (aPoints.Value (anI));
590 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
591 aGroup->SetPrimitivesAspect (theDrawer->FreeBoundaryAspect()->Aspect());
592 aGroup->AddPrimitiveArray (aFreeArray);
595 if (anUnFreeCurves.Size() > 0)
597 aNbBounds = anUnFreeCurves.Size();
598 Prs3d_NListIteratorOfListOfSequenceOfPnt anIt;
599 for (anIt.Init (anUnFreeCurves); anIt.More(); anIt.Next())
601 aNbVertices += anIt.Value().Length();
603 Handle(Graphic3d_ArrayOfPolylines) anUnFreeArray = new Graphic3d_ArrayOfPolylines (aNbVertices, aNbBounds);
604 for (anIt.Init (anUnFreeCurves); anIt.More(); anIt.Next())
606 TColgp_SequenceOfPnt aPoints;
607 aPoints.Assign (anIt.Value());
608 anUnFreeArray->AddBound (aPoints.Length());
609 for (anI = 1; anI <= aPoints.Length(); ++anI)
611 anUnFreeArray->AddVertex (aPoints.Value (anI));
614 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
615 aGroup->SetPrimitivesAspect (theDrawer->UnFreeBoundaryAspect()->Aspect());
616 aGroup->AddPrimitiveArray (anUnFreeArray);
620 for (aTool.InitVertex(); aTool.MoreVertex(); aTool.NextVertex())
622 aShapePoints.Append (BRep_Tool::Pnt (aTool.GetVertex()));
625 aNbVertices = aShapePoints.Length();
628 Graphic3d_Array1OfVertex aPointArray (1, aNbVertices);
629 for (anI = 1; anI <= aNbVertices; ++anI)
631 aPointArray.SetValue (anI, Graphic3d_Vertex (aShapePoints.Value (anI).X(),
632 aShapePoints.Value (anI).Y(),
633 aShapePoints.Value (anI).Z()));
636 Handle(Graphic3d_Group) aGroup = Prs3d_Root::NewGroup (thePresentation);
637 aGroup->SetPrimitivesAspect (theDrawer->PointAspect()->Aspect());
638 aGroup->MarkerSet (aPointArray);
642 // =========================================================================
643 // function: PickCurve
645 // =========================================================================
646 Handle(TopTools_HSequenceOfShape) Prs3d_WFShape::PickCurve
647 (const Quantity_Length theX,
648 const Quantity_Length theY,
649 const Quantity_Length theZ,
650 const Quantity_Length theDistance,
651 const TopoDS_Shape& theShape,
652 const Handle (Prs3d_Drawer)& theDrawer)
654 Handle(TopTools_HSequenceOfShape) aSeq = new TopTools_HSequenceOfShape();
655 Prs3d_ShapeTool aTool (theShape);
656 for (aTool.InitCurve(); aTool.MoreCurve(); aTool.NextCurve())
658 Bnd_Box aBndBox = aTool.CurveBound();
659 aBndBox.Enlarge (theDistance);
660 if (!aBndBox.IsOut (gp_Pnt (theX, theY, theZ)))
662 if (myCurveAlgo.Match (theX, theY, theZ, theDistance,
663 BRepAdaptor_Curve (aTool.GetCurve()), theDrawer))
665 Standard_Boolean isContain = Standard_False;
666 for (Standard_Integer anI = 1; anI <= aSeq->Length(); ++anI)
668 if (aSeq->Value (anI) == (aTool.GetCurve()))
670 isContain = Standard_True;
676 aSeq->Append (aTool.GetCurve());
684 // =========================================================================
685 // function: PickPatch
687 // =========================================================================
688 Handle(TopTools_HSequenceOfShape) Prs3d_WFShape::PickPatch
689 (const Quantity_Length theX,
690 const Quantity_Length theY,
691 const Quantity_Length theZ,
692 const Quantity_Length theDistance,
693 const TopoDS_Shape& theShape,
694 const Handle(Prs3d_Drawer)& theDrawer)
696 Handle(TopTools_HSequenceOfShape) aSeq = new TopTools_HSequenceOfShape();
697 Prs3d_ShapeTool aTool (theShape);
699 Standard_Boolean aRba1 = theDrawer->UIsoAspect()->Number() != 0;
700 Standard_Boolean aRba2 = theDrawer->VIsoAspect()->Number() != 0;
701 Standard_Boolean isContain;
705 BRepAdaptor_Surface aSurface;
706 for (aTool.InitFace(); aTool.MoreFace(); aTool.NextFace())
708 Bnd_Box aBndBox = aTool.FaceBound();
709 aBndBox.Enlarge (theDistance);
710 if (!aBndBox.IsOut (gp_Pnt (theX, theY, theZ)))
712 aSurface.Initialize (aTool.GetFace());
713 Handle(BRepAdaptor_HSurface) aHSurface = new BRepAdaptor_HSurface (aSurface);
714 if (myFaceAlgo.Match (theX, theY, theZ, theDistance, aHSurface, theDrawer))
716 isContain = Standard_False;
717 for (Standard_Integer anI = 1; anI <= aSeq->Length(); ++anI)
719 if (aSeq->Value (anI) == (aTool.GetFace()))
721 isContain = Standard_True;
727 aSeq->Append (aTool.GetFace());
734 for (aTool.InitCurve(); aTool.MoreCurve(); aTool.NextCurve())
736 Bnd_Box aBndBox = aTool.CurveBound();
737 aBndBox.Enlarge (theDistance);
738 if (!aBndBox.IsOut (gp_Pnt (theX, theY, theZ)))
740 if (myCurveAlgo.Match (theX, theY, theZ, theDistance,
741 BRepAdaptor_Curve(aTool.GetCurve()), theDrawer))
743 Handle(TopTools_HSequenceOfShape) aSurface = aTool.FacesOfEdge();
744 for (Standard_Integer anI = 1; anI <= aSurface->Length(); ++anI)
746 isContain = Standard_False;
747 for (Standard_Integer aJ = 1; aJ <= aSeq->Length(); ++aJ)
749 if (aSeq->Value (aJ) == (aSurface->Value (anI)))
751 isContain = Standard_True;
757 aSeq->Append (aSurface->Value (anI));