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