]> SALOME platform Git repositories - modules/geom.git/blob - src/GEOM_I/GEOM_I3DPrimOperations_i.cc
Salome HOME
Fixed 2 fatal error at 3d sketcher dialog opening and when using it.
[modules/geom.git] / src / GEOM_I / GEOM_I3DPrimOperations_i.cc
1 // Copyright (C) 2007-2012  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  *  MakePrismVecH
499  */
500 //=============================================================================
501 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecHWithScaling
502                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
503                        CORBA::Double theH, CORBA::Double theScaleFactor)
504 {
505   GEOM::GEOM_Object_var aGEOMObject;
506
507   //Set a not done flag
508   GetOperations()->SetNotDone();
509
510   //Get the reference objects
511   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
512   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
513
514   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
515
516   //Create the Prism
517   Handle(GEOM_Object) anObject =
518     GetOperations()->MakePrismVecH(aBase, aVec, theH, theScaleFactor);
519   if (!GetOperations()->IsDone() || anObject.IsNull())
520     return aGEOMObject._retn();
521
522   return GetObject(anObject);
523 }
524
525 //=============================================================================
526 /*!
527  *  MakePrismTwoPnt
528  */
529 //=============================================================================
530 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
531                                              (GEOM::GEOM_Object_ptr theBase,
532                                               GEOM::GEOM_Object_ptr thePoint1,
533                                               GEOM::GEOM_Object_ptr thePoint2)
534 {
535   GEOM::GEOM_Object_var aGEOMObject;
536
537   //Set a not done flag
538   GetOperations()->SetNotDone();
539
540   //Get the reference objects
541   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
542   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
543   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
544
545   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
546     return aGEOMObject._retn();
547
548   //Create the Prism
549   Handle(GEOM_Object) anObject =
550     GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
551   if (!GetOperations()->IsDone() || anObject.IsNull())
552     return aGEOMObject._retn();
553
554   return GetObject(anObject);
555 }
556
557 //=============================================================================
558 /*!
559  *  MakePrismTwoPnt2Ways
560  */
561 //=============================================================================
562 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
563                                              (GEOM::GEOM_Object_ptr theBase,
564                                               GEOM::GEOM_Object_ptr thePoint1,
565                                               GEOM::GEOM_Object_ptr thePoint2)
566 {
567   GEOM::GEOM_Object_var aGEOMObject;
568
569   //Set a not done flag
570   GetOperations()->SetNotDone();
571
572   //Get the reference objects
573   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
574   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
575   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
576
577   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
578     return aGEOMObject._retn();
579
580   //Create the Prism
581   Handle(GEOM_Object) anObject =
582     GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
583   if (!GetOperations()->IsDone() || anObject.IsNull())
584     return aGEOMObject._retn();
585
586   return GetObject(anObject);
587 }
588
589 //=============================================================================
590 /*!
591  *  MakePrismTwoPnt
592  */
593 //=============================================================================
594 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPntWithScaling
595                                              (GEOM::GEOM_Object_ptr theBase,
596                                               GEOM::GEOM_Object_ptr thePoint1,
597                                               GEOM::GEOM_Object_ptr thePoint2,
598                                               CORBA::Double         theScaleFactor)
599 {
600   GEOM::GEOM_Object_var aGEOMObject;
601
602   //Set a not done flag
603   GetOperations()->SetNotDone();
604
605   //Get the reference objects
606   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
607   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
608   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
609
610   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
611     return aGEOMObject._retn();
612
613   //Create the Prism
614   Handle(GEOM_Object) anObject =
615     GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2, theScaleFactor);
616   if (!GetOperations()->IsDone() || anObject.IsNull())
617     return aGEOMObject._retn();
618
619   return GetObject(anObject);
620 }
621
622 //=============================================================================
623 /*!
624  *  MakePrismDXDYDZ
625  */
626 //=============================================================================
627 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
628                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
629                        CORBA::Double theDY, CORBA::Double theDZ)
630 {
631   GEOM::GEOM_Object_var aGEOMObject;
632
633   //Set a not done flag
634   GetOperations()->SetNotDone();
635
636   //Get the reference objects
637   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
638
639   if (aBase.IsNull()) return aGEOMObject._retn();
640
641   //Create the Prism
642   Handle(GEOM_Object) anObject =
643       GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
644   if (!GetOperations()->IsDone() || anObject.IsNull())
645     return aGEOMObject._retn();
646
647   return GetObject(anObject);
648 }
649
650 //=============================================================================
651 /*!
652  *  MakePrismDXDYDZ2Ways
653  */
654 //=============================================================================
655 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
656                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
657                        CORBA::Double theDY, CORBA::Double theDZ)
658 {
659   GEOM::GEOM_Object_var aGEOMObject;
660
661   //Set a not done flag
662   GetOperations()->SetNotDone();
663
664   //Get the reference objects
665   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
666
667   if (aBase.IsNull()) return aGEOMObject._retn();
668
669   //Create the Prism
670   Handle(GEOM_Object) anObject =
671       GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
672   if (!GetOperations()->IsDone() || anObject.IsNull())
673     return aGEOMObject._retn();
674
675   return GetObject(anObject);
676 }
677
678 //=============================================================================
679 /*!
680  *  MakePrismDXDYDZ
681  */
682 //=============================================================================
683 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZWithScaling
684                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
685                        CORBA::Double theDY, CORBA::Double theDZ,
686                        CORBA::Double theScaleFactor)
687 {
688   GEOM::GEOM_Object_var aGEOMObject;
689
690   //Set a not done flag
691   GetOperations()->SetNotDone();
692
693   //Get the reference objects
694   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
695
696   if (aBase.IsNull()) return aGEOMObject._retn();
697
698   //Create the Prism
699   Handle(GEOM_Object) anObject =
700     GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ, theScaleFactor);
701   if (!GetOperations()->IsDone() || anObject.IsNull())
702     return aGEOMObject._retn();
703
704   return GetObject(anObject);
705 }
706
707 //=============================================================================
708 /*!
709  *  MakeDraftPrism
710  */
711 //=============================================================================
712 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDraftPrism
713                       (GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase, 
714                        CORBA::Double  theHeight,
715                        CORBA::Double  theAngle,
716                        CORBA::Boolean theFuse)
717 {
718   GEOM::GEOM_Object_var aGEOMObject;
719   
720   //Set a not done flag
721   GetOperations()->SetNotDone();
722
723   //Get the reference objects
724   Handle(GEOM_Object) aInit   = GetObjectImpl(theInitShape);
725   Handle(GEOM_Object) aBase   = GetObjectImpl(theBase);
726
727   if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn();
728
729   //Create the Prism
730   Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse);
731  
732   if (!GetOperations()->IsDone() || anObject.IsNull())
733     return aGEOMObject._retn();
734
735   return GetObject(anObject);
736 }
737
738 //=============================================================================
739 /*!
740  *  MakePipe
741  */
742 //=============================================================================
743 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
744                  (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
745 {
746   GEOM::GEOM_Object_var aGEOMObject;
747
748   //Set a not done flag
749   GetOperations()->SetNotDone();
750
751   //Get the reference objects
752   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
753   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
754
755   if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
756
757   //Create the Pipe
758   Handle(GEOM_Object) anObject =
759     GetOperations()->MakePipe(aBase, aPath);
760   if (!GetOperations()->IsDone() || anObject.IsNull())
761     return aGEOMObject._retn();
762
763   return GetObject(anObject);
764 }
765
766 //=============================================================================
767 /*!
768  *  MakeRevolutionAxisAngle
769  */
770 //=============================================================================
771 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
772                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
773                        CORBA::Double theAngle)
774 {
775   GEOM::GEOM_Object_var aGEOMObject;
776
777   //Set a not done flag
778   GetOperations()->SetNotDone();
779
780   //Get the reference objects
781   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
782   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
783
784   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
785
786   //Create the Revolution
787   Handle(GEOM_Object) anObject =
788       GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
789   if (!GetOperations()->IsDone() || anObject.IsNull())
790     return aGEOMObject._retn();
791
792   return GetObject(anObject);
793 }
794
795 //=============================================================================
796 /*!
797  *  MakeRevolutionAxisAngle2Ways
798  */
799 //=============================================================================
800 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
801                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
802                        CORBA::Double theAngle)
803 {
804   GEOM::GEOM_Object_var aGEOMObject;
805
806   //Set a not done flag
807   GetOperations()->SetNotDone();
808
809   //Get the reference objects
810   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
811   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
812
813   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
814
815   //Create the Revolution
816   Handle(GEOM_Object) anObject =
817       GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
818   if (!GetOperations()->IsDone() || anObject.IsNull())
819     return aGEOMObject._retn();
820
821   return GetObject(anObject);
822 }
823
824 //=============================================================================
825 /*!
826  *  MakeFilling
827  */
828 //=============================================================================
829 GEOM::GEOM_Object_ptr
830 GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
831                                       CORBA::Long theMinDeg,
832                                       CORBA::Long theMaxDeg,
833                                       CORBA::Double theTol2D,
834                                       CORBA::Double theTol3D,
835                                       CORBA::Long theNbIter,
836                                       GEOM::filling_oper_method theMethod,
837                                       CORBA::Boolean theApprox)
838 {
839   GEOM::GEOM_Object_var aGEOMObject;
840
841   //Set a not done flag
842   GetOperations()->SetNotDone();
843
844   //Get the reference objects
845   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
846
847   if (aShape.IsNull()) return aGEOMObject._retn();
848
849   int aMethod = 0;
850   switch (theMethod) {
851   case GEOM::FOM_Default:
852     {
853       // Default (standard behaviour)
854       aMethod = 0;
855     }
856     break;
857   case GEOM::FOM_UseOri:
858     {
859       // Use edges orientation
860       aMethod = 1;
861     }
862     break;
863   case GEOM::FOM_AutoCorrect:
864     {
865       // Auto-correct edges orientation
866       aMethod = 2;
867     }
868     break;
869   default:
870     {}
871   }
872
873   //Create the Solid
874   Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
875     (aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter,
876      aMethod, theApprox);
877   if (!GetOperations()->IsDone() || anObject.IsNull())
878     return aGEOMObject._retn();
879
880   return GetObject(anObject);
881 }
882
883 //=============================================================================
884 /*!
885  *  MakeThruSections
886  */
887 //=============================================================================
888 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
889                                                                  CORBA::Boolean theModeSolid,
890                                                                  CORBA::Double thePreci,
891                                                                  CORBA::Boolean theRuled)
892 {
893    GEOM::GEOM_Object_var aGEOMObject;
894
895   //Set a not done flag
896   GetOperations()->SetNotDone();
897   Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
898   int ind, aLen;
899
900   //Get the shapes
901   aLen = theSeqSections.length();
902   for (ind = 0; ind < aLen; ind++) {
903     Handle(GEOM_Object) aSh = GetObjectImpl(theSeqSections[ind]);
904     if (!aSh.IsNull())
905       aSeqSections->Append(aSh);
906   }
907   if (!aSeqSections->Length())
908     return aGEOMObject._retn();
909
910   // Make shell or solid
911   Handle(GEOM_Object) anObject =
912     GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
913   if (!GetOperations()->IsDone() || anObject.IsNull())
914     return aGEOMObject._retn();
915
916   return GetObject(anObject);
917 }
918
919 //=============================================================================
920 /*!
921  *  MakePipeWithDifferentSections
922  */
923 //=============================================================================
924 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
925                       (const GEOM::ListOfGO& theBases,
926                        const GEOM::ListOfGO& theLocations,
927                        GEOM::GEOM_Object_ptr thePath,
928                        CORBA::Boolean theWithContact,
929                        CORBA::Boolean theWithCorrections)
930 {
931   GEOM::GEOM_Object_var aGEOMObject;
932
933   //Set a not done flag
934   GetOperations()->SetNotDone();
935   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
936   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
937   int ind=0, aNbBases =0,aNbLocs=0;
938
939   //Get the shapes
940   aNbBases = theBases.length();
941   aNbLocs = theLocations.length();
942
943   if (aNbLocs && aNbBases != aNbLocs)
944     return aGEOMObject._retn();
945
946   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
947   if (aPath.IsNull())
948     return aGEOMObject._retn();
949
950   for (ind = 0; ind < aNbBases; ind++) {
951     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
952     if (aBase.IsNull())
953       continue;
954     if (aNbLocs)
955     {
956       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
957       if (aLoc.IsNull())
958         continue;
959       aSeqLocations->Append(aLoc);
960     }
961     aSeqBases->Append(aBase);
962   }
963   if (!aSeqBases->Length())
964     return aGEOMObject._retn();
965
966   // Make pipe
967   Handle(GEOM_Object) anObject =
968     GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
969                                                    theWithContact,theWithCorrections);
970   if (!GetOperations()->IsDone() || anObject.IsNull())
971     return aGEOMObject._retn();
972
973   return GetObject(anObject);
974 }
975
976
977 //=============================================================================
978 /*!
979  *  MakePipeWithShellSections
980  */
981 //=============================================================================
982 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
983                  (const GEOM::ListOfGO& theBases,
984                   const GEOM::ListOfGO& theSubBases,
985                   const GEOM::ListOfGO& theLocations,
986                   GEOM::GEOM_Object_ptr thePath,
987                   CORBA::Boolean theWithContact,
988                   CORBA::Boolean theWithCorrections)
989 {
990   GEOM::GEOM_Object_var aGEOMObject;
991
992   //Set a not done flag
993   GetOperations()->SetNotDone();
994   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
995   Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
996   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
997   int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
998
999   //Get the shapes
1000   aNbBases = theBases.length();
1001   aNbSubBases = theSubBases.length();
1002   aNbLocs = theLocations.length();
1003
1004   if (aNbLocs && aNbBases != aNbLocs)
1005     return aGEOMObject._retn();
1006
1007   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
1008   if (aPath.IsNull())
1009     return aGEOMObject._retn();
1010
1011   for (ind = 0; ind < aNbBases; ind++) {
1012     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1013     if (aBase.IsNull())
1014       continue;
1015     if (aNbLocs) {
1016       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1017       if (aLoc.IsNull())
1018         continue;
1019       aSeqLocations->Append(aLoc);
1020     }
1021     aSeqBases->Append(aBase);
1022
1023     if (aNbSubBases >= aNbBases) {
1024       Handle(GEOM_Object) aSubBase = GetObjectImpl(theSubBases[ind]);
1025       if (aSubBase.IsNull()) {
1026         aSeqSubBases->Clear();
1027         aNbSubBases = 0;
1028         continue;
1029       }
1030       aSeqSubBases->Append(aSubBase);
1031     }
1032   }
1033   if (!aSeqBases->Length())
1034     return aGEOMObject._retn();
1035
1036   // Make pipe
1037   Handle(GEOM_Object) anObject =
1038     GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
1039                                                aSeqLocations, aPath,
1040                                                theWithContact, theWithCorrections);
1041   if (!GetOperations()->IsDone() || anObject.IsNull())
1042     return aGEOMObject._retn();
1043
1044   return GetObject(anObject);
1045 }
1046
1047
1048 //=============================================================================
1049 /*!
1050  *  MakePipeShellsWithoutPath
1051  */
1052 //=============================================================================
1053 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
1054                  (const GEOM::ListOfGO& theBases,
1055                   const GEOM::ListOfGO& theLocations)
1056 {
1057   GEOM::GEOM_Object_var aGEOMObject;
1058
1059   //Set a not done flag
1060   GetOperations()->SetNotDone();
1061   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
1062   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
1063   int ind=0, aNbBases=0, aNbLocs=0;
1064
1065   //Get the shapes
1066   aNbBases = theBases.length();
1067   aNbLocs = theLocations.length();
1068
1069   if (aNbLocs && aNbBases != aNbLocs)
1070     return aGEOMObject._retn();
1071
1072   for (ind = 0; ind < aNbBases; ind++) {
1073     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1074     if (aBase.IsNull())
1075       continue;
1076     if (aNbLocs) {
1077       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1078       if (aLoc.IsNull())
1079         continue;
1080       aSeqLocations->Append(aLoc);
1081     }
1082     aSeqBases->Append(aBase);
1083   }
1084
1085   if (!aSeqBases->Length())
1086     return aGEOMObject._retn();
1087
1088   // Make pipe
1089   Handle(GEOM_Object) anObject =
1090     GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
1091
1092   if (!GetOperations()->IsDone() || anObject.IsNull())
1093     return aGEOMObject._retn();
1094
1095   return GetObject(anObject);
1096 }
1097
1098 //=============================================================================
1099 /*!
1100  *  MakePipeBiNormalAlongVector
1101  */
1102 //=============================================================================
1103 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
1104                  (GEOM::GEOM_Object_ptr theBase,
1105                   GEOM::GEOM_Object_ptr thePath,
1106                   GEOM::GEOM_Object_ptr theVec)
1107 {
1108   GEOM::GEOM_Object_var aGEOMObject;
1109
1110   //Set a not done flag
1111   GetOperations()->SetNotDone();
1112
1113   //Get the reference objects
1114   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
1115   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
1116   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
1117
1118   if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
1119
1120   //Create the Pipe
1121   Handle(GEOM_Object) anObject =
1122     GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
1123   if (!GetOperations()->IsDone() || anObject.IsNull())
1124     return aGEOMObject._retn();
1125
1126   return GetObject(anObject);
1127 }
1128
1129 //=============================================================================
1130 /*!
1131  *  RestorePath
1132  */
1133 //=============================================================================
1134 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::RestorePath
1135                  (GEOM::GEOM_Object_ptr theShape,
1136                   GEOM::GEOM_Object_ptr theBase1,
1137                   GEOM::GEOM_Object_ptr theBase2)
1138 {
1139   GEOM::GEOM_Object_var aGEOMObject;
1140
1141   // Set a not done flag
1142   GetOperations()->SetNotDone();
1143
1144   // Get the reference objects
1145   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1146   Handle(GEOM_Object) aBase1 = GetObjectImpl(theBase1);
1147   Handle(GEOM_Object) aBase2 = GetObjectImpl(theBase2);
1148
1149   if (aShape.IsNull() || aBase1.IsNull() || aBase2.IsNull()) return aGEOMObject._retn();
1150
1151   // Create the Path
1152   Handle(GEOM_Object) anObject = GetOperations()->RestorePath(aShape, aBase1, aBase2);
1153   if (!GetOperations()->IsDone() || anObject.IsNull())
1154     return aGEOMObject._retn();
1155
1156   return GetObject(anObject);
1157 }
1158
1159 //=============================================================================
1160 /*!
1161  *  RestorePathEdges
1162  */
1163 //=============================================================================
1164 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::RestorePathEdges
1165                  (GEOM::GEOM_Object_ptr theShape,
1166                   const GEOM::ListOfGO& theBase1,
1167                   const GEOM::ListOfGO& theBase2)
1168 {
1169   GEOM::GEOM_Object_var aGEOMObject;
1170
1171   // Set a not done flag
1172   GetOperations()->SetNotDone();
1173
1174   // Get the reference objects
1175   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
1176   if (aShape.IsNull()) return aGEOMObject._retn();
1177
1178   Handle(TColStd_HSequenceOfTransient) aSeqBases1 = new TColStd_HSequenceOfTransient;
1179   Handle(TColStd_HSequenceOfTransient) aSeqBases2 = new TColStd_HSequenceOfTransient;
1180
1181   int ind;
1182   int aNbBases1 = theBase1.length();
1183   int aNbBases2 = theBase2.length();
1184
1185   for (ind = 0; ind < aNbBases1; ind++) {
1186     Handle(GEOM_Object) aBase = GetObjectImpl(theBase1[ind]);
1187     if (!aBase.IsNull())
1188       aSeqBases1->Append(aBase);
1189   }
1190   for (ind = 0; ind < aNbBases2; ind++) {
1191     Handle(GEOM_Object) aBase = GetObjectImpl(theBase2[ind]);
1192     if (!aBase.IsNull())
1193       aSeqBases2->Append(aBase);
1194   }
1195
1196   if (!aSeqBases1->Length() || !aSeqBases2->Length())
1197     return aGEOMObject._retn();
1198
1199   // Create the Path
1200   Handle(GEOM_Object) anObject = GetOperations()->RestorePath(aShape, aSeqBases1, aSeqBases2);
1201   if (!GetOperations()->IsDone() || anObject.IsNull())
1202     return aGEOMObject._retn();
1203
1204   return GetObject(anObject);
1205 }