From d90a61c7ab57a57b2797f3a11ecf2d0b8866014f Mon Sep 17 00:00:00 2001 From: mpa Date: Wed, 24 Feb 2016 16:52:30 +0300 Subject: [PATCH] Migration to OCCT 7.0 --- adm_local/cmake_files/FindDXF.cmake | 35 ++++++++++++++++++++--------- src/DXFPlugin_ExportDriver.cxx | 14 ++---------- src/DXFPlugin_ExportDriver.hxx | 13 ++++------- src/DXFPlugin_IOperations_i.cc | 4 ++-- src/DXFPlugin_ImportDriver.cxx | 20 ++++++----------- src/DXFPlugin_ImportDriver.hxx | 13 ++++------- 6 files changed, 44 insertions(+), 55 deletions(-) diff --git a/adm_local/cmake_files/FindDXF.cmake b/adm_local/cmake_files/FindDXF.cmake index ad8e9bb..33b4fa5 100644 --- a/adm_local/cmake_files/FindDXF.cmake +++ b/adm_local/cmake_files/FindDXF.cmake @@ -41,16 +41,31 @@ IF(OCCLICENSE_ROOT_DIR) LIST(APPEND CMAKE_PREFIX_PATH "${OCCLICENSE_ROOT_DIR}") ENDIF(OCCLICENSE_ROOT_DIR) -FIND_PATH(DXF_INCLUDE_DIRS DxfData.hxx PATH_SUFFIXES inc) -FIND_PATH(OCCTLICENSE_INCLUDE_DIRS OCCLicense_Activate.hxx PATH_SUFFIXES inc) -IF(OCCTLICENSE_INCLUDE_DIRS) - LIST(APPEND DXF_INCLUDE_DIRS ${OCCTLICENSE_INCLUDE_DIRS}) -ENDIF(OCCTLICENSE_INCLUDE_DIRS) - -FIND_LIBRARY(DXF_TKACIS NAMES TKACIS) -FIND_LIBRARY(DXF_TKDXF NAMES TKDXF) -FIND_LIBRARY(DXF_TKXDEDXF NAMES TKXDEDXF) -FIND_LIBRARY(DXF_TKOCCLicense NAMES TKOCCLicense) +FIND_PATH(DXF_INCLUDE_DIRS DxfData.hxx PATH_SUFFIXES include/opencascade) +IF(DXF_INCLUDE_DIRS) + SET(DXF_UPCOUNT 2) +ELSE(DXF_INCLUDE_DIRS) + FIND_PATH(DXF_INCLUDE_DIRS DxfData.hxx PATH_SUFFIXES include inc) +ENDIF(DXF_INCLUDE_DIRS) + +FIND_PATH(OCCTLICENSE_INCLUDE_DIRS OCCLicense_Activate.hxx PATH_SUFFIXES include/opencascade) +IF(NOT OCCTLICENSE_INCLUDE_DIRS) + FIND_PATH(OCCTLICENSE_INCLUDE_DIRS OCCLicense_Activate.hxx PATH_SUFFIXES include inc) +ENDIF(NOT OCCTLICENSE_INCLUDE_DIRS) + +IF(DXF_INCLUDE_DIRS AND OCCTLICENSE_INCLUDE_DIRS) + FILE(TO_NATIVE_PATH ${DXF_INCLUDE_DIRS} _dxf_dir) + FILE(TO_NATIVE_PATH ${OCCTLICENSE_INCLUDE_DIRS} _lic_dir) + STRING(COMPARE NOTEQUAL ${_dxf_dir} ${_lic_dir} _diff_dir) + IF(_diff_dir) + LIST(APPEND DXF_INCLUDE_DIRS ${OCCTLICENSE_INCLUDE_DIRS}) + ENDIF() +ENDIF(DXF_INCLUDE_DIRS AND OCCTLICENSE_INCLUDE_DIRS) + +FIND_LIBRARY(DXF_TKACIS NAMES TKACIS PATH_SUFFIXES lib lin64/gcc/lib bin) +FIND_LIBRARY(DXF_TKDXF NAMES TKDXF PATH_SUFFIXES lib lin64/gcc/lib bin) +FIND_LIBRARY(DXF_TKXDEDXF NAMES TKXDEDXF PATH_SUFFIXES lib lin64/gcc/lib bin) +FIND_LIBRARY(DXF_TKOCCLicense NAMES TKOCCLicense PATH_SUFFIXES lib lin64/gcc/lib bin) SET(DXF_LIBRARIES ${DXF_TKACIS} diff --git a/src/DXFPlugin_ExportDriver.cxx b/src/DXFPlugin_ExportDriver.cxx index a43fc73..808a92d 100644 --- a/src/DXFPlugin_ExportDriver.cxx +++ b/src/DXFPlugin_ExportDriver.cxx @@ -64,7 +64,7 @@ DXFPlugin_ExportDriver::DXFPlugin_ExportDriver() //function : Execute //purpose : //======================================================================= -Standard_Integer DXFPlugin_ExportDriver::Execute( TFunction_Logbook& log ) const +Standard_Integer DXFPlugin_ExportDriver::Execute( LOGBOOK& log ) const { #ifdef DXF_HASLICENSE try { @@ -108,15 +108,6 @@ Standard_Integer DXFPlugin_ExportDriver::Execute( TFunction_Logbook& log ) const return 0; } -//======================================================================= -//function : MustExecute -//purpose : -//======================================================================= -Standard_Boolean DXFPlugin_ExportDriver::MustExecute( const TFunction_Logbook& ) const -{ - return Standard_True; -} - //================================================================================ /*! * \brief Returns a name of creation operation and names and values of creation parameters @@ -129,5 +120,4 @@ GetCreationInformation( std::string& theOperationName, return false; } -IMPLEMENT_STANDARD_HANDLE( DXFPlugin_ExportDriver,GEOM_BaseDriver ); -IMPLEMENT_STANDARD_RTTIEXT( DXFPlugin_ExportDriver,GEOM_BaseDriver ); +OCCT_IMPLEMENT_STANDARD_RTTIEXT( DXFPlugin_ExportDriver,GEOM_BaseDriver ) diff --git a/src/DXFPlugin_ExportDriver.hxx b/src/DXFPlugin_ExportDriver.hxx index 54888ee..a006da2 100644 --- a/src/DXFPlugin_ExportDriver.hxx +++ b/src/DXFPlugin_ExportDriver.hxx @@ -23,11 +23,6 @@ // GEOM includes #include -// OCCT includes -#ifndef _TFunction_Logbook_HeaderFile -#include -#endif - DEFINE_STANDARD_HANDLE( DXFPlugin_ExportDriver, GEOM_BaseDriver ); class DXFPlugin_ExportDriver : public GEOM_BaseDriver @@ -37,14 +32,14 @@ public: ~DXFPlugin_ExportDriver() {}; static const Standard_GUID& GetID(); - virtual Standard_Integer Execute( TFunction_Logbook& log ) const; - Standard_Boolean MustExecute( const TFunction_Logbook& ) const; - virtual void Validate( TFunction_Logbook& ) const {} + virtual Standard_Integer Execute( LOGBOOK& log ) const; + Standard_Boolean MustExecute( const LOGBOOK& ) const { return Standard_True; } + virtual void Validate( LOGBOOK& ) const {} virtual bool GetCreationInformation( std::string& theOperationName, std::vector& params ); -DEFINE_STANDARD_RTTI( DXFPlugin_ExportDriver ) +OCCT_DEFINE_STANDARD_RTTIEXT( DXFPlugin_ExportDriver, GEOM_BaseDriver ) }; #endif // _DXFPlugin_ExportDriver_HXX diff --git a/src/DXFPlugin_IOperations_i.cc b/src/DXFPlugin_IOperations_i.cc index b057167..680ea8c 100644 --- a/src/DXFPlugin_IOperations_i.cc +++ b/src/DXFPlugin_IOperations_i.cc @@ -66,7 +66,7 @@ void DXFPlugin_IOperations_i::ExportDXF( GEOM::GEOM_Object_ptr theOriginal, GetOperations()->SetNotDone(); //Get the reference shape - Handle(GEOM_Object) anOriginal = GetObjectImpl( theOriginal ); + HANDLE_NAMESPACE(GEOM_Object) anOriginal = GetObjectImpl( theOriginal ); if (anOriginal.IsNull()) return; //Export the shape to the file @@ -98,7 +98,7 @@ GEOM::ListOfGO* DXFPlugin_IOperations_i::ImportDXF( const char* theFileName ) Standard_Integer aLength = aHSeq->Length(); aSeq->length( aLength ); for( Standard_Integer i = 1; i <= aLength; i++ ) - aSeq[i-1] = GetObject( Handle(GEOM_Object)::DownCast( aHSeq->Value(i) ) ); + aSeq[i-1] = GetObject( HANDLE_NAMESPACE(GEOM_Object)::DownCast( aHSeq->Value(i) ) ); return aSeq._retn(); } diff --git a/src/DXFPlugin_ImportDriver.cxx b/src/DXFPlugin_ImportDriver.cxx index 4bb64c3..164f8ad 100644 --- a/src/DXFPlugin_ImportDriver.cxx +++ b/src/DXFPlugin_ImportDriver.cxx @@ -81,7 +81,7 @@ DXFPlugin_ImportDriver::DXFPlugin_ImportDriver() //function : Execute //purpose : //======================================================================= -Standard_Integer DXFPlugin_ImportDriver::Execute( TFunction_Logbook& log ) const +Standard_Integer DXFPlugin_ImportDriver::Execute( LOGBOOK& log ) const { if( Label().IsNull() ) return 0; Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction( Label() ); @@ -170,20 +170,15 @@ Standard_Integer DXFPlugin_ImportDriver::Execute( TFunction_Logbook& log ) const aFunction->SetValue( aResShape ); - log.SetTouched( Label() ); +#if OCC_VERSION_MAJOR < 7 + log.SetTouched(Label()); +#else + log->SetTouched(Label()); +#endif return 1; } -//======================================================================= -//function : MustExecute -//purpose : -//======================================================================= -Standard_Boolean DXFPlugin_ImportDriver::MustExecute( const TFunction_Logbook& ) const -{ - return Standard_True; -} - //================================================================================ /*! * \brief Returns a name of creation operation and names and values of creation parameters @@ -212,5 +207,4 @@ GetCreationInformation( std::string& theOperationName, return true; } -IMPLEMENT_STANDARD_HANDLE( DXFPlugin_ImportDriver, GEOM_BaseDriver ); -IMPLEMENT_STANDARD_RTTIEXT( DXFPlugin_ImportDriver, GEOM_BaseDriver ); +OCCT_IMPLEMENT_STANDARD_RTTIEXT( DXFPlugin_ImportDriver, GEOM_BaseDriver ); diff --git a/src/DXFPlugin_ImportDriver.hxx b/src/DXFPlugin_ImportDriver.hxx index d396f99..53ef5ed 100644 --- a/src/DXFPlugin_ImportDriver.hxx +++ b/src/DXFPlugin_ImportDriver.hxx @@ -23,11 +23,6 @@ // GEOM includes #include -// OCCT includes -#ifndef _TFunction_Logbook_HeaderFile -#include -#endif - DEFINE_STANDARD_HANDLE( DXFPlugin_ImportDriver, GEOM_BaseDriver ); class DXFPlugin_ImportDriver : public GEOM_BaseDriver @@ -37,14 +32,14 @@ public: ~DXFPlugin_ImportDriver() {}; static const Standard_GUID& GetID(); - virtual Standard_Integer Execute( TFunction_Logbook& log ) const; - Standard_Boolean MustExecute( const TFunction_Logbook& ) const; - virtual void Validate( TFunction_Logbook& ) const {} + virtual Standard_Integer Execute( LOGBOOK& log ) const; + Standard_Boolean MustExecute( const LOGBOOK& ) const { return Standard_True; } + virtual void Validate( LOGBOOK& ) const {} virtual bool GetCreationInformation( std::string& theOperationName, std::vector& params ); -DEFINE_STANDARD_RTTI( DXFPlugin_ImportDriver ) +OCCT_DEFINE_STANDARD_RTTIEXT( DXFPlugin_ImportDriver, GEOM_BaseDriver ) }; #endif // _DXFPlugin_ImportDriver_HXX -- 2.39.2