1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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, or (at your option) any later version.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include <Standard_Stream.hxx>
25 #include "GEOM_I3DPrimOperations_i.hh"
27 #include "utilities.h"
29 #include "Utils_ExceptHandlers.hxx"
31 #include "GEOM_Engine.hxx"
32 #include "GEOM_Object.hxx"
34 #define SUBSHAPE_ERROR "Sub shape cannot be transformed"
36 //=============================================================================
40 //=============================================================================
41 GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_I3DPrimOperations* theImpl)
42 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
44 MESSAGE("GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i");
47 //=============================================================================
51 //=============================================================================
52 GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i()
54 MESSAGE("GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i");
58 //=============================================================================
62 //=============================================================================
63 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX,
67 GEOM::GEOM_Object_var aGEOMObject;
70 GetOperations()->SetNotDone();
73 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
74 if (!GetOperations()->IsDone() || anObject.IsNull())
75 return aGEOMObject._retn();
77 return GetObject(anObject);
80 //=============================================================================
84 //=============================================================================
85 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
86 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
88 GEOM::GEOM_Object_var aGEOMObject;
91 GetOperations()->SetNotDone();
93 HANDLE_NAMESPACE(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
94 HANDLE_NAMESPACE(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
96 if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
99 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeBoxTwoPnt(aPnt1, aPnt2);
100 if (!GetOperations()->IsDone() || anObject.IsNull())
101 return aGEOMObject._retn();
103 return GetObject(anObject);
106 //=============================================================================
110 //=============================================================================
111 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
113 CORBA::Short theOrientation)
115 GEOM::GEOM_Object_var aGEOMObject;
117 //Set a not done flag
118 GetOperations()->SetNotDone();
120 if (theH == 0 || theW == 0)
121 return aGEOMObject._retn();
124 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeFaceHW(theH, theW, theOrientation);
125 if (!GetOperations()->IsDone() || anObject.IsNull())
126 return aGEOMObject._retn();
128 return GetObject(anObject);
131 //=============================================================================
135 //=============================================================================
136 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
137 (GEOM::GEOM_Object_ptr theObj,
141 GEOM::GEOM_Object_var aGEOMObject;
143 //Set a not done flag
144 GetOperations()->SetNotDone();
146 //Get the reference object
147 HANDLE_NAMESPACE(GEOM_Object) anObj = GetObjectImpl(theObj);
150 return aGEOMObject._retn();
153 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
154 if (!GetOperations()->IsDone() || anObject.IsNull())
155 return aGEOMObject._retn();
157 return GetObject(anObject);
160 //=============================================================================
164 //=============================================================================
165 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
166 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
169 GEOM::GEOM_Object_var aGEOMObject;
171 //Set a not done flag
172 GetOperations()->SetNotDone();
174 //Get the reference points
175 HANDLE_NAMESPACE(GEOM_Object) aPnt = GetObjectImpl(thePnt);
176 HANDLE_NAMESPACE(GEOM_Object) aVec = GetObjectImpl(theVec);
178 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
181 HANDLE_NAMESPACE(GEOM_Object) anObject =
182 GetOperations()->MakeDiskPntVecR(aPnt, aVec, theR);
183 if (!GetOperations()->IsDone() || anObject.IsNull())
184 return aGEOMObject._retn();
186 return GetObject(anObject);
189 //=============================================================================
193 //=============================================================================
194 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
195 (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
196 GEOM::GEOM_Object_ptr thePnt3)
198 GEOM::GEOM_Object_var aGEOMObject;
200 //Set a not done flag
201 GetOperations()->SetNotDone();
203 //Get the reference points
204 HANDLE_NAMESPACE(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
205 HANDLE_NAMESPACE(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
206 HANDLE_NAMESPACE(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3);
208 if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
211 HANDLE_NAMESPACE(GEOM_Object) anObject =
212 GetOperations()->MakeDiskThreePnt(aPnt1, aPnt2, aPnt3);
213 if (!GetOperations()->IsDone() || anObject.IsNull())
214 return aGEOMObject._retn();
216 return GetObject(anObject);
219 //=============================================================================
223 //=============================================================================
224 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
225 CORBA::Short theOrientation)
227 GEOM::GEOM_Object_var aGEOMObject;
229 //Set a not done flag
230 GetOperations()->SetNotDone();
233 return aGEOMObject._retn();
236 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeDiskR(theR, theOrientation);
237 if (!GetOperations()->IsDone() || anObject.IsNull())
238 return aGEOMObject._retn();
240 return GetObject(anObject);
243 //=============================================================================
247 //=============================================================================
248 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
251 GEOM::GEOM_Object_var aGEOMObject;
253 //Set a not done flag
254 GetOperations()->SetNotDone();
256 //Create the Cylinder
257 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
258 if (!GetOperations()->IsDone() || anObject.IsNull())
259 return aGEOMObject._retn();
261 return GetObject(anObject);
264 //=============================================================================
268 //=============================================================================
269 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRHA (CORBA::Double theR,
273 GEOM::GEOM_Object_var aGEOMObject;
275 //Set a not done flag
276 GetOperations()->SetNotDone();
278 //Create the Cylinder
279 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeCylinderRHA(theR, theH, theA);
280 if (!GetOperations()->IsDone() || anObject.IsNull())
281 return aGEOMObject._retn();
283 return GetObject(anObject);
286 //=============================================================================
288 * MakeCylinderPntVecRH
290 //=============================================================================
291 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
292 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
293 CORBA::Double theR, CORBA::Double theH)
295 GEOM::GEOM_Object_var aGEOMObject;
297 //Set a not done flag
298 GetOperations()->SetNotDone();
300 //Get the reference points
301 HANDLE_NAMESPACE(GEOM_Object) aPnt = GetObjectImpl(thePnt);
302 HANDLE_NAMESPACE(GEOM_Object) aVec = GetObjectImpl(theVec);
304 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
306 //Create the Cylinder
307 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
308 if (!GetOperations()->IsDone() || anObject.IsNull())
309 return aGEOMObject._retn();
311 return GetObject(anObject);
314 //=============================================================================
316 * MakeCylinderPntVecRHA
318 //=============================================================================
319 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRHA
320 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
321 CORBA::Double theR, CORBA::Double theH, CORBA::Double theA)
323 GEOM::GEOM_Object_var aGEOMObject;
325 //Set a not done flag
326 GetOperations()->SetNotDone();
328 //Get the reference points
329 HANDLE_NAMESPACE(GEOM_Object) aPnt = GetObjectImpl(thePnt);
330 HANDLE_NAMESPACE(GEOM_Object) aVec = GetObjectImpl(theVec);
332 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
334 //Create the Cylinder
335 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRHA(aPnt, aVec, theR, theH, theA);
336 if (!GetOperations()->IsDone() || anObject.IsNull())
337 return aGEOMObject._retn();
339 return GetObject(anObject);
342 //=============================================================================
346 //=============================================================================
347 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
351 GEOM::GEOM_Object_var aGEOMObject;
353 //Set a not done flag
354 GetOperations()->SetNotDone();
357 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
358 if (!GetOperations()->IsDone() || anObject.IsNull())
359 return aGEOMObject._retn();
361 return GetObject(anObject);
364 //=============================================================================
366 * MakeConePntVecR1R2H
368 //=============================================================================
369 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
370 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
371 CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
373 GEOM::GEOM_Object_var aGEOMObject;
375 //Set a not done flag
376 GetOperations()->SetNotDone();
378 //Get the reference points
379 HANDLE_NAMESPACE(GEOM_Object) aPnt = GetObjectImpl(thePnt);
380 HANDLE_NAMESPACE(GEOM_Object) aVec = GetObjectImpl(theVec);
382 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
385 HANDLE_NAMESPACE(GEOM_Object) anObject =
386 GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
387 if (!GetOperations()->IsDone() || anObject.IsNull())
388 return aGEOMObject._retn();
390 return GetObject(anObject);
393 //=============================================================================
397 //=============================================================================
398 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
400 GEOM::GEOM_Object_var aGEOMObject;
402 //Set a not done flag
403 GetOperations()->SetNotDone();
406 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
407 if (!GetOperations()->IsDone() || anObject.IsNull())
408 return aGEOMObject._retn();
410 return GetObject(anObject);
413 //=============================================================================
417 //=============================================================================
418 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
419 (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
421 GEOM::GEOM_Object_var aGEOMObject;
423 //Set a not done flag
424 GetOperations()->SetNotDone();
426 //Get the reference point
427 HANDLE_NAMESPACE(GEOM_Object) aPnt = GetObjectImpl(thePnt);
429 if (aPnt.IsNull()) return aGEOMObject._retn();
432 HANDLE_NAMESPACE(GEOM_Object) anObject =
433 GetOperations()->MakeSpherePntR(aPnt, theR);
434 if (!GetOperations()->IsDone() || anObject.IsNull())
435 return aGEOMObject._retn();
437 return GetObject(anObject);
440 //=============================================================================
444 //=============================================================================
445 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
446 (CORBA::Double theRMajor, CORBA::Double theRMinor)
448 GEOM::GEOM_Object_var aGEOMObject;
450 //Set a not done flag
451 GetOperations()->SetNotDone();
454 HANDLE_NAMESPACE(GEOM_Object) anObject =
455 GetOperations()->MakeTorusRR(theRMajor, theRMinor);
456 if (!GetOperations()->IsDone() || anObject.IsNull())
457 return aGEOMObject._retn();
459 return GetObject(anObject);
462 //=============================================================================
466 //=============================================================================
467 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
468 (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
469 CORBA::Double theRMajor, CORBA::Double theRMinor)
471 GEOM::GEOM_Object_var aGEOMObject;
473 //Set a not done flag
474 GetOperations()->SetNotDone();
476 //Get the reference points
477 HANDLE_NAMESPACE(GEOM_Object) aPnt = GetObjectImpl(thePnt);
478 HANDLE_NAMESPACE(GEOM_Object) aVec = GetObjectImpl(theVec);
480 if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
483 HANDLE_NAMESPACE(GEOM_Object) anObject =
484 GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
485 if (!GetOperations()->IsDone() || anObject.IsNull())
486 return aGEOMObject._retn();
488 return GetObject(anObject);
491 //=============================================================================
495 //=============================================================================
496 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
497 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
500 GEOM::GEOM_Object_var aGEOMObject;
502 //Set a not done flag
503 GetOperations()->SetNotDone();
505 //Get the reference objects
506 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
507 HANDLE_NAMESPACE(GEOM_Object) aVec = GetObjectImpl(theVec);
509 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
512 HANDLE_NAMESPACE(GEOM_Object) anObject =
513 GetOperations()->MakePrismVecH(aBase, aVec, theH);
514 if (!GetOperations()->IsDone() || anObject.IsNull())
515 return aGEOMObject._retn();
517 return GetObject(anObject);
520 //=============================================================================
524 //=============================================================================
525 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
526 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
529 GEOM::GEOM_Object_var aGEOMObject;
531 //Set a not done flag
532 GetOperations()->SetNotDone();
534 //Get the reference objects
535 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
536 HANDLE_NAMESPACE(GEOM_Object) aVec = GetObjectImpl(theVec);
538 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
541 HANDLE_NAMESPACE(GEOM_Object) anObject =
542 GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
543 if (!GetOperations()->IsDone() || anObject.IsNull())
544 return aGEOMObject._retn();
546 return GetObject(anObject);
549 //=============================================================================
553 //=============================================================================
554 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecHWithScaling
555 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
556 CORBA::Double theH, CORBA::Double theScaleFactor)
558 GEOM::GEOM_Object_var aGEOMObject;
560 //Set a not done flag
561 GetOperations()->SetNotDone();
563 //Get the reference objects
564 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
565 HANDLE_NAMESPACE(GEOM_Object) aVec = GetObjectImpl(theVec);
567 if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
570 HANDLE_NAMESPACE(GEOM_Object) anObject =
571 GetOperations()->MakePrismVecH(aBase, aVec, theH, theScaleFactor);
572 if (!GetOperations()->IsDone() || anObject.IsNull())
573 return aGEOMObject._retn();
575 return GetObject(anObject);
578 //=============================================================================
582 //=============================================================================
583 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
584 (GEOM::GEOM_Object_ptr theBase,
585 GEOM::GEOM_Object_ptr thePoint1,
586 GEOM::GEOM_Object_ptr thePoint2)
588 GEOM::GEOM_Object_var aGEOMObject;
590 //Set a not done flag
591 GetOperations()->SetNotDone();
593 //Get the reference objects
594 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
595 HANDLE_NAMESPACE(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
596 HANDLE_NAMESPACE(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
598 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
599 return aGEOMObject._retn();
602 HANDLE_NAMESPACE(GEOM_Object) anObject =
603 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
604 if (!GetOperations()->IsDone() || anObject.IsNull())
605 return aGEOMObject._retn();
607 return GetObject(anObject);
610 //=============================================================================
612 * MakePrismTwoPnt2Ways
614 //=============================================================================
615 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
616 (GEOM::GEOM_Object_ptr theBase,
617 GEOM::GEOM_Object_ptr thePoint1,
618 GEOM::GEOM_Object_ptr thePoint2)
620 GEOM::GEOM_Object_var aGEOMObject;
622 //Set a not done flag
623 GetOperations()->SetNotDone();
625 //Get the reference objects
626 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
627 HANDLE_NAMESPACE(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
628 HANDLE_NAMESPACE(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
630 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
631 return aGEOMObject._retn();
634 HANDLE_NAMESPACE(GEOM_Object) anObject =
635 GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
636 if (!GetOperations()->IsDone() || anObject.IsNull())
637 return aGEOMObject._retn();
639 return GetObject(anObject);
642 //=============================================================================
646 //=============================================================================
647 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPntWithScaling
648 (GEOM::GEOM_Object_ptr theBase,
649 GEOM::GEOM_Object_ptr thePoint1,
650 GEOM::GEOM_Object_ptr thePoint2,
651 CORBA::Double theScaleFactor)
653 GEOM::GEOM_Object_var aGEOMObject;
655 //Set a not done flag
656 GetOperations()->SetNotDone();
658 //Get the reference objects
659 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
660 HANDLE_NAMESPACE(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
661 HANDLE_NAMESPACE(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
663 if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
664 return aGEOMObject._retn();
667 HANDLE_NAMESPACE(GEOM_Object) anObject =
668 GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2, theScaleFactor);
669 if (!GetOperations()->IsDone() || anObject.IsNull())
670 return aGEOMObject._retn();
672 return GetObject(anObject);
675 //=============================================================================
679 //=============================================================================
680 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
681 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
682 CORBA::Double theDY, CORBA::Double theDZ)
684 GEOM::GEOM_Object_var aGEOMObject;
686 //Set a not done flag
687 GetOperations()->SetNotDone();
689 //Get the reference objects
690 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
692 if (aBase.IsNull()) return aGEOMObject._retn();
695 HANDLE_NAMESPACE(GEOM_Object) anObject =
696 GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
697 if (!GetOperations()->IsDone() || anObject.IsNull())
698 return aGEOMObject._retn();
700 return GetObject(anObject);
703 //=============================================================================
705 * MakePrismDXDYDZ2Ways
707 //=============================================================================
708 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
709 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
710 CORBA::Double theDY, CORBA::Double theDZ)
712 GEOM::GEOM_Object_var aGEOMObject;
714 //Set a not done flag
715 GetOperations()->SetNotDone();
717 //Get the reference objects
718 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
720 if (aBase.IsNull()) return aGEOMObject._retn();
723 HANDLE_NAMESPACE(GEOM_Object) anObject =
724 GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
725 if (!GetOperations()->IsDone() || anObject.IsNull())
726 return aGEOMObject._retn();
728 return GetObject(anObject);
731 //=============================================================================
735 //=============================================================================
736 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZWithScaling
737 (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
738 CORBA::Double theDY, CORBA::Double theDZ,
739 CORBA::Double theScaleFactor)
741 GEOM::GEOM_Object_var aGEOMObject;
743 //Set a not done flag
744 GetOperations()->SetNotDone();
746 //Get the reference objects
747 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
749 if (aBase.IsNull()) return aGEOMObject._retn();
752 HANDLE_NAMESPACE(GEOM_Object) anObject =
753 GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ, theScaleFactor);
754 if (!GetOperations()->IsDone() || anObject.IsNull())
755 return aGEOMObject._retn();
757 return GetObject(anObject);
760 //=============================================================================
764 //=============================================================================
765 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDraftPrism
766 (GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase,
767 CORBA::Double theHeight,
768 CORBA::Double theAngle,
769 CORBA::Boolean theFuse,
770 CORBA::Boolean theInvert)
772 GEOM::GEOM_Object_var aGEOMObject;
774 //Set a not done flag
775 GetOperations()->SetNotDone();
777 //Get the reference objects
778 HANDLE_NAMESPACE(GEOM_Object) aInit = GetObjectImpl(theInitShape);
779 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
781 if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn();
784 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse, theInvert);
786 if (!GetOperations()->IsDone() || anObject.IsNull())
787 return aGEOMObject._retn();
789 return GetObject(anObject);
792 //=============================================================================
796 //=============================================================================
797 GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipe
798 (GEOM::GEOM_Object_ptr theBase,
799 GEOM::GEOM_Object_ptr thePath,
800 CORBA::Boolean IsGenerateGroups)
802 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
804 //Set a not done flag
805 GetOperations()->SetNotDone();
807 //Get the reference objects
808 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
809 HANDLE_NAMESPACE(GEOM_Object) aPath = GetObjectImpl(thePath);
811 if (aBase.IsNull() || aPath.IsNull()) return aSeq._retn();
814 Handle(TColStd_HSequenceOfTransient) aHSeq =
815 GetOperations()->MakePipe(aBase, aPath, IsGenerateGroups);
816 if (!GetOperations()->IsDone() || aHSeq.IsNull())
819 Standard_Integer aLength = aHSeq->Length();
820 aSeq->length(aLength);
821 for (Standard_Integer i = 1; i <= aLength; i++)
822 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
827 //=============================================================================
829 * MakeRevolutionAxisAngle
831 //=============================================================================
832 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
833 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
834 CORBA::Double theAngle)
836 GEOM::GEOM_Object_var aGEOMObject;
838 //Set a not done flag
839 GetOperations()->SetNotDone();
841 //Get the reference objects
842 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
843 HANDLE_NAMESPACE(GEOM_Object) anAxis = GetObjectImpl(theAxis);
845 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
847 //Create the Revolution
848 HANDLE_NAMESPACE(GEOM_Object) anObject =
849 GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
850 if (!GetOperations()->IsDone() || anObject.IsNull())
851 return aGEOMObject._retn();
853 return GetObject(anObject);
856 //=============================================================================
858 * MakeRevolutionAxisAngle2Ways
860 //=============================================================================
861 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
862 (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
863 CORBA::Double theAngle)
865 GEOM::GEOM_Object_var aGEOMObject;
867 //Set a not done flag
868 GetOperations()->SetNotDone();
870 //Get the reference objects
871 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
872 HANDLE_NAMESPACE(GEOM_Object) anAxis = GetObjectImpl(theAxis);
874 if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
876 //Create the Revolution
877 HANDLE_NAMESPACE(GEOM_Object) anObject =
878 GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
879 if (!GetOperations()->IsDone() || anObject.IsNull())
880 return aGEOMObject._retn();
882 return GetObject(anObject);
885 //=============================================================================
889 //=============================================================================
890 GEOM::GEOM_Object_ptr
891 GEOM_I3DPrimOperations_i::MakeFilling(const GEOM::ListOfGO& theContours,
892 CORBA::Long theMinDeg,
893 CORBA::Long theMaxDeg,
894 CORBA::Double theTol2D,
895 CORBA::Double theTol3D,
896 CORBA::Long theNbIter,
897 GEOM::filling_oper_method theMethod,
898 CORBA::Boolean theApprox)
900 GEOM::GEOM_Object_var aGEOMObject;
902 //Set a not done flag
903 GetOperations()->SetNotDone();
905 //Get the reference objects
906 std::list< HANDLE_NAMESPACE(GEOM_Object) > aShapes;
907 if (! GetListOfObjectsImpl( theContours, aShapes ))
908 return aGEOMObject._retn();
912 case GEOM::FOM_Default:
914 // Default (standard behaviour)
918 case GEOM::FOM_UseOri:
920 // Use edges orientation
924 case GEOM::FOM_AutoCorrect:
926 // Auto-correct edges orientation
935 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeFilling
936 (aShapes, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter, aMethod, theApprox);
937 if (!GetOperations()->IsDone() || anObject.IsNull())
938 return aGEOMObject._retn();
940 return GetObject(anObject);
943 //=============================================================================
947 //=============================================================================
948 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
949 CORBA::Boolean theModeSolid,
950 CORBA::Double thePreci,
951 CORBA::Boolean theRuled)
953 GEOM::GEOM_Object_var aGEOMObject;
955 //Set a not done flag
956 GetOperations()->SetNotDone();
957 Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
961 aLen = theSeqSections.length();
962 for (ind = 0; ind < aLen; ind++) {
963 HANDLE_NAMESPACE(GEOM_Object) aSh = GetObjectImpl(theSeqSections[ind]);
965 aSeqSections->Append(aSh);
967 if (!aSeqSections->Length())
968 return aGEOMObject._retn();
970 // Make shell or solid
971 HANDLE_NAMESPACE(GEOM_Object) anObject =
972 GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
973 if (!GetOperations()->IsDone() || anObject.IsNull())
974 return aGEOMObject._retn();
976 return GetObject(anObject);
979 //=============================================================================
981 * MakePipeWithDifferentSections
983 //=============================================================================
984 GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
985 (const GEOM::ListOfGO &theBases,
986 const GEOM::ListOfGO &theLocations,
987 GEOM::GEOM_Object_ptr thePath,
988 CORBA::Boolean theWithContact,
989 CORBA::Boolean theWithCorrections,
990 CORBA::Boolean IsBySteps,
991 CORBA::Boolean IsGenerateGroups)
993 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
995 //Set a not done flag
996 GetOperations()->SetNotDone();
997 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
998 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
999 int ind=0, aNbBases =0,aNbLocs=0;
1002 aNbBases = theBases.length();
1003 aNbLocs = theLocations.length();
1005 if (aNbLocs && aNbBases != aNbLocs)
1006 return aSeq._retn();
1008 HANDLE_NAMESPACE(GEOM_Object) aPath = GetObjectImpl(thePath);
1010 return aSeq._retn();
1012 for (ind = 0; ind < aNbBases; ind++) {
1013 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1018 HANDLE_NAMESPACE(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1021 aSeqLocations->Append(aLoc);
1023 aSeqBases->Append(aBase);
1025 if (!aSeqBases->Length())
1026 return aSeq._retn();
1029 Handle(TColStd_HSequenceOfTransient) aHSeq =
1030 GetOperations()->MakePipeWithDifferentSections
1031 (aSeqBases, aSeqLocations,
1032 aPath, theWithContact,
1033 theWithCorrections, IsBySteps, IsGenerateGroups);
1034 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1035 return aSeq._retn();
1037 Standard_Integer aLength = aHSeq->Length();
1038 aSeq->length(aLength);
1039 for (Standard_Integer i = 1; i <= aLength; i++)
1040 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1042 return aSeq._retn();
1046 //=============================================================================
1048 * MakePipeWithShellSections
1050 //=============================================================================
1051 GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeWithShellSections
1052 (const GEOM::ListOfGO &theBases,
1053 const GEOM::ListOfGO &theSubBases,
1054 const GEOM::ListOfGO &theLocations,
1055 GEOM::GEOM_Object_ptr thePath,
1056 CORBA::Boolean theWithContact,
1057 CORBA::Boolean theWithCorrections,
1058 CORBA::Boolean IsGenerateGroups)
1060 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1062 //Set a not done flag
1063 GetOperations()->SetNotDone();
1064 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
1065 Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
1066 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
1067 int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
1070 aNbBases = theBases.length();
1071 aNbSubBases = theSubBases.length();
1072 aNbLocs = theLocations.length();
1074 if (aNbLocs && aNbBases != aNbLocs)
1075 return aSeq._retn();
1077 HANDLE_NAMESPACE(GEOM_Object) aPath = GetObjectImpl(thePath);
1079 return aSeq._retn();
1081 for (ind = 0; ind < aNbBases; ind++) {
1082 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1086 HANDLE_NAMESPACE(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1089 aSeqLocations->Append(aLoc);
1091 aSeqBases->Append(aBase);
1093 if (aNbSubBases >= aNbBases) {
1094 HANDLE_NAMESPACE(GEOM_Object) aSubBase = GetObjectImpl(theSubBases[ind]);
1095 if (aSubBase.IsNull()) {
1096 aSeqSubBases->Clear();
1100 aSeqSubBases->Append(aSubBase);
1103 if (!aSeqBases->Length())
1104 return aSeq._retn();
1107 Handle(TColStd_HSequenceOfTransient) aHSeq =
1108 GetOperations()->MakePipeWithShellSections
1109 (aSeqBases, aSeqSubBases,
1110 aSeqLocations, aPath,
1111 theWithContact, theWithCorrections, IsGenerateGroups);
1112 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1113 return aSeq._retn();
1115 Standard_Integer aLength = aHSeq->Length();
1116 aSeq->length(aLength);
1117 for (Standard_Integer i = 1; i <= aLength; i++)
1118 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1120 return aSeq._retn();
1124 //=============================================================================
1126 * MakePipeShellsWithoutPath
1128 //=============================================================================
1129 GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
1130 (const GEOM::ListOfGO &theBases,
1131 const GEOM::ListOfGO &theLocations,
1132 CORBA::Boolean IsGenerateGroups)
1134 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1136 //Set a not done flag
1137 GetOperations()->SetNotDone();
1138 Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
1139 Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
1140 int ind=0, aNbBases=0, aNbLocs=0;
1143 aNbBases = theBases.length();
1144 aNbLocs = theLocations.length();
1146 if (aNbLocs && aNbBases != aNbLocs)
1147 return aSeq._retn();
1149 for (ind = 0; ind < aNbBases; ind++) {
1150 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
1154 HANDLE_NAMESPACE(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
1157 aSeqLocations->Append(aLoc);
1159 aSeqBases->Append(aBase);
1162 if (!aSeqBases->Length())
1163 return aSeq._retn();
1166 Handle(TColStd_HSequenceOfTransient) aHSeq =
1167 GetOperations()->MakePipeShellsWithoutPath
1168 (aSeqBases, aSeqLocations, IsGenerateGroups);
1170 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1171 return aSeq._retn();
1173 Standard_Integer aLength = aHSeq->Length();
1174 aSeq->length(aLength);
1175 for (Standard_Integer i = 1; i <= aLength; i++)
1176 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1178 return aSeq._retn();
1181 //=============================================================================
1183 * MakePipeBiNormalAlongVector
1185 //=============================================================================
1186 GEOM::ListOfGO *GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
1187 (GEOM::GEOM_Object_ptr theBase,
1188 GEOM::GEOM_Object_ptr thePath,
1189 GEOM::GEOM_Object_ptr theVec,
1190 CORBA::Boolean IsGenerateGroups)
1192 GEOM::ListOfGO_var aSeq = new GEOM::ListOfGO;
1194 //Set a not done flag
1195 GetOperations()->SetNotDone();
1197 //Get the reference objects
1198 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase);
1199 HANDLE_NAMESPACE(GEOM_Object) aPath = GetObjectImpl(thePath);
1200 HANDLE_NAMESPACE(GEOM_Object) aVec = GetObjectImpl(theVec);
1202 if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aSeq._retn();
1205 Handle(TColStd_HSequenceOfTransient) aHSeq =
1206 GetOperations()->MakePipeBiNormalAlongVector
1207 (aBase, aPath, aVec, IsGenerateGroups);
1208 if (!GetOperations()->IsDone() || aHSeq.IsNull())
1209 return aSeq._retn();
1211 Standard_Integer aLength = aHSeq->Length();
1212 aSeq->length(aLength);
1213 for (Standard_Integer i = 1; i <= aLength; i++)
1214 aSeq[i-1] = GetObject(HANDLE_NAMESPACE(GEOM_Object)::DownCast(aHSeq->Value(i)));
1216 return aSeq._retn();
1219 //=============================================================================
1223 //=============================================================================
1224 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening
1225 (GEOM::GEOM_Object_ptr theObject,
1226 const GEOM::ListOfLong &theFacesIDs,
1227 CORBA::Double theOffset,
1228 CORBA::Boolean doCopy,
1229 CORBA::Boolean theInside)
1231 GEOM::GEOM_Object_var aGEOMObject;
1232 //Set a not done flag
1233 GetOperations()->SetNotDone();
1235 if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
1237 //check if the object is a sub-shape
1238 if (!theObject->IsMainShape() && !doCopy) {
1239 GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
1240 return aGEOMObject._retn();
1244 aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
1246 //Get the basic object
1247 HANDLE_NAMESPACE(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
1248 if (aBasicObject.IsNull()) return aGEOMObject._retn();
1251 Handle(TColStd_HArray1OfInteger) aFaceIDs;
1252 Standard_Integer aNbIDs = theFacesIDs.length();
1256 aFaceIDs = new TColStd_HArray1OfInteger (1, aNbIDs);
1258 for (i = 0; i < aNbIDs; i++) {
1259 aFaceIDs->SetValue(i + 1, theFacesIDs[i]);
1263 //Create the thickened shape
1266 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->MakeThickening(
1267 aBasicObject, aFaceIDs, theOffset, doCopy, theInside);
1268 if (!GetOperations()->IsDone() || anObject.IsNull())
1269 return aGEOMObject._retn();
1271 return GetObject(anObject);
1275 GetOperations()->MakeThickening(aBasicObject, aFaceIDs, theOffset, doCopy, theInside);
1278 UpdateGUIForObject(theObject);
1280 return aGEOMObject._retn();
1284 //=============================================================================
1288 //=============================================================================
1289 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::RestorePath
1290 (GEOM::GEOM_Object_ptr theShape,
1291 GEOM::GEOM_Object_ptr theBase1,
1292 GEOM::GEOM_Object_ptr theBase2)
1294 GEOM::GEOM_Object_var aGEOMObject;
1296 // Set a not done flag
1297 GetOperations()->SetNotDone();
1299 // Get the reference objects
1300 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1301 HANDLE_NAMESPACE(GEOM_Object) aBase1 = GetObjectImpl(theBase1);
1302 HANDLE_NAMESPACE(GEOM_Object) aBase2 = GetObjectImpl(theBase2);
1304 if (aShape.IsNull() || aBase1.IsNull() || aBase2.IsNull()) return aGEOMObject._retn();
1307 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->RestorePath(aShape, aBase1, aBase2);
1308 if (!GetOperations()->IsDone() || anObject.IsNull())
1309 return aGEOMObject._retn();
1311 return GetObject(anObject);
1314 //=============================================================================
1318 //=============================================================================
1319 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::RestorePathEdges
1320 (GEOM::GEOM_Object_ptr theShape,
1321 const GEOM::ListOfGO& theBase1,
1322 const GEOM::ListOfGO& theBase2)
1324 GEOM::GEOM_Object_var aGEOMObject;
1326 // Set a not done flag
1327 GetOperations()->SetNotDone();
1329 // Get the reference objects
1330 HANDLE_NAMESPACE(GEOM_Object) aShape = GetObjectImpl(theShape);
1331 if (aShape.IsNull()) return aGEOMObject._retn();
1333 Handle(TColStd_HSequenceOfTransient) aSeqBases1 = new TColStd_HSequenceOfTransient;
1334 Handle(TColStd_HSequenceOfTransient) aSeqBases2 = new TColStd_HSequenceOfTransient;
1337 int aNbBases1 = theBase1.length();
1338 int aNbBases2 = theBase2.length();
1340 for (ind = 0; ind < aNbBases1; ind++) {
1341 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase1[ind]);
1342 if (!aBase.IsNull())
1343 aSeqBases1->Append(aBase);
1345 for (ind = 0; ind < aNbBases2; ind++) {
1346 HANDLE_NAMESPACE(GEOM_Object) aBase = GetObjectImpl(theBase2[ind]);
1347 if (!aBase.IsNull())
1348 aSeqBases2->Append(aBase);
1351 if (!aSeqBases1->Length() || !aSeqBases2->Length())
1352 return aGEOMObject._retn();
1355 HANDLE_NAMESPACE(GEOM_Object) anObject = GetOperations()->RestorePath(aShape, aSeqBases1, aSeqBases2);
1356 if (!GetOperations()->IsDone() || anObject.IsNull())
1357 return aGEOMObject._retn();
1359 return GetObject(anObject);