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