Back to index

salome-geom  6.5.0
GEOM_I3DPrimOperations_i.cc
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 #include <Standard_Stream.hxx>
00024 
00025 #include "GEOM_I3DPrimOperations_i.hh"
00026 
00027 #include "utilities.h"
00028 #include "OpUtil.hxx"
00029 #include "Utils_ExceptHandlers.hxx"
00030 
00031 #include "GEOM_Engine.hxx"
00032 #include "GEOM_Object.hxx"
00033 
00034 //=============================================================================
00038 //=============================================================================
00039 GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i(PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine, ::GEOMImpl_I3DPrimOperations* theImpl)
00040 :GEOM_IOperations_i(thePOA, theEngine, theImpl)
00041 {
00042   MESSAGE("GEOM_I3DPrimOperations_i::GEOM_I3DPrimOperations_i");
00043 }
00044 
00045 //=============================================================================
00049 //=============================================================================
00050 GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i()
00051 {
00052   MESSAGE("GEOM_I3DPrimOperations_i::~GEOM_I3DPrimOperations_i");
00053 }
00054 
00055 
00056 //=============================================================================
00060 //=============================================================================
00061 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxDXDYDZ (CORBA::Double theDX,
00062                                                                CORBA::Double theDY,
00063                                                                CORBA::Double theDZ)
00064 {
00065   GEOM::GEOM_Object_var aGEOMObject;
00066 
00067   //Set a not done flag
00068   GetOperations()->SetNotDone();
00069 
00070   //Create the Box
00071   Handle(GEOM_Object) anObject = GetOperations()->MakeBoxDXDYDZ(theDX, theDY, theDZ);
00072   if (!GetOperations()->IsDone() || anObject.IsNull())
00073     return aGEOMObject._retn();
00074 
00075   return GetObject(anObject);
00076 }
00077 
00078 //=============================================================================
00082 //=============================================================================
00083 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeBoxTwoPnt
00084                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2)
00085 {
00086   GEOM::GEOM_Object_var aGEOMObject;
00087 
00088   //Set a not done flag
00089   GetOperations()->SetNotDone();
00090 
00091   Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
00092   Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
00093 
00094   if (aPnt1.IsNull() || aPnt2.IsNull()) return aGEOMObject._retn();
00095 
00096   //Create the Box
00097   Handle(GEOM_Object) anObject = GetOperations()->MakeBoxTwoPnt(aPnt1, aPnt2);
00098   if (!GetOperations()->IsDone() || anObject.IsNull())
00099     return aGEOMObject._retn();
00100 
00101   return GetObject(anObject);
00102 }
00103 
00104 //=============================================================================
00108 //=============================================================================
00109 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceHW (CORBA::Double theH,
00110                                                             CORBA::Double theW,
00111                                                             CORBA::Short  theOrientation)
00112 {
00113   GEOM::GEOM_Object_var aGEOMObject;
00114 
00115   //Set a not done flag
00116   GetOperations()->SetNotDone();
00117 
00118   if (theH == 0 || theW == 0)
00119     return aGEOMObject._retn();
00120 
00121   //Create the Face
00122   Handle(GEOM_Object) anObject = GetOperations()->MakeFaceHW(theH, theW, theOrientation);
00123   if (!GetOperations()->IsDone() || anObject.IsNull())
00124     return aGEOMObject._retn();
00125 
00126   return GetObject(anObject);
00127 }
00128 
00129 //=============================================================================
00133 //=============================================================================
00134 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeFaceObjHW
00135                                                (GEOM::GEOM_Object_ptr theObj,
00136                                                 CORBA::Double theH,
00137                                                 CORBA::Double theW)
00138 {
00139   GEOM::GEOM_Object_var aGEOMObject;
00140 
00141   //Set a not done flag
00142   GetOperations()->SetNotDone();
00143 
00144   //Get the reference object
00145   Handle(GEOM_Object) anObj = GetObjectImpl(theObj);
00146 
00147   if (anObj.IsNull())
00148     return aGEOMObject._retn();
00149 
00150   //Create the Face
00151   Handle(GEOM_Object) anObject = GetOperations()->MakeFaceObjHW(anObj, theH, theW);
00152   if (!GetOperations()->IsDone() || anObject.IsNull())
00153     return aGEOMObject._retn();
00154 
00155   return GetObject(anObject);
00156 }
00157 
00158 //=============================================================================
00162 //=============================================================================
00163 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskPntVecR
00164                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
00165                        CORBA::Double theR)
00166 {
00167   GEOM::GEOM_Object_var aGEOMObject;
00168 
00169   //Set a not done flag
00170   GetOperations()->SetNotDone();
00171 
00172   //Get the reference points
00173   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
00174   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
00175 
00176   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
00177 
00178   // Make Disk
00179   Handle(GEOM_Object) anObject =
00180     GetOperations()->MakeDiskPntVecR(aPnt, aVec, theR);
00181   if (!GetOperations()->IsDone() || anObject.IsNull())
00182     return aGEOMObject._retn();
00183 
00184   return GetObject(anObject);
00185 }
00186 
00187 //=============================================================================
00191 //=============================================================================
00192 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskThreePnt
00193                       (GEOM::GEOM_Object_ptr thePnt1, GEOM::GEOM_Object_ptr thePnt2,
00194                        GEOM::GEOM_Object_ptr thePnt3)
00195 {
00196   GEOM::GEOM_Object_var aGEOMObject;
00197 
00198   //Set a not done flag
00199   GetOperations()->SetNotDone();
00200 
00201   //Get the reference points
00202   Handle(GEOM_Object) aPnt1 = GetObjectImpl(thePnt1);
00203   Handle(GEOM_Object) aPnt2 = GetObjectImpl(thePnt2);
00204   Handle(GEOM_Object) aPnt3 = GetObjectImpl(thePnt3);
00205 
00206   if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
00207 
00208   // Make Disk
00209   Handle(GEOM_Object) anObject =
00210       GetOperations()->MakeDiskThreePnt(aPnt1, aPnt2, aPnt3);
00211   if (!GetOperations()->IsDone() || anObject.IsNull())
00212     return aGEOMObject._retn();
00213 
00214   return GetObject(anObject);
00215 }
00216 
00217 //=============================================================================
00221 //=============================================================================
00222 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
00223                                                            CORBA::Short  theOrientation)
00224 {
00225   GEOM::GEOM_Object_var aGEOMObject;
00226 
00227   //Set a not done flag
00228   GetOperations()->SetNotDone();
00229 
00230   if (theR == 0)
00231     return aGEOMObject._retn();
00232 
00233   //Create the Face
00234   Handle(GEOM_Object) anObject = GetOperations()->MakeDiskR(theR, theOrientation);
00235   if (!GetOperations()->IsDone() || anObject.IsNull())
00236     return aGEOMObject._retn();
00237 
00238   return GetObject(anObject);
00239 }
00240 
00241 //=============================================================================
00245 //=============================================================================
00246 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
00247                                                                 CORBA::Double theH)
00248 {
00249   GEOM::GEOM_Object_var aGEOMObject;
00250 
00251   //Set a not done flag
00252   GetOperations()->SetNotDone();
00253 
00254   //Create the Cylinder
00255   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
00256   if (!GetOperations()->IsDone() || anObject.IsNull())
00257     return aGEOMObject._retn();
00258 
00259   return GetObject(anObject);
00260 }
00261 
00262 //=============================================================================
00266 //=============================================================================
00267 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
00268                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
00269                        CORBA::Double theR, CORBA::Double theH)
00270 {
00271   GEOM::GEOM_Object_var aGEOMObject;
00272 
00273   //Set a not done flag
00274   GetOperations()->SetNotDone();
00275 
00276   //Get the reference points
00277   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
00278   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
00279 
00280   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
00281 
00282   //Create the Cylinder
00283   Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
00284   if (!GetOperations()->IsDone() || anObject.IsNull())
00285     return aGEOMObject._retn();
00286 
00287   return GetObject(anObject);
00288 }
00289 
00290 //=============================================================================
00294 //=============================================================================
00295 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConeR1R2H (CORBA::Double theR1,
00296                                                                CORBA::Double theR2,
00297                                                                CORBA::Double theH)
00298 {
00299   GEOM::GEOM_Object_var aGEOMObject;
00300 
00301   //Set a not done flag
00302   GetOperations()->SetNotDone();
00303 
00304   //Create the Cone
00305   Handle(GEOM_Object) anObject = GetOperations()->MakeConeR1R2H(theR1, theR2, theH);
00306   if (!GetOperations()->IsDone() || anObject.IsNull())
00307     return aGEOMObject._retn();
00308 
00309   return GetObject(anObject);
00310 }
00311 
00312 //=============================================================================
00316 //=============================================================================
00317 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeConePntVecR1R2H
00318                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
00319                        CORBA::Double theR1, CORBA::Double theR2, CORBA::Double theH)
00320 {
00321   GEOM::GEOM_Object_var aGEOMObject;
00322 
00323   //Set a not done flag
00324   GetOperations()->SetNotDone();
00325 
00326   //Get the reference points
00327   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
00328   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
00329 
00330   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
00331 
00332   //Create the Cone
00333   Handle(GEOM_Object) anObject =
00334       GetOperations()->MakeConePntVecR1R2H(aPnt, aVec, theR1, theR2, theH);
00335   if (!GetOperations()->IsDone() || anObject.IsNull())
00336     return aGEOMObject._retn();
00337 
00338   return GetObject(anObject);
00339 }
00340 
00341 //=============================================================================
00345 //=============================================================================
00346 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSphereR (CORBA::Double theR)
00347 {
00348   GEOM::GEOM_Object_var aGEOMObject;
00349 
00350   //Set a not done flag
00351   GetOperations()->SetNotDone();
00352 
00353   //Create the Cone
00354   Handle(GEOM_Object) anObject = GetOperations()->MakeSphereR(theR);
00355   if (!GetOperations()->IsDone() || anObject.IsNull())
00356     return aGEOMObject._retn();
00357 
00358   return GetObject(anObject);
00359 }
00360 
00361 //=============================================================================
00365 //=============================================================================
00366 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeSpherePntR
00367                       (GEOM::GEOM_Object_ptr thePnt, CORBA::Double theR)
00368 {
00369   GEOM::GEOM_Object_var aGEOMObject;
00370 
00371   //Set a not done flag
00372   GetOperations()->SetNotDone();
00373 
00374   //Get the reference point
00375   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
00376 
00377   if (aPnt.IsNull()) return aGEOMObject._retn();
00378 
00379   //Create the Sphere
00380   Handle(GEOM_Object) anObject =
00381     GetOperations()->MakeSpherePntR(aPnt, theR);
00382   if (!GetOperations()->IsDone() || anObject.IsNull())
00383     return aGEOMObject._retn();
00384 
00385   return GetObject(anObject);
00386 }
00387 
00388 //=============================================================================
00392 //=============================================================================
00393 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusRR
00394                       (CORBA::Double theRMajor, CORBA::Double theRMinor)
00395 {
00396   GEOM::GEOM_Object_var aGEOMObject;
00397 
00398   //Set a not done flag
00399   GetOperations()->SetNotDone();
00400 
00401   // Make Torus
00402   Handle(GEOM_Object) anObject =
00403     GetOperations()->MakeTorusRR(theRMajor, theRMinor);
00404   if (!GetOperations()->IsDone() || anObject.IsNull())
00405     return aGEOMObject._retn();
00406 
00407   return GetObject(anObject);
00408 }
00409 
00410 //=============================================================================
00414 //=============================================================================
00415 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeTorusPntVecRR
00416                       (GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
00417                        CORBA::Double theRMajor, CORBA::Double theRMinor)
00418 {
00419   GEOM::GEOM_Object_var aGEOMObject;
00420 
00421   //Set a not done flag
00422   GetOperations()->SetNotDone();
00423 
00424   //Get the reference points
00425   Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
00426   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
00427 
00428   if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
00429 
00430   // Make Torus
00431   Handle(GEOM_Object) anObject =
00432     GetOperations()->MakeTorusPntVecRR(aPnt, aVec, theRMajor, theRMinor);
00433   if (!GetOperations()->IsDone() || anObject.IsNull())
00434     return aGEOMObject._retn();
00435 
00436   return GetObject(anObject);
00437 }
00438 
00439 //=============================================================================
00443 //=============================================================================
00444 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH
00445                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
00446                        CORBA::Double theH)
00447 {
00448   GEOM::GEOM_Object_var aGEOMObject;
00449 
00450   //Set a not done flag
00451   GetOperations()->SetNotDone();
00452 
00453   //Get the reference objects
00454   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00455   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
00456 
00457   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
00458 
00459   //Create the Prism
00460   Handle(GEOM_Object) anObject =
00461     GetOperations()->MakePrismVecH(aBase, aVec, theH);
00462   if (!GetOperations()->IsDone() || anObject.IsNull())
00463     return aGEOMObject._retn();
00464 
00465   return GetObject(anObject);
00466 }
00467 
00468 //=============================================================================
00472 //=============================================================================
00473 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecH2Ways
00474                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
00475                        CORBA::Double theH)
00476 {
00477   GEOM::GEOM_Object_var aGEOMObject;
00478 
00479   //Set a not done flag
00480   GetOperations()->SetNotDone();
00481 
00482   //Get the reference objects
00483   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00484   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
00485 
00486   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
00487 
00488   //Create the Prism
00489   Handle(GEOM_Object) anObject =
00490       GetOperations()->MakePrismVecH2Ways(aBase, aVec, theH);
00491   if (!GetOperations()->IsDone() || anObject.IsNull())
00492     return aGEOMObject._retn();
00493 
00494   return GetObject(anObject);
00495 }
00496 
00497 //=============================================================================
00501 //=============================================================================
00502 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismVecHWithScaling
00503                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theVec,
00504                        CORBA::Double theH, CORBA::Double theScaleFactor)
00505 {
00506   GEOM::GEOM_Object_var aGEOMObject;
00507 
00508   //Set a not done flag
00509   GetOperations()->SetNotDone();
00510 
00511   //Get the reference objects
00512   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00513   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
00514 
00515   if (aBase.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
00516 
00517   //Create the Prism
00518   Handle(GEOM_Object) anObject =
00519     GetOperations()->MakePrismVecH(aBase, aVec, theH, theScaleFactor);
00520   if (!GetOperations()->IsDone() || anObject.IsNull())
00521     return aGEOMObject._retn();
00522 
00523   return GetObject(anObject);
00524 }
00525 
00526 //=============================================================================
00530 //=============================================================================
00531 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt
00532                                              (GEOM::GEOM_Object_ptr theBase,
00533                                               GEOM::GEOM_Object_ptr thePoint1,
00534                                               GEOM::GEOM_Object_ptr thePoint2)
00535 {
00536   GEOM::GEOM_Object_var aGEOMObject;
00537 
00538   //Set a not done flag
00539   GetOperations()->SetNotDone();
00540 
00541   //Get the reference objects
00542   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00543   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
00544   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
00545 
00546   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
00547     return aGEOMObject._retn();
00548 
00549   //Create the Prism
00550   Handle(GEOM_Object) anObject =
00551     GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2);
00552   if (!GetOperations()->IsDone() || anObject.IsNull())
00553     return aGEOMObject._retn();
00554 
00555   return GetObject(anObject);
00556 }
00557 
00558 //=============================================================================
00562 //=============================================================================
00563 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPnt2Ways
00564                                              (GEOM::GEOM_Object_ptr theBase,
00565                                               GEOM::GEOM_Object_ptr thePoint1,
00566                                               GEOM::GEOM_Object_ptr thePoint2)
00567 {
00568   GEOM::GEOM_Object_var aGEOMObject;
00569 
00570   //Set a not done flag
00571   GetOperations()->SetNotDone();
00572 
00573   //Get the reference objects
00574   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00575   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
00576   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
00577 
00578   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
00579     return aGEOMObject._retn();
00580 
00581   //Create the Prism
00582   Handle(GEOM_Object) anObject =
00583     GetOperations()->MakePrismTwoPnt2Ways(aBase, aPoint1, aPoint2);
00584   if (!GetOperations()->IsDone() || anObject.IsNull())
00585     return aGEOMObject._retn();
00586 
00587   return GetObject(anObject);
00588 }
00589 
00590 //=============================================================================
00594 //=============================================================================
00595 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismTwoPntWithScaling
00596                                              (GEOM::GEOM_Object_ptr theBase,
00597                                               GEOM::GEOM_Object_ptr thePoint1,
00598                                               GEOM::GEOM_Object_ptr thePoint2,
00599                                               CORBA::Double         theScaleFactor)
00600 {
00601   GEOM::GEOM_Object_var aGEOMObject;
00602 
00603   //Set a not done flag
00604   GetOperations()->SetNotDone();
00605 
00606   //Get the reference objects
00607   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00608   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
00609   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
00610 
00611   if (aBase.IsNull() || aPoint1.IsNull() || aPoint2.IsNull())
00612     return aGEOMObject._retn();
00613 
00614   //Create the Prism
00615   Handle(GEOM_Object) anObject =
00616     GetOperations()->MakePrismTwoPnt(aBase, aPoint1, aPoint2, theScaleFactor);
00617   if (!GetOperations()->IsDone() || anObject.IsNull())
00618     return aGEOMObject._retn();
00619 
00620   return GetObject(anObject);
00621 }
00622 
00623 //=============================================================================
00627 //=============================================================================
00628 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ
00629                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
00630                        CORBA::Double theDY, CORBA::Double theDZ)
00631 {
00632   GEOM::GEOM_Object_var aGEOMObject;
00633 
00634   //Set a not done flag
00635   GetOperations()->SetNotDone();
00636 
00637   //Get the reference objects
00638   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00639 
00640   if (aBase.IsNull()) return aGEOMObject._retn();
00641 
00642   //Create the Prism
00643   Handle(GEOM_Object) anObject =
00644       GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ);
00645   if (!GetOperations()->IsDone() || anObject.IsNull())
00646     return aGEOMObject._retn();
00647 
00648   return GetObject(anObject);
00649 }
00650 
00651 //=============================================================================
00655 //=============================================================================
00656 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZ2Ways
00657                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
00658                        CORBA::Double theDY, CORBA::Double theDZ)
00659 {
00660   GEOM::GEOM_Object_var aGEOMObject;
00661 
00662   //Set a not done flag
00663   GetOperations()->SetNotDone();
00664 
00665   //Get the reference objects
00666   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00667 
00668   if (aBase.IsNull()) return aGEOMObject._retn();
00669 
00670   //Create the Prism
00671   Handle(GEOM_Object) anObject =
00672       GetOperations()->MakePrismDXDYDZ2Ways(aBase, theDX, theDY, theDZ);
00673   if (!GetOperations()->IsDone() || anObject.IsNull())
00674     return aGEOMObject._retn();
00675 
00676   return GetObject(anObject);
00677 }
00678 
00679 //=============================================================================
00683 //=============================================================================
00684 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePrismDXDYDZWithScaling
00685                       (GEOM::GEOM_Object_ptr theBase, CORBA::Double theDX,
00686                        CORBA::Double theDY, CORBA::Double theDZ,
00687                        CORBA::Double theScaleFactor)
00688 {
00689   GEOM::GEOM_Object_var aGEOMObject;
00690 
00691   //Set a not done flag
00692   GetOperations()->SetNotDone();
00693 
00694   //Get the reference objects
00695   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00696 
00697   if (aBase.IsNull()) return aGEOMObject._retn();
00698 
00699   //Create the Prism
00700   Handle(GEOM_Object) anObject =
00701     GetOperations()->MakePrismDXDYDZ(aBase, theDX, theDY, theDZ, theScaleFactor);
00702   if (!GetOperations()->IsDone() || anObject.IsNull())
00703     return aGEOMObject._retn();
00704 
00705   return GetObject(anObject);
00706 }
00707 
00708 //=============================================================================
00712 //=============================================================================
00713 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDraftPrism
00714                       (GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase, 
00715                        CORBA::Double  theHeight,
00716                        CORBA::Double  theAngle,
00717                        CORBA::Boolean theFuse)
00718 {
00719   GEOM::GEOM_Object_var aGEOMObject;
00720   
00721   //Set a not done flag
00722   GetOperations()->SetNotDone();
00723 
00724   //Get the reference objects
00725   Handle(GEOM_Object) aInit   = GetObjectImpl(theInitShape);
00726   Handle(GEOM_Object) aBase   = GetObjectImpl(theBase);
00727 
00728   if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn();
00729 
00730   //Create the Prism
00731   Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse);
00732  
00733   if (!GetOperations()->IsDone() || anObject.IsNull())
00734     return aGEOMObject._retn();
00735 
00736   return GetObject(anObject);
00737 }
00738 
00739 //=============================================================================
00743 //=============================================================================
00744 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipe
00745                  (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr thePath)
00746 {
00747   GEOM::GEOM_Object_var aGEOMObject;
00748 
00749   //Set a not done flag
00750   GetOperations()->SetNotDone();
00751 
00752   //Get the reference objects
00753   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00754   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
00755 
00756   if (aBase.IsNull() || aPath.IsNull()) return aGEOMObject._retn();
00757 
00758   //Create the Pipe
00759   Handle(GEOM_Object) anObject =
00760     GetOperations()->MakePipe(aBase, aPath);
00761   if (!GetOperations()->IsDone() || anObject.IsNull())
00762     return aGEOMObject._retn();
00763 
00764   return GetObject(anObject);
00765 }
00766 
00767 //=============================================================================
00771 //=============================================================================
00772 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle
00773                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
00774                        CORBA::Double theAngle)
00775 {
00776   GEOM::GEOM_Object_var aGEOMObject;
00777 
00778   //Set a not done flag
00779   GetOperations()->SetNotDone();
00780 
00781   //Get the reference objects
00782   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00783   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
00784 
00785   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
00786 
00787   //Create the Revolution
00788   Handle(GEOM_Object) anObject =
00789       GetOperations()->MakeRevolutionAxisAngle(aBase, anAxis, theAngle);
00790   if (!GetOperations()->IsDone() || anObject.IsNull())
00791     return aGEOMObject._retn();
00792 
00793   return GetObject(anObject);
00794 }
00795 
00796 //=============================================================================
00800 //=============================================================================
00801 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeRevolutionAxisAngle2Ways
00802                       (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theAxis,
00803                        CORBA::Double theAngle)
00804 {
00805   GEOM::GEOM_Object_var aGEOMObject;
00806 
00807   //Set a not done flag
00808   GetOperations()->SetNotDone();
00809 
00810   //Get the reference objects
00811   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
00812   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
00813 
00814   if (aBase.IsNull() || anAxis.IsNull()) return aGEOMObject._retn();
00815 
00816   //Create the Revolution
00817   Handle(GEOM_Object) anObject =
00818       GetOperations()->MakeRevolutionAxisAngle2Ways(aBase, anAxis, theAngle);
00819   if (!GetOperations()->IsDone() || anObject.IsNull())
00820     return aGEOMObject._retn();
00821 
00822   return GetObject(anObject);
00823 }
00824 
00825 //=============================================================================
00829 //=============================================================================
00830 GEOM::GEOM_Object_ptr
00831 GEOM_I3DPrimOperations_i::MakeFilling(GEOM::GEOM_Object_ptr theShape,
00832                                       CORBA::Long theMinDeg,
00833                                       CORBA::Long theMaxDeg,
00834                                       CORBA::Double theTol2D,
00835                                       CORBA::Double theTol3D,
00836                                       CORBA::Long theNbIter,
00837                                       GEOM::filling_oper_method theMethod,
00838                                       CORBA::Boolean theApprox)
00839 {
00840   GEOM::GEOM_Object_var aGEOMObject;
00841 
00842   //Set a not done flag
00843   GetOperations()->SetNotDone();
00844 
00845   //Get the reference objects
00846   Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
00847 
00848   if (aShape.IsNull()) return aGEOMObject._retn();
00849 
00850   int aMethod = 0;
00851   switch (theMethod) {
00852   case GEOM::FOM_Default:
00853     {
00854       // Default (standard behaviour)
00855       aMethod = 0;
00856     }
00857     break;
00858   case GEOM::FOM_UseOri:
00859     {
00860       // Use edges orientation
00861       aMethod = 1;
00862     }
00863     break;
00864   case GEOM::FOM_AutoCorrect:
00865     {
00866       // Auto-correct edges orientation
00867       aMethod = 2;
00868     }
00869     break;
00870   default:
00871     {}
00872   }
00873 
00874   //Create the Solid
00875   Handle(GEOM_Object) anObject = GetOperations()->MakeFilling
00876     (aShape, theMinDeg, theMaxDeg, theTol2D, theTol3D, theNbIter,
00877      aMethod, theApprox);
00878   if (!GetOperations()->IsDone() || anObject.IsNull())
00879     return aGEOMObject._retn();
00880 
00881   return GetObject(anObject);
00882 }
00883 
00884 //=============================================================================
00888 //=============================================================================
00889 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThruSections(const GEOM::ListOfGO& theSeqSections,
00890                                                                  CORBA::Boolean theModeSolid,
00891                                                                  CORBA::Double thePreci,
00892                                                                  CORBA::Boolean theRuled)
00893 {
00894    GEOM::GEOM_Object_var aGEOMObject;
00895 
00896   //Set a not done flag
00897   GetOperations()->SetNotDone();
00898   Handle(TColStd_HSequenceOfTransient) aSeqSections = new TColStd_HSequenceOfTransient;
00899   int ind, aLen;
00900 
00901   //Get the shapes
00902   aLen = theSeqSections.length();
00903   for (ind = 0; ind < aLen; ind++) {
00904     Handle(GEOM_Object) aSh = GetObjectImpl(theSeqSections[ind]);
00905     if (!aSh.IsNull())
00906       aSeqSections->Append(aSh);
00907   }
00908   if (!aSeqSections->Length())
00909     return aGEOMObject._retn();
00910 
00911   // Make shell or solid
00912   Handle(GEOM_Object) anObject =
00913     GetOperations()->MakeThruSections(aSeqSections,theModeSolid,thePreci,theRuled);
00914   if (!GetOperations()->IsDone() || anObject.IsNull())
00915     return aGEOMObject._retn();
00916 
00917   return GetObject(anObject);
00918 }
00919 
00920 //=============================================================================
00924 //=============================================================================
00925 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithDifferentSections
00926                       (const GEOM::ListOfGO& theBases,
00927                        const GEOM::ListOfGO& theLocations,
00928                        GEOM::GEOM_Object_ptr thePath,
00929                        CORBA::Boolean theWithContact,
00930                        CORBA::Boolean theWithCorrections)
00931 {
00932   GEOM::GEOM_Object_var aGEOMObject;
00933 
00934   //Set a not done flag
00935   GetOperations()->SetNotDone();
00936   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
00937   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
00938   int ind=0, aNbBases =0,aNbLocs=0;
00939 
00940   //Get the shapes
00941   aNbBases = theBases.length();
00942   aNbLocs = theLocations.length();
00943 
00944   if (aNbLocs && aNbBases != aNbLocs)
00945     return aGEOMObject._retn();
00946 
00947   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
00948   if (aPath.IsNull())
00949     return aGEOMObject._retn();
00950 
00951   for (ind = 0; ind < aNbBases; ind++) {
00952     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
00953     if (aBase.IsNull())
00954       continue;
00955     if (aNbLocs)
00956     {
00957       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
00958       if (aLoc.IsNull())
00959         continue;
00960       aSeqLocations->Append(aLoc);
00961     }
00962     aSeqBases->Append(aBase);
00963   }
00964   if (!aSeqBases->Length())
00965     return aGEOMObject._retn();
00966 
00967   // Make pipe
00968   Handle(GEOM_Object) anObject =
00969     GetOperations()->MakePipeWithDifferentSections(aSeqBases,aSeqLocations ,aPath,
00970                                                    theWithContact,theWithCorrections);
00971   if (!GetOperations()->IsDone() || anObject.IsNull())
00972     return aGEOMObject._retn();
00973 
00974   return GetObject(anObject);
00975 }
00976 
00977 
00978 //=============================================================================
00982 //=============================================================================
00983 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeWithShellSections
00984                  (const GEOM::ListOfGO& theBases,
00985                   const GEOM::ListOfGO& theSubBases,
00986                   const GEOM::ListOfGO& theLocations,
00987                   GEOM::GEOM_Object_ptr thePath,
00988                   CORBA::Boolean theWithContact,
00989                   CORBA::Boolean theWithCorrections)
00990 {
00991   GEOM::GEOM_Object_var aGEOMObject;
00992 
00993   //Set a not done flag
00994   GetOperations()->SetNotDone();
00995   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
00996   Handle(TColStd_HSequenceOfTransient) aSeqSubBases = new TColStd_HSequenceOfTransient;
00997   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
00998   int ind=0, aNbBases=0, aNbSubBases=0, aNbLocs=0;
00999 
01000   //Get the shapes
01001   aNbBases = theBases.length();
01002   aNbSubBases = theSubBases.length();
01003   aNbLocs = theLocations.length();
01004 
01005   if (aNbLocs && aNbBases != aNbLocs)
01006     return aGEOMObject._retn();
01007 
01008   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
01009   if (aPath.IsNull())
01010     return aGEOMObject._retn();
01011 
01012   for (ind = 0; ind < aNbBases; ind++) {
01013     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
01014     if (aBase.IsNull())
01015       continue;
01016     if (aNbLocs) {
01017       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
01018       if (aLoc.IsNull())
01019         continue;
01020       aSeqLocations->Append(aLoc);
01021     }
01022     aSeqBases->Append(aBase);
01023 
01024     if (aNbSubBases >= aNbBases) {
01025       Handle(GEOM_Object) aSubBase = GetObjectImpl(theSubBases[ind]);
01026       if (aSubBase.IsNull()) {
01027         aSeqSubBases->Clear();
01028         aNbSubBases = 0;
01029         continue;
01030       }
01031       aSeqSubBases->Append(aSubBase);
01032     }
01033   }
01034   if (!aSeqBases->Length())
01035     return aGEOMObject._retn();
01036 
01037   // Make pipe
01038   Handle(GEOM_Object) anObject =
01039     GetOperations()->MakePipeWithShellSections(aSeqBases, aSeqSubBases,
01040                                                aSeqLocations, aPath,
01041                                                theWithContact, theWithCorrections);
01042   if (!GetOperations()->IsDone() || anObject.IsNull())
01043     return aGEOMObject._retn();
01044 
01045   return GetObject(anObject);
01046 }
01047 
01048 
01049 //=============================================================================
01053 //=============================================================================
01054 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeShellsWithoutPath
01055                  (const GEOM::ListOfGO& theBases,
01056                   const GEOM::ListOfGO& theLocations)
01057 {
01058   GEOM::GEOM_Object_var aGEOMObject;
01059 
01060   //Set a not done flag
01061   GetOperations()->SetNotDone();
01062   Handle(TColStd_HSequenceOfTransient) aSeqBases = new TColStd_HSequenceOfTransient;
01063   Handle(TColStd_HSequenceOfTransient) aSeqLocations = new TColStd_HSequenceOfTransient;
01064   int ind=0, aNbBases=0, aNbLocs=0;
01065 
01066   //Get the shapes
01067   aNbBases = theBases.length();
01068   aNbLocs = theLocations.length();
01069 
01070   if (aNbLocs && aNbBases != aNbLocs)
01071     return aGEOMObject._retn();
01072 
01073   for (ind = 0; ind < aNbBases; ind++) {
01074     Handle(GEOM_Object) aBase = GetObjectImpl(theBases[ind]);
01075     if (aBase.IsNull())
01076       continue;
01077     if (aNbLocs) {
01078       Handle(GEOM_Object) aLoc = GetObjectImpl(theLocations[ind]);
01079       if (aLoc.IsNull())
01080         continue;
01081       aSeqLocations->Append(aLoc);
01082     }
01083     aSeqBases->Append(aBase);
01084   }
01085 
01086   if (!aSeqBases->Length())
01087     return aGEOMObject._retn();
01088 
01089   // Make pipe
01090   Handle(GEOM_Object) anObject =
01091     GetOperations()->MakePipeShellsWithoutPath(aSeqBases,aSeqLocations);
01092 
01093   if (!GetOperations()->IsDone() || anObject.IsNull())
01094     return aGEOMObject._retn();
01095 
01096   return GetObject(anObject);
01097 }
01098 
01099 
01100 //=============================================================================
01104 //=============================================================================
01105 GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakePipeBiNormalAlongVector
01106                  (GEOM::GEOM_Object_ptr theBase,
01107                   GEOM::GEOM_Object_ptr thePath,
01108                   GEOM::GEOM_Object_ptr theVec)
01109 {
01110   GEOM::GEOM_Object_var aGEOMObject;
01111 
01112   //Set a not done flag
01113   GetOperations()->SetNotDone();
01114 
01115   //Get the reference objects
01116   Handle(GEOM_Object) aBase = GetObjectImpl(theBase);
01117   Handle(GEOM_Object) aPath = GetObjectImpl(thePath);
01118   Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
01119 
01120   if (aBase.IsNull() || aPath.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
01121 
01122   //Create the Pipe
01123   Handle(GEOM_Object) anObject =
01124     GetOperations()->MakePipeBiNormalAlongVector(aBase, aPath, aVec);
01125   if (!GetOperations()->IsDone() || anObject.IsNull())
01126     return aGEOMObject._retn();
01127 
01128   return GetObject(anObject);
01129 }