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