1 // Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <GEOMAlgo_ShapeInfoFiller.hxx>
22 #include <Precision.hxx>
27 #include <gp_Circ.hxx>
29 #include <gp_Elips.hxx>
30 #include <gp_Sphere.hxx>
32 #include <gp_Cylinder.hxx>
33 #include <gp_Cone.hxx>
34 #include <gp_Torus.hxx>
36 #include <gp_Hypr.hxx>
37 #include <gp_Parab.hxx>
39 #include <Geom_Curve.hxx>
40 #include <Geom_Surface.hxx>
41 #include <Geom_BSplineCurve.hxx>
42 #include <Geom_BezierCurve.hxx>
44 #include <GeomAdaptor_Curve.hxx>
45 #include <GeomAdaptor_Surface.hxx>
48 #include <TopoDS_Edge.hxx>
49 #include <TopoDS_Solid.hxx>
50 #include <TopoDS_Vertex.hxx>
51 #include <TopoDS_Iterator.hxx>
52 #include <TopoDS_Wire.hxx>
53 #include <TopoDS_Face.hxx>
55 #include <BRep_Tool.hxx>
57 #include <BRepTools.hxx>
59 #include <TopTools_IndexedMapOfShape.hxx>
61 //=======================================================================
64 //=======================================================================
65 GEOMAlgo_ShapeInfoFiller::GEOMAlgo_ShapeInfoFiller()
71 //=======================================================================
74 //=======================================================================
75 GEOMAlgo_ShapeInfoFiller::~GEOMAlgo_ShapeInfoFiller()
78 //=======================================================================
79 //function : SetTolerance
81 //=======================================================================
82 void GEOMAlgo_ShapeInfoFiller::SetTolerance(const Standard_Real aT)
86 //=======================================================================
87 //function : Tolerance
89 //=======================================================================
90 Standard_Real GEOMAlgo_ShapeInfoFiller::Tolerance()const
94 //=======================================================================
97 //=======================================================================
98 void GEOMAlgo_ShapeInfoFiller::SetShape(const TopoDS_Shape& aS)
102 //=======================================================================
105 //=======================================================================
106 const TopoDS_Shape& GEOMAlgo_ShapeInfoFiller::Shape() const
110 //=======================================================================
113 //=======================================================================
114 const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info() const
116 return Info(myShape);
118 //=======================================================================
121 //=======================================================================
122 const GEOMAlgo_ShapeInfo& GEOMAlgo_ShapeInfoFiller::Info
123 (const TopoDS_Shape& aS) const
126 if (myMapInfo.Contains(aS)) {
127 const GEOMAlgo_ShapeInfo& aInfo=myMapInfo.FindFromKey(aS);
134 //=======================================================================
135 //function : CheckData
137 //=======================================================================
138 void GEOMAlgo_ShapeInfoFiller::CheckData()
142 if (myShape.IsNull()) {
147 //=======================================================================
150 //=======================================================================
151 void GEOMAlgo_ShapeInfoFiller::Perform()
164 //=======================================================================
165 //function :FillShape
167 //=======================================================================
168 void GEOMAlgo_ShapeInfoFiller::FillShape(const TopoDS_Shape& aS)
170 TopAbs_ShapeEnum aType;
172 aType=aS.ShapeType();
193 case TopAbs_COMPSOLID:
194 case TopAbs_COMPOUND:
202 //=======================================================================
203 //function :FillSubShapes
205 //=======================================================================
206 void GEOMAlgo_ShapeInfoFiller::FillSubShapes(const TopoDS_Shape& aS)
211 for (; aIt.More(); aIt.Next()) {
212 const TopoDS_Shape& aSx=aIt.Value();
216 //=======================================================================
217 //function : FillContainer
219 //=======================================================================
220 void GEOMAlgo_ShapeInfoFiller::FillContainer(const TopoDS_Shape& aS)
224 Standard_Boolean bIsClosed;
225 TopAbs_ShapeEnum aType;
226 GEOMAlgo_KindOfClosed aKC;
228 aType=aS.ShapeType();
229 //----------------------------------------------------
230 if (myMapInfo.Contains(aS)) {
234 GEOMAlgo_ShapeInfo aInfoX;
235 myMapInfo.Add(aS, aInfoX);
237 GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS);
238 //----------------------------------------------------
239 aInfo.SetType(aType);
240 FillNbSubShapes(aS, aInfo);
242 if (aType==TopAbs_SHELL) {
243 bIsClosed=BRep_Tool::IsClosed(aS);
244 aKC=(bIsClosed) ? GEOMAlgo_KC_CLOSED :GEOMAlgo_KC_NOTCLOSED;
245 aInfo.SetKindOfClosed(aKC);
247 else if (aType==TopAbs_WIRE) {
249 TopoDS_Vertex aV1, aV2;
252 TopExp::Vertices(aW, aV1, aV2);
254 bIsClosed=aV1.IsSame(aV2);
255 aKC=(bIsClosed) ? GEOMAlgo_KC_CLOSED :GEOMAlgo_KC_NOTCLOSED;
256 aInfo.SetKindOfClosed(aKC);
261 //=======================================================================
262 //function : FillSolid
264 //=======================================================================
265 void GEOMAlgo_ShapeInfoFiller::FillSolid(const TopoDS_Shape& aS)
270 //----------------------------------------------------
271 if (myMapInfo.Contains(aS)) {
275 GEOMAlgo_ShapeInfo aInfoX;
276 myMapInfo.Add(aS, aInfoX);
278 GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS);
279 //----------------------------------------------------
280 aInfo.SetType(TopAbs_SOLID);
281 FillNbSubShapes(aS, aInfo);
284 aSd=TopoDS::Solid(aS);
288 //=======================================================================
291 //=======================================================================
292 void GEOMAlgo_ShapeInfoFiller::FillFace(const TopoDS_Shape& aS)
295 if (myMapInfo.Contains(aS)) {
299 Standard_Boolean bIsAllowedType;
300 Standard_Boolean bInf, bInfU1, bInfU2, bInfV1, bInfV2;
301 Standard_Real aUMin, aUMax, aVMin, aVMax, aR1, aR2, dV;
305 GeomAbs_SurfaceType aST;
306 Handle(Geom_Surface) aSurf;
308 //----------------------------------------------------
309 GEOMAlgo_ShapeInfo aInfoX;
310 myMapInfo.Add(aS, aInfoX);
312 GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS);
313 //----------------------------------------------------
314 aInfo.SetType(TopAbs_FACE);
316 FillNbSubShapes(aS, aInfo);
322 aSurf=BRep_Tool::Surface(aF);
323 GeomAdaptor_Surface aGAS(aSurf);
325 bIsAllowedType=GEOMAlgo_ShapeInfoFiller::IsAllowedType(aST);
326 if (!bIsAllowedType) {
330 //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
332 if (aST==GeomAbs_Plane) {
337 aAx3=aPln.Position();
339 aInfo.SetKindOfShape(GEOMAlgo_KS_PLANE);
340 aInfo.SetKindOfName(GEOMAlgo_KN_PLANE);
341 aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
342 aInfo.SetLocation(aP0);
343 aInfo.SetPosition(aAx3);
345 BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
346 bInfU1=Precision::IsNegativeInfinite(aUMin);
347 bInfU2=Precision::IsPositiveInfinite(aUMax);
348 bInfV1=Precision::IsNegativeInfinite(aVMin);
349 bInfV2=Precision::IsPositiveInfinite(aVMax);
351 bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
353 aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
357 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
359 FillDetails(aF, aPln);
360 }// if (aCT==GeomAbs_Line) {
362 //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
364 else if (aST==GeomAbs_Sphere) {
367 aSphere=aGAS.Sphere();
368 aP0=aSphere.Location();
369 aAx3=aSphere.Position();
370 aR1=aSphere.Radius();
372 aInfo.SetKindOfShape(GEOMAlgo_KS_SPHERE);
373 aInfo.SetKindOfName(GEOMAlgo_KN_SPHERE);
374 aInfo.SetLocation(aP0);
375 aInfo.SetPosition(aAx3);
376 aInfo.SetRadius1(aR1);
378 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
379 aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED);
381 FillDetails(aF, aSphere);
382 }// else if (aST==GeomAbs_Sphere) {
384 //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
386 else if (aST==GeomAbs_Cylinder) {
389 aCyl=aGAS.Cylinder();
391 aAx3=aCyl.Position();
394 aInfo.SetKindOfShape(GEOMAlgo_KS_CYLINDER);
395 aInfo.SetKindOfName(GEOMAlgo_KN_CYLINDER);
396 aInfo.SetLocation(aP0);
397 aInfo.SetPosition(aAx3);
398 aInfo.SetRadius1(aR1);
400 BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
401 bInfU1=Precision::IsNegativeInfinite(aUMin);
402 bInfU2=Precision::IsPositiveInfinite(aUMax);
403 bInfV1=Precision::IsNegativeInfinite(aVMin);
404 bInfV2=Precision::IsPositiveInfinite(aVMax);
406 bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
408 aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
412 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
417 FillDetails(aF, aCyl);
420 //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
422 else if (aST==GeomAbs_Cone) {
423 Standard_Real aSemiAngle;
427 aP0=aCone.Location();
428 aAx3=aCone.Position();
430 aInfo.SetKindOfShape(GEOMAlgo_KS_CONE);
431 aInfo.SetKindOfName(GEOMAlgo_KN_CONE);
432 aInfo.SetLocation(aP0);
433 aInfo.SetPosition(aAx3);
435 BRepTools::UVBounds(aF, aUMin, aUMax, aVMin, aVMax);
436 bInfU1=Precision::IsNegativeInfinite(aUMin);
437 bInfU2=Precision::IsPositiveInfinite(aUMax);
438 bInfV1=Precision::IsNegativeInfinite(aVMin);
439 bInfV2=Precision::IsPositiveInfinite(aVMax);
441 bInf=(bInfU1 || bInfU2 || bInfV1 || bInfV2);
443 aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
447 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
449 aSemiAngle=fabs(aCone.SemiAngle());
450 dV=(aVMax-aVMin)*cos(aSemiAngle);
454 FillDetails(aF, aCone);
457 //||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
459 else if (aST==GeomAbs_Torus) {
463 aP0=aTorus.Location();
464 aAx3=aTorus.Position();
465 aR1=aTorus.MajorRadius();
466 aR2=aTorus.MinorRadius();
468 aInfo.SetKindOfShape(GEOMAlgo_KS_TORUS);
469 aInfo.SetKindOfName(GEOMAlgo_KN_TORUS);
470 aInfo.SetLocation(aP0);
471 aInfo.SetPosition(aAx3);
472 aInfo.SetRadius1(aR1);
473 aInfo.SetRadius2(aR2);
475 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
477 FillDetails(aF, aTorus);
480 //=======================================================================
483 //=======================================================================
484 void GEOMAlgo_ShapeInfoFiller::FillEdge(const TopoDS_Shape& aS)
488 Standard_Boolean bDegenerated, bIsAllowedType;
489 Standard_Integer aNbV;
490 Standard_Real aR1, aR2;
491 gp_Pnt aP, aP1, aP2, aPc;
494 Standard_Real aT1, aT2;
495 GeomAbs_CurveType aCT;
496 Handle(Geom_Curve) aC3D;
498 //----------------------------------------------------
499 if (myMapInfo.Contains(aS)) {
503 GEOMAlgo_ShapeInfo aInfoX;
504 myMapInfo.Add(aS, aInfoX);
506 GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS);
507 //----------------------------------------------------
508 aInfo.SetType(TopAbs_EDGE);
510 FillNbSubShapes(aS, aInfo);
514 bDegenerated=BRep_Tool::Degenerated(aE);
516 aInfo.SetKindOfShape(GEOMAlgo_KS_DEGENERATED);
521 aC3D=BRep_Tool::Curve(aE, aT1, aT2);
522 GeomAdaptor_Curve aGAC(aC3D);
524 bIsAllowedType=GEOMAlgo_ShapeInfoFiller::IsAllowedType(aCT);
525 if (!bIsAllowedType) {
530 if (aCT==GeomAbs_BSplineCurve) {
531 Standard_Integer aNbKnots, aNbPoles, aNbWeights, aNbMultiplicities, aDegree, i;
532 Standard_Real aLength;
533 gp_XYZ aXYZ1, aXYZ2, aXYZc;
534 Handle(Geom_BSplineCurve) aBSp;
537 aDegree = aBSp->Degree();
538 aNbPoles = aBSp->NbPoles();
539 aNbKnots = aBSp->NbKnots();
540 aNbWeights = (aBSp->IsRational() ? aNbPoles : 0);
541 aNbMultiplicities = (aBSp->KnotDistribution() == GeomAbs_Uniform ? 0 : aNbKnots);
542 if (aDegree==1 && aNbKnots==2 && aNbPoles==2) {
543 // This is a single line segment
544 aInfo.SetKindOfShape(GEOMAlgo_KS_BSPLINE);
545 aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
547 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
548 aInfo.SetKindOfName(GEOMAlgo_KN_SEGMENT);
554 aLength=aP1.Distance(aP2);
555 aInfo.SetLength(aLength);
562 aInfo.SetLocation(aPc);
564 if ( aLength >= gp::Resolution() ) {
565 gp_Vec aVec(aPc, aP2);
567 aInfo.SetDirection(aDir);
571 // We have a higher degree B-Spline curve
572 aInfo.SetKindOfShape(GEOMAlgo_KS_BSPLINE);
573 aInfo.SetKindOfName(GEOMAlgo_KN_CURVEBSPLINE);
574 aInfo.SetKindOfPeriod(aBSp->IsPeriodic() ? GEOMAlgo_KP_PERIODIC : GEOMAlgo_KP_NONPERIODIC);
575 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
576 aInfo.SetKindOfClosed(aBSp->IsClosed() ? GEOMAlgo_KC_CLOSED : GEOMAlgo_KC_NOTCLOSED);
582 aInfo.SetDegree(aDegree);
583 aInfo.SetNbKnots(aNbKnots);
584 aInfo.SetNbPoles(aNbPoles);
585 aInfo.SetNbWeights(aNbWeights);
586 aInfo.SetNbMultiplicities(aNbMultiplicities);
588 Handle(TColgp_HArray1OfPnt) poles = new TColgp_HArray1OfPnt(1, aNbPoles);
589 for (i=1; i<=aNbPoles; i++)
590 poles->SetValue(i, aBSp->Pole(i));
591 aInfo.SetPoles(poles);
593 Handle(TColStd_HArray1OfReal) knots = new TColStd_HArray1OfReal(1, aNbKnots);
594 for (i=1; i<=aNbKnots; i++)
595 knots->SetValue(i, aBSp->Knot(i));
596 aInfo.SetKnots(knots);
598 if (aNbWeights > 0) {
599 Handle(TColStd_HArray1OfReal) weights = new TColStd_HArray1OfReal(1, aNbWeights);
600 for (i=1; i<=aNbWeights; i++)
601 weights->SetValue(i, aBSp->Weight(i));
602 aInfo.SetWeights(weights);
604 // Fill the multiplicities
605 if (aNbMultiplicities > 0) {
606 Handle(TColStd_HArray1OfInteger) mults = new TColStd_HArray1OfInteger(1, aNbMultiplicities);
607 for (i=1; i<=aNbMultiplicities; i++)
608 mults->SetValue(i, aBSp->Multiplicity(i));
609 aInfo.SetMultiplicities(mults);
612 }//if (aCT==GeomAbs_BSplineCurve) {
614 else if (aCT==GeomAbs_BezierCurve) {
615 Standard_Integer aNbPoles, aNbWeights, aDegree, i;
616 Handle(Geom_BezierCurve) aBC;
618 aNbPoles = aBC->NbPoles();
619 aNbWeights = (aBC->IsRational() ? aNbPoles : 0);
620 aDegree = aBC->Degree();
621 aInfo.SetKindOfShape(GEOMAlgo_KS_BEZIER);
622 aInfo.SetKindOfName(GEOMAlgo_KN_CURVEBEZIER);
623 aInfo.SetKindOfPeriod(aBC->IsPeriodic() ? GEOMAlgo_KP_PERIODIC : GEOMAlgo_KP_NONPERIODIC);
624 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
625 aInfo.SetKindOfClosed(aBC->IsClosed() ? GEOMAlgo_KC_CLOSED : GEOMAlgo_KC_NOTCLOSED);
631 aInfo.SetDegree(aDegree);
632 aInfo.SetNbPoles(aNbPoles);
633 aInfo.SetNbWeights(aNbWeights);
635 Handle(TColgp_HArray1OfPnt) poles = new TColgp_HArray1OfPnt(1, aNbPoles);
636 for (i=1; i<=aNbPoles; i++)
637 poles->SetValue(i, aBC->Pole(i));
638 aInfo.SetPoles(poles);
640 if (aNbWeights > 0) {
641 Handle(TColStd_HArray1OfReal) weights = new TColStd_HArray1OfReal(1, aNbWeights);
642 for (i=1; i<=aNbWeights; i++)
643 weights->SetValue(i, aBC->Weight(i));
644 aInfo.SetWeights(weights);
646 }// if (aCT==GeomAbs_BezierCurve) {
648 else if (aCT==GeomAbs_Line) {
649 Standard_Boolean bInf1, bInf2;
650 Standard_Real aLength;
652 gp_XYZ aXYZ1, aXYZ2, aXYZc;
658 aInfo.SetKindOfShape(GEOMAlgo_KS_LINE);
659 aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
660 aInfo.SetLocation(aP);
661 aInfo.SetDirection(aD);
663 bInf1=Precision::IsNegativeInfinite(aT1);
664 bInf2=Precision::IsPositiveInfinite(aT2);
666 aInfo.SetKindOfBounds(GEOMAlgo_KB_INFINITE);
667 aInfo.SetKindOfName(GEOMAlgo_KN_LINE);
670 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
671 aInfo.SetKindOfName(GEOMAlgo_KN_SEGMENT);
677 aLength=aP1.Distance(aP2);
684 gp_Vec aVec(aPc, aP2);
687 aInfo.SetLocation(aPc);
688 aInfo.SetDirection(aDir);
689 aInfo.SetLength(aLength);
691 }// if (aCT==GeomAbs_Line) {
694 else if (aCT==GeomAbs_Circle) {
699 aAx2=aCirc.Position();
702 aInfo.SetKindOfShape(GEOMAlgo_KS_CIRCLE);
703 aInfo.SetLocation(aP);
704 aInfo.SetPosition(aAx2);
705 aInfo.SetRadius1(aR1);
707 aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
709 myErrorStatus=11; // circle edge without vertices
712 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
719 aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED);
720 aInfo.SetKindOfName(GEOMAlgo_KN_CIRCLE);
723 aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
724 aInfo.SetKindOfName(GEOMAlgo_KN_ARCCIRCLE);
726 gp_Vec aVecX(aP, aP1);
728 gp_Ax2 aAx2new(aP, aAx2.Direction(), aDirX);
729 aInfo.SetPosition(aAx2new);
731 }// else if (aCT==GeomAbs_Circle) {
734 else if (aCT==GeomAbs_Ellipse) {
737 aElips=aGAC.Ellipse();
738 aP=aElips.Location();
739 aAx2=aElips.Position();
740 aR1=aElips.MajorRadius();
741 aR2=aElips.MinorRadius();
743 aInfo.SetKindOfShape(GEOMAlgo_KS_ELLIPSE);
744 aInfo.SetLocation(aP);
745 aInfo.SetPosition(aAx2);
746 aInfo.SetRadius1(aR1);
747 aInfo.SetRadius2(aR2);
749 aNbV=aInfo.NbSubShapes(TopAbs_VERTEX);
751 myErrorStatus=11; // ellipse edge without vertices
754 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
761 aInfo.SetKindOfClosed(GEOMAlgo_KC_CLOSED);
762 aInfo.SetKindOfName(GEOMAlgo_KN_ELLIPSE);
765 aInfo.SetKindOfClosed(GEOMAlgo_KC_NOTCLOSED);
766 aInfo.SetKindOfName(GEOMAlgo_KN_ARCELLIPSE);
768 }// else if (aCT==GeomAbs_Ellipse) {
770 else if (aCT==GeomAbs_Hyperbola) {
772 aHyp=aGAC.Hyperbola();
774 aAx2=aHyp.Position();
775 aR1=aHyp.MajorRadius();
776 aR2=aHyp.MinorRadius();
777 aInfo.SetKindOfShape(GEOMAlgo_KS_HYPERBOLA);
778 aInfo.SetKindOfName(GEOMAlgo_KN_HYPERBOLA);
779 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
780 aInfo.SetLocation(aP);
781 aInfo.SetPosition(aAx2);
782 aInfo.SetRadius1(aR1);
783 aInfo.SetRadius2(aR2);
790 }// if (aCT==GeomAbs_Hyperbola) {
792 else if (aCT==GeomAbs_Parabola) {
794 aPara=aGAC.Parabola();
796 aAx2=aPara.Position();
798 aInfo.SetKindOfShape(GEOMAlgo_KS_PARABOLA);
799 aInfo.SetKindOfName(GEOMAlgo_KN_PARABOLA);
800 aInfo.SetKindOfBounds(GEOMAlgo_KB_TRIMMED);
801 aInfo.SetLocation(aP);
802 aInfo.SetPosition(aAx2);
803 aInfo.SetRadius1(aR1);
810 }// if (aCT==GeomAbs_Parabola) {
814 //=======================================================================
815 //function :FillVertex
817 //=======================================================================
818 void GEOMAlgo_ShapeInfoFiller::FillVertex(const TopoDS_Shape& aS)
825 if (myMapInfo.Contains(aS)) {
829 GEOMAlgo_ShapeInfo aInfoX;
830 myMapInfo.Add(aS, aInfoX);
832 GEOMAlgo_ShapeInfo& aInfo=myMapInfo.ChangeFromKey(aS);
834 aV=TopoDS::Vertex(aS);
835 aP=BRep_Tool::Pnt(aV);
837 aInfo.SetType(TopAbs_VERTEX);
838 aInfo.SetLocation(aP);
839 myMapInfo.Add(aS, aInfo);
841 //=======================================================================
842 //function : FillNbSubshapes
844 //=======================================================================
845 void GEOMAlgo_ShapeInfoFiller::FillNbSubShapes(const TopoDS_Shape& aS,
846 GEOMAlgo_ShapeInfo& aInfo)
850 Standard_Integer i, aNb, aNbS;
851 TopTools_IndexedMapOfShape aM;
852 TopAbs_ShapeEnum aST;
853 TopAbs_ShapeEnum aTypes[]= {
854 //TopAbs_FACE, TopAbs_EDGE, TopAbs_VERTEX
867 aNb=sizeof(aTypes)/sizeof(aTypes[0]);
868 for (i=0; i<aNb; ++i) {
869 if (aTypes[i]==aST) {
873 TopExp::MapShapes(aS, aTypes[i], aM);
875 aInfo.SetNbSubShapes(aTypes[i], aNbS);
878 //=======================================================================
881 //=======================================================================
882 Standard_Integer GEOMAlgo_ShapeInfoFiller::NbShells
883 (const TopoDS_Solid& aSd)
885 Standard_Integer iCnt;
891 for (; aIt.More(); aIt.Next()) {
896 //=======================================================================
899 //=======================================================================
900 Standard_Integer GEOMAlgo_ShapeInfoFiller::NbWires
901 (const TopoDS_Face& aF)
903 Standard_Integer iCnt;
909 for (; aIt.More(); aIt.Next()) {
914 //=======================================================================
915 //function : IsAllowedType
917 //=======================================================================
918 Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
919 (const GeomAbs_CurveType aCT)
921 Standard_Boolean bRet;
922 Standard_Integer i, aNb;
923 GeomAbs_CurveType aTypes[]={
927 GeomAbs_BSplineCurve,
934 aNb=sizeof(aTypes)/sizeof(aTypes[0]);
935 for (i=0; i<aNb && !bRet; ++i) {
936 bRet=(aCT==aTypes[i]);
940 //=======================================================================
941 //function : IsAllowedType
943 //=======================================================================
944 Standard_Boolean GEOMAlgo_ShapeInfoFiller::IsAllowedType
945 (const GeomAbs_SurfaceType aST)
947 Standard_Boolean bRet;
948 Standard_Integer i, aNb;
949 GeomAbs_SurfaceType aTypes[]={
950 GeomAbs_Plane, GeomAbs_Cylinder,
951 GeomAbs_Cone, GeomAbs_Sphere,
956 aNb=sizeof(aTypes)/sizeof(aTypes[0]);
957 for (i=0; i<aNb && !bRet; ++i) {
958 bRet=(aST==aTypes[i]);
967 // 1 - The object is just initialized
970 // 11 - circle/ellipse edge without vertices