// 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/
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#ifdef WNT
#pragma warning( disable:4786 )
#include <TDF_Tool.hxx>
+#include <Standard_Failure.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
}
//Compute the translation
- try
- {
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
if (!GetSolver()->ComputeFunction(aFunction))
{
SetErrorCode("Shape Healing algorithm failed");
* ShapeProcess
*/
//=============================================================================
-void GEOMImpl_IHealingOperations::GetShapeProcessParameters (list<string>& theOperations,
- list<string>& theParams,
- list<string>& theValues)
+void GEOMImpl_IHealingOperations::GetShapeProcessParameters (std::list<std::string>& theOperations,
+ std::list<std::string>& theParams,
+ std::list<std::string>& theValues)
{
ShHealOper_ShapeProcess aHealer;
TColStd_SequenceOfAsciiString anOperators;
{
for ( Standard_Integer i = 1; i <= anOperators.Length(); i++ )
{
- string anOperation = anOperators.Value( i ).ToCString();
+ std::string anOperation = anOperators.Value( i ).ToCString();
if ( GetOperatorParameters( anOperation, theParams, theValues ) )
theOperations.push_back( anOperation );
else
* GetOperatorParameters
*/
//=============================================================================
-bool GEOMImpl_IHealingOperations::GetOperatorParameters( const string theOperation,
- list<string>& theParams,
- list<string>& theValues )
+bool GEOMImpl_IHealingOperations::GetOperatorParameters( const std::string theOperation,
+ std::list<std::string>& theParams,
+ std::list<std::string>& theValues )
{
ShHealOper_ShapeProcess aHealer;
int nbParamValueErrors( 0 );
- list<string> aParams;
+ std::list<std::string> aParams;
if ( GetParameters( theOperation, aParams ) ) {
- for ( list<string>::iterator it = aParams.begin(); it != aParams.end(); ++it ) {
+ for ( std::list<std::string>::iterator it = aParams.begin(); it != aParams.end(); ++it ) {
TCollection_AsciiString aParam( (Standard_CString)(*it).c_str() );
TCollection_AsciiString aValue;
if ( aHealer.GetParameter( aParam, aValue ) ) {
* GetParameters
*/
//=============================================================================
-bool GEOMImpl_IHealingOperations::GetParameters (const string theOperation,
- list<string>& theParams)
+bool GEOMImpl_IHealingOperations::GetParameters (const std::string theOperation,
+ std::list<std::string>& theParams)
{
if ( theOperation == "SplitAngle" ) {
theParams.push_back( "SplitAngle.Angle" );
HI.SetOriginal( aLastFunction );
//Compute the translation
- try
- {
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
if (!GetSolver()->ComputeFunction(aFunction))
{
SetErrorCode("Healing driver failed");
HI.SetOriginal( aLastFunction );
//Compute the translation
- try
- {
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
if (!GetSolver()->ComputeFunction(aFunction))
{
SetErrorCode("Healing driver failed");
HI.SetOriginal( aLastFunction );
//Compute the translation
- try
- {
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
if (!GetSolver()->ComputeFunction(aFunction))
{
SetErrorCode("Healing driver failed");
HI.SetOriginal( aLastFunction );
//Compute the translation
- try
- {
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
if (!GetSolver()->ComputeFunction(aFunction))
{
SetErrorCode("Healing driver failed");
HI.SetOriginal( aLastFunction );
//Compute the translation
- try
- {
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
if (!GetSolver()->ComputeFunction(aFunction))
{
SetErrorCode("Healing driver failed");
HI.SetOriginal( aLastFunction );
//Compute the translation
- try
- {
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
if (!GetSolver()->ComputeFunction(aFunction))
{
SetErrorCode("Healing driver failed");
SetErrorCode(OK);
return true;
}
+
+
+//=============================================================================
+/*!
+ * ChangeOrientation
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientation (Handle(GEOM_Object) theObject)
+{
+ // set error code, check parameters
+ SetErrorCode(KO);
+
+ if (theObject.IsNull())
+ return NULL;
+
+ if (!theObject->IsMainShape()) {
+ SetErrorCode("Sub shape cannot be transformed - need to create a copy");
+ return NULL;
+ }
+
+ Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
+ if (aLastFunction.IsNull())
+ return NULL; //There is no function which creates an object to be processed
+
+ //Add the function
+ aFunction = theObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION);
+
+ if (aFunction.IsNull())
+ return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
+
+ // prepare "data container" class IHealing
+ GEOMImpl_IHealing HI(aFunction);
+ HI.SetOriginal( aLastFunction );
+
+ //Compute the translation
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Healing driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << "geompy.ChangeOrientationShell("
+ << theObject << ")";
+
+ SetErrorCode(OK);
+ return theObject;
+}
+
+
+//=============================================================================
+/*!
+ * ChangeOrientationCopy
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IHealingOperations::ChangeOrientationCopy (Handle(GEOM_Object) theObject)
+{
+ // set error code, check parameters
+ SetErrorCode(KO);
+
+ if (theObject.IsNull())
+ return NULL;
+
+ Handle(GEOM_Function) aFunction, aLastFunction = theObject->GetLastFunction();
+ if (aLastFunction.IsNull())
+ return NULL; //There is no function which creates an object to be processed
+
+ // Add a new object
+ Handle(GEOM_Object) aNewObject = GetEngine()->AddObject( GetDocID(), GEOM_COPY );
+
+ //Add the function
+ aFunction = aNewObject->AddFunction(GEOMImpl_HealingDriver::GetID(), CHANGE_ORIENTATION);
+
+ if (aFunction.IsNull())
+ return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_HealingDriver::GetID()) return NULL;
+
+ // prepare "data container" class IHealing
+ GEOMImpl_IHealing HI(aFunction);
+ HI.SetOriginal( aLastFunction );
+
+ //Compute the translation
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Healing driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump(aFunction) << aNewObject << " = geompy.ChangeOrientationShellCopy("
+ << theObject << ")";
+
+ SetErrorCode(OK);
+ return aNewObject;
+}
+