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_ShapeInfo.hxx>
23 Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType);
25 void DumpKindOfShape(const GEOMAlgo_KindOfShape aKS);
27 void DumpKindOfClosed(const GEOMAlgo_KindOfClosed aKC);
29 void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB);
31 void DumpKindOfName(const GEOMAlgo_KindOfName aKS);
33 void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD);
35 void DumpKindOfPeriod(const GEOMAlgo_KindOfPeriod aKP);
37 void DumpPosition(const gp_Ax3& aAx3);
39 void DumpLocation(const gp_Pnt& aP);
41 void DumpDirection(const gp_Dir& aD);
42 //=======================================================================
45 //=======================================================================
46 GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo()
50 //=======================================================================
53 //=======================================================================
54 GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo()
57 //=======================================================================
60 //=======================================================================
61 void GEOMAlgo_ShapeInfo::Reset()
68 for (i=0; i<myNbTypes; ++i) {
72 myKindOfShape=GEOMAlgo_KS_UNKNOWN;
73 myKindOfBounds=GEOMAlgo_KB_UNKNOWN;
74 myKindOfClosed=GEOMAlgo_KC_UNKNOWN;
75 myKindOfName=GEOMAlgo_KN_UNKNOWN;
76 myKindOfDef=GEOMAlgo_KD_UNKNOWN;
77 myKindOfPeriod=GEOMAlgo_KP_UNKNOWN;
79 myLocation.SetCoord(99., 99., 99.);
80 myDirection.SetCoord(1.,0.,0.);
92 myPoles = Handle(TColgp_HArray1OfPnt)();
93 myKnots = Handle(TColStd_HArray1OfReal)();
94 myWeights = Handle(TColStd_HArray1OfReal)();
95 myMultiplicities = Handle(TColStd_HArray1OfInteger)();
97 //=======================================================================
100 //=======================================================================
101 void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType)
105 //=======================================================================
108 //=======================================================================
109 TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const
113 //=======================================================================
114 //function : SetNbSubShapes
116 //=======================================================================
117 void GEOMAlgo_ShapeInfo::SetNbSubShapes(const TopAbs_ShapeEnum aType,
118 const Standard_Integer aNb)
122 iN=TypeToInteger(aType);
123 if (iN>=0 && iN<myNbTypes) {
124 myNbSubShapes[iN]=aNb;
127 //=======================================================================
128 //function : NbSubShapes
130 //=======================================================================
131 Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes
132 (const TopAbs_ShapeEnum aType) const
136 iN=TypeToInteger(aType);
137 if (iN>=0 && iN<myNbTypes) {
138 return myNbSubShapes[iN];
142 //=======================================================================
143 //function : SetKindOfShape
145 //=======================================================================
146 void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT)
150 //=======================================================================
151 //function : KindOfShape
153 //=======================================================================
154 GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const
156 return myKindOfShape;
158 //=======================================================================
159 //function : SetKindOfName
161 //=======================================================================
162 void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT)
166 //=======================================================================
167 //function : KindOfName
169 //=======================================================================
170 GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const
174 //=======================================================================
175 //function : SetKindOfBounds
177 //=======================================================================
178 void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT)
182 //=======================================================================
183 //function : KindOfBounds
185 //=======================================================================
186 GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const
188 return myKindOfBounds;
190 //=======================================================================
191 //function : SetKindOfClosed
193 //=======================================================================
194 void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT)
198 //=======================================================================
199 //function : KindOfClosed
201 //=======================================================================
202 GEOMAlgo_KindOfClosed GEOMAlgo_ShapeInfo::KindOfClosed() const
204 return myKindOfClosed;
206 //=======================================================================
207 //function : SetKindOfDef
209 //=======================================================================
210 void GEOMAlgo_ShapeInfo::SetKindOfDef(const GEOMAlgo_KindOfDef aT)
214 //=======================================================================
215 //function : KindOfDef
217 //=======================================================================
218 GEOMAlgo_KindOfDef GEOMAlgo_ShapeInfo::KindOfDef() const
222 //=======================================================================
223 //function : SetKindOfPeriod
225 //=======================================================================
226 void GEOMAlgo_ShapeInfo::SetKindOfPeriod(const GEOMAlgo_KindOfPeriod aT)
230 //=======================================================================
231 //function : KindOfPeriod
233 //=======================================================================
234 GEOMAlgo_KindOfPeriod GEOMAlgo_ShapeInfo::KindOfPeriod() const
236 return myKindOfPeriod;
238 //=======================================================================
239 //function : SetLocation
241 //=======================================================================
242 void GEOMAlgo_ShapeInfo::SetLocation(const gp_Pnt& aP)
246 //=======================================================================
247 //function : Location
249 //=======================================================================
250 const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const
254 //=======================================================================
255 //function : SetDirection
257 //=======================================================================
258 void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD)
262 //=======================================================================
263 //function : Direction
265 //=======================================================================
266 const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const
270 //=======================================================================
271 //function : SetPosition
273 //=======================================================================
274 void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax2& aAx2)
279 //=======================================================================
280 //function : SetPosition
282 //=======================================================================
283 void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3)
287 //=======================================================================
288 //function : Position
290 //=======================================================================
291 const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const
296 //=======================================================================
299 //=======================================================================
300 void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP)
304 //=======================================================================
307 //=======================================================================
308 const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const
312 //=======================================================================
315 //=======================================================================
316 void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP)
320 //=======================================================================
323 //=======================================================================
324 const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const
328 //=======================================================================
329 //function : SetRadius1
331 //=======================================================================
332 void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR)
336 //=======================================================================
339 //=======================================================================
340 Standard_Real GEOMAlgo_ShapeInfo::Radius1() const
344 //=======================================================================
345 //function : SetRadius2
347 //=======================================================================
348 void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR)
352 //=======================================================================
355 //=======================================================================
356 Standard_Real GEOMAlgo_ShapeInfo::Radius2() const
360 //=======================================================================
361 //function : SetLength
363 //=======================================================================
364 void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL)
368 //=======================================================================
371 //=======================================================================
372 Standard_Real GEOMAlgo_ShapeInfo::Length() const
376 //=======================================================================
377 //function : SetWidth
379 //=======================================================================
380 void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW)
384 //=======================================================================
387 //=======================================================================
388 Standard_Real GEOMAlgo_ShapeInfo::Width() const
392 //=======================================================================
393 //function : SetHeight
395 //=======================================================================
396 void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH)
400 //=======================================================================
403 //=======================================================================
404 Standard_Real GEOMAlgo_ShapeInfo::Height() const
408 //=======================================================================
409 //function : SetDegree
411 //=======================================================================
412 void GEOMAlgo_ShapeInfo::SetDegree(const Standard_Integer aD)
416 //=======================================================================
419 //=======================================================================
420 Standard_Integer GEOMAlgo_ShapeInfo::Degree() const
424 //=======================================================================
425 //function : SetNbPoles
427 //=======================================================================
428 void GEOMAlgo_ShapeInfo::SetNbPoles(const Standard_Integer aNb)
432 //=======================================================================
435 //=======================================================================
436 Standard_Integer GEOMAlgo_ShapeInfo::NbPoles() const
440 //=======================================================================
441 //function : SetNbKnots
443 //=======================================================================
444 void GEOMAlgo_ShapeInfo::SetNbKnots(const Standard_Integer aNb)
448 //=======================================================================
451 //=======================================================================
452 Standard_Integer GEOMAlgo_ShapeInfo::NbKnots() const
456 //=======================================================================
457 //function : SetNbWeights
459 //=======================================================================
460 void GEOMAlgo_ShapeInfo::SetNbWeights(const Standard_Integer aNb)
464 //=======================================================================
465 //function : NbWeights
467 //=======================================================================
468 Standard_Integer GEOMAlgo_ShapeInfo::NbWeights() const
472 //=======================================================================
473 //function : SetNbMultiplicities
475 //=======================================================================
476 void GEOMAlgo_ShapeInfo::SetNbMultiplicities(const Standard_Integer aNb)
478 myNbMultiplicities=aNb;
480 //=======================================================================
481 //function : NbWeights
483 //=======================================================================
484 Standard_Integer GEOMAlgo_ShapeInfo::NbMultiplicities() const
486 return myNbMultiplicities;
488 //=======================================================================
489 //function : SetPoles
491 //=======================================================================
492 void GEOMAlgo_ShapeInfo::SetPoles(Handle(TColgp_HArray1OfPnt) P)
496 //=======================================================================
499 //=======================================================================
500 Handle(TColgp_HArray1OfPnt) GEOMAlgo_ShapeInfo::Poles() const
504 //=======================================================================
505 //function : SetKnots
507 //=======================================================================
508 void GEOMAlgo_ShapeInfo::SetKnots(Handle(TColStd_HArray1OfReal) K)
512 //=======================================================================
515 //=======================================================================
516 Handle(TColStd_HArray1OfReal) GEOMAlgo_ShapeInfo::Knots() const
520 //=======================================================================
521 //function : SetWeights
523 //=======================================================================
524 void GEOMAlgo_ShapeInfo::SetWeights(Handle(TColStd_HArray1OfReal) W)
528 //=======================================================================
531 //=======================================================================
532 Handle(TColStd_HArray1OfReal) GEOMAlgo_ShapeInfo::Weights() const
536 //=======================================================================
537 //function : SetMultiplicities
539 //=======================================================================
540 void GEOMAlgo_ShapeInfo::SetMultiplicities(Handle(TColStd_HArray1OfInteger) M)
542 myMultiplicities = M;
544 //=======================================================================
545 //function : Multiplicities
547 //=======================================================================
548 Handle(TColStd_HArray1OfInteger) GEOMAlgo_ShapeInfo::Multiplicities() const
550 return myMultiplicities;
552 //=======================================================================
553 //function : TypeToInteger
555 //=======================================================================
556 Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
560 iN=(Standard_Integer)aType;
563 //=======================================================================
566 //=======================================================================
567 void GEOMAlgo_ShapeInfo::Dump()const
595 case TopAbs_COMPSOLID:
599 case TopAbs_COMPOUND:
604 printf(" * not implemented yet\n");
608 //=======================================================================
609 //function : DumpCompound
611 //=======================================================================
612 void GEOMAlgo_ShapeInfo::DumpCompound()const
614 Standard_Integer aNbV, aNbE, aNbF, aNbS, aNbC, aNbP;
615 GEOMAlgo_KindOfShape aKS;
616 GEOMAlgo_KindOfName aKN;
617 GEOMAlgo_KindOfBounds aKB;
618 GEOMAlgo_KindOfClosed aKC;
620 aNbV=NbSubShapes(TopAbs_VERTEX);
621 aNbE=NbSubShapes(TopAbs_EDGE);
622 aNbF=NbSubShapes(TopAbs_FACE);
623 aNbS=NbSubShapes(TopAbs_SOLID);
624 aNbC=NbSubShapes(TopAbs_COMPSOLID);
625 aNbP=NbSubShapes(TopAbs_COMPOUND);
631 printf(" *COMPOUND\n");
632 printf(" number of vertices : %d\n", aNbV);
633 printf(" number of edges : %d\n", aNbE);
634 printf(" number of faces : %d\n", aNbF);
635 printf(" number of solids : %d\n", aNbS);
636 printf(" number of compsolids : %d\n", aNbC);
637 printf(" number of compounds : %d\n", aNbP);
638 DumpKindOfShape (aKS);
639 DumpKindOfName (aKN);
640 DumpKindOfBounds(aKB);
641 DumpKindOfClosed(aKC);
643 //=======================================================================
644 //function : DumpCompSolid
646 //=======================================================================
647 void GEOMAlgo_ShapeInfo::DumpCompSolid()const
649 Standard_Integer aNbV, aNbE, aNbF, aNbS;
650 GEOMAlgo_KindOfShape aKS;
651 GEOMAlgo_KindOfName aKN;
652 GEOMAlgo_KindOfBounds aKB;
653 GEOMAlgo_KindOfClosed aKC;
655 aNbV=NbSubShapes(TopAbs_VERTEX);
656 aNbE=NbSubShapes(TopAbs_EDGE);
657 aNbF=NbSubShapes(TopAbs_FACE);
658 aNbS=NbSubShapes(TopAbs_SOLID);
664 printf(" *COMPSOLID\n");
665 printf(" number of vertices: %d\n", aNbV);
666 printf(" number of edges : %d\n", aNbE);
667 printf(" number of faces : %d\n", aNbF);
668 printf(" number of solids : %d\n", aNbS);
669 DumpKindOfShape (aKS);
670 DumpKindOfName (aKN);
671 DumpKindOfBounds(aKB);
672 DumpKindOfClosed(aKC);
674 //=======================================================================
675 //function : DumpSolid
677 //=======================================================================
678 void GEOMAlgo_ShapeInfo::DumpSolid()const
680 Standard_Integer aNbV, aNbE, aNbF;
681 GEOMAlgo_KindOfShape aKS;
682 GEOMAlgo_KindOfName aKN;
683 GEOMAlgo_KindOfBounds aKB;
684 GEOMAlgo_KindOfClosed aKC;
686 aNbV=NbSubShapes(TopAbs_VERTEX);
687 aNbE=NbSubShapes(TopAbs_EDGE);
688 aNbF=NbSubShapes(TopAbs_FACE);
695 printf(" number of vertices: %d\n", aNbV);
696 printf(" number of edges : %d\n", aNbE);
697 printf(" number of faces : %d\n", aNbF);
698 DumpKindOfShape (aKS);
699 DumpKindOfName (aKN);
700 DumpKindOfBounds(aKB);
701 DumpKindOfClosed(aKC);
703 if (aKN==GEOMAlgo_KN_SPHERE) {
704 DumpLocation (myLocation);
705 DumpPosition (myPosition);
706 printf(" Radius1 : %.3lf\n", myRadius1);
708 if (aKN==GEOMAlgo_KN_CYLINDER) {
709 DumpLocation (myLocation);
710 DumpPosition (myPosition);
711 printf(" Radius1 : %.3lf\n", myRadius1);
712 printf(" Height : %.3lf\n", myHeight);
714 else if (aKN==GEOMAlgo_KN_CONE) {
715 DumpLocation (myLocation);
716 DumpPosition (myPosition);
717 printf(" Radius1 : %.3lf\n", myRadius1);
718 printf(" Radius2 : %.3lf\n", myRadius2);
719 printf(" Height : %.3lf\n", myHeight);
721 else if (aKN==GEOMAlgo_KN_TORUS) {
722 DumpLocation (myLocation);
723 DumpPosition (myPosition);
724 printf(" Radius1 : %.3lf\n", myRadius1);
725 printf(" Radius2 : %.3lf\n", myRadius2);
727 else if (aKN==GEOMAlgo_KN_POLYHEDRON) {
728 DumpLocation (myLocation);
729 DumpPosition (myPosition);
731 else if (aKN==GEOMAlgo_KN_BOX) {
732 DumpLocation (myLocation);
733 DumpPosition (myPosition);
734 printf(" Length : %.3lf\n", myLength);
735 printf(" Width : %.3lf\n", myWidth);
736 printf(" Height : %.3lf\n", myHeight);
739 //=======================================================================
740 //function : DumpFace
742 //=======================================================================
743 void GEOMAlgo_ShapeInfo::DumpFace()const
745 Standard_Integer aNbV, aNbE;
746 GEOMAlgo_KindOfShape aKS;
747 GEOMAlgo_KindOfName aKN;
748 GEOMAlgo_KindOfBounds aKB;
749 GEOMAlgo_KindOfClosed aKC;
750 GEOMAlgo_KindOfDef aKD;
752 aNbV=NbSubShapes(TopAbs_VERTEX);
753 aNbE=NbSubShapes(TopAbs_EDGE);
761 printf(" number of vertices: %d\n", aNbV);
762 printf(" number of edges : %d\n", aNbE);
763 DumpKindOfShape (aKS);
764 DumpKindOfName (aKN);
765 DumpKindOfBounds(aKB);
766 DumpKindOfClosed(aKC);
770 if (aKN==GEOMAlgo_KN_PLANE) {
771 DumpLocation (myLocation);
772 DumpPosition (myPosition);
774 else if (aKN==GEOMAlgo_KN_DISKCIRCLE) {
775 DumpLocation (myLocation);
776 DumpPosition (myPosition);
777 printf(" Radius1 : %.3lf\n", myRadius1);
779 else if (aKN==GEOMAlgo_KN_DISKELLIPSE) {
780 DumpLocation (myLocation);
781 DumpPosition (myPosition);
782 printf(" Radius1 : %.3lf\n", myRadius1);
783 printf(" Radius2 : %.3lf\n", myRadius2);
785 else if (aKN==GEOMAlgo_KN_RECTANGLE) {
786 DumpLocation (myLocation);
787 DumpPosition (myPosition);
788 printf(" Length : %.3lf\n", myLength);
789 printf(" Width : %.3lf\n", myWidth);
791 else if (aKN==GEOMAlgo_KN_TRIANGLE ||
792 aKN==GEOMAlgo_KN_QUADRANGLE||
793 aKN==GEOMAlgo_KN_POLYGON) {
794 DumpLocation (myLocation);
795 DumpPosition (myPosition);
799 else if (aKN==GEOMAlgo_KN_SPHERE) {
800 DumpLocation (myLocation);
801 DumpPosition (myPosition);
802 printf(" Radius1 : %.3lf", myRadius1);
806 else if (aKN==GEOMAlgo_KN_CYLINDER) {
807 DumpLocation (myLocation);
808 DumpPosition (myPosition);
809 printf(" Radius1 : %.3lf\n", myRadius1);
810 printf(" Height : %.3lf\n", myHeight);
814 else if (aKN==GEOMAlgo_KN_CONE) {
815 DumpLocation (myLocation);
816 DumpPosition (myPosition);
817 printf(" Radius1 : %.3lf\n", myRadius1);
818 printf(" Radius2 : %.3lf\n", myRadius2);
819 printf(" Height : %.3lf\n", myHeight);
823 else if (aKN==GEOMAlgo_KN_TORUS) {
824 DumpLocation (myLocation);
825 DumpPosition (myPosition);
826 printf(" Radius1 : %.3lf\n", myRadius1);
827 printf(" Radius2 : %.3lf\n", myRadius2);
833 //=======================================================================
834 //function : DumpShell
836 //=======================================================================
837 void GEOMAlgo_ShapeInfo::DumpShell()const
839 Standard_Integer aNbV, aNbE, aNbF;
840 GEOMAlgo_KindOfClosed aKC;
844 aNbV=NbSubShapes(TopAbs_VERTEX);
845 aNbE=NbSubShapes(TopAbs_EDGE);
846 aNbF=NbSubShapes(TopAbs_FACE);
847 printf(" number of vertices: %d\n", aNbV);
848 printf(" number of edges : %d\n", aNbE);
849 printf(" number of faces : %d\n", aNbF);
851 DumpKindOfClosed(aKC);
854 //=======================================================================
855 //function : DumpWire
857 //=======================================================================
858 void GEOMAlgo_ShapeInfo::DumpWire()const
860 Standard_Integer aNbV, aNbE;
861 GEOMAlgo_KindOfClosed aKC;
865 aNbV=NbSubShapes(TopAbs_VERTEX);
866 aNbE=NbSubShapes(TopAbs_EDGE);
867 printf(" number of vertices: %d\n", aNbV);
868 printf(" number of edges : %d\n", aNbE);
871 DumpKindOfClosed(aKC);
874 //=======================================================================
875 //function : DumpEdge
877 //=======================================================================
878 void GEOMAlgo_ShapeInfo::DumpEdge()const
880 Standard_Integer aNbV;
881 Standard_Real aX, aY, aZ;
882 GEOMAlgo_KindOfShape aKS;
883 GEOMAlgo_KindOfName aKN;
884 GEOMAlgo_KindOfBounds aKB;
885 GEOMAlgo_KindOfClosed aKC;
886 GEOMAlgo_KindOfPeriod aKP;
888 aNbV=NbSubShapes(TopAbs_VERTEX);
895 printf(" number of vertices: %d\n", aNbV);
896 DumpKindOfShape (aKS);
897 DumpKindOfName (aKN);
898 DumpKindOfBounds(aKB);
899 DumpKindOfClosed(aKC);
902 if (aKN==GEOMAlgo_KN_LINE) {
903 DumpLocation (myLocation);
904 DumpDirection(myDirection);
906 else if (aKN==GEOMAlgo_KN_SEGMENT) {
907 DumpLocation (myLocation);
908 DumpDirection(myDirection);
909 printf(" Length : %.3lf\n", myLength);
910 myPnt1.Coord(aX, aY, aZ);
911 printf(" Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
912 myPnt2.Coord(aX, aY, aZ);
913 printf(" Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
916 else if (aKN==GEOMAlgo_KN_CIRCLE) {
917 DumpLocation (myLocation);
918 DumpPosition (myPosition);
919 printf(" Radius1 : %.3lf\n", myRadius1);
921 else if (aKN==GEOMAlgo_KN_ARCCIRCLE) {
922 DumpLocation (myLocation);
923 DumpPosition (myPosition);
924 printf(" Radius1 : %.3lf\n", myRadius1);
925 myPnt1.Coord(aX, aY, aZ);
926 printf(" Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
927 myPnt2.Coord(aX, aY, aZ);
928 printf(" Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
930 else if (aKN==GEOMAlgo_KN_ELLIPSE) {
931 DumpLocation (myLocation);
932 DumpPosition (myPosition);
933 printf(" Radius1 : %.3lf\n", myRadius1);
934 printf(" Radius2 : %.3lf\n", myRadius2);
936 else if (aKN==GEOMAlgo_KN_ARCELLIPSE) {
937 DumpLocation (myLocation);
938 DumpPosition (myPosition);
939 printf(" Radius1 : %.3lf\n", myRadius1);
940 printf(" Radius2 : %.3lf\n", myRadius2);
941 myPnt1.Coord(aX, aY, aZ);
942 printf(" Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
943 myPnt2.Coord(aX, aY, aZ);
944 printf(" Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
946 else if (aKN==GEOMAlgo_KN_CURVEBSPLINE) {
948 DumpKindOfPeriod(aKP);
949 printf(" Degree : %d\n", myDegree);
950 printf(" NbPoles : %d\n", myNbPoles);
951 printf(" NbKnots : %d\n", myNbKnots);
952 printf(" NbWeights : %d\n", myNbWeights);
953 printf(" NbMultis : %d\n", myNbMultiplicities);
955 if (aKB == GEOMAlgo_KB_TRIMMED) {
956 myPnt1.Coord(aX, aY, aZ);
957 printf(" Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
958 myPnt2.Coord(aX, aY, aZ);
959 printf(" Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
963 if (myNbPoles > 0 && !myPoles.IsNull() && myPoles->Length() == myNbPoles) {
964 bool aHasWeight = (myNbWeights == myNbPoles);
966 for (i=1; i<=myNbPoles; i++) {
967 const gp_Pnt &aP = myPoles->Value(i);
969 printf(" %3d : %.3lf %.3lf %.3lf %.3lf\n", i, aP.X(), aP.Y(), aP.Z(), myWeights->Value(i));
971 printf(" %3d : %.3lf %.3lf %.3lf\n", i, aP.X(), aP.Y(), aP.Z());
975 if (myNbKnots > 0 && !myKnots.IsNull() && myKnots->Length() == myNbKnots) {
976 bool aHasMulti = (myNbMultiplicities == myNbKnots);
978 for (i=1; i<=myNbKnots; i++) {
980 printf(" %3d : %.3lf %.3lf\n", i, myKnots->Value(i), myMultiplicities->Value(i));
982 printf(" %3d : %.3lf\n", i, myKnots->Value(i));
987 else if (aKN==GEOMAlgo_KN_CURVEBEZIER) {
989 DumpKindOfPeriod(aKP);
990 printf(" Degree : %d\n", myDegree);
991 printf(" NbPoles : %d\n", myNbPoles);
992 printf(" NbWeights : %d\n", myNbWeights);
993 if (aKB == GEOMAlgo_KB_TRIMMED) {
994 myPnt1.Coord(aX, aY, aZ);
995 printf(" Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
996 myPnt2.Coord(aX, aY, aZ);
997 printf(" Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
1001 if (myNbPoles > 0 && !myPoles.IsNull() && myPoles->Length() == myNbPoles) {
1002 bool aHasWeight = (myNbWeights == myNbPoles);
1004 for (i=1; i<=myNbPoles; i++) {
1005 const gp_Pnt &aP = myPoles->Value(i);
1007 printf(" %3d : %.3lf %.3lf %.3lf %.3lf\n", i, aP.X(), aP.Y(), aP.Z(), myWeights->Value(i));
1009 printf(" %3d : %.3lf %.3lf %.3lf\n", i, aP.X(), aP.Y(), aP.Z());
1013 else if (aKN==GEOMAlgo_KN_HYPERBOLA) {
1014 DumpLocation (myLocation);
1015 DumpPosition (myPosition);
1016 printf(" Radius1 : %.3lf\n", myRadius1);
1017 printf(" Radius2 : %.3lf\n", myRadius2);
1019 else if (aKN==GEOMAlgo_KN_PARABOLA) {
1020 DumpLocation (myLocation);
1021 DumpPosition (myPosition);
1022 printf(" Focal : %.3lf\n", myRadius1);
1026 //=======================================================================
1027 //function : DumpVertex
1029 //=======================================================================
1030 void GEOMAlgo_ShapeInfo::DumpVertex()const
1032 printf(" *VERTEX\n");
1033 DumpLocation(myLocation);
1035 //=======================================================================
1036 //function : DumpLocation
1038 //=======================================================================
1039 void DumpLocation(const gp_Pnt& aP)
1041 Standard_Real aX, aY, aZ;
1043 aP.Coord(aX, aY, aZ);
1044 printf(" Location : %.3lf %.3lf %.3lf \n", aX, aY, aZ);
1046 //=======================================================================
1047 //function : DumpDirection
1049 //=======================================================================
1050 void DumpDirection(const gp_Dir& aD)
1052 Standard_Real aX, aY, aZ;
1054 aD.Coord(aX, aY, aZ);
1055 printf(" Direction: %.3lf %.3lf %.3lf \n", aX, aY, aZ);
1057 //=======================================================================
1058 //function : DumpPosition
1060 //=======================================================================
1061 void DumpPosition(const gp_Ax3& aAx3)
1063 const gp_Dir& aDZ=aAx3.Axis().Direction();
1064 const gp_Dir& aDX=aAx3.XDirection();
1065 const gp_Dir& aDY=aAx3.YDirection();
1066 printf(" Position:\n");
1067 printf(" Axis: %.3lf %.3lf %.3lf \n", aDZ.X(), aDZ.Y(), aDZ.Z());
1068 printf(" X : %.3lf %.3lf %.3lf \n", aDX.X(), aDX.Y(), aDX.Z());
1069 printf(" Y : %.3lf %.3lf %.3lf \n", aDY.X(), aDY.Y(), aDY.Z());
1071 //=======================================================================
1072 //function : DumpKindOfBounds
1074 //=======================================================================
1075 void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB)
1077 const char *pStr[]={
1084 i=(Standard_Integer)aKB;
1085 printf(" KindOfBounds: %s\n", pStr[i]);
1088 //=======================================================================
1089 //function : DumpKindOfClosed
1091 //=======================================================================
1092 void DumpKindOfClosed(const GEOMAlgo_KindOfClosed aKC)
1094 const char *pStr[]={
1101 i=(Standard_Integer)aKC;
1102 printf(" KindOfClosed: %s\n", pStr[i]);
1105 //=======================================================================
1106 //function : DumpKindOfShape
1108 //=======================================================================
1109 void DumpKindOfShape(const GEOMAlgo_KindOfShape aKS)
1111 const char *pStr[]={
1130 i=(Standard_Integer)aKS;
1131 printf(" KindOfShape : %s\n", pStr[i]);
1133 //=======================================================================
1134 //function : DumpKindOfName
1136 //=======================================================================
1137 void DumpKindOfName(const GEOMAlgo_KindOfName aKS)
1139 const char *pStr[]={
1168 i=(Standard_Integer)aKS;
1169 printf(" KindOfName : %s\n", pStr[i]);
1171 //=======================================================================
1172 //function : DumpKindOfDef
1174 //=======================================================================
1175 void DumpKindOfDef(const GEOMAlgo_KindOfDef aKD)
1177 const char *pStr[]={
1184 i=(Standard_Integer)aKD;
1185 printf(" KindOfDef: %s\n", pStr[i]);
1187 //=======================================================================
1188 //function : DumpKindOfPeriod
1190 //=======================================================================
1191 void DumpKindOfPeriod(const GEOMAlgo_KindOfPeriod aKP)
1193 const char *pStr[]={
1200 i=(Standard_Integer)aKP;
1201 printf(" KindOfPeriod: %s\n", pStr[i]);