Salome HOME
Changes for bug 0020673.
[modules/geom.git] / src / GEOM_I / GEOM_I3DPrimOperations_i.cc
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 <Standard_Stream.hxx>
23
24 #include "GEOM_I3DPrimOperations_i.hh"
25
26 #include "utilities.h"
27 #include "OpUtil.hxx"
28 #include "Utils_ExceptHandlers.hxx"
29
30 #include "GEOM_Engine.hxx"
31 #include "GEOM_Object.hxx"
32
33 //=============================================================================
34 /*!
35  *   constructor:
36  */
37 //=============================================================================
38 GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_I3DPrimOperations* theImpl)
39 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
40 {
41   MESSAGE("GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i");
42 }
43
44 //=============================================================================
45 /*!
46  *  destructor
47  */
48 //=============================================================================
49 GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i()
50 {
51   MESSAGE("GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i");
52 }
53
54
55 //=============================================================================
56 /*!
57  *  MakeBoxDXDYDZ
58  */
59 //=============================================================================
60 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX,
61                                                                CORBA::Double theDY,
62                                                                CORBA::Double theDZ)
63 {
64   GEOM::GEOM_Object_var aGEOMObject;
65
66   //Set a not done flag
67   GetOperations()->SetNotDone();
68
69   //Create the Box
70   Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
71   if (!GetOperations()->IsDone() || anObject.IsNull())
72     return aGEOMObject._retn();
73
74   return GetObject(anObject);
75 }
76
77 //=============================================================================
78 /*!
79  *  MakeBoxTwoPnt
80  */
81 //=============================================================================
82 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
83                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
84 {
85   GEOM::GEOM_Object_var aGEOMObject;
86
87   //Set a not done flag
88   GetOperations()->SetNotDone();
89
90   Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
91   Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
92
93   if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
94
95   //Create the Box
96   Handle(GEOM_Object) anObject = GetOperations()->MakeBoxTwoPnt(aPnt1, aPnt2);
97   if (!GetOperations()->IsDone() || anObject.IsNull())
98     return aGEOMObject._retn();
99
100   return GetObject(anObject);
101 }
102
103 //=============================================================================
104 /*!
105  *  MakeFaceHW
106  */
107 //=============================================================================
108 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
109                                                             CORBA::Double theW,
110                                                             CORBA::Short  theOrientation)
111 {
112   GEOM::GEOM_Object_var aGEOMObject;
113
114   //Set a not done flag
115   GetOperations()->SetNotDone();
116
117   if (theH == 0 || theW == 0)
118     return aGEOMObject._retn();
119
120   //Create the Face
121   Handle(GEOM_Object) anObject = GetOperations()->MakeFaceHW(theH, theW, theOrientation);
122   if (!GetOperations()->IsDone() || anObject.IsNull())
123     return aGEOMObject._retn();
124
125   return GetObject(anObject);
126 }
127
128 //=============================================================================
129 /*!
130  *  MakeFaceObjHW
131  */
132 //=============================================================================
133 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
134                                                (GEOM::GEOM_Object_ptr theObj,
135                                                 CORBA::Double theH,
136                                                 CORBA::Double theW)
137 {
138   GEOM::GEOM_Object_var aGEOMObject;
139
140   //Set a not done flag
141   GetOperations()->SetNotDone();
142
143   //Get the reference object
144   Handle(GEOM_Object) anObj = GetObjectImpl(theObj);
145
146   if (anObj.IsNull())
147     return aGEOMObject._retn();
148
149   //Create the Face
150   Handle(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
151   if (!GetOperations()->IsDone() || anObject.IsNull())
152     return aGEOMObject._retn();
153
154   return GetObject(anObject);
155 }
156
157 //=============================================================================
158 /*!
159  *  MakeDiskPntVecR
160  */
161 //=============================================================================
162 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
163                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
164                        CORBA::Double theR)
165 {
166   GEOM::GEOM_Object_var aGEOMObject;
167
168   //Set a not done flag
169   GetOperations()->SetNotDone();
170
171   //Get the reference points
172   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
173   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
174
175   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
176
177   // Make Disk
178   Handle(GEOM_Object) anObject =
179     GetOperations()->MakeDiskPntVecR(aPnt, aVec, theR);
180   if (!GetOperations()->IsDone() || anObject.IsNull())
181     return aGEOMObject._retn();
182
183   return GetObject(anObject);
184 }
185
186 //=============================================================================
187 /*!
188  *  MakeDiskThreePnt
189  */
190 //=============================================================================
191 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
192                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
193                        GEOM::GEOM_Object_ptr thePnt3)
194 {
195   GEOM::GEOM_Object_var aGEOMObject;
196
197   //Set a not done flag
198   GetOperations()->SetNotDone();
199
200   //Get the reference points
201   Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
202   Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
203   Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3);
204
205   if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
206
207   // Make Disk
208   Handle(GEOM_Object) anObject =
209       GetOperations()->MakeDiskThreePnt(aPnt1, aPnt2, aPnt3);
210   if (!GetOperations()->IsDone() || anObject.IsNull())
211     return aGEOMObject._retn();
212
213   return GetObject(anObject);
214 }
215
216 //=============================================================================
217 /*!
218  *  MakeDiskR
219  */
220 //=============================================================================
221 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
222                                                            CORBA::Short  theOrientation)
223 {
224   GEOM::GEOM_Object_var aGEOMObject;
225
226   //Set a not done flag
227   GetOperations()->SetNotDone();
228
229   if (theR == 0)
230     return aGEOMObject._retn();
231
232   //Create the Face
233   Handle(GEOM_Object) anObject = GetOperations()->MakeDiskR(theR, theOrientation);
234   if (!GetOperations()->IsDone() || anObject.IsNull())
235     return aGEOMObject._retn();
236
237   return GetObject(anObject);
238 }
239
240 //=============================================================================
241 /*!
242  *  MakeCylinderRH
243  */
244 //=============================================================================
245 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
246                                                                 CORBA::Double theH)
247 {
248   GEOM::GEOM_Object_var aGEOMObject;
249
250   //Set a not done flag
251   GetOperations()->SetNotDone();
252
253   //Create the Cylinder
254   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
255   if (!GetOperations()->IsDone() || anObject.IsNull())
256     return aGEOMObject._retn();
257
258   return GetObject(anObject);
259 }
260
261 //=============================================================================
262 /*!
263  *  MakeCylinderPntVecRH
264  */
265 //=============================================================================
266 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
267                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
268                        CORBA::Double theR, CORBA::Double theH)
269 {
270   GEOM::GEOM_Object_var aGEOMObject;
271
272   //Set a not done flag
273   GetOperations()->SetNotDone();
274
275   //Get the reference points
276   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
277   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
278
279   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
280
281   //Create the Cylinder
282   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
283   if (!GetOperations()->IsDone() || anObject.IsNull())
284     return aGEOMObject._retn();
285
286   return GetObject(anObject);
287 }
288
289 //=============================================================================
290 /*!
291  *  MakeConeR1R2H
292  */
293 //=============================================================================
294 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
295                                                                CORBA::Double theR2,
296                                                                CORBA::Double theH)
297 {
298   GEOM::GEOM_Object_var aGEOMObject;
299
300   //Set a not done flag
301   GetOperations()->SetNotDone();
302
303   //Create the Cone
304   Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
305   if (!GetOperations()->IsDone() || anObject.IsNull())
306     return aGEOMObject._retn();
307
308   return GetObject(anObject);
309 }
310
311 //=============================================================================
312 /*!
313  *  MakeConePntVecR1R2H
314  */
315 //=============================================================================
316 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
317                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
318                        CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
319 {
320   GEOM::GEOM_Object_var aGEOMObject;
321
322   //Set a not done flag
323   GetOperations()->SetNotDone();
324
325   //Get the reference points
326   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
327   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
328
329   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
330
331   //Create the Cone
332   Handle(GEOM_Object) anObject =
333       GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
334   if (!GetOperations()->IsDone() || anObject.IsNull())
335     return aGEOMObject._retn();
336
337   return GetObject(anObject);
338 }
339
340 //=============================================================================
341 /*!
342  *  MakeSphereR
343  */
344 //=============================================================================
345 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
346 {
347   GEOM::GEOM_Object_var aGEOMObject;
348
349   //Set a not done flag
350   GetOperations()->SetNotDone();
351
352   //Create the Cone
353   Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
354   if (!GetOperations()->IsDone() || anObject.IsNull())
355     return aGEOMObject._retn();
356
357   return GetObject(anObject);
358 }
359
360 //=============================================================================
361 /*!
362  *  MakeSpherePntR
363  */
364 //=============================================================================
365 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
366                       (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
367 {
368   GEOM::GEOM_Object_var aGEOMObject;
369
370   //Set a not done flag
371   GetOperations()->SetNotDone();
372
373   //Get the reference point
374   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
375
376   if (aPnt.IsNull()) return aGEOMObject._retn();
377
378   //Create the Sphere
379   Handle(GEOM_Object) anObject =
380     GetOperations()->MakeSpherePntR(aPnt, theR);
381   if (!GetOperations()->IsDone() || anObject.IsNull())
382     return aGEOMObject._retn();
383
384   return GetObject(anObject);
385 }
386
387 //=============================================================================
388 /*!
389  *  MakeTorusRR
390  */
391 //=============================================================================
392 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
393                       (CORBA::Double theRMajor, CORBA::Double theRMinor)
394 {
395   GEOM::GEOM_Object_var aGEOMObject;
396
397   //Set a not done flag
398   GetOperations()->SetNotDone();
399
400   // Make Torus
401   Handle(GEOM_Object) anObject =
402     GetOperations()->MakeTorusRR(theRMajor, theRMinor);
403   if (!GetOperations()->IsDone() || anObject.IsNull())
404     return aGEOMObject._retn();
405
406   return GetObject(anObject);
407 }
408
409 //=============================================================================
410 /*!
411  *  MakeTorusPntVecRR
412  */
413 //=============================================================================
414 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
415                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
416                        CORBA::Double theRMajor, CORBA::Double theRMinor)
417 {
418   GEOM::GEOM_Object_var aGEOMObject;
419
420   //Set a not done flag
421   GetOperations()->SetNotDone();
422
423   //Get the reference points
424   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
425   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
426
427   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
428
429   // Make Torus
430   Handle(GEOM_Object) anObject =
431     GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
432   if (!GetOperations()->IsDone() || anObject.IsNull())
433     return aGEOMObject._retn();
434
435   return GetObject(anObject);
436 }
437
438 //=============================================================================
439 /*!
440  *  MakePrismVecH
441  */
442 //=============================================================================
443 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
444                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
445                        CORBA::Double theH)
446 {
447   GEOM::GEOM_Object_var aGEOMObject;
448
449   //Set a not done flag
450   GetOperations()->SetNotDone();
451
452   //Get the reference objects
453   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
454   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
455
456   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
457
458   //Create the Prism
459   Handle(GEOM_Object) anObject =
460       GetOperations()->MakePrismVecH(aBase, aVec, theH);
461   if (!GetOperations()->IsDone() || anObject.IsNull())
462     return aGEOMObject._retn();
463
464   return GetObject(anObject);
465 }
466
467 //=============================================================================
468 /*!
469  *  MakePrismVecH2Ways
470  */
471 //=============================================================================
472 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
473                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
474                        CORBA::Double theH)
475 {
476   GEOM::GEOM_Object_var aGEOMObject;
477
478   //Set a not done flag
479   GetOperations()->SetNotDone();
480
481   //Get the reference objects
482   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
483   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
484
485   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
486
487   //Create the Prism
488   Handle(GEOM_Object) anObject =
489       GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
490   if (!GetOperations()->IsDone() || anObject.IsNull())
491     return aGEOMObject._retn();
492
493   return GetObject(anObject);
494 }
495
496 //=============================================================================
497 /*!
498  *  MakePrismTwoPnt
499  */
500 //=============================================================================
501 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
502                                              (GEOM::GEOM_Object_ptr theBase,
503                                               GEOM::GEOM_Object_ptr thePoint1,
504                                               GEOM::GEOM_Object_ptr thePoint2)
505 {
506   GEOM::GEOM_Object_var aGEOMObject;
507
508   //Set a not done flag
509   GetOperations()->SetNotDone();
510
511   //Get the reference objects
512   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
513   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
514   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
515
516   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
517     return aGEOMObject._retn();
518
519   //Create the Prism
520   Handle(GEOM_Object) anObject =
521     GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
522   if (!GetOperations()->IsDone() || anObject.IsNull())
523     return aGEOMObject._retn();
524
525   return GetObject(anObject);
526 }
527
528 //=============================================================================
529 /*!
530  *  MakePrismTwoPnt2Ways
531  */
532 //=============================================================================
533 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
534                                              (GEOM::GEOM_Object_ptr theBase,
535                                               GEOM::GEOM_Object_ptr thePoint1,
536                                               GEOM::GEOM_Object_ptr thePoint2)
537 {
538   GEOM::GEOM_Object_var aGEOMObject;
539
540   //Set a not done flag
541   GetOperations()->SetNotDone();
542
543   //Get the reference objects
544   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
545   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
546   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
547
548   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
549     return aGEOMObject._retn();
550
551   //Create the Prism
552   Handle(GEOM_Object) anObject =
553     GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
554   if (!GetOperations()->IsDone() || anObject.IsNull())
555     return aGEOMObject._retn();
556
557   return GetObject(anObject);
558 }
559
560 //=============================================================================
561 /*!
562  *  MakePrismDXDYDZ
563  */
564 //=============================================================================
565 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
566                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
567                        CORBA::Double theDY, CORBA::Double theDZ)
568 {
569   GEOM::GEOM_Object_var aGEOMObject;
570
571   //Set a not done flag
572   GetOperations()->SetNotDone();
573
574   //Get the reference objects
575   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
576
577   if (aBase.IsNull()) return aGEOMObject._retn();
578
579   //Create the Prism
580   Handle(GEOM_Object) anObject =
581       GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
582   if (!GetOperations()->IsDone() || anObject.IsNull())
583     return aGEOMObject._retn();
584
585   return GetObject(anObject);
586 }
587
588 //=============================================================================
589 /*!
590  *  MakePrismDXDYDZ2Ways
591  */
592 //=============================================================================
593 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
594                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
595                        CORBA::Double theDY, CORBA::Double theDZ)
596 {
597   GEOM::GEOM_Object_var aGEOMObject;
598
599   //Set a not done flag
600   GetOperations()->SetNotDone();
601
602   //Get the reference objects
603   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
604
605   if (aBase.IsNull()) return aGEOMObject._retn();
606
607   //Create the Prism
608   Handle(GEOM_Object) anObject =
609       GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
610   if (!GetOperations()->IsDone() || anObject.IsNull())
611     return aGEOMObject._retn();
612
613   return GetObject(anObject);
614 }
615
616 //=============================================================================
617 /*!
618  *  MakePipe
619  */
620 //=============================================================================
621 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
622                  (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
623 {
624   GEOM::GEOM_Object_var aGEOMObject;
625
626   //Set a not done flag
627   GetOperations()->SetNotDone();
628
629   //Get the reference objects
630   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
631   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
632
633   if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
634
635   //Create the Pipe
636   Handle(GEOM_Object) anObject =
637     GetOperations()->MakePipe(aBase, aPath);
638   if (!GetOperations()->IsDone() || anObject.IsNull())
639     return aGEOMObject._retn();
640
641   return GetObject(anObject);
642 }
643
644 //=============================================================================
645 /*!
646  *  MakeRevolutionAxisAngle
647  */
648 //=============================================================================
649 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
650                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
651                        CORBA::Double theAngle)
652 {
653   GEOM::GEOM_Object_var aGEOMObject;
654
655   //Set a not done flag
656   GetOperations()->SetNotDone();
657
658   //Get the reference objects
659   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
660   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
661
662   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
663
664   //Create the Revolution
665   Handle(GEOM_Object) anObject =
666       GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
667   if (!GetOperations()->IsDone() || anObject.IsNull())
668     return aGEOMObject._retn();
669
670   return GetObject(anObject);
671 }
672
673 //=============================================================================
674 /*!
675  *  MakeRevolutionAxisAngle2Ways
676  */
677 //=============================================================================
678 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
679                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
680                        CORBA::Double theAngle)
681 {
682   GEOM::GEOM_Object_var aGEOMObject;
683
684   //Set a not done flag
685   GetOperations()->SetNotDone();
686
687   //Get the reference objects
688   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
689   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
690
691   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
692
693   //Create the Revolution
694   Handle(GEOM_Object) anObject =
695       GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
696   if (!GetOperations()->IsDone() || anObject.IsNull())
697     return aGEOMObject._retn();
698
699   return GetObject(anObject);
700 }
701
702 //=============================================================================
703 /*!
704  *  MakeFilling
705  */
706 //=============================================================================
707 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
708                                                             CORBA::Long theMinDeg,
709                                                             CORBA::Long theMaxDeg,
710                                                             CORBA::Double theTol2D,
711                                                             CORBA::Double theTol3D,
712                                                             CORBA::Long theNbIter,
713                                                             CORBA::Boolean theUseOri,
714                                                             CORBA::Boolean theApprox)
715 {
716   GEOM::GEOM_Object_var aGEOMObject;
717
718   //Set a not done flag
719   GetOperations()->SetNotDone();
720
721   //Get the reference objects
722   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
723
724   if (aShape.IsNull()) return aGEOMObject._retn();
725
726   //Create the Solid
727   Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
728     (aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter,
729      theUseOri, theApprox);
730   if (!GetOperations()->IsDone() || anObject.IsNull())
731     return aGEOMObject._retn();
732
733   return GetObject(anObject);
734 }
735
736 //=============================================================================
737 /*!
738  *  MakeThruSections
739  */
740 //=============================================================================
741 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
742                                                                  CORBA::Boolean theModeSolid,
743                                                                  CORBA::Double thePreci,
744                                                                  CORBA::Boolean theRuled)
745 {
746    GEOM::GEOM_Object_var aGEOMObject;
747
748   //Set a not done flag
749   GetOperations()->SetNotDone();
750   Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
751   int ind, aLen;
752
753   //Get the shapes
754   aLen = theSeqSections.length();
755   for (ind = 0; ind < aLen; ind++) {
756     Handle(GEOM_Object) aSh = GetObjectImpl(theSeqSections[ind]);
757     if (!aSh.IsNull())
758       aSeqSections->Append(aSh);
759   }
760   if (!aSeqSections->Length())
761     return aGEOMObject._retn();
762
763   // Make shell or solid
764   Handle(GEOM_Object) anObject =
765     GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
766   if (!GetOperations()->IsDone() || anObject.IsNull())
767     return aGEOMObject._retn();
768
769   return GetObject(anObject);
770 }
771
772 //=============================================================================
773 /*!
774  *  MakePipeWithDifferentSections
775  */
776 //=============================================================================
777 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
778                       (const GEOM::ListOfGO& theBases,
779                        const GEOM::ListOfGO& theLocations,
780                        GEOM::GEOM_Object_ptr thePath,
781                        CORBA::Boolean theWithContact,
782                        CORBA::Boolean theWithCorrections)
783 {
784   GEOM::GEOM_Object_var aGEOMObject;
785
786   //Set a not done flag
787   GetOperations()->SetNotDone();
788   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
789   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
790   int ind=0, aNbBases =0,aNbLocs=0;
791
792   //Get the shapes
793   aNbBases = theBases.length();
794   aNbLocs = theLocations.length();
795
796   if (aNbLocs && aNbBases != aNbLocs)
797     return aGEOMObject._retn();
798
799   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
800   if (aPath.IsNull())
801     return aGEOMObject._retn();
802
803   for (ind = 0; ind < aNbBases; ind++) {
804     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
805     if (aBase.IsNull())
806       continue;
807     if (aNbLocs)
808     {
809       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
810       if (aLoc.IsNull())
811         continue;
812       aSeqLocations->Append(aLoc);
813     }
814     aSeqBases->Append(aBase);
815   }
816   if (!aSeqBases->Length())
817     return aGEOMObject._retn();
818
819   // Make pipe
820   Handle(GEOM_Object) anObject =
821     GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
822                                                    theWithContact,theWithCorrections);
823   if (!GetOperations()->IsDone() || anObject.IsNull())
824     return aGEOMObject._retn();
825
826   return GetObject(anObject);
827 }
828
829
830 //=============================================================================
831 /*!
832  *  MakePipeWithShellSections
833  */
834 //=============================================================================
835 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
836                  (const GEOM::ListOfGO& theBases,
837                   const GEOM::ListOfGO& theSubBases,
838                   const GEOM::ListOfGO& theLocations,
839                   GEOM::GEOM_Object_ptr thePath,
840                   CORBA::Boolean theWithContact,
841                   CORBA::Boolean theWithCorrections)
842 {
843   GEOM::GEOM_Object_var aGEOMObject;
844
845   //Set a not done flag
846   GetOperations()->SetNotDone();
847   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
848   Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
849   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
850   int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
851
852   //Get the shapes
853   aNbBases = theBases.length();
854   aNbSubBases = theSubBases.length();
855   aNbLocs = theLocations.length();
856
857   if (aNbLocs && aNbBases != aNbLocs)
858     return aGEOMObject._retn();
859
860   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
861   if (aPath.IsNull())
862     return aGEOMObject._retn();
863
864   for (ind = 0; ind < aNbBases; ind++) {
865     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
866     if (aBase.IsNull())
867       continue;
868     if (aNbLocs) {
869       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
870       if (aLoc.IsNull())
871         continue;
872       aSeqLocations->Append(aLoc);
873     }
874     aSeqBases->Append(aBase);
875
876     if (aNbSubBases >= aNbBases) {
877       Handle(GEOM_Object) aSubBase = GetObjectImpl(theSubBases[ind]);
878       if (aSubBase.IsNull()) {
879         aSeqSubBases->Clear();
880         aNbSubBases = 0;
881         continue;
882       }
883       aSeqSubBases->Append(aSubBase);
884     }
885   }
886   if (!aSeqBases->Length())
887     return aGEOMObject._retn();
888
889   // Make pipe
890   Handle(GEOM_Object) anObject =
891     GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
892                                                aSeqLocations, aPath,
893                                                theWithContact, theWithCorrections);
894   if (!GetOperations()->IsDone() || anObject.IsNull())
895     return aGEOMObject._retn();
896
897   return GetObject(anObject);
898 }
899
900
901 //=============================================================================
902 /*!
903  *  MakePipeShellsWithoutPath
904  */
905 //=============================================================================
906 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
907                  (const GEOM::ListOfGO& theBases,
908                   const GEOM::ListOfGO& theLocations)
909 {
910   GEOM::GEOM_Object_var aGEOMObject;
911
912   //Set a not done flag
913   GetOperations()->SetNotDone();
914   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
915   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
916   int ind=0, aNbBases=0, aNbLocs=0;
917
918   //Get the shapes
919   aNbBases = theBases.length();
920   aNbLocs = theLocations.length();
921
922   if (aNbLocs && aNbBases != aNbLocs)
923     return aGEOMObject._retn();
924
925   for (ind = 0; ind < aNbBases; ind++) {
926     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
927     if (aBase.IsNull())
928       continue;
929     if (aNbLocs) {
930       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
931       if (aLoc.IsNull())
932         continue;
933       aSeqLocations->Append(aLoc);
934     }
935     aSeqBases->Append(aBase);
936   }
937
938   if (!aSeqBases->Length())
939     return aGEOMObject._retn();
940
941   // Make pipe
942   Handle(GEOM_Object) anObject =
943     GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
944
945   if (!GetOperations()->IsDone() || anObject.IsNull())
946     return aGEOMObject._retn();
947
948   return GetObject(anObject);
949 }
950
951
952 //=============================================================================
953 /*!
954  *  MakePipeBiNormalAlongVector
955  */
956 //=============================================================================
957 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
958                  (GEOM::GEOM_Object_ptr theBase,
959                   GEOM::GEOM_Object_ptr thePath,
960                   GEOM::GEOM_Object_ptr theVec)
961 {
962   GEOM::GEOM_Object_var aGEOMObject;
963
964   //Set a not done flag
965   GetOperations()->SetNotDone();
966
967   //Get the reference objects
968   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
969   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
970   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
971
972   if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
973
974   //Create the Pipe
975   Handle(GEOM_Object) anObject =
976     GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
977   if (!GetOperations()->IsDone() || anObject.IsNull())
978     return aGEOMObject._retn();
979
980   return GetObject(anObject);
981 }