Salome HOME
546a5bcc37a6da1ec8412bbdfca75fde32c9d936
[modules/geom.git] / src / GEOMAlgo / GEOMAlgo_ShapeInfo.cxx
1 // Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include <GEOMAlgo_ShapeInfo.hxx>
21
22 static
23   Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType);
24 static
25   void DumpKindOfShape(const GEOMAlgo_KindOfShape aKS);
26 static
27   void DumpKindOfClosed(const GEOMAlgo_KindOfClosed aKC);
28 static
29   void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB);
30 static
31   void DumpKindOfName(const GEOMAlgo_KindOfName aKS);
32 static
33   void DumpPosition(const gp_Ax3& aAx3);
34 static
35   void DumpLocation(const gp_Pnt& aP);
36 static
37   void DumpDirection(const gp_Dir& aD);
38 //=======================================================================
39 //function :
40 //purpose  :
41 //=======================================================================
42   GEOMAlgo_ShapeInfo::GEOMAlgo_ShapeInfo()
43 {
44   Reset();
45 }
46 //=======================================================================
47 //function : ~
48 //purpose  :
49 //=======================================================================
50   GEOMAlgo_ShapeInfo::~GEOMAlgo_ShapeInfo()
51 {
52 }
53 //=======================================================================
54 //function : Reset
55 //purpose  :
56 //=======================================================================
57   void GEOMAlgo_ShapeInfo::Reset()
58 {
59   Standard_Integer i;
60   //
61   myType=TopAbs_SHAPE;
62   //
63   myNbTypes=9;
64   for (i=0; i<myNbTypes; ++i) {
65     myNbSubShapes[i]=0;
66   }
67   //
68   myKindOfShape=GEOMAlgo_KS_UNKNOWN;
69   myKindOfBounds=GEOMAlgo_KB_UNKNOWN;
70   myKindOfClosed=GEOMAlgo_KC_UNKNOWN;
71   myKindOfName=GEOMAlgo_KN_UNKNOWN;
72   //
73   myLocation.SetCoord(99., 99., 99.);
74   myDirection.SetCoord(1.,0.,0.);
75   //
76   myRadius1=-1.;
77   myRadius2=-2.;
78   myLength=-3.;
79   myWidth=-3.;
80   myHeight=-3.;
81 }
82 //=======================================================================
83 //function : SetType
84 //purpose  :
85 //=======================================================================
86   void GEOMAlgo_ShapeInfo::SetType(const TopAbs_ShapeEnum aType)
87 {
88   myType=aType;
89 }
90 //=======================================================================
91 //function : Type
92 //purpose  :
93 //=======================================================================
94   TopAbs_ShapeEnum GEOMAlgo_ShapeInfo::Type() const
95 {
96   return myType;
97 }
98 //=======================================================================
99 //function : SetNbSubShapes
100 //purpose  :
101 //=======================================================================
102   void GEOMAlgo_ShapeInfo::SetNbSubShapes(const TopAbs_ShapeEnum aType,
103                                           const Standard_Integer aNb)
104 {
105   Standard_Integer iN;
106
107   iN=TypeToInteger(aType);
108   if (iN>=0 && iN<myNbTypes) {
109     myNbSubShapes[iN]=aNb;
110   }
111 }
112 //=======================================================================
113 //function : NbSubShapes
114 //purpose  :
115 //=======================================================================
116   Standard_Integer GEOMAlgo_ShapeInfo::NbSubShapes(const TopAbs_ShapeEnum aType) const
117 {
118   Standard_Integer iN;
119
120   iN=TypeToInteger(aType);
121   if (iN>=0 && iN<myNbTypes) {
122     return myNbSubShapes[iN];
123   }
124   return 0;
125 }
126 //=======================================================================
127 //function : SetKindOfShape
128 //purpose  :
129 //=======================================================================
130   void GEOMAlgo_ShapeInfo::SetKindOfShape(const GEOMAlgo_KindOfShape aT)
131 {
132   myKindOfShape=aT;
133 }
134 //=======================================================================
135 //function : KindOfShape
136 //purpose  :
137 //=======================================================================
138   GEOMAlgo_KindOfShape GEOMAlgo_ShapeInfo::KindOfShape() const
139 {
140   return myKindOfShape;
141 }
142 //=======================================================================
143 //function : SetKindOfName
144 //purpose  :
145 //=======================================================================
146   void GEOMAlgo_ShapeInfo::SetKindOfName(const GEOMAlgo_KindOfName aT)
147 {
148   myKindOfName=aT;
149 }
150 //=======================================================================
151 //function : KindOfName
152 //purpose  :
153 //=======================================================================
154   GEOMAlgo_KindOfName GEOMAlgo_ShapeInfo::KindOfName() const
155 {
156   return myKindOfName;
157 }
158 //=======================================================================
159 //function : SetKindOfBounds
160 //purpose  :
161 //=======================================================================
162   void GEOMAlgo_ShapeInfo::SetKindOfBounds(const GEOMAlgo_KindOfBounds aT)
163 {
164   myKindOfBounds=aT;
165 }
166 //=======================================================================
167 //function : KindOfBounds
168 //purpose  :
169 //=======================================================================
170   GEOMAlgo_KindOfBounds GEOMAlgo_ShapeInfo::KindOfBounds() const
171 {
172   return myKindOfBounds;
173 }
174 //=======================================================================
175 //function : SetKindOfClosed
176 //purpose  :
177 //=======================================================================
178   void GEOMAlgo_ShapeInfo::SetKindOfClosed(const GEOMAlgo_KindOfClosed aT)
179 {
180   myKindOfClosed=aT;
181 }
182 //=======================================================================
183 //function : KindOfClosed
184 //purpose  :
185 //=======================================================================
186   GEOMAlgo_KindOfClosed GEOMAlgo_ShapeInfo::KindOfClosed() const
187 {
188   return myKindOfClosed;
189 }
190 //=======================================================================
191 //function : SetLocation
192 //purpose  :
193 //=======================================================================
194   void GEOMAlgo_ShapeInfo::SetLocation(const gp_Pnt& aP)
195 {
196   myLocation=aP;
197 }
198 //=======================================================================
199 //function : Location
200 //purpose  :
201 //=======================================================================
202   const gp_Pnt& GEOMAlgo_ShapeInfo::Location() const
203 {
204   return myLocation;
205 }
206 //=======================================================================
207 //function : SetDirection
208 //purpose  :
209 //=======================================================================
210   void GEOMAlgo_ShapeInfo::SetDirection(const gp_Dir& aD)
211 {
212   myDirection=aD;
213 }
214 //=======================================================================
215 //function : Direction
216 //purpose  :
217 //=======================================================================
218   const gp_Dir& GEOMAlgo_ShapeInfo::Direction() const
219 {
220   return myDirection;
221 }
222 //=======================================================================
223 //function : SetPosition
224 //purpose  :
225 //=======================================================================
226   void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax2& aAx2)
227 {
228   gp_Ax3 aAx3(aAx2);
229   SetPosition(aAx3);
230 }
231 //=======================================================================
232 //function : SetPosition
233 //purpose  :
234 //=======================================================================
235   void GEOMAlgo_ShapeInfo::SetPosition(const gp_Ax3& aAx3)
236 {
237   myPosition=aAx3;
238 }
239 //=======================================================================
240 //function : Position
241 //purpose  :
242 //=======================================================================
243   const gp_Ax3& GEOMAlgo_ShapeInfo::Position() const
244 {
245   return myPosition;
246 }
247
248 //=======================================================================
249 //function : SetPnt1
250 //purpose  :
251 //=======================================================================
252   void GEOMAlgo_ShapeInfo::SetPnt1(const gp_Pnt& aP)
253 {
254   myPnt1=aP;
255 }
256 //=======================================================================
257 //function : Pnt1
258 //purpose  :
259 //=======================================================================
260   const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt1() const
261 {
262   return myPnt1;
263 }
264 //=======================================================================
265 //function : SetPnt2
266 //purpose  :
267 //=======================================================================
268   void GEOMAlgo_ShapeInfo::SetPnt2(const gp_Pnt& aP)
269 {
270   myPnt2=aP;
271 }
272 //=======================================================================
273 //function : Pnt2
274 //purpose  :
275 //=======================================================================
276   const gp_Pnt& GEOMAlgo_ShapeInfo::Pnt2() const
277 {
278   return myPnt2;
279 }
280 //=======================================================================
281 //function : SetRadius1
282 //purpose  :
283 //=======================================================================
284   void GEOMAlgo_ShapeInfo::SetRadius1(const Standard_Real aR)
285 {
286   myRadius1=aR;
287 }
288 //=======================================================================
289 //function : Radius1
290 //purpose  :
291 //=======================================================================
292   Standard_Real GEOMAlgo_ShapeInfo::Radius1() const
293 {
294   return myRadius1;
295 }
296 //=======================================================================
297 //function : SetRadius2
298 //purpose  :
299 //=======================================================================
300   void GEOMAlgo_ShapeInfo::SetRadius2(const Standard_Real aR)
301 {
302   myRadius2=aR;
303 }
304 //=======================================================================
305 //function : Radius2
306 //purpose  :
307 //=======================================================================
308   Standard_Real GEOMAlgo_ShapeInfo::Radius2() const
309 {
310   return myRadius2;
311 }
312 //=======================================================================
313 //function : SetLength
314 //purpose  :
315 //=======================================================================
316   void GEOMAlgo_ShapeInfo::SetLength(const Standard_Real aL)
317 {
318   myLength=aL;
319 }
320 //=======================================================================
321 //function : Length
322 //purpose  :
323 //=======================================================================
324   Standard_Real GEOMAlgo_ShapeInfo::Length() const
325 {
326   return myLength;
327 }
328 //=======================================================================
329 //function : SetWidth
330 //purpose  :
331 //=======================================================================
332   void GEOMAlgo_ShapeInfo::SetWidth(const Standard_Real aW)
333 {
334   myWidth=aW;
335 }
336 //=======================================================================
337 //function : Width
338 //purpose  :
339 //=======================================================================
340   Standard_Real GEOMAlgo_ShapeInfo::Width() const
341 {
342   return myWidth;
343 }
344 //=======================================================================
345 //function : SetHeight
346 //purpose  :
347 //=======================================================================
348   void GEOMAlgo_ShapeInfo::SetHeight(const Standard_Real aH)
349 {
350   myHeight=aH;
351 }
352 //=======================================================================
353 //function : Height
354 //purpose  :
355 //=======================================================================
356   Standard_Real GEOMAlgo_ShapeInfo::Height() const
357 {
358   return myHeight;
359 }
360 //=======================================================================
361 //function : TypeToInteger
362 //purpose  :
363 //=======================================================================
364 Standard_Integer TypeToInteger(const TopAbs_ShapeEnum aType)
365 {
366   Standard_Integer iN;
367   //
368   iN=(Standard_Integer)aType;
369   return iN;
370 }
371 //=======================================================================
372 //function : Dump
373 //purpose  :
374 //=======================================================================
375   void GEOMAlgo_ShapeInfo::Dump()const
376 {
377   switch (myType) {
378     //
379   case TopAbs_VERTEX:
380     DumpVertex();
381     break;
382     //
383   case TopAbs_EDGE:
384     DumpEdge();
385     break;
386     //
387   case TopAbs_WIRE:
388     DumpWire();
389     break;
390     //
391   case TopAbs_FACE:
392     DumpFace();
393     break;
394     //
395   case TopAbs_SHELL:
396     DumpShell();
397     break;
398     //
399   case TopAbs_SOLID:
400     DumpSolid();
401     break;
402     //
403   case TopAbs_COMPSOLID:
404     DumpCompSolid();
405     break;
406     //
407   case TopAbs_COMPOUND:
408     DumpCompound();
409     break;
410     //
411   default:
412     printf(" * not implememted yet\n");
413     break;
414   }
415 }
416 //=======================================================================
417 //function : DumpCompound
418 //purpose  :
419 //=======================================================================
420   void GEOMAlgo_ShapeInfo::DumpCompound()const
421 {
422   Standard_Integer aNbV, aNbE, aNbF, aNbS, aNbC, aNbP;
423   GEOMAlgo_KindOfShape aKS;
424   GEOMAlgo_KindOfName aKN;
425   GEOMAlgo_KindOfBounds aKB;
426   GEOMAlgo_KindOfClosed aKC;
427   //
428   aNbV=NbSubShapes(TopAbs_VERTEX);
429   aNbE=NbSubShapes(TopAbs_EDGE);
430   aNbF=NbSubShapes(TopAbs_FACE);
431   aNbS=NbSubShapes(TopAbs_SOLID);
432   aNbC=NbSubShapes(TopAbs_COMPSOLID);
433   aNbP=NbSubShapes(TopAbs_COMPOUND);
434   aKS=KindOfShape();
435   aKN=KindOfName();
436   aKB=KindOfBounds();
437   aKC=KindOfClosed();
438   //
439   printf(" *COMPOUND\n");
440   printf("  number of vertices    : %d\n", aNbV);
441   printf("  number of edges       : %d\n", aNbE);
442   printf("  number of faces       : %d\n", aNbF);
443   printf("  number of solids      : %d\n", aNbS);
444   printf("  number of compsolids  : %d\n", aNbC);
445   printf("  number of compounds   : %d\n", aNbP);
446   DumpKindOfShape (aKS);
447   DumpKindOfName (aKN);
448   DumpKindOfBounds(aKB);
449   DumpKindOfClosed(aKC);
450 }
451 //=======================================================================
452 //function : DumpCompSolid
453 //purpose  :
454 //=======================================================================
455   void GEOMAlgo_ShapeInfo::DumpCompSolid()const
456 {
457   Standard_Integer aNbV, aNbE, aNbF, aNbS;
458   GEOMAlgo_KindOfShape aKS;
459   GEOMAlgo_KindOfName aKN;
460   GEOMAlgo_KindOfBounds aKB;
461   GEOMAlgo_KindOfClosed aKC;
462   //
463   aNbV=NbSubShapes(TopAbs_VERTEX);
464   aNbE=NbSubShapes(TopAbs_EDGE);
465   aNbF=NbSubShapes(TopAbs_FACE);
466   aNbS=NbSubShapes(TopAbs_SOLID);
467   aKS=KindOfShape();
468   aKN=KindOfName();
469   aKB=KindOfBounds();
470   aKC=KindOfClosed();
471   //
472   printf(" *COMPSOLID\n");
473   printf("  number of vertices: %d\n", aNbV);
474   printf("  number of edges   : %d\n", aNbE);
475   printf("  number of faces   : %d\n", aNbF);
476   printf("  number of solids  : %d\n", aNbS);
477   DumpKindOfShape (aKS);
478   DumpKindOfName (aKN);
479   DumpKindOfBounds(aKB);
480   DumpKindOfClosed(aKC);
481 }
482
483 //=======================================================================
484 //function : DumpSolid
485 //purpose  :
486 //=======================================================================
487   void GEOMAlgo_ShapeInfo::DumpSolid()const
488 {
489   Standard_Integer aNbV, aNbE, aNbF;
490   GEOMAlgo_KindOfShape aKS;
491   GEOMAlgo_KindOfName aKN;
492   GEOMAlgo_KindOfBounds aKB;
493   GEOMAlgo_KindOfClosed aKC;
494   //
495   aNbV=NbSubShapes(TopAbs_VERTEX);
496   aNbE=NbSubShapes(TopAbs_EDGE);
497   aNbF=NbSubShapes(TopAbs_FACE);
498   aKS=KindOfShape();
499   aKN=KindOfName();
500   aKB=KindOfBounds();
501   aKC=KindOfClosed();
502   //
503   printf(" *SOLID\n");
504   printf("  number of vertices: %d\n", aNbV);
505   printf("  number of edges   : %d\n", aNbE);
506   printf("  number of faces   : %d\n", aNbF);
507   DumpKindOfShape (aKS);
508   DumpKindOfName (aKN);
509   DumpKindOfBounds(aKB);
510   DumpKindOfClosed(aKC);
511   //
512   if (aKN==GEOMAlgo_KN_SPHERE) {
513     DumpLocation (myLocation);
514     DumpPosition (myPosition);
515     printf("  Radius1   : %.3lf\n", myRadius1);
516   }
517   if (aKN==GEOMAlgo_KN_CYLINDER) {
518     DumpLocation (myLocation);
519     DumpPosition (myPosition);
520     printf("  Radius1   : %.3lf\n", myRadius1);
521     printf("  Height    : %.3lf\n", myHeight);
522   }
523   else if (aKN==GEOMAlgo_KN_CONE) {
524     DumpLocation (myLocation);
525     DumpPosition (myPosition);
526     printf("  Radius1   : %.3lf\n", myRadius1);
527     printf("  Radius2   : %.3lf\n", myRadius2);
528     printf("  Height    : %.3lf\n", myHeight);
529   }
530   else if (aKN==GEOMAlgo_KN_TORUS) {
531     DumpLocation (myLocation);
532     DumpPosition (myPosition);
533     printf("  Radius1   : %.3lf\n", myRadius1);
534     printf("  Radius2   : %.3lf\n", myRadius2);
535   }
536   else if (aKN==GEOMAlgo_KN_POLYHEDRON) {
537     DumpLocation (myLocation);
538     DumpPosition (myPosition);
539   }
540   else if (aKN==GEOMAlgo_KN_BOX) {
541     DumpLocation (myLocation);
542     DumpPosition (myPosition);
543     printf("  Length    : %.3lf\n", myLength);
544     printf("  Width     : %.3lf\n", myWidth);
545     printf("  Height    : %.3lf\n", myHeight);
546   }
547 }
548
549 //=======================================================================
550 //function : DumpFace
551 //purpose  :
552 //=======================================================================
553   void GEOMAlgo_ShapeInfo::DumpFace()const
554 {
555   Standard_Integer aNbV, aNbE;
556   GEOMAlgo_KindOfShape aKS;
557   GEOMAlgo_KindOfName aKN;
558   GEOMAlgo_KindOfBounds aKB;
559   GEOMAlgo_KindOfClosed aKC;
560   //
561   aNbV=NbSubShapes(TopAbs_VERTEX);
562   aNbE=NbSubShapes(TopAbs_EDGE);
563   aKS=KindOfShape();
564   aKN=KindOfName();
565   aKB=KindOfBounds();
566   aKC=KindOfClosed();
567   //
568   printf(" *FACE\n");
569   printf("  number of vertices: %d\n", aNbV);
570   printf("  number of edges   : %d\n", aNbE);
571   DumpKindOfShape (aKS);
572   DumpKindOfName (aKN);
573   DumpKindOfBounds(aKB);
574   DumpKindOfClosed(aKC);
575   //
576   // PLANE
577   if (aKN==GEOMAlgo_KN_PLANE) {
578     DumpLocation (myLocation);
579     DumpPosition (myPosition);
580   }
581   else if (aKN==GEOMAlgo_KN_DISKCIRCLE) {
582     DumpLocation (myLocation);
583     DumpPosition (myPosition);
584     printf("  Radius1   : %.3lf\n", myRadius1);
585   }
586   else if (aKN==GEOMAlgo_KN_DISKELLIPSE) {
587     DumpLocation (myLocation);
588     DumpPosition (myPosition);
589     printf("  Radius1   : %.3lf\n", myRadius1);
590     printf("  Radius2   : %.3lf\n", myRadius2);
591   }
592   else if (aKN==GEOMAlgo_KN_RECTANGLE) {
593     DumpLocation (myLocation);
594     DumpPosition (myPosition);
595     printf("  Length    : %.3lf\n", myLength);
596     printf("  Width     : %.3lf\n", myWidth);
597   }
598   else if (aKN==GEOMAlgo_KN_TRIANGLE ||
599            aKN==GEOMAlgo_KN_QUADRANGLE||
600            aKN==GEOMAlgo_KN_POLYGON) {
601     DumpLocation (myLocation);
602     DumpPosition (myPosition);
603   }
604   //
605   // SPHERE
606   else if (aKN==GEOMAlgo_KN_SPHERE) {
607     DumpLocation (myLocation);
608     DumpPosition (myPosition);
609     printf("  Radius1   : %.3lf", myRadius1);
610   }
611   //
612   // CYLINDER
613   else if (aKN==GEOMAlgo_KN_CYLINDER) {
614     DumpLocation (myLocation);
615     DumpPosition (myPosition);
616     printf("  Radius1   : %.3lf\n", myRadius1);
617     printf("  Height    : %.3lf\n", myHeight);
618   }
619   //
620   // CONE
621   else if (aKN==GEOMAlgo_KN_CONE) {
622     DumpLocation (myLocation);
623     DumpPosition (myPosition);
624     printf("  Radius1   : %.3lf\n", myRadius1);
625     printf("  Radius2   : %.3lf\n", myRadius2);
626     printf("  Height    : %.3lf\n", myHeight);
627   }
628   //
629   // TORUS
630   else if (aKN==GEOMAlgo_KN_TORUS) {
631     DumpLocation (myLocation);
632     DumpPosition (myPosition);
633     printf("  Radius1   : %.3lf\n", myRadius1);
634     printf("  Radius2   : %.3lf\n", myRadius2);
635   }
636
637
638   printf("\n");
639 }
640 //=======================================================================
641 //function : DumpShell
642 //purpose  :
643 //=======================================================================
644   void GEOMAlgo_ShapeInfo::DumpShell()const
645 {
646   Standard_Integer aNbV, aNbE, aNbF;
647   GEOMAlgo_KindOfClosed aKC;
648   //
649   printf(" *SHELL\n");
650   //
651   aNbV=NbSubShapes(TopAbs_VERTEX);
652   aNbE=NbSubShapes(TopAbs_EDGE);
653   aNbF=NbSubShapes(TopAbs_FACE);
654   printf("  number of vertices: %d\n", aNbV);
655   printf("  number of edges   : %d\n", aNbE);
656   printf("  number of faces   : %d\n", aNbF);
657   aKC=KindOfClosed();
658   DumpKindOfClosed(aKC);
659   printf("\n");
660 }
661 //=======================================================================
662 //function : DumpWire
663 //purpose  :
664 //=======================================================================
665   void GEOMAlgo_ShapeInfo::DumpWire()const
666 {
667   Standard_Integer aNbV, aNbE;
668   GEOMAlgo_KindOfClosed aKC;
669   //
670   printf(" *WIRE\n");
671   //
672   aNbV=NbSubShapes(TopAbs_VERTEX);
673   aNbE=NbSubShapes(TopAbs_EDGE);
674   printf("  number of vertices: %d\n", aNbV);
675   printf("  number of edges   : %d\n", aNbE);
676
677   aKC=KindOfClosed();
678   DumpKindOfClosed(aKC);
679   printf("\n");
680 }
681 //=======================================================================
682 //function : DumpEdge
683 //purpose  :
684 //=======================================================================
685   void GEOMAlgo_ShapeInfo::DumpEdge()const
686 {
687   Standard_Integer aNbV;
688   Standard_Real aX, aY, aZ;
689   GEOMAlgo_KindOfShape aKS;
690   GEOMAlgo_KindOfName aKN;
691   GEOMAlgo_KindOfBounds aKB;
692   GEOMAlgo_KindOfClosed aKC;
693   //
694   aNbV=NbSubShapes(TopAbs_VERTEX);
695   aKS=KindOfShape();
696   aKN=KindOfName();
697   aKB=KindOfBounds();
698   aKC=KindOfClosed();
699   //
700   printf(" *EDGE\n");
701   printf("  number of vertices: %d\n", aNbV);
702   DumpKindOfShape (aKS);
703   DumpKindOfName (aKN);
704   DumpKindOfBounds(aKB);
705   DumpKindOfClosed(aKC);
706   //
707   // LINE
708   if (aKN==GEOMAlgo_KN_LINE) {
709     DumpLocation (myLocation);
710     DumpDirection(myDirection);
711   }
712   else if (aKN==GEOMAlgo_KN_SEGMENT) {
713     DumpLocation (myLocation);
714     DumpDirection(myDirection);
715     printf("  Length    : %.3lf\n", myLength);
716     myPnt1.Coord(aX, aY, aZ);
717     printf("  Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
718     myPnt2.Coord(aX, aY, aZ);
719     printf("  Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
720
721   }
722   else if (aKN==GEOMAlgo_KN_CIRCLE) {
723     DumpLocation (myLocation);
724     DumpPosition (myPosition);
725     printf("  Radius1   : %.3lf\n", myRadius1);
726   }
727   else if (aKN==GEOMAlgo_KN_ARCCIRCLE) {
728     DumpLocation (myLocation);
729     DumpPosition (myPosition);
730     printf("  Radius1   : %.3lf\n", myRadius1);
731     myPnt1.Coord(aX, aY, aZ);
732     printf("  Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
733     myPnt2.Coord(aX, aY, aZ);
734     printf("  Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
735   }
736   else if (aKN==GEOMAlgo_KN_ELLIPSE) {
737     DumpLocation (myLocation);
738     DumpPosition (myPosition);
739     printf("  Radius1   : %.3lf\n", myRadius1);
740     printf("  Radius2   : %.3lf\n", myRadius2);
741   }
742   else if (aKN==GEOMAlgo_KN_ARCELLIPSE) {
743     DumpLocation (myLocation);
744     DumpPosition (myPosition);
745     printf("  Radius1   : %.3lf\n", myRadius1);
746     printf("  Radius2   : %.3lf\n", myRadius2);
747     myPnt1.Coord(aX, aY, aZ);
748     printf("  Pnt1 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
749     myPnt2.Coord(aX, aY, aZ);
750     printf("  Pnt2 : %.3lf %.3lf %.3lf\n", aX, aY, aZ);
751   }
752   printf("\n");
753 }
754 //=======================================================================
755 //function : DumpVertex
756 //purpose  :
757 //=======================================================================
758   void GEOMAlgo_ShapeInfo::DumpVertex()const
759 {
760   printf(" *VERTEX\n");
761   DumpLocation(myLocation);
762 }
763 //=======================================================================
764 //function : DumpLocation
765 //purpose  :
766 //=======================================================================
767   void DumpLocation(const gp_Pnt& aP)
768 {
769   Standard_Real aX, aY, aZ;
770   //
771   aP.Coord(aX, aY, aZ);
772   printf("  Location : %.3lf %.3lf %.3lf \n", aX, aY, aZ);
773 }
774 //=======================================================================
775 //function : DumpDirection
776 //purpose  :
777 //=======================================================================
778   void DumpDirection(const gp_Dir& aD)
779 {
780   Standard_Real aX, aY, aZ;
781   //
782   aD.Coord(aX, aY, aZ);
783   printf("  Direction: %.3lf %.3lf %.3lf \n", aX, aY, aZ);
784 }
785 //=======================================================================
786 //function : DumpPosition
787 //purpose  :
788 //=======================================================================
789 void DumpPosition(const gp_Ax3& aAx3)
790 {
791   const gp_Dir& aDZ=aAx3.Axis().Direction();
792   const gp_Dir& aDX=aAx3.XDirection();
793   const gp_Dir& aDY=aAx3.YDirection();
794   printf("  Position:\n");
795   printf("  Axis: %.3lf %.3lf %.3lf \n", aDZ.X(), aDZ.Y(), aDZ.Z());
796   printf("  X   : %.3lf %.3lf %.3lf \n", aDX.X(), aDX.Y(), aDX.Z());
797   printf("  Y   : %.3lf %.3lf %.3lf \n", aDY.X(), aDY.Y(), aDY.Z());
798 }
799 //=======================================================================
800 //function : DumpKindOfBounds
801 //purpose  :
802 //=======================================================================
803 void DumpKindOfBounds(const GEOMAlgo_KindOfBounds aKB)
804 {
805   const char *pStr[]={
806     "KB_UNKNOWN",
807     "KB_TRIMMED",
808     "KB_INFINITE"
809   };
810   int i;
811   //
812   i=(Standard_Integer)aKB;
813   printf(" KindOfBounds: %s\n", pStr[i]);
814
815 }
816 //=======================================================================
817 //function : DumpKindOfClosed
818 //purpose  :
819 //=======================================================================
820 void DumpKindOfClosed(const GEOMAlgo_KindOfClosed aKC)
821 {
822   const char *pStr[]={
823     "KC_UNKNOWN",
824     "KC_CLOSED",
825     "KC_NOTCLOSED"
826   };
827   int i;
828   //
829   i=(Standard_Integer)aKC;
830   printf(" KindOfClosed: %s\n", pStr[i]);
831
832 }
833 //=======================================================================
834 //function : DumpKindOfShape
835 //purpose  :
836 //=======================================================================
837 void DumpKindOfShape(const GEOMAlgo_KindOfShape aKS)
838 {
839   const char *pStr[]={
840     "KS_UNKNOWN",
841     "KS_SPHERE",
842     "KS_CYLINDER",
843     "KS_BOX",
844     "KS_TORUS",
845     "KS_CONE",
846     "KS_ELLIPSE",
847     "KS_PLANE",
848     "KS_CIRCLE",
849     "KS_LINE",
850     "KS_DEGENERATED",
851     "KS_BSPLINE"
852     };
853   int i;
854   //
855   i=(Standard_Integer)aKS;
856   printf(" KindOfShape : %s\n", pStr[i]);
857 }
858 //=======================================================================
859 //function : DumpKindOfName
860 //purpose  :
861 //=======================================================================
862 void DumpKindOfName(const GEOMAlgo_KindOfName aKS)
863 {
864   const char *pStr[]={
865     "KN_UNKNOWN",
866     "KN_SPHERE",
867     "KN_CYLINDER",
868     "KN_TORUS",
869     "KN_CONE",
870     "KN_ELLIPSE",
871     "KN_CIRCLE",
872     "KN_PLANE",
873     "KN_LINE",
874     "KN_BOX",
875     "KN_SEGMENT",
876     "KN_ARCCIRCLE",
877     "KN_POLYGON",
878     "KN_POLYHEDRON",
879     "KN_DISKCIRCLE",
880     "KN_DISKELLIPSE",
881     "KN_RECTANGLE",
882     "KN_TRIANGLE",
883     "KN_QUADRANGLE",
884     "KN_ARCELLIPSE"
885     };
886   int i;
887   //
888   i=(Standard_Integer)aKS;
889   printf(" KindOfName  : %s\n", pStr[i]);
890 }