Back to index

salome-geom  6.5.0
GEOM_ITransformOperations_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_ITransformOperations_i.hh"
00026 
00027 #include "utilities.h"
00028 #include "OpUtil.hxx"
00029 #include "Utils_ExceptHandlers.hxx"
00030 
00031 #include <TDF_Label.hxx>
00032 #include <TDF_Tool.hxx>
00033 #include <TCollection_AsciiString.hxx>
00034 #include "GEOM_Engine.hxx"
00035 #include "GEOM_Object.hxx"
00036 
00037 #define SUBSHAPE_ERROR "Sub shape cannot be transformed"
00038 
00039 //=============================================================================
00043 //=============================================================================
00044 
00045 GEOM_ITransformOperations_i::GEOM_ITransformOperations_i (PortableServer::POA_ptr thePOA,
00046                                                           GEOM::GEOM_Gen_ptr theEngine,
00047                                                           ::GEOMImpl_ITransformOperations* theImpl)
00048      :GEOM_IOperations_i(thePOA, theEngine, theImpl)
00049 {
00050   MESSAGE("GEOM_ITransformOperations_i::GEOM_ITransformOperations_i");
00051 }
00052 
00053 //=============================================================================
00057 //=============================================================================
00058 
00059 GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i()
00060 {
00061   MESSAGE("GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i");
00062 }
00063 
00064 
00065 //=============================================================================
00069 //=============================================================================
00070 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints
00071                                              (GEOM::GEOM_Object_ptr theObject,
00072                                               GEOM::GEOM_Object_ptr thePoint1,
00073                                               GEOM::GEOM_Object_ptr thePoint2)
00074 {
00075   //Set a not done flag
00076   GetOperations()->SetNotDone();
00077   GEOM::GEOM_Object_var aGEOMObject;
00078 
00079   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
00080 
00081   //check if the object is a sub-shape
00082   if (!theObject->IsMainShape()) {
00083     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00084     return aGEOMObject._retn();
00085   }
00086 
00087   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00088 
00089   //Get the object itself
00090   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
00091   if (anObject.IsNull()) return aGEOMObject._retn();
00092 
00093   //Get the first point of translation
00094   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
00095   if (aPoint1.IsNull()) return aGEOMObject._retn();
00096 
00097   //Get the second point of translation
00098   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
00099   if (aPoint2.IsNull()) return aGEOMObject._retn();
00100 
00101   //Perform the translation
00102   GetOperations()->TranslateTwoPoints(anObject, aPoint1, aPoint2);
00103 
00104   return aGEOMObject._retn();
00105 }
00106 
00107 //=============================================================================
00111 //=============================================================================
00112 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPointsCopy
00113                                              (GEOM::GEOM_Object_ptr theObject,
00114                                               GEOM::GEOM_Object_ptr thePoint1,
00115                                               GEOM::GEOM_Object_ptr thePoint2)
00116 {
00117   GEOM::GEOM_Object_var aGEOMObject;
00118 
00119   //Set a not done flag
00120   GetOperations()->SetNotDone();
00121 
00122   //Get the object itself
00123   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00124   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00125 
00126   //Get the first point of translation
00127   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
00128   if (aPoint1.IsNull()) return aGEOMObject._retn();
00129 
00130   //Get the second point of translation
00131   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
00132   if (aPoint2.IsNull()) return aGEOMObject._retn();
00133 
00134   //Create the translated shape
00135   Handle(GEOM_Object) anObject =
00136     GetOperations()->TranslateTwoPointsCopy(aBasicObject, aPoint1, aPoint2);
00137   if (!GetOperations()->IsDone() || anObject.IsNull())
00138     return aGEOMObject._retn();
00139 
00140   return GetObject(anObject);
00141 }
00142 
00143 //=============================================================================
00147 //=============================================================================
00148 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ
00149                       (GEOM::GEOM_Object_ptr theObject,
00150                        CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
00151 {
00152   //Set a not done flag
00153   GetOperations()->SetNotDone();
00154   GEOM::GEOM_Object_var aGEOMObject;
00155 
00156   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
00157 
00158   //check if the object is a sub-shape
00159   if (!theObject->IsMainShape()) {
00160     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00161     return aGEOMObject._retn();
00162   }
00163 
00164   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00165 
00166   //Get the object itself
00167   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
00168   if (anObject.IsNull()) return aGEOMObject._retn();
00169 
00170   //Perform the translation
00171   GetOperations()->TranslateDXDYDZ(anObject, theDX, theDY, theDZ);
00172 
00173   return aGEOMObject._retn();
00174 }
00175 
00176 //=============================================================================
00180 //=============================================================================
00181 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZCopy
00182                                              (GEOM::GEOM_Object_ptr theObject,
00183                                               CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
00184 {
00185   GEOM::GEOM_Object_var aGEOMObject;
00186 
00187   //Set a not done flag
00188   GetOperations()->SetNotDone();
00189 
00190   //Get the object itself
00191   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00192   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00193 
00194   //Create the translated shape
00195   Handle(GEOM_Object) anObject =
00196     GetOperations()->TranslateDXDYDZCopy(aBasicObject, theDX, theDY, theDZ);
00197   if (!GetOperations()->IsDone() || anObject.IsNull())
00198     return aGEOMObject._retn();
00199 
00200   return GetObject(anObject);
00201 }
00202 
00203 //=============================================================================
00207 //=============================================================================
00208 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector
00209                                             (GEOM::GEOM_Object_ptr theObject,
00210                                              GEOM::GEOM_Object_ptr theVector)
00211 {
00212   //Set a not done flag
00213   GetOperations()->SetNotDone();
00214   GEOM::GEOM_Object_var aGEOMObject;
00215 
00216   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
00217 
00218   //check if the object is a sub-shape
00219   if (!theObject->IsMainShape()) {
00220     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00221     return aGEOMObject._retn();
00222   }
00223 
00224   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00225 
00226   //Get the object itself
00227   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
00228   if (anObject.IsNull()) return aGEOMObject._retn();
00229 
00230   //Get the vector of translation
00231   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
00232   if (aVector.IsNull()) return aGEOMObject._retn();
00233 
00234   //Perform the translation
00235   GetOperations()->TranslateVector(anObject, aVector);
00236 
00237   return aGEOMObject._retn();
00238 }
00239 
00240 //=============================================================================
00244 //=============================================================================
00245 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorCopy
00246                                             (GEOM::GEOM_Object_ptr theObject,
00247                                              GEOM::GEOM_Object_ptr theVector)
00248 {
00249   GEOM::GEOM_Object_var aGEOMObject;
00250 
00251   //Set a not done flag
00252   GetOperations()->SetNotDone();
00253 
00254   //Get the object itself
00255   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00256   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00257 
00258   //Get the vector of translation
00259   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
00260   if (aVector.IsNull()) return aGEOMObject._retn();
00261 
00262   //Perform the translation
00263   Handle(GEOM_Object) anObject = GetOperations()->TranslateVectorCopy(aBasicObject, aVector);
00264   if (!GetOperations()->IsDone() || anObject.IsNull())
00265     return aGEOMObject._retn();
00266 
00267   return GetObject(anObject);
00268 }
00269 
00270 //=============================================================================
00274 //=============================================================================
00275 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorDistance
00276                                             (GEOM::GEOM_Object_ptr theObject,
00277                                              GEOM::GEOM_Object_ptr theVector,
00278                                              CORBA::Double theDistance,
00279                                              CORBA::Boolean theCopy)
00280 {
00281   GEOM::GEOM_Object_var aGEOMObject;
00282   GetOperations()->SetNotDone(); //Set a not done flag
00283 
00284   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
00285 
00286   //check if the object is a sub-shape
00287   if (!theCopy && !theObject->IsMainShape()) {
00288     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00289     return aGEOMObject._retn();
00290   }
00291 
00292   if (!theCopy)
00293     aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00294 
00295   //Get the object itself
00296   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00297   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00298 
00299   //Get the vector of translation
00300   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
00301   if (aVector.IsNull()) return aGEOMObject._retn();
00302 
00303   //Perform the translation
00304   if (theCopy) {
00305     Handle(GEOM_Object) anObject = GetOperations()->
00306       TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy);
00307     if (!GetOperations()->IsDone() || anObject.IsNull())
00308       return aGEOMObject._retn();
00309 
00310     return GetObject(anObject);
00311   }
00312 
00313   GetOperations()->TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy);
00314   return aGEOMObject._retn();
00315 }
00316 
00317 //=============================================================================
00321 //=============================================================================
00322 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr theObject,
00323                                                            GEOM::GEOM_Object_ptr theAxis,
00324                                                            CORBA::Double theAngle)
00325 {
00326   //Set a not done flag
00327   GetOperations()->SetNotDone();
00328   GEOM::GEOM_Object_var aGEOMObject;
00329 
00330   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
00331 
00332   //check if the object is a sub-shape
00333   if (!theObject->IsMainShape()) {
00334     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00335     return aGEOMObject._retn();
00336   }
00337 
00338   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00339 
00340   //Get the object itself
00341   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
00342   if (anObject.IsNull()) return aGEOMObject._retn();
00343 
00344   //Get the axis of revolution
00345   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
00346   if (anAxis.IsNull()) return aGEOMObject._retn();
00347 
00348   //Perform the rotation
00349   GetOperations()->Rotate(anObject, anAxis, theAngle);
00350 
00351   return aGEOMObject._retn();
00352 }
00353 
00354 //=============================================================================
00358 //=============================================================================
00359 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateCopy (GEOM::GEOM_Object_ptr theObject,
00360                                                                GEOM::GEOM_Object_ptr theAxis,
00361                                                                CORBA::Double theAngle)
00362 {
00363   GEOM::GEOM_Object_var aGEOMObject;
00364 
00365   //Set a not done flag
00366   GetOperations()->SetNotDone();
00367 
00368   //Get the object itself
00369   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00370   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00371 
00372   //Get the axis of rotation
00373   Handle(GEOM_Object) anAxis = GetObjectImpl(theAxis);
00374   if (anAxis.IsNull()) return aGEOMObject._retn();
00375 
00376   //Perform the rotation
00377   Handle(GEOM_Object) anObject = GetOperations()->RotateCopy(aBasicObject, anAxis, theAngle);
00378   if (!GetOperations()->IsDone() || anObject.IsNull())
00379     return aGEOMObject._retn();
00380 
00381   return GetObject(anObject);
00382 }
00383 
00384 //=============================================================================
00388 //=============================================================================
00389 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlane
00390                                             (GEOM::GEOM_Object_ptr theObject,
00391                                              GEOM::GEOM_Object_ptr thePlane)
00392 {
00393   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00394 
00395   //Set a not done flag
00396   GetOperations()->SetNotDone();
00397 
00398   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
00399 
00400   //check if the object is a sub-shape
00401   if (!theObject->IsMainShape()) {
00402     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00403     return aGEOMObject._retn();
00404   }
00405 
00406   //Get the object itself
00407   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
00408   if (anObject.IsNull()) return aGEOMObject._retn();
00409 
00410   //Get the plane
00411   Handle(GEOM_Object) aPlane = GetObjectImpl(thePlane);
00412   if (aPlane.IsNull()) return aGEOMObject._retn();
00413 
00414   //Perform the mirror
00415   GetOperations()->MirrorPlane(anObject, aPlane);
00416 
00417   return aGEOMObject._retn();
00418 }
00419 
00420 //=============================================================================
00424 //=============================================================================
00425 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlaneCopy
00426                                             (GEOM::GEOM_Object_ptr theObject,
00427                                              GEOM::GEOM_Object_ptr thePlane)
00428 {
00429   GEOM::GEOM_Object_var aGEOMObject;
00430 
00431   //Set a not done flag
00432   GetOperations()->SetNotDone();
00433 
00434   //Get the object itself
00435   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00436   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00437 
00438   //Get the vector of translation
00439   Handle(GEOM_Object) aPlane = GetObjectImpl(thePlane);
00440   if (aPlane.IsNull()) return aGEOMObject._retn();
00441 
00442   //Perform the mirror
00443   Handle(GEOM_Object) anObject = GetOperations()->MirrorPlaneCopy(aBasicObject, aPlane);
00444   if (!GetOperations()->IsDone() || anObject.IsNull())
00445     return aGEOMObject._retn();
00446 
00447   return GetObject(anObject);
00448 }
00449 
00450 //=============================================================================
00454 //=============================================================================
00455 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxis
00456                                             (GEOM::GEOM_Object_ptr theObject,
00457                                              GEOM::GEOM_Object_ptr theAxis)
00458 {
00459   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00460 
00461   //Set a not done flag
00462   GetOperations()->SetNotDone();
00463 
00464   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
00465 
00466   //check if the object is a sub-shape
00467   if (!theObject->IsMainShape()) {
00468     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00469     return aGEOMObject._retn();
00470   }
00471 
00472   //Get the object itself
00473   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
00474   if (anObject.IsNull()) return aGEOMObject._retn();
00475 
00476   //Get the axis
00477   Handle(GEOM_Object) aAxis = GetObjectImpl(theAxis);
00478   if (aAxis.IsNull()) return aGEOMObject._retn();
00479 
00480   //Perform the mirror
00481   GetOperations()->MirrorAxis(anObject, aAxis);
00482 
00483   return aGEOMObject._retn();
00484 }
00485 
00486 //=============================================================================
00490 //=============================================================================
00491 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxisCopy
00492                                             (GEOM::GEOM_Object_ptr theObject,
00493                                              GEOM::GEOM_Object_ptr theAxis)
00494 {
00495   GEOM::GEOM_Object_var aGEOMObject;
00496 
00497   //Set a not done flag
00498   GetOperations()->SetNotDone();
00499 
00500   //Get the object itself
00501   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00502   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00503 
00504   //Get the vector of translation
00505   Handle(GEOM_Object) aAxis = GetObjectImpl(theAxis);
00506   if (aAxis.IsNull()) return aGEOMObject._retn();
00507 
00508   //Perform the mirror
00509   Handle(GEOM_Object) anObject = GetOperations()->MirrorAxisCopy(aBasicObject, aAxis);
00510   if (!GetOperations()->IsDone() || anObject.IsNull())
00511     return aGEOMObject._retn();
00512 
00513   return GetObject(anObject);
00514 }
00515 
00516 //=============================================================================
00520 //=============================================================================
00521 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPoint
00522                                             (GEOM::GEOM_Object_ptr theObject,
00523                                              GEOM::GEOM_Object_ptr thePoint)
00524 {
00525   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00526 
00527   //Set a not done flag
00528   GetOperations()->SetNotDone();
00529 
00530   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
00531 
00532   //check if the object is a sub-shape
00533   if (!theObject->IsMainShape()) {
00534     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00535     return aGEOMObject._retn();
00536   }
00537 
00538   //Get the object itself
00539   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
00540   if (anObject.IsNull()) return aGEOMObject._retn();
00541 
00542   //Get the point
00543   Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
00544   if (aPoint.IsNull()) return aGEOMObject._retn();
00545 
00546   //Perform the mirror
00547   GetOperations()->MirrorPoint(anObject, aPoint);
00548 
00549   return aGEOMObject._retn();
00550 }
00551 
00552 //=============================================================================
00556 //=============================================================================
00557 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPointCopy
00558                                             (GEOM::GEOM_Object_ptr theObject,
00559                                              GEOM::GEOM_Object_ptr thePoint)
00560 {
00561   GEOM::GEOM_Object_var aGEOMObject;
00562 
00563   //Set a not done flag
00564   GetOperations()->SetNotDone();
00565 
00566   //Get the object itself
00567   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00568   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00569 
00570   //Get the vector of translation
00571   Handle(GEOM_Object) aPoint = GetObjectImpl(thePoint);
00572   if (aPoint.IsNull()) return aGEOMObject._retn();
00573 
00574   //Perform the mirror
00575   Handle(GEOM_Object) anObject = GetOperations()->MirrorPointCopy(aBasicObject, aPoint);
00576   if (!GetOperations()->IsDone() || anObject.IsNull())
00577     return aGEOMObject._retn();
00578 
00579   return GetObject(anObject);
00580 }
00581 
00582 //=============================================================================
00586 //=============================================================================
00587 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape
00588                                              (GEOM::GEOM_Object_ptr theObject,
00589                                               CORBA::Double theOffset)
00590 {
00591   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00592 
00593   //Set a not done flag
00594   GetOperations()->SetNotDone();
00595 
00596   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
00597 
00598   //check if the object is a sub-shape
00599   if (!theObject->IsMainShape()) {
00600     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00601     return aGEOMObject._retn();
00602   }
00603 
00604   //Get the basic object
00605   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00606   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00607 
00608   //Create the offset shape
00609   GetOperations()->OffsetShape(aBasicObject, theOffset);
00610 
00611   return aGEOMObject._retn();
00612 }
00613 
00614 //=============================================================================
00618 //=============================================================================
00619 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy
00620                                              (GEOM::GEOM_Object_ptr theObject,
00621                                               CORBA::Double theOffset)
00622 {
00623   GEOM::GEOM_Object_var aGEOMObject;
00624 
00625   //Set a not done flag
00626   GetOperations()->SetNotDone();
00627 
00628   //Get the basic object
00629   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00630   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00631 
00632   //Create the offset shape
00633   Handle(GEOM_Object) anObject = GetOperations()->OffsetShapeCopy(aBasicObject, theOffset);
00634   if (!GetOperations()->IsDone() || anObject.IsNull())
00635     return aGEOMObject._retn();
00636 
00637   return GetObject(anObject);
00638 }
00639 
00640 //=============================================================================
00644 //=============================================================================
00645 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ProjectShapeCopy
00646                                              (GEOM::GEOM_Object_ptr theSource,
00647                                               GEOM::GEOM_Object_ptr theTarget)
00648 {
00649   GEOM::GEOM_Object_var aGEOMObject;
00650 
00651   //Set a not done flag
00652   GetOperations()->SetNotDone();
00653 
00654   //Get the input objects
00655   Handle(GEOM_Object) aSource = GetObjectImpl(theSource);
00656   Handle(GEOM_Object) aTarget = GetObjectImpl(theTarget);
00657   if (aSource.IsNull() || aTarget.IsNull()) return aGEOMObject._retn();
00658 
00659   //Create the projection
00660   Handle(GEOM_Object) anObject = GetOperations()->ProjectShapeCopy(aSource, aTarget);
00661   if (!GetOperations()->IsDone() || anObject.IsNull())
00662     return aGEOMObject._retn();
00663 
00664   return GetObject(anObject);
00665 }
00666 
00667 //=============================================================================
00671 //=============================================================================
00672 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape
00673                                              (GEOM::GEOM_Object_ptr theObject,
00674                                               GEOM::GEOM_Object_ptr thePoint,
00675                                               CORBA::Double         theFactor)
00676 {
00677   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00678 
00679   //Set a not done flag
00680   GetOperations()->SetNotDone();
00681 
00682   if (theObject->_is_nil()) return aGEOMObject._retn();
00683 
00684   //check if the object is a sub-shape
00685   if (!theObject->IsMainShape()) {
00686     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00687     return aGEOMObject._retn();
00688   }
00689 
00690   //Get the object itself
00691   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
00692   if (anObject.IsNull()) return aGEOMObject._retn();
00693 
00694   //Get the point
00695   Handle(GEOM_Object) aPoint;
00696   if (!thePoint->_is_nil()) {
00697     aPoint = GetObjectImpl(thePoint);
00698     if (aPoint.IsNull()) return aGEOMObject._retn();
00699   }
00700 
00701   //Perform the scale
00702   GetOperations()->ScaleShape(anObject, aPoint, theFactor);
00703 
00704   return  aGEOMObject._retn();
00705 }
00706 
00707 //=============================================================================
00711 //=============================================================================
00712 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy
00713                                              (GEOM::GEOM_Object_ptr theObject,
00714                                               GEOM::GEOM_Object_ptr thePoint,
00715                                               CORBA::Double         theFactor)
00716 {
00717   GEOM::GEOM_Object_var aGEOMObject;
00718 
00719   //Set a not done flag
00720   GetOperations()->SetNotDone();
00721 
00722   //Get the basic object
00723   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00724   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00725 
00726   //Get the point
00727   Handle(GEOM_Object) aPoint;
00728   if (!thePoint->_is_nil()) {
00729     aPoint = GetObjectImpl(thePoint);
00730     if (aPoint.IsNull()) return aGEOMObject._retn();
00731   }
00732 
00733   //Perform the scale
00734   Handle(GEOM_Object) anObject =
00735     GetOperations()->ScaleShapeCopy(aBasicObject, aPoint, theFactor);
00736   if (!GetOperations()->IsDone() || anObject.IsNull())
00737     return aGEOMObject._retn();
00738 
00739   return GetObject(anObject);
00740 }
00741 
00742 //=============================================================================
00746 //=============================================================================
00747 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxes
00748                                              (GEOM::GEOM_Object_ptr theObject,
00749                                               GEOM::GEOM_Object_ptr thePoint,
00750                                               CORBA::Double         theFactorX,
00751                                               CORBA::Double         theFactorY,
00752                                               CORBA::Double         theFactorZ)
00753 {
00754   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00755 
00756   //Set a not done flag
00757   GetOperations()->SetNotDone();
00758 
00759   if (theObject->_is_nil()) return aGEOMObject._retn();
00760 
00761   //check if the object is a sub-shape
00762   if (!theObject->IsMainShape()) {
00763     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00764     return aGEOMObject._retn();
00765   }
00766 
00767   //Get the object itself
00768   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
00769   if (anObject.IsNull()) return aGEOMObject._retn();
00770 
00771   //Get the point
00772   Handle(GEOM_Object) aPoint;
00773   if (!thePoint->_is_nil()) {
00774     aPoint = GetObjectImpl(thePoint);
00775     if (aPoint.IsNull()) return aGEOMObject._retn();
00776   }
00777 
00778   //Perform the scale
00779   GetOperations()->ScaleShapeAlongAxes
00780     (anObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/false);
00781 
00782   return  aGEOMObject._retn();
00783 }
00784 
00785 //=============================================================================
00789 //=============================================================================
00790 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxesCopy
00791                                              (GEOM::GEOM_Object_ptr theObject,
00792                                               GEOM::GEOM_Object_ptr thePoint,
00793                                               CORBA::Double         theFactorX,
00794                                               CORBA::Double         theFactorY,
00795                                               CORBA::Double         theFactorZ)
00796 {
00797   GEOM::GEOM_Object_var aGEOMObject;
00798 
00799   //Set a not done flag
00800   GetOperations()->SetNotDone();
00801 
00802   //Get the basic object
00803   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00804   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00805 
00806   //Get the point
00807   Handle(GEOM_Object) aPoint;
00808   if (!thePoint->_is_nil()) {
00809     aPoint = GetObjectImpl(thePoint);
00810     if (aPoint.IsNull()) return aGEOMObject._retn();
00811   }
00812 
00813   //Perform the scale
00814   Handle(GEOM_Object) anObject = GetOperations()->ScaleShapeAlongAxes
00815     (aBasicObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/true);
00816   if (!GetOperations()->IsDone() || anObject.IsNull())
00817     return aGEOMObject._retn();
00818 
00819   return GetObject(anObject);
00820 }
00821 
00822 //=============================================================================
00826 //=============================================================================
00827 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape
00828                                              (GEOM::GEOM_Object_ptr theObject,
00829                                               GEOM::GEOM_Object_ptr theStartLCS,
00830                                               GEOM::GEOM_Object_ptr theEndLCS)
00831 {
00832   GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
00833 
00834   //Set a not done flag
00835   GetOperations()->SetNotDone();
00836 
00837   if (CORBA::is_nil(theObject) || CORBA::is_nil(theEndLCS))
00838     return aGEOMObject._retn();
00839 
00840   //check if the object is a sub-shape
00841   if (!theObject->IsMainShape()) {
00842     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
00843     return aGEOMObject._retn();
00844   }
00845 
00846   //Get the basic object
00847   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
00848   if (anObject.IsNull()) return aGEOMObject._retn();
00849 
00850   //Get the Start LCS (may be NULL for positioning from global LCS)
00851   Handle(GEOM_Object) aStartLCS;
00852   if (!CORBA::is_nil(theStartLCS)) {
00853     aStartLCS = GetObjectImpl(theStartLCS);
00854     if (aStartLCS.IsNull()) return aGEOMObject._retn();
00855   }
00856 
00857   //Get the End LCS
00858   Handle(GEOM_Object) aEndLCS = GetObjectImpl(theEndLCS);
00859   if (aEndLCS.IsNull()) return aGEOMObject._retn();
00860 
00861   //Perform the Position
00862   GetOperations()->PositionShape(anObject, aStartLCS, aEndLCS);
00863 
00864   return  aGEOMObject._retn();
00865 }
00866 
00867 //=============================================================================
00871 //=============================================================================
00872 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShapeCopy
00873                                              (GEOM::GEOM_Object_ptr theObject,
00874                                               GEOM::GEOM_Object_ptr theStartLCS,
00875                                               GEOM::GEOM_Object_ptr theEndLCS)
00876 {
00877   GEOM::GEOM_Object_var aGEOMObject;
00878 
00879   //Set a not done flag
00880   GetOperations()->SetNotDone();
00881 
00882   //Get the basic object
00883   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00884   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00885 
00886   //Get the Start LCS (may be NULL for positioning from global LCS)
00887   Handle(GEOM_Object) aStartLCS;
00888   if (!CORBA::is_nil(theStartLCS)) {
00889     aStartLCS = GetObjectImpl(theStartLCS);
00890     if (aStartLCS.IsNull()) return aGEOMObject._retn();
00891   }
00892 
00893   //Get the End LCS
00894   Handle(GEOM_Object) aEndLCS = GetObjectImpl(theEndLCS);
00895   if (aEndLCS.IsNull()) return aGEOMObject._retn();
00896 
00897   //Perform the position
00898   Handle(GEOM_Object) anObject =
00899     GetOperations()->PositionShapeCopy(aBasicObject, aStartLCS, aEndLCS);
00900   if (!GetOperations()->IsDone() || anObject.IsNull())
00901     return aGEOMObject._retn();
00902 
00903   return GetObject(anObject);
00904 }
00905 
00906 //=============================================================================
00910 //=============================================================================
00911 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath
00912                                              (GEOM::GEOM_Object_ptr theObject,
00913                                               GEOM::GEOM_Object_ptr thePath,
00914                                               CORBA::Double         theDistance,
00915                                               CORBA::Boolean        theCopy,
00916                                               CORBA::Boolean        theReverse)
00917 {
00918   GEOM::GEOM_Object_var aGEOMObject;
00919 
00920   //Set a not done flag
00921   GetOperations()->SetNotDone();
00922 
00923   //Get the basic object
00924   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00925   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00926 
00927   //Get the path object
00928   Handle(GEOM_Object) aPathObject = GetObjectImpl(thePath);
00929   if (aPathObject.IsNull()) return aGEOMObject._retn();
00930 
00931   //Perform the position
00932   Handle(GEOM_Object) anObject =
00933     GetOperations()->PositionAlongPath(aBasicObject, aPathObject, theDistance, theCopy, theReverse);
00934   if (!GetOperations()->IsDone() || anObject.IsNull())
00935     return aGEOMObject._retn();
00936 
00937   return GetObject(anObject);
00938 }
00939 
00940 //=============================================================================
00944 //=============================================================================
00945 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate1D
00946                            (GEOM::GEOM_Object_ptr theObject,
00947                             GEOM::GEOM_Object_ptr theVector,
00948                             CORBA::Double theStep, CORBA::Long theNbTimes)
00949 {
00950   //Set a not done flag
00951   GetOperations()->SetNotDone();
00952 
00953   GEOM::GEOM_Object_var aGEOMObject;
00954 
00955   //Get the object itself
00956   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00957   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00958 
00959   //Get the vector of translation
00960   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
00961   if (aVector.IsNull()) return aGEOMObject._retn();
00962 
00963   //Perform the translation
00964   Handle(GEOM_Object) anObject =
00965     GetOperations()->Translate1D(aBasicObject, aVector, theStep, theNbTimes);
00966   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
00967 
00968   return GetObject(anObject);
00969 }
00970 
00971 //=============================================================================
00975 //=============================================================================
00976 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate2D (GEOM::GEOM_Object_ptr theObject,
00977                                                                      GEOM::GEOM_Object_ptr theVector1,
00978                                                                      CORBA::Double theStep1,
00979                                                                      CORBA::Long theNbTimes1,
00980                                                                      GEOM::GEOM_Object_ptr theVector2,
00981                                                                      CORBA::Double theStep2,
00982                                                                      CORBA::Long theNbTimes2)
00983 {
00984   //Set a not done flag
00985   GetOperations()->SetNotDone();
00986 
00987   GEOM::GEOM_Object_var aGEOMObject;
00988 
00989   //Get the object itself
00990   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
00991   if (aBasicObject.IsNull()) return aGEOMObject._retn();
00992 
00993   //Get the vector1 of translation
00994   Handle(GEOM_Object) aVector1 = GetObjectImpl(theVector1);
00995   if (aVector1.IsNull()) return aGEOMObject._retn();
00996 
00997   //Get the vector2 of translation
00998   Handle(GEOM_Object) aVector2 = GetObjectImpl(theVector2);
00999   if (aVector2.IsNull()) return aGEOMObject._retn();
01000 
01001   //Perform the translation
01002   Handle(GEOM_Object) anObject = GetOperations()->Translate2D
01003     (aBasicObject, aVector1, theStep1, theNbTimes1, aVector2, theStep2, theNbTimes2);
01004   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
01005 
01006   return GetObject(anObject);
01007 }
01008 
01009 //=============================================================================
01013 //=============================================================================
01014 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObject,
01015                                                                   GEOM::GEOM_Object_ptr theVector,
01016                                                                   CORBA::Long theNbTimes)
01017 {
01018   //Set a not done flag
01019   GetOperations()->SetNotDone();
01020 
01021   GEOM::GEOM_Object_var aGEOMObject;
01022 
01023   //Get the object itself
01024   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
01025   if (aBasicObject.IsNull()) return aGEOMObject._retn();
01026 
01027   //Get the a directon of rotation
01028   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
01029   if (aVector.IsNull()) return aGEOMObject._retn();
01030 
01031   //Perform the rotation
01032   Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theNbTimes);
01033   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
01034 
01035   return GetObject(anObject);
01036 }
01037 
01038 //=============================================================================
01042 //=============================================================================
01043 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObject,
01044                                                                   GEOM::GEOM_Object_ptr theVector,
01045                                                                   CORBA::Double theAngle,
01046                                                                   CORBA::Long theNbTimes1,
01047                                                                   CORBA::Double theStep,
01048                                                                   CORBA::Long theNbTimes2)
01049 {
01050   //Set a not done flag
01051   GetOperations()->SetNotDone();
01052 
01053   GEOM::GEOM_Object_var aGEOMObject;
01054 
01055   //Get the object itself
01056   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
01057   if (aBasicObject.IsNull()) return aGEOMObject._retn();
01058 
01059   //Get the a directon of rotation
01060   Handle(GEOM_Object) aVector = GetObjectImpl(theVector);
01061   if (aVector.IsNull()) return aGEOMObject._retn();
01062 
01063   //Perform the rotation
01064   Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
01065     (aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2);
01066   if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
01067 
01068   return GetObject(anObject);
01069 }
01070 
01071 //=============================================================================
01075 //=============================================================================
01076 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePoints
01077                                              (GEOM::GEOM_Object_ptr theObject,
01078                                               GEOM::GEOM_Object_ptr theCentPoint,
01079                                               GEOM::GEOM_Object_ptr thePoint1,
01080                                               GEOM::GEOM_Object_ptr thePoint2)
01081 {
01082   //Set a not done flag
01083   GetOperations()->SetNotDone();
01084   GEOM::GEOM_Object_var aGEOMObject;
01085 
01086   if (CORBA::is_nil(theObject))
01087     return aGEOMObject._retn();
01088 
01089   //check if the object is a sub-shape
01090   if (!theObject->IsMainShape()) {
01091     GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
01092     return aGEOMObject._retn();
01093   }
01094 
01095   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
01096 
01097   //Get the object itself
01098   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
01099   if (anObject.IsNull()) return aGEOMObject._retn();
01100 
01101   //Get the central point of rotation
01102   Handle(GEOM_Object) aCentPoint = GetObjectImpl(theCentPoint);
01103   if (aCentPoint.IsNull()) return aGEOMObject._retn();
01104 
01105   //Get the first point
01106   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
01107   if (aPoint1.IsNull()) return aGEOMObject._retn();
01108 
01109   //Get the second point
01110   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
01111   if (aPoint2.IsNull()) return aGEOMObject._retn();
01112 
01113   //Perform the translation
01114   GetOperations()->RotateThreePoints(anObject, aCentPoint, aPoint1, aPoint2);
01115 
01116   return aGEOMObject._retn();
01117 }
01118 
01119 //=============================================================================
01123 //=============================================================================
01124 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePointsCopy
01125                                              (GEOM::GEOM_Object_ptr theObject,
01126                                               GEOM::GEOM_Object_ptr theCentPoint,
01127                                               GEOM::GEOM_Object_ptr thePoint1,
01128                                               GEOM::GEOM_Object_ptr thePoint2)
01129 {
01130   GEOM::GEOM_Object_var aGEOMObject;
01131 
01132   //Set a not done flag
01133   GetOperations()->SetNotDone();
01134 
01135   //Get the object itself
01136   Handle(GEOM_Object) aBasicObject = GetObjectImpl(theObject);
01137   if (aBasicObject.IsNull()) return aGEOMObject._retn();
01138 
01139   //Get the central point of rotation
01140   Handle(GEOM_Object) aCentPoint = GetObjectImpl(theCentPoint);
01141   if (aCentPoint.IsNull()) return aGEOMObject._retn();
01142 
01143   //Get the first point
01144   Handle(GEOM_Object) aPoint1 = GetObjectImpl(thePoint1);
01145   if (aPoint1.IsNull()) return aGEOMObject._retn();
01146 
01147   //Get the second point
01148   Handle(GEOM_Object) aPoint2 = GetObjectImpl(thePoint2);
01149   if (aPoint2.IsNull()) return aGEOMObject._retn();
01150 
01151   //Perform the rotation
01152   Handle(GEOM_Object) anObject =
01153     GetOperations()->RotateThreePointsCopy(aBasicObject, aCentPoint, aPoint1, aPoint2);
01154   if (!GetOperations()->IsDone() || anObject.IsNull())
01155     return aGEOMObject._retn();
01156 
01157   return GetObject(anObject);
01158 }
01159 
01160 //=============================================================================
01164 //=============================================================================
01165 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TransformLikeOtherCopy
01166                                              (GEOM::GEOM_Object_ptr theObject,
01167                                               GEOM::GEOM_Object_ptr theSample)
01168 {
01169   GEOM::GEOM_Object_var aGEOMObject;
01170 
01171   //Set a not done flag
01172   GetOperations()->SetNotDone();
01173 
01174   //Get the object itself
01175   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
01176   if (anObject.IsNull()) return aGEOMObject._retn();
01177 
01178   //Get the sample object
01179   Handle(GEOM_Object) aSample = GetObjectImpl(theSample);
01180   if (aSample.IsNull()) return aGEOMObject._retn();
01181 
01182   //Perform the transformation
01183   Handle(GEOM_Object) aResObject =
01184     GetOperations()->TransformLikeOtherCopy(anObject, aSample);
01185   if (!GetOperations()->IsDone() || aResObject.IsNull())
01186     return aGEOMObject._retn();
01187 
01188   return GetObject(aResObject);
01189 }
01190 
01191 //=============================================================================
01195 //=============================================================================
01196 GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RecomputeObject
01197                                              (GEOM::GEOM_Object_ptr theObject)
01198 {
01199   //Set a not done flag
01200   GetOperations()->SetNotDone();
01201   GEOM::GEOM_Object_var aGEOMObject;
01202 
01203   if (CORBA::is_nil(theObject)) return aGEOMObject._retn();
01204 
01205   aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
01206 
01207   //Get the object itself
01208   Handle(GEOM_Object) anObject = GetObjectImpl(theObject);
01209   if (anObject.IsNull()) return aGEOMObject._retn();
01210 
01211   //Perform the recomputation
01212   Handle(GEOM_Function) aLastFunction = anObject->GetLastFunction();
01213   if (aLastFunction.IsNull()) return aGEOMObject._retn();
01214   GetOperations()->GetSolver()->ComputeFunction(aLastFunction);
01215 
01216   return aGEOMObject._retn();
01217 }