2009-02-13 17:16:39 +05:00
|
|
|
// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
|
2008-03-07 12:45:34 +05:00
|
|
|
//
|
2009-02-13 17:16:39 +05:00
|
|
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
|
|
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
2008-03-07 12:45:34 +05:00
|
|
|
//
|
2009-02-13 17:16:39 +05:00
|
|
|
// This library is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation; either
|
|
|
|
// version 2.1 of the License.
|
2005-12-05 21:23:52 +05:00
|
|
|
//
|
2009-02-13 17:16:39 +05:00
|
|
|
// This library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// Lesser General Public License for more details.
|
2005-12-05 21:23:52 +05:00
|
|
|
//
|
2009-02-13 17:16:39 +05:00
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
//
|
|
|
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
2005-12-05 21:23:52 +05:00
|
|
|
//
|
2005-08-11 10:14:22 +06:00
|
|
|
#include <Standard_Stream.hxx>
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
#include "GEOM_ITransformOperations_i.hh"
|
|
|
|
|
|
|
|
#include "utilities.h"
|
|
|
|
#include "OpUtil.hxx"
|
|
|
|
#include "Utils_ExceptHandlers.hxx"
|
|
|
|
|
|
|
|
#include <TDF_Label.hxx>
|
|
|
|
#include <TDF_Tool.hxx>
|
|
|
|
#include <TCollection_AsciiString.hxx>
|
|
|
|
#include "GEOM_Engine.hxx"
|
|
|
|
#include "GEOM_Object.hxx"
|
|
|
|
|
|
|
|
#define SUBSHAPE_ERROR "Sub shape cannot be transformed"
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* constructor:
|
|
|
|
*/
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
GEOM_ITransformOperations_i::GEOM_ITransformOperations_i (PortableServer::POA_ptr thePOA,
|
|
|
|
GEOM::GEOM_Gen_ptr theEngine,
|
|
|
|
::GEOMImpl_ITransformOperations* theImpl)
|
|
|
|
:GEOM_IOperations_i(thePOA, theEngine, theImpl)
|
|
|
|
{
|
|
|
|
MESSAGE("GEOM_ITransformOperations_i::GEOM_ITransformOperations_i");
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* destructor
|
|
|
|
*/
|
|
|
|
//=============================================================================
|
|
|
|
|
|
|
|
GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i()
|
|
|
|
{
|
|
|
|
MESSAGE("GEOM_ITransformOperations_i::~GEOM_ITransformOperations_i");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* TranslateTwoPoints
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPoints
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint1,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint2)
|
|
|
|
{
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
if (thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
|
|
|
if(!theObject->IsMainShape()) {
|
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) anObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the first point of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aP1Entry = thePoint1->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aPoint1 =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), aP1Entry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aPoint1.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the second point of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aP2Entry = thePoint2->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aPoint2 =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), aP2Entry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aPoint2.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the translation
|
|
|
|
GetOperations()->TranslateTwoPoints(anObject, aPoint1, aPoint2);
|
|
|
|
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* TranslateTwoPointsCopy
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateTwoPointsCopy
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint1,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint2)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
|
|
|
if (thePoint1 == NULL || thePoint2 == NULL || theObject == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the first point of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aP1Entry = thePoint1->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aPoint1 =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), aP1Entry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aPoint1.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the second point of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aP2Entry = thePoint2->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aPoint2 =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), aP2Entry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aPoint2.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Create the translated shape
|
|
|
|
Handle(GEOM_Object) anObject =
|
|
|
|
GetOperations()->TranslateTwoPointsCopy(aBasicObject, aPoint1, aPoint2);
|
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
return GetObject(anObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* TranslateDXDYDZ
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2009-02-13 17:16:39 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZ
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_var aGEOMObject ;
|
|
|
|
|
|
|
|
if (theObject == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
|
|
|
if(!theObject->IsMainShape()) {
|
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) anObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the translation
|
|
|
|
GetOperations()->TranslateDXDYDZ(anObject, theDX, theDY, theDZ);
|
|
|
|
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* TranslateDXDYDZCopy
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateDXDYDZCopy
|
2009-02-13 17:16:39 +05:00
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
CORBA::Double theDX, CORBA::Double theDY, CORBA::Double theDZ)
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
|
|
|
if (theObject == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Create the translated shape
|
|
|
|
Handle(GEOM_Object) anObject =
|
|
|
|
GetOperations()->TranslateDXDYDZCopy(aBasicObject, theDX, theDY, theDZ);
|
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
return GetObject(anObject);
|
|
|
|
}
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* TranslateVector
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVector
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theVector)
|
|
|
|
{
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
|
|
|
if(!theObject->IsMainShape()) {
|
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
2009-02-13 17:16:39 +05:00
|
|
|
aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) anObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the vector of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aVEntry = theVector->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aVector =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aVector.IsNull()) return aGEOMObject._retn();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Perform the translation
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->TranslateVector(anObject, aVector);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return aGEOMObject._retn();
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* TranslateVectorCopy
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorCopy
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theVector)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the vector of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aVEntry = theVector->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aVector =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aVector.IsNull()) return aGEOMObject._retn();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Perform the translation
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->TranslateVectorCopy(aBasicObject, aVector);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return GetObject(anObject);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
|
|
|
|
2009-02-13 17:16:39 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* TranslateVectorDistance
|
|
|
|
*/
|
|
|
|
//=============================================================================
|
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::TranslateVectorDistance
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theVector,
|
|
|
|
CORBA::Double theDistance,
|
|
|
|
CORBA::Boolean theCopy)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
GetOperations()->SetNotDone(); //Set a not done flag
|
|
|
|
|
|
|
|
if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
|
|
|
if (!theCopy && !theObject->IsMainShape()) {
|
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!theCopy)
|
|
|
|
aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Get the object itself
|
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
|
|
|
Handle(GEOM_Object) aBasicObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the vector of translation
|
|
|
|
CORBA::String_var aVecEntry = theVector->GetEntry();
|
|
|
|
Handle(GEOM_Object) aVector =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVecEntry);
|
|
|
|
if (aVector.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the translation
|
|
|
|
if (theCopy) {
|
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->
|
|
|
|
TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy);
|
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
return GetObject(anObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
GetOperations()->TranslateVectorDistance(aBasicObject, aVector, theDistance, theCopy);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* Rotate
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::Rotate (GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theAxis,
|
|
|
|
CORBA::Double theAngle)
|
|
|
|
{
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
|
|
|
if(!theObject->IsMainShape()) {
|
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
|
|
|
Handle(GEOM_Object) anObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the axis of revolution
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anAEntry = theAxis->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) anAxis =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), anAEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anAxis.IsNull()) return aGEOMObject._retn();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Perform the rotation
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->Rotate(anObject, anAxis, theAngle);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return aGEOMObject._retn();
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* RotateCopy
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateCopy (GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theAxis,
|
|
|
|
CORBA::Double theAngle)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the axis of rotation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anAEntry = theAxis->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) anAxis =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), anAEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anAxis.IsNull()) return aGEOMObject._retn();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Perform the rotation
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->RotateCopy(aBasicObject, anAxis, theAngle);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return GetObject(anObject);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* MirrorPlane
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlane
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePlane)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
if (theObject == NULL || thePlane == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
2009-02-13 17:16:39 +05:00
|
|
|
if (!theObject->IsMainShape()) {
|
2004-12-01 15:39:14 +05:00
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) anObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the plane
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aPlnEntry = thePlane->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aPlane =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePlane->GetStudyID(), aPlnEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aPlane.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the mirror
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->MirrorPlane(anObject, aPlane);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return aGEOMObject._retn();
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* MirrorPlaneCopy
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPlaneCopy
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePlane)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
if (theObject == NULL || thePlane == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the vector of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aPlnEntry = thePlane->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aPlane =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePlane->GetStudyID(), aPlnEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aPlane.IsNull()) return aGEOMObject._retn();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Perform the mirror
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->MirrorPlaneCopy(aBasicObject, aPlane);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return GetObject(anObject);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* MirrorAxis
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxis
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theAxis)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
|
|
|
if(!theObject->IsMainShape()) {
|
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) anObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the axis
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anAEntry = theAxis->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aAxis =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), anAEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aAxis.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the mirror
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->MirrorAxis(anObject, aAxis);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return aGEOMObject._retn();
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* MirrorAxisCopy
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorAxisCopy
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theAxis)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
if (theObject == NULL || theAxis == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the vector of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anAEntry = theAxis->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aAxis =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theAxis->GetStudyID(), anAEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aAxis.IsNull()) return aGEOMObject._retn();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Perform the mirror
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->MirrorAxisCopy(aBasicObject, aAxis);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return GetObject(anObject);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* MirrorPoint
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPoint
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
if (theObject == NULL || thePoint == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
2009-02-13 17:16:39 +05:00
|
|
|
if (!theObject->IsMainShape()) {
|
2004-12-01 15:39:14 +05:00
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) anObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the point
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aPoint =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aPoint.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the mirror
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->MirrorPoint(anObject, aPoint);
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return aGEOMObject._retn();
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* MirrorPointCopy
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPointCopy
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
if (theObject == NULL || thePoint == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the vector of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aPoint =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aPoint.IsNull()) return aGEOMObject._retn();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Perform the mirror
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->MirrorPointCopy(aBasicObject, aPoint);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return GetObject(anObject);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* OffsetShape
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
CORBA::Double theOffset)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
|
|
|
if (theObject == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
2009-02-13 17:16:39 +05:00
|
|
|
if (!theObject->IsMainShape()) {
|
2004-12-01 15:39:14 +05:00
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Get the basic object
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Create the offset shape
|
|
|
|
GetOperations()->OffsetShape(aBasicObject, theOffset);
|
|
|
|
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* OffsetShapeCopy
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
CORBA::Double theOffset)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
|
|
|
if (theObject == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the basic object
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Create the offset shape
|
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->OffsetShapeCopy(aBasicObject, theOffset);
|
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
return GetObject(anObject);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* ScaleShape
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShape
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint,
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::Double theFactor)
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
2009-02-13 17:16:39 +05:00
|
|
|
if (theObject->_is_nil()) return aGEOMObject._retn();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//check if the object is a subshape
|
2009-02-13 17:16:39 +05:00
|
|
|
if (!theObject->IsMainShape()) {
|
2004-12-01 15:39:14 +05:00
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) anObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the point
|
2009-02-13 17:16:39 +05:00
|
|
|
Handle(GEOM_Object) aPoint;
|
|
|
|
if (!thePoint->_is_nil()) {
|
|
|
|
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
|
|
|
aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
|
|
|
if (aPoint.IsNull()) return aGEOMObject._retn();
|
|
|
|
}
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Perform the scale
|
|
|
|
GetOperations()->ScaleShape(anObject, aPoint, theFactor);
|
|
|
|
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* ScaleShapeCopy
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeCopy
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint,
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::Double theFactor)
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
2009-02-13 17:16:39 +05:00
|
|
|
if (theObject->_is_nil()) return aGEOMObject._retn();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Get the basic object
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the point
|
2009-02-13 17:16:39 +05:00
|
|
|
Handle(GEOM_Object) aPoint;
|
|
|
|
if (!thePoint->_is_nil()) {
|
|
|
|
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
|
|
|
aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
|
|
|
if (aPoint.IsNull()) return aGEOMObject._retn();
|
|
|
|
}
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Perform the scale
|
|
|
|
Handle(GEOM_Object) anObject =
|
|
|
|
GetOperations()->ScaleShapeCopy(aBasicObject, aPoint, theFactor);
|
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
return GetObject(anObject);
|
|
|
|
}
|
|
|
|
|
2009-02-13 17:16:39 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* ScaleShapeAlongAxes
|
|
|
|
*/
|
|
|
|
//=============================================================================
|
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxes
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint,
|
|
|
|
CORBA::Double theFactorX,
|
|
|
|
CORBA::Double theFactorY,
|
|
|
|
CORBA::Double theFactorZ)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
|
|
|
if (theObject->_is_nil()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
|
|
|
if (!theObject->IsMainShape()) {
|
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Get the object itself
|
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
|
|
|
Handle(GEOM_Object) anObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the point
|
|
|
|
Handle(GEOM_Object) aPoint;
|
|
|
|
if (!thePoint->_is_nil()) {
|
|
|
|
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
|
|
|
aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
|
|
|
if (aPoint.IsNull()) return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Perform the scale
|
|
|
|
GetOperations()->ScaleShapeAlongAxes
|
|
|
|
(anObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/false);
|
|
|
|
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* ScaleShapeAlongAxesCopy
|
|
|
|
*/
|
|
|
|
//=============================================================================
|
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::ScaleShapeAlongAxesCopy
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint,
|
|
|
|
CORBA::Double theFactorX,
|
|
|
|
CORBA::Double theFactorY,
|
|
|
|
CORBA::Double theFactorZ)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
|
|
|
if (theObject->_is_nil()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the basic object
|
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
|
|
|
Handle(GEOM_Object) aBasicObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the point
|
|
|
|
Handle(GEOM_Object) aPoint;
|
|
|
|
if (!thePoint->_is_nil()) {
|
|
|
|
CORBA::String_var aPntEntry = thePoint->GetEntry();
|
|
|
|
aPoint = GetOperations()->GetEngine()->GetObject(thePoint->GetStudyID(), aPntEntry);
|
|
|
|
if (aPoint.IsNull()) return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Perform the scale
|
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->ScaleShapeAlongAxes
|
|
|
|
(aBasicObject, aPoint, theFactorX, theFactorY, theFactorZ, /*doCopy*/true);
|
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
return GetObject(anObject);
|
|
|
|
}
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* PositionShape
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShape
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theStartLCS,
|
|
|
|
GEOM::GEOM_Object_ptr theEndLCS)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
if (theObject == NULL || theEndLCS == NULL)
|
2004-12-01 15:39:14 +05:00
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
2009-02-13 17:16:39 +05:00
|
|
|
if (!theObject->IsMainShape()) {
|
2004-12-01 15:39:14 +05:00
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//Get the basic object
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) anObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
//Get the Start LCS (may be NULL for positioning from global LCS)
|
|
|
|
Handle(GEOM_Object) aStartLCS = NULL;
|
|
|
|
if (theStartLCS != NULL && !CORBA::is_nil(theStartLCS)) {
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aStartLCSEntry = theStartLCS->GetEntry();
|
|
|
|
aStartLCS = GetOperations()->GetEngine()->GetObject(theStartLCS->GetStudyID(), aStartLCSEntry);
|
2008-03-07 12:45:34 +05:00
|
|
|
if (aStartLCS.IsNull()) return aGEOMObject._retn();
|
|
|
|
}
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Get the End LCS
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEndLCSEntry = theEndLCS->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aEndLCS =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theEndLCS->GetStudyID(), anEndLCSEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aEndLCS.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the Position
|
|
|
|
GetOperations()->PositionShape(anObject, aStartLCS, aEndLCS);
|
|
|
|
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* PositionShapeCopy
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShapeCopy
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theStartLCS,
|
|
|
|
GEOM::GEOM_Object_ptr theEndLCS)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
if (theObject == NULL || theEndLCS == NULL)
|
2004-12-01 15:39:14 +05:00
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the basic object
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
//Get the Start LCS (may be NULL for positioning from global LCS)
|
|
|
|
Handle(GEOM_Object) aStartLCS = NULL;
|
|
|
|
if (theStartLCS != NULL && !CORBA::is_nil(theStartLCS)) {
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aStartLCSEntry = theStartLCS->GetEntry();
|
|
|
|
aStartLCS = GetOperations()->GetEngine()->GetObject(theStartLCS->GetStudyID(), aStartLCSEntry);
|
2008-03-07 12:45:34 +05:00
|
|
|
if (aStartLCS.IsNull()) return aGEOMObject._retn();
|
|
|
|
}
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Get the End LCS
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEndLCSEntry = theEndLCS->GetEntry();
|
2004-12-01 15:39:14 +05:00
|
|
|
Handle(GEOM_Object) aEndLCS =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theEndLCS->GetStudyID(), anEndLCSEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aEndLCS.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the position
|
|
|
|
Handle(GEOM_Object) anObject =
|
|
|
|
GetOperations()->PositionShapeCopy(aBasicObject, aStartLCS, aEndLCS);
|
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
return GetObject(anObject);
|
|
|
|
}
|
|
|
|
|
2009-02-13 17:16:39 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* PositionAlongPath
|
|
|
|
*/
|
|
|
|
//=============================================================================
|
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr thePath,
|
|
|
|
CORBA::Double theDistance,
|
|
|
|
CORBA::Boolean theCopy,
|
|
|
|
CORBA::Boolean theReverse)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
|
|
|
if (theObject == NULL || thePath == NULL)
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the basic object
|
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
|
|
|
Handle(GEOM_Object) aBasicObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the path object
|
|
|
|
CORBA::String_var aPathEntry = thePath->GetEntry();
|
|
|
|
Handle(GEOM_Object) aPathObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), aPathEntry);
|
|
|
|
if (aPathObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the position
|
|
|
|
Handle(GEOM_Object) anObject =
|
|
|
|
GetOperations()->PositionAlongPath(aBasicObject, aPathObject, theDistance, theCopy, theReverse);
|
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
return GetObject(anObject);
|
|
|
|
}
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* MultiTranslate1D
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2005-03-01 13:44:43 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate1D
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theVector,
|
|
|
|
CORBA::Double theStep, CORBA::Long theNbTimes)
|
2004-12-01 15:39:14 +05:00
|
|
|
{
|
2005-03-01 13:44:43 +05:00
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2005-03-01 13:44:43 +05:00
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
|
|
|
|
|
2005-03-01 13:44:43 +05:00
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
|
|
|
Handle(GEOM_Object) aBasicObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2005-03-01 13:44:43 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the vector of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aVecEntry = theVector->GetEntry();
|
|
|
|
Handle(GEOM_Object) aVector =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVecEntry);
|
2005-03-01 13:44:43 +05:00
|
|
|
if (aVector.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the translation
|
|
|
|
Handle(GEOM_Object) anObject =
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->Translate1D(aBasicObject, aVector, theStep, theNbTimes);
|
2005-03-01 13:44:43 +05:00
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return GetObject(anObject);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* MultiTranslate2D
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiTranslate2D (GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theVector1,
|
|
|
|
CORBA::Double theStep1,
|
2004-12-01 15:39:14 +05:00
|
|
|
CORBA::Long theNbTimes1,
|
2008-03-07 12:45:34 +05:00
|
|
|
GEOM::GEOM_Object_ptr theVector2,
|
|
|
|
CORBA::Double theStep2,
|
2004-12-01 15:39:14 +05:00
|
|
|
CORBA::Long theNbTimes2)
|
|
|
|
{
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2005-03-01 13:44:43 +05:00
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
if (theObject == NULL || theVector1 == NULL || theVector2 == NULL) return aGEOMObject._retn();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
|
|
|
Handle(GEOM_Object) aBasicObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the vector1 of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aVec1Entry = theVector1->GetEntry();
|
|
|
|
Handle(GEOM_Object) aVector1 =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theVector1->GetStudyID(), aVec1Entry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aVector1.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
2005-03-01 13:44:43 +05:00
|
|
|
//Get the vector2 of translation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aVec2Entry = theVector2->GetEntry();
|
|
|
|
Handle(GEOM_Object) aVector2 =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theVector2->GetStudyID(), aVec2Entry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aVector2.IsNull()) return aGEOMObject._retn();
|
2005-03-01 13:44:43 +05:00
|
|
|
|
2004-12-01 15:39:14 +05:00
|
|
|
//Perform the translation
|
2005-03-01 13:44:43 +05:00
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->Translate2D
|
2008-03-07 12:45:34 +05:00
|
|
|
(aBasicObject, aVector1, theStep1, theNbTimes1, aVector2, theStep2, theNbTimes2);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return GetObject(anObject);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* MultiRotate1D
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate1D (GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theVector,
|
|
|
|
CORBA::Long theNbTimes)
|
|
|
|
{
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2005-03-01 13:44:43 +05:00
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2005-03-01 13:44:43 +05:00
|
|
|
if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
|
|
|
Handle(GEOM_Object) aBasicObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the a directon of rotation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aVecEntry = theVector->GetEntry();
|
|
|
|
Handle(GEOM_Object) aVector =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVecEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aVector.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the rotation
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->Rotate1D(aBasicObject, aVector, theNbTimes);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return GetObject(anObject);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* MultiRotate2D
|
|
|
|
*/
|
2008-03-07 12:45:34 +05:00
|
|
|
//=============================================================================
|
2004-12-01 15:39:14 +05:00
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MultiRotate2D (GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theVector,
|
2008-03-07 12:45:34 +05:00
|
|
|
CORBA::Double theAngle,
|
|
|
|
CORBA::Long theNbTimes1,
|
|
|
|
CORBA::Double theStep,
|
2004-12-01 15:39:14 +05:00
|
|
|
CORBA::Long theNbTimes2)
|
|
|
|
{
|
|
|
|
//Set a not done flag
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetNotDone();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2005-03-01 13:44:43 +05:00
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
2004-12-01 15:39:14 +05:00
|
|
|
|
2005-03-01 13:44:43 +05:00
|
|
|
if (theObject == NULL || theVector == NULL) return aGEOMObject._retn();
|
2004-12-01 15:39:14 +05:00
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
|
|
|
Handle(GEOM_Object) aBasicObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the a directon of rotation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aVecEntry = theVector->GetEntry();
|
|
|
|
Handle(GEOM_Object) aVector =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theVector->GetStudyID(), aVecEntry);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (aVector.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the rotation
|
2005-03-01 13:44:43 +05:00
|
|
|
Handle(GEOM_Object) anObject = GetOperations()->Rotate2D
|
2008-03-07 12:45:34 +05:00
|
|
|
(aBasicObject, aVector, theAngle, theNbTimes1, theStep, theNbTimes2);
|
2004-12-01 15:39:14 +05:00
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
2008-03-07 12:45:34 +05:00
|
|
|
return GetObject(anObject);
|
2004-12-01 15:39:14 +05:00
|
|
|
}
|
2008-03-07 12:45:34 +05:00
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* RotateThreePoints
|
|
|
|
*/
|
|
|
|
//=============================================================================
|
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePoints
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theCentPoint,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint1,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint2)
|
|
|
|
{
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
2009-02-13 17:16:39 +05:00
|
|
|
if (theCentPoint == NULL || thePoint1 == NULL || thePoint2 == NULL || theObject == NULL)
|
|
|
|
return aGEOMObject._retn();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
|
|
|
//check if the object is a subshape
|
2009-02-13 17:16:39 +05:00
|
|
|
if (!theObject->IsMainShape()) {
|
2008-03-07 12:45:34 +05:00
|
|
|
GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) anObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2008-03-07 12:45:34 +05:00
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the central point of rotation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aCPEntry = theCentPoint->GetEntry();
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) aCentPoint =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theCentPoint->GetStudyID(), aCPEntry);
|
2008-03-07 12:45:34 +05:00
|
|
|
if (aCentPoint.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the first point
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aP1Entry = thePoint1->GetEntry();
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) aPoint1 =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), aP1Entry);
|
2008-03-07 12:45:34 +05:00
|
|
|
if (aPoint1.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the second point
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aP2Entry = thePoint2->GetEntry();
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) aPoint2 =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), aP2Entry);
|
2008-03-07 12:45:34 +05:00
|
|
|
if (aPoint2.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the translation
|
|
|
|
GetOperations()->RotateThreePoints(anObject, aCentPoint, aPoint1, aPoint2);
|
|
|
|
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|
|
|
|
|
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* RotateThreePointsCopy
|
|
|
|
*/
|
|
|
|
//=============================================================================
|
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RotateThreePointsCopy
|
|
|
|
(GEOM::GEOM_Object_ptr theObject,
|
|
|
|
GEOM::GEOM_Object_ptr theCentPoint,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint1,
|
|
|
|
GEOM::GEOM_Object_ptr thePoint2)
|
|
|
|
{
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
|
2009-02-13 17:16:39 +05:00
|
|
|
if (theCentPoint == NULL || thePoint1 == NULL || thePoint2 == NULL || theObject == NULL)
|
|
|
|
return aGEOMObject._retn();
|
2008-03-07 12:45:34 +05:00
|
|
|
|
|
|
|
//Get the object itself
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) aBasicObject =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
2008-03-07 12:45:34 +05:00
|
|
|
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the central point of rotation
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aCPEntry = theCentPoint->GetEntry();
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) aCentPoint =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(theCentPoint->GetStudyID(), aCPEntry);
|
2008-03-07 12:45:34 +05:00
|
|
|
if (aCentPoint.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the first point
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aP1Entry = thePoint1->GetEntry();
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) aPoint1 =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePoint1->GetStudyID(), aP1Entry);
|
2008-03-07 12:45:34 +05:00
|
|
|
if (aPoint1.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Get the second point
|
2009-02-13 17:16:39 +05:00
|
|
|
CORBA::String_var aP2Entry = thePoint2->GetEntry();
|
2008-03-07 12:45:34 +05:00
|
|
|
Handle(GEOM_Object) aPoint2 =
|
2009-02-13 17:16:39 +05:00
|
|
|
GetOperations()->GetEngine()->GetObject(thePoint2->GetStudyID(), aP2Entry);
|
2008-03-07 12:45:34 +05:00
|
|
|
if (aPoint2.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the rotation
|
|
|
|
Handle(GEOM_Object) anObject =
|
|
|
|
GetOperations()->RotateThreePointsCopy(aBasicObject, aCentPoint, aPoint1, aPoint2);
|
|
|
|
if (!GetOperations()->IsDone() || anObject.IsNull())
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
|
|
|
|
return GetObject(anObject);
|
|
|
|
}
|
|
|
|
|
2009-02-13 17:16:39 +05:00
|
|
|
//=============================================================================
|
|
|
|
/*!
|
|
|
|
* RecomputeObject
|
|
|
|
*/
|
|
|
|
//=============================================================================
|
|
|
|
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::RecomputeObject
|
|
|
|
(GEOM::GEOM_Object_ptr theObject)
|
|
|
|
{
|
|
|
|
//Set a not done flag
|
|
|
|
GetOperations()->SetNotDone();
|
|
|
|
GEOM::GEOM_Object_var aGEOMObject;
|
|
|
|
|
|
|
|
if (theObject == NULL) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//check if the object is a subshape
|
|
|
|
//if (!theObject->IsMainShape()) {
|
|
|
|
// GetOperations()->SetErrorCode(SUBSHAPE_ERROR);
|
|
|
|
// return aGEOMObject._retn();
|
|
|
|
//}
|
|
|
|
|
|
|
|
aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
|
|
|
|
|
|
|
//Get the object itself
|
|
|
|
CORBA::String_var anEntry = theObject->GetEntry();
|
|
|
|
Handle(GEOM_Object) anObject =
|
|
|
|
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
|
|
|
|
if (anObject.IsNull()) return aGEOMObject._retn();
|
|
|
|
|
|
|
|
//Perform the recomputation
|
|
|
|
Handle(GEOM_Function) aLastFunction = anObject->GetLastFunction();
|
|
|
|
if (aLastFunction.IsNull()) return aGEOMObject._retn();
|
|
|
|
GetOperations()->GetSolver()->ComputeFunction(aLastFunction);
|
|
|
|
|
|
|
|
return aGEOMObject._retn();
|
|
|
|
}
|