From: TMA Salome Date: Thu, 21 Dec 2017 15:00:46 +0000 (+0100) Subject: Merge branch 'master' into agy/NewPV1_For_850 X-Git-Tag: V9_0_0^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=47848bdd4b7f61ef1a87c051ebcbde3f72d5cc0b;hp=2cf6bdad9e9616801d7c28f4cd7bc8d570c802ad;p=modules%2Fgui.git Merge branch 'master' into agy/NewPV1_For_850 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 5aab3cae7..7c86a5a6f 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ ENDIF(WIN32) STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) SET(${PROJECT_NAME_UC}_MAJOR_VERSION 8) -SET(${PROJECT_NAME_UC}_MINOR_VERSION 3) +SET(${PROJECT_NAME_UC}_MINOR_VERSION 4) SET(${PROJECT_NAME_UC}_PATCH_VERSION 0) SET(${PROJECT_NAME_UC}_VERSION ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) @@ -286,8 +286,6 @@ SET(SALOME_INSTALL_RES "${SALOME_INSTALL_RES}" CACHE PATH "Install path: SALOME SET(SALOME_INSTALL_DOC "${SALOME_INSTALL_DOC}" CACHE PATH "Install path: SALOME documentation") # Specific to GUI: -SET(SALOME_GUI_INSTALL_PARAVIEW_LIBS lib/paraview CACHE PATH - "Install path: SALOME GUI ParaView libraries") SET(SALOME_GUI_INSTALL_RES_DATA "${SALOME_INSTALL_RES}/gui" CACHE PATH "Install path: SALOME GUI specific data") SET(SALOME_GUI_INSTALL_RES_SCRIPTS "${SALOME_INSTALL_RES}/gui" CACHE PATH @@ -299,15 +297,14 @@ MARK_AS_ADVANCED(SALOME_INSTALL_BINS SALOME_INSTALL_LIBS SALOME_INSTALL_IDLS SAL MARK_AS_ADVANCED(SALOME_INSTALL_SCRIPT_SCRIPTS SALOME_INSTALL_SCRIPT_DATA SALOME_INSTALL_SCRIPT_PYTHON) MARK_AS_ADVANCED(SALOME_INSTALL_APPLISKEL_SCRIPTS SALOME_INSTALL_APPLISKEL_PYTHON SALOME_INSTALL_CMAKE SALOME_INSTALL_CMAKE_LOCAL SALOME_INSTALL_RES) MARK_AS_ADVANCED(SALOME_INSTALL_PYTHON SALOME_INSTALL_PYTHON_SHARED) -MARK_AS_ADVANCED(SALOME_GUI_INSTALL_PARAVIEW_LIBS SALOME_GUI_INSTALL_RES_DATA SALOME_GUI_INSTALL_RES_SCRIPTS SALOME_GUI_INSTALL_PLUGINS) +MARK_AS_ADVANCED(SALOME_GUI_INSTALL_RES_DATA SALOME_GUI_INSTALL_RES_SCRIPTS SALOME_GUI_INSTALL_PLUGINS) MARK_AS_ADVANCED(SALOME_INSTALL_AMCONFIG_LOCAL SALOME_INSTALL_DOC) # Accumulate environment variables for GUI module SALOME_ACCUMULATE_ENVIRONMENT(PYTHONPATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_BINS} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON} ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_PYTHON_SHARED}) -SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS} - ${CMAKE_INSTALL_PREFIX}/${SALOME_GUI_INSTALL_PARAVIEW_LIBS}) +SALOME_ACCUMULATE_ENVIRONMENT(LD_LIBRARY_PATH NOCHECK ${CMAKE_INSTALL_PREFIX}/${SALOME_INSTALL_LIBS}) # Sources # ======== diff --git a/bin/gui_setenv.py b/bin/gui_setenv.py index 0c38bddb4..76ea8027d 100644 --- a/bin/gui_setenv.py +++ b/bin/gui_setenv.py @@ -25,16 +25,9 @@ import os, re def set_env( args ): """Add environment required for GUI module""" - vtk_overloads_dir = os.path.join( os.getenv( "GUI_ROOT_DIR" ), "lib", "paraview" ) - dirs = re.split( ":|;", os.getenv( 'VTK_AUTOLOAD_PATH', vtk_overloads_dir ) ) - if vtk_overloads_dir not in dirs: dirs[0:0] = [vtk_overloads_dir] - #os.environ['VTK_AUTOLOAD_PATH'] = os.pathsep.join(dirs) - #print 'QT_PLUGIN_PATH: ', os.environ['QT_PLUGIN_PATH'] qt_plugin_dir = os.path.join( os.getenv( "QTDIR" ), "plugins" ) dirs = re.split( ":|;", os.getenv( 'QT_PLUGIN_PATH', qt_plugin_dir ) ) if qt_plugin_dir not in dirs: dirs[0:0] = [qt_plugin_dir] dirs2 = list(set(dirs)) os.environ['QT_PLUGIN_PATH'] = os.pathsep.join(dirs2) - #print 'QT_PLUGIN_PATH: ', os.environ['QT_PLUGIN_PATH'] - #print 'QT_QPA_PLATFORM_PLUGIN_PATH: ', os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] return diff --git a/src/CASCatch/CASCatch_Failure.cxx b/src/CASCatch/CASCatch_Failure.cxx index ecdaf950c..8d34ee2f0 100644 --- a/src/CASCatch/CASCatch_Failure.cxx +++ b/src/CASCatch/CASCatch_Failure.cxx @@ -29,7 +29,7 @@ #include #include -OCCT_IMPLEMENT_STANDARD_RTTIEXT( CASCatch_Failure, Standard_Transient ) +IMPLEMENT_STANDARD_RTTIEXT(CASCatch_Failure, Standard_Transient) #ifndef NO_CXX_EXCEPTION static Handle(CASCatch_Failure) RaisedError; diff --git a/src/CASCatch/CASCatch_Failure.hxx b/src/CASCatch/CASCatch_Failure.hxx index 27c1f6ea6..f8d5954ce 100644 --- a/src/CASCatch/CASCatch_Failure.hxx +++ b/src/CASCatch/CASCatch_Failure.hxx @@ -26,12 +26,8 @@ #ifndef CASCATCH_FAILURE_HXX #define CASCATCH_FAILURE_HXX -#include - #include #include -DEFINE_STANDARD_HANDLE( CASCatch_Failure, Standard_Transient ) - #include /*! @@ -53,8 +49,7 @@ Standard_EXPORT static void Raise(const Standard_CString aMessage = "") ; Standard_EXPORT virtual void Throw() const;public: public: - - OCCT_DEFINE_STANDARD_RTTIEXT(CASCatch_Failure,Standard_Transient) + DEFINE_STANDARD_RTTIEXT(CASCatch_Failure, Standard_Transient) private: /*!\var myMessage @@ -64,5 +59,6 @@ Standard_Character* myMessage; }; +DEFINE_STANDARD_HANDLE(CASCatch_Failure, Standard_Transient) #endif // CASCATCH_FAILURE_HXX diff --git a/src/DDS/DDS.h b/src/DDS/DDS.h index f2a03e931..70104b189 100644 --- a/src/DDS/DDS.h +++ b/src/DDS/DDS.h @@ -23,10 +23,7 @@ #ifndef DDS_H #define DDS_H -#include - #include - #include #define UNIT_SYSTEM_SI "SI" diff --git a/src/DDS/DDS_DicGroup.cxx b/src/DDS/DDS_DicGroup.cxx index ed5d18e5b..d4ed520b7 100644 --- a/src/DDS/DDS_DicGroup.cxx +++ b/src/DDS/DDS_DicGroup.cxx @@ -32,7 +32,7 @@ #include #include -OCCT_IMPLEMENT_STANDARD_RTTIEXT(DDS_DicGroup, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(DDS_DicGroup, Standard_Transient) /*! \class DDS_DicGroup @@ -47,7 +47,7 @@ OCCT_IMPLEMENT_STANDARD_RTTIEXT(DDS_DicGroup, MMgt_TShared) \param name group name */ DDS_DicGroup::DDS_DicGroup( const TCollection_AsciiString& name ) -: MMgt_TShared(), +: Standard_Transient(), myName( name ), myActiveSystem( UNIT_SYSTEM_SI ) { diff --git a/src/DDS/DDS_DicGroup.h b/src/DDS/DDS_DicGroup.h index debefdbe6..a592657af 100644 --- a/src/DDS/DDS_DicGroup.h +++ b/src/DDS/DDS_DicGroup.h @@ -27,15 +27,15 @@ #include "DDS_DicItem.h" -#include +#include #include #include class LDOM_Element; -DEFINE_STANDARD_HANDLE(DDS_DicGroup, MMgt_TShared) +DEFINE_STANDARD_HANDLE(DDS_DicGroup, Standard_Transient) -class DDS_DicGroup : public MMgt_TShared +class DDS_DicGroup : public Standard_Transient { public: Standard_EXPORT DDS_DicGroup( const TCollection_AsciiString& ); @@ -89,7 +89,7 @@ private: friend class DDS_Dictionary; public: - OCCT_DEFINE_STANDARD_RTTIEXT(DDS_DicGroup,MMgt_TShared) + DEFINE_STANDARD_RTTIEXT(DDS_DicGroup, Standard_Transient) }; typedef NCollection_IndexedDataMap DDS_IndexedDataMapOfDicGroups; diff --git a/src/DDS/DDS_DicItem.cxx b/src/DDS/DDS_DicItem.cxx index 2ff1d1c37..1d40d4c57 100644 --- a/src/DDS/DDS_DicItem.cxx +++ b/src/DDS/DDS_DicItem.cxx @@ -30,7 +30,7 @@ #include #include -OCCT_IMPLEMENT_STANDARD_RTTIEXT(DDS_DicItem, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(DDS_DicItem, Standard_Transient) /*! \class DDS_DicItem diff --git a/src/DDS/DDS_DicItem.h b/src/DDS/DDS_DicItem.h index d3f01a517..26dcb53e3 100644 --- a/src/DDS/DDS_DicItem.h +++ b/src/DDS/DDS_DicItem.h @@ -25,7 +25,7 @@ #include "DDS.h" -#include +#include #include @@ -49,7 +49,7 @@ class DDS_Dictionary; // optional : format, units, // min value, max value, default value. -class DDS_DicItem : public MMgt_TShared +class DDS_DicItem : public Standard_Transient { public: /*! Enum describes type of datum value */ @@ -253,10 +253,10 @@ private: friend class DDS_DicGroup; public: - OCCT_DEFINE_STANDARD_RTTIEXT(DDS_DicItem,MMgt_TShared) + DEFINE_STANDARD_RTTIEXT(DDS_DicItem, Standard_Transient) }; -DEFINE_STANDARD_HANDLE(DDS_DicItem, MMgt_TShared) +DEFINE_STANDARD_HANDLE(DDS_DicItem, Standard_Transient) typedef NCollection_IndexedDataMap DDS_IndexedDataMapOfDicItems; diff --git a/src/DDS/DDS_Dictionary.cxx b/src/DDS/DDS_Dictionary.cxx index b26dc1e6d..079bb4647 100644 --- a/src/DDS/DDS_Dictionary.cxx +++ b/src/DDS/DDS_Dictionary.cxx @@ -38,7 +38,7 @@ #include #include -OCCT_IMPLEMENT_STANDARD_RTTIEXT(DDS_Dictionary, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(DDS_Dictionary, Standard_Transient) Handle(DDS_Dictionary) DDS_Dictionary::myDictionary = Handle(DDS_Dictionary)(); @@ -259,7 +259,7 @@ Handle(DDS_Dictionary) DDS_Dictionary::myDictionary = Handle(DDS_Dictionary)(); Use Get() method instead. */ DDS_Dictionary::DDS_Dictionary() -: MMgt_TShared() +: Standard_Transient() { } diff --git a/src/DDS/DDS_Dictionary.h b/src/DDS/DDS_Dictionary.h index 458f13f0f..3db4752dd 100644 --- a/src/DDS/DDS_Dictionary.h +++ b/src/DDS/DDS_Dictionary.h @@ -27,14 +27,14 @@ #include -#include +#include class LDOM_Element; class TCollection_AsciiString; -DEFINE_STANDARD_HANDLE(DDS_Dictionary, MMgt_TShared) +DEFINE_STANDARD_HANDLE(DDS_Dictionary, Standard_Transient) -class DDS_Dictionary : public MMgt_TShared +class DDS_Dictionary : public Standard_Transient { public: Standard_EXPORT static Handle(DDS_Dictionary) Get(); @@ -92,7 +92,7 @@ private: static Handle(DDS_Dictionary) myDictionary; public: - OCCT_DEFINE_STANDARD_RTTIEXT(DDS_Dictionary,MMgt_TShared) + DEFINE_STANDARD_RTTIEXT(DDS_Dictionary, Standard_Transient) }; #endif diff --git a/src/DDS/DDS_KeyWords.cxx b/src/DDS/DDS_KeyWords.cxx index f01c58b5a..db9796076 100644 --- a/src/DDS/DDS_KeyWords.cxx +++ b/src/DDS/DDS_KeyWords.cxx @@ -22,7 +22,7 @@ #include "DDS_KeyWords.h" -OCCT_IMPLEMENT_STANDARD_RTTIEXT(DDS_KeyWords, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(DDS_KeyWords, Standard_Transient) /*! \class DDS_KeyWords @@ -87,7 +87,7 @@ OCCT_IMPLEMENT_STANDARD_RTTIEXT(DDS_KeyWords, MMgt_TShared) Use Get() method instead. */ DDS_KeyWords::DDS_KeyWords() -: MMgt_TShared() +: Standard_Transient() { SetKeyWord( "D_URI", "dictionary" ); diff --git a/src/DDS/DDS_KeyWords.h b/src/DDS/DDS_KeyWords.h index 62de5d8ff..137c6efe1 100644 --- a/src/DDS/DDS_KeyWords.h +++ b/src/DDS/DDS_KeyWords.h @@ -25,15 +25,15 @@ #include "DDS.h" -#include +#include #include -DEFINE_STANDARD_HANDLE(DDS_KeyWords, MMgt_TShared) +DEFINE_STANDARD_HANDLE(DDS_KeyWords, Standard_Transient) class TCollection_AsciiString; -class DDS_KeyWords : public MMgt_TShared +class DDS_KeyWords : public Standard_Transient { public: Standard_EXPORT static Handle(DDS_KeyWords) Get(); @@ -53,7 +53,7 @@ private: KeyWordMap myKeyWord; public: - OCCT_DEFINE_STANDARD_RTTIEXT(DDS_KeyWords,MMgt_TShared) + DEFINE_STANDARD_RTTIEXT(DDS_KeyWords, Standard_Transient) }; #endif diff --git a/src/GUI_PY/CMakeLists.txt b/src/GUI_PY/CMakeLists.txt index 098f5b128..ed18b1075 100755 --- a/src/GUI_PY/CMakeLists.txt +++ b/src/GUI_PY/CMakeLists.txt @@ -22,7 +22,7 @@ INCLUDE(UsePyQt) # --- resources --- # uic files / to be processed by pyuic -SET(_pyuic_files +SET(_pyuic_FILES SelectVarsDialog.ui genericdialog.ui mytestdialog.ui @@ -31,7 +31,7 @@ SET(_pyuic_files # --- scripts --- # scripts / pyuic wrappings -PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) +PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_FILES} TARGET_NAME _target_name_pyuic) # scripts / static SET(_other_SCRIPTS @@ -42,6 +42,7 @@ SET(_other_SCRIPTS selectvars.py dockwidgets.py ) + SET(_bin_SCRIPTS test_dockwidgets.py ) @@ -52,11 +53,11 @@ SET(_gen_SCRIPTS ${CMAKE_CURRENT_BINARY_DIR}/qtsalome.py ) -# scripts / to install - -SET(_all_SCRIPTS ${_other_SCRIPTS} ${_pyuic_SCRIPTS}) - # --- rules --- SALOME_INSTALL_SCRIPTS("${_gen_SCRIPTS}" ${SALOME_INSTALL_PYTHON}) -SALOME_INSTALL_SCRIPTS("${_all_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/gui) +SALOME_INSTALL_SCRIPTS("${_other_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/gui) SALOME_INSTALL_SCRIPTS("${_bin_SCRIPTS}" ${SALOME_INSTALL_SCRIPT_DATA}) +SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/gui TARGET_NAME _target_name_pyuic_py) +# add dependency of compiled py files on uic files in order +# to avoid races problems when compiling in parallel +ADD_DEPENDENCIES(${_target_name_pyuic_py} ${_target_name_pyuic}) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 38acfcc60..529725ad4 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -246,6 +246,14 @@ int LightApp_Application::lastStudyId = 0; //since the 'toolbar marker' is not unique, find index of first occurrence of the //'toolbar marker' in the array and check that next string is name of the toolbar +void LightAppCleanUpAppResources() +{ + if ( LightApp_Application::_prefs_ ) { + delete LightApp_Application::_prefs_; + LightApp_Application::_prefs_ = 0; + } +} + namespace { int getToolbarMarkerIndex( QByteArray input, const QStringList& aFlags ) { @@ -439,6 +447,7 @@ LightApp_Application::~LightApp_Application() savePreferences(); delete mySelMgr; delete myScreenHelper; + myPrefs = 0; } /*!Start application.*/ @@ -1581,7 +1590,6 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType resMgr->booleanValue( "3DViewer", "relative_size", vm->trihedronRelative() )); vm->setInteractionStyle( resMgr->integerValue( "3DViewer", "navigation_mode", vm->interactionStyle() ) ); vm->setProjectionType( resMgr->integerValue( "OCCViewer", "projection_mode", vm->projectionType() ) ); - #if OCC_VERSION_LARGE > 0x06090000 vm->setStereoType( resMgr->integerValue( "OCCViewer", "stereo_type", vm->stereoType() ) ); vm->setAnaglyphFilter( resMgr->integerValue( "OCCViewer", "anaglyph_filter", vm->anaglyphFilter() ) ); vm->setStereographicFocus( resMgr->integerValue( "OCCViewer", "focus_type", vm->stereographicFocusType() ), @@ -1592,7 +1600,6 @@ SUIT_ViewManager* LightApp_Application::createViewManager( const QString& vmType vm->setReverseStereo( resMgr->booleanValue( "OCCViewer", "reverse_stereo", vm->isReverseStereo() ) ); vm->setVSync( resMgr->booleanValue( "OCCViewer", "enable_vsync", vm->isVSync() ) ); vm->setQuadBufferSupport( resMgr->booleanValue( "OCCViewer", "enable_quad_buffer_support", vm->isQuadBufferSupport() ) ); - #endif vm->setZoomingStyle( resMgr->integerValue( "3DViewer", "zooming_mode", vm->zoomingStyle() ) ); vm->enablePreselection( resMgr->booleanValue( "OCCViewer", "enable_preselection", vm->isPreselectionEnabled() ) ); vm->enableSelection( resMgr->booleanValue( "OCCViewer", "enable_selection", vm->isSelectionEnabled() ) ); @@ -2130,6 +2137,7 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const { _prefs_ = new LightApp_Preferences( resourceMgr() ); that->createPreferences( _prefs_ ); + qAddPostRoutine( LightAppCleanUpAppResources ); } that->myPrefs = _prefs_; @@ -2411,7 +2419,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) anIndicesList << 0 << 1; pref->setItemProperty( "strings", aValuesList, occProjMode ); pref->setItemProperty( "indexes", anIndicesList, occProjMode ); -#if OCC_VERSION_LARGE > 0x06090000 + // .... -> Stereo group int stereoGroup = pref->addPreference( tr( "PREF_GROUP_STEREO" ), occGroup); pref->setItemProperty( "columns", 2, stereoGroup ); @@ -2482,7 +2490,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) // .... -> Enable quad-buffer support pref->addPreference( tr( "PREF_ENABLE_QUAD_BUFFER_SUPPORT" ), stereoGroup, LightApp_Preferences::Bool, "OCCViewer", "enable_quad_buffer_support" ); -#endif + // ... "Background" group <> int bgGroup = pref->addPreference( tr( "PREF_VIEWER_BACKGROUND" ), occGroup ); // pref->setItemProperty( "columns", 2, bgGroup ); @@ -3257,7 +3265,7 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString } } #endif -#if OCC_VERSION_LARGE > 0x06090000 + #ifndef DISABLE_OCCVIEWER if ( sec == QString( "OCCViewer" ) && param == QString( "stereo_type" ) ) { @@ -3394,7 +3402,7 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString } } #endif -#endif + if ( sec == QString( "3DViewer" ) && param == QString( "zooming_mode" ) ) { int mode = resMgr->integerValue( "3DViewer", "zooming_mode", 0 ); diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index b7d2fb9ec..cd9ce2e15 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -343,6 +343,8 @@ protected: static int lastStudyId; QStringList myUserWmTypes; + + friend void LightAppCleanUpAppResources(); }; #ifdef WIN32 diff --git a/src/LightApp/LightApp_DataModel.cxx b/src/LightApp/LightApp_DataModel.cxx index ccef46ec0..88a29bdb1 100644 --- a/src/LightApp/LightApp_DataModel.cxx +++ b/src/LightApp/LightApp_DataModel.cxx @@ -110,7 +110,7 @@ void LightApp_DataModel::build() void LightApp_DataModel::updateWidgets() { LightApp_Application* app = dynamic_cast( module()->application() ); - if ( app ) + if ( app && app->objectBrowser() ) app->objectBrowser()->updateTree( 0, false ); } diff --git a/src/LightApp/resources/LightApp_msg_fr.ts b/src/LightApp/resources/LightApp_msg_fr.ts index b91790d59..4a3b4610f 100755 --- a/src/LightApp/resources/LightApp_msg_fr.ts +++ b/src/LightApp/resources/LightApp_msg_fr.ts @@ -1043,27 +1043,27 @@ Le fichier n'existe pas PREF_GROUP_PY_EDITOR - Editor settings + Paramètres de l'éditeur PREF_PY_COMPLETION_MODE - Completion mode + Mode de complétion PREF_PY_NONE - None + Aucun PREF_PY_AUTO - Auto + Auto PREF_PY_MANUAL - Manual + Manuel PREF_PY_ALWAYS - Always + Toujours PREF_GROUP_PY_TAB diff --git a/src/LightApp/resources/LightApp_msg_ja.ts b/src/LightApp/resources/LightApp_msg_ja.ts index 02fa314f2..632c65c91 100644 --- a/src/LightApp/resources/LightApp_msg_ja.ts +++ b/src/LightApp/resources/LightApp_msg_ja.ts @@ -1041,28 +1041,28 @@ Pythonファイルは、文字、数字、アンダースコアが含まれて ライン数エリアの表示 - PREF_GROUP_PY_EDITOR - Editor settings + PREF_GROUP_PY_EDITOR + エディタ設定 - PREF_PY_COMPLETION_MODE - Completion mode + PREF_PY_COMPLETION_MODE + 完了モード - PREF_PY_NONE - None + PREF_PY_NONE + なし - PREF_PY_AUTO - Auto + PREF_PY_AUTO + 自動 - PREF_PY_MANUAL - Manual + PREF_PY_MANUAL + 手動 - PREF_PY_ALWAYS - Always + PREF_PY_ALWAYS + 常に PREF_GROUP_PY_TAB diff --git a/src/OBJECT/SALOME_AISObject.cxx b/src/OBJECT/SALOME_AISObject.cxx index 64bcbf9c9..82b02f568 100755 --- a/src/OBJECT/SALOME_AISObject.cxx +++ b/src/OBJECT/SALOME_AISObject.cxx @@ -22,7 +22,7 @@ #include "SALOME_AISObject.hxx" -OCCT_IMPLEMENT_STANDARD_RTTIEXT(SALOME_AISObject, AIS_InteractiveObject) +IMPLEMENT_STANDARD_RTTIEXT(SALOME_AISObject, AIS_InteractiveObject) SALOME_AISObject::SALOME_AISObject() { diff --git a/src/OBJECT/SALOME_AISObject.hxx b/src/OBJECT/SALOME_AISObject.hxx index d30ce8a86..4fea394ee 100755 --- a/src/OBJECT/SALOME_AISObject.hxx +++ b/src/OBJECT/SALOME_AISObject.hxx @@ -42,7 +42,7 @@ public: Standard_EXPORT virtual void setName(const Standard_CString aName) = 0; public: - OCCT_DEFINE_STANDARD_RTTIEXT(SALOME_AISObject,AIS_InteractiveObject) + DEFINE_STANDARD_RTTIEXT(SALOME_AISObject, AIS_InteractiveObject) }; DEFINE_STANDARD_HANDLE(SALOME_AISObject, AIS_InteractiveObject) diff --git a/src/OBJECT/SALOME_AISShape.cxx b/src/OBJECT/SALOME_AISShape.cxx index 7be2fd5c3..51f0c90ba 100755 --- a/src/OBJECT/SALOME_AISShape.cxx +++ b/src/OBJECT/SALOME_AISShape.cxx @@ -22,7 +22,7 @@ #include "SALOME_AISShape.hxx" -OCCT_IMPLEMENT_STANDARD_RTTIEXT(SALOME_AISShape, ViewerData_AISShape) +IMPLEMENT_STANDARD_RTTIEXT(SALOME_AISShape, ViewerData_AISShape) /*! Constructor diff --git a/src/OBJECT/SALOME_AISShape.hxx b/src/OBJECT/SALOME_AISShape.hxx index acf22fa61..3c1765834 100755 --- a/src/OBJECT/SALOME_AISShape.hxx +++ b/src/OBJECT/SALOME_AISShape.hxx @@ -54,7 +54,7 @@ public: Standard_EXPORT virtual void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight ) = 0; public: - OCCT_DEFINE_STANDARD_RTTIEXT(SALOME_AISShape,ViewerData_AISShape) + DEFINE_STANDARD_RTTIEXT(SALOME_AISShape, ViewerData_AISShape) }; DEFINE_STANDARD_HANDLE(SALOME_AISShape, ViewerData_AISShape) diff --git a/src/OBJECT/SALOME_Filter.cxx b/src/OBJECT/SALOME_Filter.cxx index f52c49bce..f2d9ad7f5 100644 --- a/src/OBJECT/SALOME_Filter.cxx +++ b/src/OBJECT/SALOME_Filter.cxx @@ -22,7 +22,7 @@ #include "SALOME_Filter.hxx" -OCCT_IMPLEMENT_STANDARD_RTTIEXT(SALOME_Filter, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(SALOME_Filter, Standard_Transient) SALOME_Filter::SALOME_Filter() { diff --git a/src/OBJECT/SALOME_Filter.hxx b/src/OBJECT/SALOME_Filter.hxx index 4f1c200ca..1db4f6924 100644 --- a/src/OBJECT/SALOME_Filter.hxx +++ b/src/OBJECT/SALOME_Filter.hxx @@ -23,13 +23,13 @@ #ifndef SALOME_FILTER_HXX #define SALOME_FILTER_HXX -#include #include +#include #include #include "SALOME_InteractiveObject.hxx" -class SALOME_Filter : public MMgt_TShared +class SALOME_Filter : public Standard_Transient { public: Standard_EXPORT SALOME_Filter(); @@ -38,9 +38,9 @@ public: Standard_EXPORT virtual Standard_Boolean IsOk(const Handle(SALOME_InteractiveObject)& anObj) const = 0; public: - OCCT_DEFINE_STANDARD_RTTIEXT(SALOME_Filter,MMgt_TShared) + DEFINE_STANDARD_RTTIEXT(SALOME_Filter, Standard_Transient) }; -DEFINE_STANDARD_HANDLE(SALOME_Filter, MMgt_TShared) +DEFINE_STANDARD_HANDLE(SALOME_Filter, Standard_Transient) #endif // SALOME_FILTER_HXX diff --git a/src/OBJECT/SALOME_InteractiveObject.cxx b/src/OBJECT/SALOME_InteractiveObject.cxx index e357b0b20..3fba48c65 100755 --- a/src/OBJECT/SALOME_InteractiveObject.cxx +++ b/src/OBJECT/SALOME_InteractiveObject.cxx @@ -27,7 +27,7 @@ #include "SALOME_InteractiveObject.hxx" -OCCT_IMPLEMENT_STANDARD_RTTIEXT(SALOME_InteractiveObject, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(SALOME_InteractiveObject, Standard_Transient) /*! Default constructor diff --git a/src/OBJECT/SALOME_InteractiveObject.hxx b/src/OBJECT/SALOME_InteractiveObject.hxx index 95a74fcea..af2fa716c 100755 --- a/src/OBJECT/SALOME_InteractiveObject.hxx +++ b/src/OBJECT/SALOME_InteractiveObject.hxx @@ -23,18 +23,16 @@ #ifndef SALOME_INTERACTIVEOBJECT_HXX #define SALOME_INTERACTIVEOBJECT_HXX -#include #include +#include #include -#include - #include class SALOME_InteractiveObject; -DEFINE_STANDARD_HANDLE(SALOME_InteractiveObject, MMgt_TShared) +DEFINE_STANDARD_HANDLE(SALOME_InteractiveObject, Standard_Transient) -class SALOME_InteractiveObject : public MMgt_TShared +class SALOME_InteractiveObject : public Standard_Transient { public: Standard_EXPORT SALOME_InteractiveObject(); @@ -71,7 +69,7 @@ protected: std::string myReference; public: - OCCT_DEFINE_STANDARD_RTTIEXT(SALOME_InteractiveObject,MMgt_TShared) + DEFINE_STANDARD_RTTIEXT(SALOME_InteractiveObject, Standard_Transient) }; #endif // SALOME_INTERACTIVEOBJECT_HXX diff --git a/src/OBJECT/SALOME_TypeFilter.cxx b/src/OBJECT/SALOME_TypeFilter.cxx index b4191f105..019f3a16e 100644 --- a/src/OBJECT/SALOME_TypeFilter.cxx +++ b/src/OBJECT/SALOME_TypeFilter.cxx @@ -22,7 +22,7 @@ #include "SALOME_TypeFilter.hxx" -OCCT_IMPLEMENT_STANDARD_RTTIEXT(SALOME_TypeFilter, SALOME_Filter) +IMPLEMENT_STANDARD_RTTIEXT(SALOME_TypeFilter, SALOME_Filter) /*! Constructor diff --git a/src/OBJECT/SALOME_TypeFilter.hxx b/src/OBJECT/SALOME_TypeFilter.hxx index a9a58f634..874607e3c 100644 --- a/src/OBJECT/SALOME_TypeFilter.hxx +++ b/src/OBJECT/SALOME_TypeFilter.hxx @@ -40,7 +40,7 @@ protected: Standard_CString myKind; public: - OCCT_DEFINE_STANDARD_RTTIEXT(SALOME_TypeFilter,SALOME_Filter) + DEFINE_STANDARD_RTTIEXT(SALOME_TypeFilter, SALOME_Filter) }; DEFINE_STANDARD_HANDLE(SALOME_TypeFilter, SALOME_Filter) diff --git a/src/OCCViewer/OCCViewer_AISSelector.cxx b/src/OCCViewer/OCCViewer_AISSelector.cxx index 03b001be7..831195d87 100755 --- a/src/OCCViewer/OCCViewer_AISSelector.cxx +++ b/src/OCCViewer/OCCViewer_AISSelector.cxx @@ -22,8 +22,6 @@ #include "OCCViewer_AISSelector.h" -#include - /*! Constructor */ @@ -72,12 +70,8 @@ void OCCViewer_AISSelector::setHilightColor ( Quantity_NameOfColor color ) { myHilightColor = color; if ( !myAISContext.IsNull() ) { -#if OCC_VERSION_LARGE > 0x07000000 const Handle(Graphic3d_HighlightStyle)& hStyle = myAISContext->HighlightStyle(); hStyle->SetColor( myHilightColor ); -#else - myAISContext->SetHilightColor( myHilightColor ); -#endif } } @@ -88,12 +82,8 @@ void OCCViewer_AISSelector::setSelectColor ( Quantity_NameOfColor color ) { mySelectColor = color; if ( !myAISContext.IsNull() ) { -#if OCC_VERSION_LARGE > 0x07000000 const Handle(Graphic3d_HighlightStyle)& sStyle = myAISContext->SelectionStyle(); sStyle->SetColor( mySelectColor ); -#else - myAISContext->SelectionColor( mySelectColor ); -#endif } } @@ -104,15 +94,10 @@ void OCCViewer_AISSelector::setAISContext ( const Handle (AIS_InteractiveContext { myAISContext = aisContext; if ( ! myAISContext.IsNull() ) { -#if OCC_VERSION_LARGE > 0x07000000 const Handle(Graphic3d_HighlightStyle)& hStyle = myAISContext->HighlightStyle(); const Handle(Graphic3d_HighlightStyle)& sStyle = myAISContext->SelectionStyle(); hStyle->SetColor( myHilightColor ); sStyle->SetColor( mySelectColor ); -#else - myAISContext->SetHilightColor( myHilightColor ); - myAISContext->SelectionColor( mySelectColor ); -#endif myAISContext->SetSubIntensityColor( Quantity_NOC_CYAN1 ); } } diff --git a/src/OCCViewer/OCCViewer_ClipPlaneInteractor.cxx b/src/OCCViewer/OCCViewer_ClipPlaneInteractor.cxx index a187df537..39d6c0a12 100644 --- a/src/OCCViewer/OCCViewer_ClipPlaneInteractor.cxx +++ b/src/OCCViewer/OCCViewer_ClipPlaneInteractor.cxx @@ -220,10 +220,10 @@ bool OCCViewer_ClipPlaneInteractor::startDragging( const QPoint& thePickPos, gp_Pnt aPickPoint = aFindPick.Point( 1 ); - const gp_Dir& aPlaneN = aPlanePln.Axis().Direction(); - const gp_Dir& aPlaneX = aPlanePln.XAxis().Direction(); - const gp_Dir& aPlaneY = aPlanePln.YAxis().Direction(); - const gp_Pnt& aPlaneCenter = aPlanePln.Location(); + gp_Dir aPlaneN = aPlanePln.Axis().Direction(); + gp_Dir aPlaneX = aPlanePln.XAxis().Direction(); + gp_Dir aPlaneY = aPlanePln.YAxis().Direction(); + gp_Pnt aPlaneCenter = aPlanePln.Location(); switch ( theDragOp ) { @@ -615,6 +615,7 @@ bool OCCViewer_ClipPlaneInteractor::mouseRelease( QMouseEvent* theEvent, myInteractedPlane = NULL; myIsDraggable = false; myIsClickable = false; + myViewer->getAISContext()->ClearSelected( Standard_True ); return true; } diff --git a/src/OCCViewer/OCCViewer_ClippingDlg.cxx b/src/OCCViewer/OCCViewer_ClippingDlg.cxx index 0805a55f9..dc5767654 100644 --- a/src/OCCViewer/OCCViewer_ClippingDlg.cxx +++ b/src/OCCViewer/OCCViewer_ClippingDlg.cxx @@ -37,8 +37,6 @@ #include "OCCViewer_ViewManager.h" #include "OCCViewer_ClipPlaneInteractor.h" -#include - #include #include #include @@ -47,11 +45,7 @@ #include #include #include -#if OCC_VERSION_LARGE > 0x06080000 - #include -#else - #include -#endif +#include #include #include #include @@ -99,7 +93,6 @@ void getMinMaxFromContext( Handle(AIS_InteractiveContext) ic, if ( !aPrs->IsEmpty() && !aPrs->IsInfinite() ) { isFound = true; double xmin, ymin, zmin, xmax, ymax, zmax; -#if OCC_VERSION_LARGE > 0x06070100 Bnd_Box aBox = aPrs->MinMaxValues(); xmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X(); ymin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y(); @@ -107,9 +100,6 @@ void getMinMaxFromContext( Handle(AIS_InteractiveContext) ic, xmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().X(); ymax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Y(); zmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Z(); -#else - aPrs->MinMaxValues( xmin, ymin, zmin, xmax, ymax, zmax ); -#endif aXMin = qMin( aXMin, xmin ); aXMax = qMax( aXMax, xmax ); aYMin = qMin( aYMin, ymin ); aYMax = qMax( aYMax, ymax ); aZMin = qMin( aZMin, zmin ); aZMax = qMax( aZMax, zmax ); @@ -646,8 +636,10 @@ OCCViewer_ClippingDlg::OCCViewer_ClippingDlg(OCCViewer_ViewWindow* parent , OCCV OCCViewer_ViewManager* aViewMgr = (OCCViewer_ViewManager*) myModel->getViewManager(); myInteractor = new OCCViewer_ClipPlaneInteractor( aViewMgr, this ); - connect( myInteractor, SIGNAL( planeClicked( const Handle(AIS_Plane)& ) ), SLOT( onPlaneClicked( const Handle(AIS_Plane)& ) ) ); - connect( myInteractor, SIGNAL( planeDragged( const Handle(AIS_Plane)& ) ), SLOT( onPlaneDragged( const Handle(AIS_Plane)& ) ) ); + connect( myInteractor, SIGNAL( planeClicked( const Handle_AIS_Plane& ) ), + SLOT( onPlaneClicked( const Handle_AIS_Plane& ) ) ); + connect( myInteractor, SIGNAL( planeDragged( const Handle_AIS_Plane& ) ), + SLOT( onPlaneDragged( const Handle_AIS_Plane& ) ) ); myLocalPlanes = myModel->getClipPlanes(); synchronize(); diff --git a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx index f081f6ed0..4c4ae27b0 100755 --- a/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx +++ b/src/OCCViewer/OCCViewer_CreateRestoreViewDlg.cxx @@ -129,9 +129,6 @@ void OCCViewer_CreateRestoreViewDlg::changeImage( QListWidgetItem* curItem ) Standard_Boolean prev = aView3d->SetImmediateUpdate( Standard_False ); aView3d->SetScale( myCurrentItem.scale ); -#if OCC_VERSION_LARGE <= 0x06070100 - aView3d->SetCenter( myCurrentItem.centerX, myCurrentItem.centerY ); -#endif aView3d->SetProj( myCurrentItem.projX, myCurrentItem.projY, myCurrentItem.projZ ); aView3d->SetTwist( myCurrentItem.twist ); aView3d->SetAt( myCurrentItem.atX, myCurrentItem.atY, myCurrentItem.atZ ); diff --git a/src/OCCViewer/OCCViewer_CubeAxesDlg.cxx b/src/OCCViewer/OCCViewer_CubeAxesDlg.cxx index 8a8c93c28..992e4a5d5 100644 --- a/src/OCCViewer/OCCViewer_CubeAxesDlg.cxx +++ b/src/OCCViewer/OCCViewer_CubeAxesDlg.cxx @@ -29,11 +29,7 @@ #include "QtxAction.h" #include "QtxIntSpinBox.h" -#include - -#if OCC_VERSION_LARGE > 0x06080000 #include -#endif #include #include @@ -264,7 +260,6 @@ void OCCViewer_CubeAxesDlg::ApplyData( const Handle(V3d_View)& theView ) // font support will be introduced in OCC-6.4) int aGap = 20; -#if OCC_VERSION_LARGE > 0x06080000 Graphic3d_GraduatedTrihedron gt; // main params gt.SetDrawGrid(Standard_True); // to draw grid @@ -292,60 +287,6 @@ void OCCViewer_CubeAxesDlg::ApplyData( const Handle(V3d_View)& theView ) } // draw trihedron theView->GraduatedTrihedronDisplay(gt); -#else - theView->GraduatedTrihedronDisplay( - anAxisData[0].Name.toLatin1().constData(), - anAxisData[1].Name.toLatin1().constData(), - anAxisData[2].Name.toLatin1().constData(), - anAxisData[0].DrawName, - anAxisData[1].DrawName, - anAxisData[2].DrawName, - anAxisData[0].DrawValues, - anAxisData[1].DrawValues, - anAxisData[2].DrawValues, - Standard_True, // draw grid - Standard_False, // draw axes - anAxisData[0].NbValues - 1, - anAxisData[1].NbValues - 1, - anAxisData[2].NbValues - 1, - anAxisData[0].Offset, - anAxisData[1].Offset, - anAxisData[2].Offset, - anAxisData[0].Offset + aGap, // see above - anAxisData[1].Offset + aGap, // see above - anAxisData[2].Offset + aGap, // see above - anAxisData[0].DrawTickmarks, - anAxisData[1].DrawTickmarks, - anAxisData[2].DrawTickmarks, - anAxisData[0].TickmarkLength, - anAxisData[1].TickmarkLength, - anAxisData[2].TickmarkLength, - Quantity_NOC_WHITE, // grid color - Quantity_Color( anAxisData[0].NameColor.redF(), - anAxisData[0].NameColor.greenF(), - anAxisData[0].NameColor.blueF(), - Quantity_TOC_RGB ), - Quantity_Color( anAxisData[1].NameColor.redF(), - anAxisData[1].NameColor.greenF(), - anAxisData[1].NameColor.blueF(), - Quantity_TOC_RGB ), - Quantity_Color( anAxisData[2].NameColor.redF(), - anAxisData[2].NameColor.greenF(), - anAxisData[2].NameColor.blueF(), - Quantity_TOC_RGB ), - Quantity_Color( anAxisData[0].Color.redF(), - anAxisData[0].Color.greenF(), - anAxisData[0].Color.blueF(), - Quantity_TOC_RGB ), - Quantity_Color( anAxisData[1].Color.redF(), - anAxisData[1].Color.greenF(), - anAxisData[1].Color.blueF(), - Quantity_TOC_RGB ), - Quantity_Color( anAxisData[2].Color.redF(), - anAxisData[2].Color.greenF(), - anAxisData[2].Color.blueF(), - Quantity_TOC_RGB ) ); -#endif // OCC_VERSION_LARGE > 0x06080000 } else theView->GraduatedTrihedronErase(); diff --git a/src/OCCViewer/OCCViewer_EnvTextureDlg.cxx b/src/OCCViewer/OCCViewer_EnvTextureDlg.cxx index b6e952481..4ed2aab2e 100644 --- a/src/OCCViewer/OCCViewer_EnvTextureDlg.cxx +++ b/src/OCCViewer/OCCViewer_EnvTextureDlg.cxx @@ -169,11 +169,7 @@ void OCCViewer_EnvTextureDlg::onEnvTexture( bool theIsChecked ) onTextureChanged(); else { Handle(Graphic3d_TextureEnv) aTexture; -#if OCC_VERSION_LARGE > 0x07000000 setEnvTexture( aTexture ); -#else - setEnvTexture( aTexture, V3d_TEX_ALL ); -#endif } } @@ -200,11 +196,7 @@ void OCCViewer_EnvTextureDlg::onTextureChanged() << Graphic3d_NOT_ENV_LINES << Graphic3d_NOT_ENV_ROAD; aTexture = new Graphic3d_TextureEnv( aTextures.at( myEnvTextureId->currentIndex() ) ); } -#if OCC_VERSION_LARGE > 0x07000000 setEnvTexture( aTexture ); -#else - setEnvTexture( aTexture, V3d_TEX_ENVIRONMENT ); -#endif } /*! @@ -232,19 +224,12 @@ void OCCViewer_EnvTextureDlg::ClickOnHelp() /*! Sets current texture environment for all view in the viewer */ -#if OCC_VERSION_LARGE > 0x07000000 void OCCViewer_EnvTextureDlg::setEnvTexture( Handle(Graphic3d_TextureEnv) theTexture) -#else -void OCCViewer_EnvTextureDlg::setEnvTexture( Handle(Graphic3d_TextureEnv) theTexture, V3d_TypeOfSurfaceDetail theMode ) -#endif { for ( int i = OCCViewer_ViewFrame::BOTTOM_RIGHT; i <= OCCViewer_ViewFrame::TOP_RIGHT; i++ ) { if ( OCCViewer_ViewWindow* aViewWindow = myViewFrame->getView(i) ) { Handle(V3d_View) aView = aViewWindow->getViewPort()->getView(); aView->SetTextureEnv( theTexture ); -#if OCC_VERSION_LARGE <= 0x07000000 - aView->SetSurfaceDetail( theMode ); -#endif aView->Redraw(); } } diff --git a/src/OCCViewer/OCCViewer_EnvTextureDlg.h b/src/OCCViewer/OCCViewer_EnvTextureDlg.h index d06c67985..2580bc12f 100644 --- a/src/OCCViewer/OCCViewer_EnvTextureDlg.h +++ b/src/OCCViewer/OCCViewer_EnvTextureDlg.h @@ -23,7 +23,6 @@ #include "OCCViewer.h" #include #include -#include class OCCViewer_ViewWindow; class OCCViewer_ViewFrame; @@ -51,11 +50,7 @@ private slots: private: void initParam(); -#if OCC_VERSION_LARGE > 0x07000000 void setEnvTexture( Handle(Graphic3d_TextureEnv) ); -#else - void setEnvTexture( Handle(Graphic3d_TextureEnv), V3d_TypeOfSurfaceDetail ); -#endif OCCViewer_ViewFrame* myViewFrame; Handle(V3d_View) myView3d; diff --git a/src/OCCViewer/OCCViewer_Trihedron.cxx b/src/OCCViewer/OCCViewer_Trihedron.cxx index d13af530e..7cce7c2cc 100644 --- a/src/OCCViewer/OCCViewer_Trihedron.cxx +++ b/src/OCCViewer/OCCViewer_Trihedron.cxx @@ -49,7 +49,7 @@ #define PI 3.14159265359 -OCCT_IMPLEMENT_STANDARD_RTTIEXT( OCCViewer_Trihedron, AIS_InteractiveObject ) +IMPLEMENT_STANDARD_RTTIEXT( OCCViewer_Trihedron, AIS_InteractiveObject ) /*! * Constructor @@ -72,7 +72,6 @@ OCCViewer_Trihedron::~OCCViewer_Trihedron() /*! * Sets the bounding box (MinMax values). */ -#if OCC_VERSION_LARGE > 0x06070100 // for OCC-6.7.2 and higher version void OCCViewer_Trihedron::bounds( Graphic3d_BndBox4f& theMinMax ) const { Graphic3d_Vec4 aMinPt (-1.f, -1.f, -1.f, 1.f); @@ -81,20 +80,6 @@ void OCCViewer_Trihedron::bounds( Graphic3d_BndBox4f& theMinMax ) const theMinMax.Add (aMinPt); theMinMax.Add (aMaxPt); } -#else -void OCCViewer_Trihedron::bounds( Graphic3d_CBounds& aMinMax ) const -{ - Standard_Real aXMin = -1, aYMin = -1, aZMin = -1; - Standard_Real aXMax = 1, aYMax = 1, aZMax = 1; - - if( aMinMax.XMin > aXMin ) aMinMax.XMin = aXMin; - if( aMinMax.YMin > aYMin ) aMinMax.YMin = aYMin; - if( aMinMax.ZMin > aZMin ) aMinMax.ZMin = aZMin; - if( aMinMax.XMax < aXMax ) aMinMax.XMax = aXMax; - if( aMinMax.YMax < aYMax ) aMinMax.YMax = aYMax; - if( aMinMax.ZMax < aZMax ) aMinMax.ZMax = aZMax; -} -#endif /*! * Redefined method. Calculates the object presentation. diff --git a/src/OCCViewer/OCCViewer_Trihedron.h b/src/OCCViewer/OCCViewer_Trihedron.h index 0618e4f20..92e7b5876 100644 --- a/src/OCCViewer/OCCViewer_Trihedron.h +++ b/src/OCCViewer/OCCViewer_Trihedron.h @@ -23,12 +23,7 @@ #include "OCCViewer.h" #include -#include -#if OCC_VERSION_LARGE > 0x06070100 // for OCC-6.7.2 and higher version - #include -#else - #include -#endif +#include #include /*! @@ -48,20 +43,16 @@ public: virtual void ComputeSelection( const Handle( SelectMgr_Selection )&, const Standard_Integer ); -#if OCC_VERSION_LARGE > 0x06070100 virtual void bounds( Graphic3d_BndBox4f& ) const; -#else - virtual void bounds( Graphic3d_CBounds& ) const; -#endif virtual void display(); - OCCT_DEFINE_STANDARD_RTTIEXT(OCCViewer_Trihedron,AIS_InteractiveObject) + DEFINE_STANDARD_RTTIEXT(OCCViewer_Trihedron, AIS_InteractiveObject) private: unsigned int myTextList; }; -DEFINE_STANDARD_HANDLE( OCCViewer_Trihedron, AIS_InteractiveObject ) +DEFINE_STANDARD_HANDLE(OCCViewer_Trihedron, AIS_InteractiveObject) -#endif +#endif // OCCVIEWER_TRIHEDRON_H diff --git a/src/OCCViewer/OCCViewer_Utilities.cxx b/src/OCCViewer/OCCViewer_Utilities.cxx index e88b29182..9a560d77a 100755 --- a/src/OCCViewer/OCCViewer_Utilities.cxx +++ b/src/OCCViewer/OCCViewer_Utilities.cxx @@ -27,15 +27,9 @@ #include "QtxActionToolMgr.h" #include "QtxMultiAction.h" -// KERNEL includes -#include - // OCC includes #include #include -#if OCC_VERSION_LARGE < 0x07000000 -#include -#endif // QT includes #include @@ -52,7 +46,6 @@ Handle(Image_PixMap) OCCViewer_Utilities::imageToPixmap( const QImage& anImage ) const uchar* aImageBytes = anImage.bits(); for ( int aLine = anImage.height() - 1; aLine >= 0; --aLine ) { -#if OCC_VERSION_LARGE > 0x06070100 // convert pixels from ARGB to renderer-compatible RGBA for ( int aByte = 0; aByte < anImage.width(); ++aByte ) { Image_ColorBGRA& aPixmapBytes = aPixmap->ChangeValue(aLine, aByte); @@ -62,18 +55,6 @@ Handle(Image_PixMap) OCCViewer_Utilities::imageToPixmap( const QImage& anImage ) aPixmapBytes.r() = (Standard_Byte) *aImageBytes++; aPixmapBytes.a() = (Standard_Byte) *aImageBytes++; } -#else - Image_ColorBGRA* aPixmapBytes = aPixmap->EditData().ChangeRow(aLine); - - // convert pixels from ARGB to renderer-compatible RGBA - for ( int aByte = 0; aByte < anImage.width(); ++aByte ) { - aPixmapBytes->b() = (Standard_Byte) *aImageBytes++; - aPixmapBytes->g() = (Standard_Byte) *aImageBytes++; - aPixmapBytes->r() = (Standard_Byte) *aImageBytes++; - aPixmapBytes->a() = (Standard_Byte) *aImageBytes++; - aPixmapBytes++; - } -#endif } } return aPixmap; @@ -170,7 +151,6 @@ bool OCCViewer_Utilities::computeVisibleBounds( const Handle(V3d_View) theView, aStructure->IsInfinite() || aStructure->CStructure()->IsForHighlight ) continue; double aBounds[6]; -#if OCC_VERSION_LARGE > 0x06070100 Bnd_Box aBox = aStructure->MinMaxValues(); aBounds[0] = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X(); aBounds[2] = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y(); @@ -178,10 +158,6 @@ bool OCCViewer_Utilities::computeVisibleBounds( const Handle(V3d_View) theView, aBounds[1] = aBox.IsVoid() ? RealLast() : aBox.CornerMax().X(); aBounds[3] = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Y(); aBounds[5] = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Z(); -#else - aStructure->MinMaxValues( aBounds[0], aBounds[2], aBounds[4], - aBounds[1], aBounds[3], aBounds[5] ); -#endif if ( aBounds[0] > -DBL_MAX && aBounds[1] < DBL_MAX && aBounds[2] > -DBL_MAX && aBounds[3] < DBL_MAX && diff --git a/src/OCCViewer/OCCViewer_VService.cxx b/src/OCCViewer/OCCViewer_VService.cxx index a9cd79fe7..048b43348 100644 --- a/src/OCCViewer/OCCViewer_VService.cxx +++ b/src/OCCViewer/OCCViewer_VService.cxx @@ -25,13 +25,7 @@ #include #include -#include -#if OCC_VERSION_LARGE > 0x06070200 // for OCC-6.7.3 and higher version #include -#else -#include -#include -#endif #include #if defined(WIN32) @@ -71,11 +65,7 @@ Handle(V3d_Viewer) OCCViewer_VService::CreateViewer( const Standard_ExtString na const Standard_Boolean computedMode, const Standard_Boolean defaultComputedMode ) { -#if OCC_VERSION_LARGE > 0x06070200 // for OCC-6.7.3 and higher version static Handle(OpenGl_GraphicDriver) aGraphicDriver; -#else - static Handle(Graphic3d_GraphicDriver) aGraphicDriver; -#endif if (aGraphicDriver.IsNull()) { Handle(Aspect_DisplayConnection) aDisplayConnection; @@ -84,25 +74,10 @@ Handle(V3d_Viewer) OCCViewer_VService::CreateViewer( const Standard_ExtString na #else aDisplayConnection = new Aspect_DisplayConnection(); #endif -#if OCC_VERSION_LARGE > 0x06070200 // for OCC-6.7.3 and higher version aGraphicDriver = new OpenGl_GraphicDriver(aDisplayConnection); -#else - aGraphicDriver = Graphic3d::InitGraphicDriver( aDisplayConnection ); -#endif } -#if OCC_VERSION_LARGE > 0x07010001 return new V3d_Viewer( aGraphicDriver, name, domain, viewSize, viewProjection, Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, computedMode, defaultComputedMode ); - -#elif OCC_VERSION_LARGE > 0x07000000 - return new V3d_Viewer( aGraphicDriver, name, domain, viewSize, viewProjection, - Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, - computedMode, defaultComputedMode ); -#else - return new V3d_Viewer( aGraphicDriver, name, domain, viewSize, viewProjection, - Quantity_NOC_GRAY30, V3d_ZBUFFER, V3d_GOURAUD, V3d_WAIT, - computedMode, defaultComputedMode, V3d_TEX_NONE ); -#endif } diff --git a/src/OCCViewer/OCCViewer_ViewFrame.cxx b/src/OCCViewer/OCCViewer_ViewFrame.cxx index 222a292bc..9656c64b4 100644 --- a/src/OCCViewer/OCCViewer_ViewFrame.cxx +++ b/src/OCCViewer/OCCViewer_ViewFrame.cxx @@ -186,9 +186,6 @@ void OCCViewer_ViewFrame::setSubViewParams( OCCViewer_ViewWindow* theView ) // set environment texture parameters aView->SetTextureEnv( aMainView->TextureEnv() ); -#if OCC_VERSION_LARGE <= 0x07000000 - aView->SetSurfaceDetail( aMainView->SurfaceDetail() ); -#endif } void OCCViewer_ViewFrame::splitSubViews() diff --git a/src/OCCViewer/OCCViewer_ViewModel.cxx b/src/OCCViewer/OCCViewer_ViewModel.cxx index 0b0ce6a97..9de784810 100644 --- a/src/OCCViewer/OCCViewer_ViewModel.cxx +++ b/src/OCCViewer/OCCViewer_ViewModel.cxx @@ -37,8 +37,6 @@ #include "ViewerData_AISShape.hxx" -#include - #include "QtxActionToolMgr.h" #include "QtxBackgroundTool.h" @@ -54,11 +52,7 @@ #include #include -#if OCC_VERSION_LARGE > 0x06080000 - #include -#else - #include -#endif +#include #include #include @@ -74,10 +68,6 @@ #include #include -#if OCC_VERSION_MAJOR < 7 - #include -#endif - /*! Get data for supported background modes: gradient types, identifiers and supported image formats */ @@ -130,18 +120,16 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron) // init selector myAISContext = new AIS_InteractiveContext( myV3dViewer ); -#if OCC_VERSION_LARGE > 0x07010100 myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_LocalSelected)->SetColor( Quantity_NOC_WHITE ); myAISContext->HighlightStyle(Prs3d_TypeOfHighlight_Selected)->SetColor( Quantity_NOC_WHITE ); -#elif OCC_VERSION_LARGE > 0x07000000 - const Handle(Graphic3d_HighlightStyle)& sStyle = myAISContext->SelectionStyle(); - sStyle->SetColor( Quantity_NOC_WHITE ); -#else - myAISContext->SelectionColor( Quantity_NOC_WHITE ); -#endif // display isoline on planar faces (box for ex.) myAISContext->IsoOnPlane( true ); + + // create color scale + myColorScale = new AIS_ColorScale(); + myColorScale->SetZLayer( Graphic3d_ZLayerId_TopOSD ); + myColorScale->SetTransformPersistence( Graphic3d_TransformPers::FromDeprecatedParams( Graphic3d_TMF_2d, gp_Pnt(-1, -1, 0) ) ); /* create trihedron */ if ( DisplayTrihedron ) @@ -154,13 +142,8 @@ OCCViewer_Viewer::OCCViewer_Viewer( bool DisplayTrihedron) //myTrihedron->SetColor( Col ); myTrihedron->SetArrowColor( Col.Name() ); myTrihedron->SetSize(100); -#if OCC_VERSION_LARGE > 0x06080000 - Handle(Prs3d_Drawer) drawer = myTrihedron->Attributes(); - if (drawer->HasOwnDatumAspect()) { -#else - Handle(AIS_Drawer) drawer = myTrihedron->Attributes(); - if (drawer->HasDatumAspect()) { -#endif + Handle(Prs3d_Drawer) drawer = myTrihedron->Attributes(); + if (drawer->HasOwnDatumAspect()) { Handle(Prs3d_DatumAspect) daspect = drawer->DatumAspect(); daspect->FirstAxisAspect()->SetColor(Quantity_Color(1.0, 0.0, 0.0, Quantity_TOC_RGB)); daspect->SecondAxisAspect()->SetColor(Quantity_Color(0.0, 1.0, 0.0, Quantity_TOC_RGB)); @@ -271,9 +254,6 @@ void OCCViewer_Viewer::initView( OCCViewer_ViewWindow* view ) OCCViewer_ViewPort3d* vp3d = view->getViewPort(); if ( vp3d ) { -#if OCC_VERSION_LARGE <= 0x07000000 - vp3d->getView()->SetSurfaceDetail(V3d_TEX_ALL); -#endif // connect signal from viewport connect(vp3d, SIGNAL(vpClosed(OCCViewer_ViewPort3d*)), this, SLOT(onViewClosed(OCCViewer_ViewPort3d*))); connect(vp3d, SIGNAL(vpMapped(OCCViewer_ViewPort3d*)), this, SLOT(onViewMapped(OCCViewer_ViewPort3d*))); @@ -1254,6 +1234,28 @@ void OCCViewer_Viewer::setTransparency( const Handle(AIS_InteractiveObject)& obj myV3dViewer->Update(); } +bool OCCViewer_Viewer::isColorScaleVisible() const +{ + return !myColorScale.IsNull() && !myAISContext.IsNull() && myAISContext->IsDisplayed( myColorScale ); +} + +void OCCViewer_Viewer::setColorScaleShown( const bool on ) +{ + if ( myColorScale.IsNull() ) + return; + if ( on ) + { + if ( !myAISContext->IsDisplayed( myColorScale ) ) + myAISContext->Display( myColorScale, Standard_True ); + myAISContext->Redisplay( myColorScale, Standard_True, Standard_True ); + } + else + { + if ( myAISContext->IsDisplayed( myColorScale ) ) + myAISContext->Erase( myColorScale, Standard_True ); + } +} + /*! Changes visibility of trihedron to opposite */ @@ -1459,7 +1461,6 @@ double OCCViewer_Viewer::computeSceneSize(const Handle(V3d_View)& view3d) const double aMaxSide = 0; double Xmin = 0, Ymin = 0, Zmin = 0, Xmax = 0, Ymax = 0, Zmax = 0; -#if OCC_VERSION_LARGE > 0x06070100 Bnd_Box aBox = view3d->View()->MinMaxValues(); Xmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X(); Ymin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y(); @@ -1467,9 +1468,6 @@ double OCCViewer_Viewer::computeSceneSize(const Handle(V3d_View)& view3d) const Xmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().X(); Ymax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Y(); Zmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Z(); -#else - view3d->View()->MinMaxValues( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax ); -#endif if ( Xmin != RealFirst() && Ymin != RealFirst() && Zmin != RealFirst() && Xmax != RealLast() && Ymax != RealLast() && Zmax != RealLast() ) diff --git a/src/OCCViewer/OCCViewer_ViewModel.h b/src/OCCViewer/OCCViewer_ViewModel.h index 329bb05bd..6e80da203 100755 --- a/src/OCCViewer/OCCViewer_ViewModel.h +++ b/src/OCCViewer/OCCViewer_ViewModel.h @@ -34,6 +34,7 @@ #include "SUIT_ViewModel.h" #include +#include #include #include #include @@ -111,6 +112,9 @@ public: Qtx::BackgroundData background(int theViewId) const; void setBackground( int theViewId, const Qtx::BackgroundData& ); + bool isColorScaleVisible() const; + virtual void setColorScaleShown( const bool ); + //! returns true if 3d Trihedron in viewer was created bool trihedronActivated() const { return !myTrihedron.IsNull(); } @@ -138,6 +142,7 @@ public: public: Handle(V3d_Viewer) getViewer3d() const { return myV3dViewer;} Handle(AIS_InteractiveContext) getAISContext() const { return myAISContext; } + Handle(AIS_ColorScale) getColorScale() const { return myColorScale; } Handle(AIS_Trihedron) getTrihedron() const { return myTrihedron; } int getTopLayerId(); @@ -240,7 +245,7 @@ protected slots: protected: Handle(V3d_Viewer) myV3dViewer; - + Handle(AIS_ColorScale) myColorScale; Handle(AIS_Trihedron) myTrihedron; Handle(AIS_InteractiveContext) myAISContext; diff --git a/src/OCCViewer/OCCViewer_ViewPort.cxx b/src/OCCViewer/OCCViewer_ViewPort.cxx index d0d2ce19d..331e1ac8f 100755 --- a/src/OCCViewer/OCCViewer_ViewPort.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort.cxx @@ -218,9 +218,7 @@ void OCCViewer_ViewPort::initialize() setBackgroundRole( QPalette::NoRole );//NoBackground ); // set focus policy to threat QContextMenuEvent from keyboard setFocusPolicy( Qt::StrongFocus ); -#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0) && OCC_VERSION_LARGE < 0x07000000) || QT_VERSION >= QT_VERSION_CHECK(5, 6, 0) setAttribute( Qt::WA_PaintOnScreen ); -#endif setAttribute( Qt::WA_NoSystemBackground ); } diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.cxx b/src/OCCViewer/OCCViewer_ViewPort3d.cxx index 784d86c0d..cdf1edfe9 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.cxx +++ b/src/OCCViewer/OCCViewer_ViewPort3d.cxx @@ -40,20 +40,8 @@ #include #include -#if OCC_VERSION_MAJOR < 7 - #include -#endif - -#if OCC_VERSION_LARGE > 0x06070100 #include -#else -#include -#include -#endif - -#if OCC_VERSION_LARGE > 0x07010000 #include -#endif #include "utilities.h" @@ -83,18 +71,7 @@ OCCViewer_ViewPort3d::OCCViewer_ViewPort3d( QWidget* parent, const Handle( V3d_V // VSR: 01/07/2010 commented to avoid SIGSEGV at SALOME exit //selectVisualId(); -#if OCC_VERSION_LARGE > 0x06070100 myActiveView = new V3d_View( viewer, type ); -#else - if ( type == V3d_ORTHOGRAPHIC ) { - myOrthoView = new V3d_OrthographicView( viewer ); - myActiveView = myOrthoView; - myPerspView = 0; - } else { - myPerspView = new V3d_PerspectiveView( viewer ); - myActiveView = myPerspView; - } -#endif setDefaultParams(); @@ -240,44 +217,16 @@ bool OCCViewer_ViewPort3d::syncronize( const OCCViewer_ViewPort3d* ref ) refView->Up( x, y, z ); tgtView->SetUp( x, y, z ); refView->Eye( x, y, z ); tgtView->SetEye( x, y, z ); refView->Proj( x, y, z ); tgtView->SetProj( x, y, z ); -#if OCC_VERSION_LARGE <= 0x06070100 - refView->Center( x, y ); tgtView->SetCenter( x, y ); -#endif tgtView->SetScale( refView->Scale() ); tgtView->SetTwist( refView->Twist() ); /* update */ tgtView->Update(); tgtView->SetImmediateUpdate( Standard_True ); -#if OCC_VERSION_LARGE <= 0x07000000 - tgtView->ZFitAll(); -#endif - return true; -} -#if OCC_VERSION_LARGE <= 0x07000000 -/*! - Returns Z-size of this view. [ public ] -*/ -double OCCViewer_ViewPort3d::getZSize() const -{ - if ( !activeView().IsNull() ) - return activeView()->ZSize(); - return 0; + return true; } -/*! - Sets Z-size of this view ( for both orthographic and perspective ). [ public ] -*/ -void OCCViewer_ViewPort3d::setZSize( double zsize ) -{ - myActiveView->SetZSize( zsize ); - /* if ( !myOrthoView.IsNull() ) - myOrthoView->SetZSize( zsize ); - if ( !myPerspView.IsNull() ) - myPerspView->SetZSize( zsize );*/ -} -#endif /*! Get axial scale to the view @@ -582,10 +531,6 @@ void OCCViewer_ViewPort3d::rotate( int x, int y, void OCCViewer_ViewPort3d::endRotation() { if ( !activeView().IsNull() ) { -#if OCC_VERSION_LARGE <= 0x07000000 - activeView()->ZFitAll( 1.0 ); - activeView()->SetZSize( 0.0 ); -#endif activeView()->Update(); emit vpTransformed( this ); } @@ -606,12 +551,7 @@ void OCCViewer_ViewPort3d::paintEvent( QPaintEvent* e ) QApplication::syncX(); #endif if ( !myPaintersRedrawing ) { -#if OCC_VERSION_MAJOR < 7 - QRect rc = e->rect(); - activeView()->Redraw( rc.x(), rc.y(), rc.width(), rc.height() ); -#else activeView()->Redraw(); -#endif } } OCCViewer_ViewPort::paintEvent( e ); @@ -657,16 +597,8 @@ void OCCViewer_ViewPort3d::fitAll( bool keepScale, bool withZ, bool upd ) Standard_Real margin = 0.01; -#if OCC_VERSION_LARGE > 0x06070100 activeView()->FitAll( margin, upd ); -#if OCC_VERSION_LARGE <= 0x07000000 - if(withZ) - activeView()->ZFitAll(); -#endif -#else - activeView()->FitAll( margin, withZ, upd ); - activeView()->SetZSize(0.); -#endif + emit vpTransformed( this ); } @@ -774,15 +706,7 @@ bool OCCViewer_ViewPort3d::synchronize( OCCViewer_ViewPort* view ) Handle(V3d_View) aView3d = getView(); Handle(V3d_View) aRefView3d = vp3d->getView(); aView3d->SetImmediateUpdate( Standard_False ); -#if OCC_VERSION_LARGE > 0x06070100 aView3d->Camera()->Copy( aRefView3d->Camera() ); -#else - aView3d->SetViewMapping( aRefView3d->ViewMapping() ); - aView3d->SetViewOrientation( aRefView3d->ViewOrientation() ); -#endif -#if OCC_VERSION_LARGE <= 0x07000000 - aView3d->ZFitAll(); -#endif aView3d->SetImmediateUpdate( Standard_True ); aView3d->Update(); blockSignals( blocked ); diff --git a/src/OCCViewer/OCCViewer_ViewPort3d.h b/src/OCCViewer/OCCViewer_ViewPort3d.h index 994284898..013c7db71 100755 --- a/src/OCCViewer/OCCViewer_ViewPort3d.h +++ b/src/OCCViewer/OCCViewer_ViewPort3d.h @@ -23,8 +23,6 @@ #ifndef OCCVIEWER_VIEWPORT3D_H #define OCCVIEWER_VIEWPORT3D_H -#include - #include "OCCViewer_ViewPort.h" #include "Qtx.h" @@ -65,11 +63,6 @@ public: // void setActive( V3d_TypeOfView ); virtual bool syncronize( const OCCViewer_ViewPort3d* ); -#if OCC_VERSION_LARGE <= 0x07000000 - double getZSize() const; - void setZSize( double ); -#endif - void getAxialScale( double&, double&, double& ); virtual void onUpdate(); @@ -128,10 +121,6 @@ private: private: Handle(V3d_View) myActiveView; -#if OCC_VERSION_LARGE <= 0x06070100 - Handle(V3d_View) myOrthoView; - Handle(V3d_View) myPerspView; -#endif bool myBusy; double myScale; bool myIsAdvancedZoomingEnabled; diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 060349844..367c85151 100644 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -52,8 +52,6 @@ #include #include -#include - #include #include #include @@ -82,14 +80,8 @@ #include #include #include -#if OCC_VERSION_LARGE > 0x06090000 #include #include -#endif - -#if OCC_VERSION_MAJOR < 7 - #include -#endif #include #include @@ -410,9 +402,6 @@ bool OCCViewer_ViewWindow::eventFilter( QObject* watched, QEvent* e ) int x1 = (int)( aEvent->x() + width()*delta/100 ); int y1 = (int)( aEvent->y() + height()*delta/100 ); myViewPort->zoom( x, y, x1, y1 ); -#if OCC_VERSION_LARGE <= 0x07000000 - myViewPort->getView()->ZFitAll(); -#endif emit vpTransformationFinished ( ZOOMVIEW ); } } @@ -675,18 +664,11 @@ bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, dou // the ones which lie within the screen limits Standard_Real aScreenLimits[4] = { 0.0, 0.0, 0.0, 0.0 }; -#if OCC_VERSION_LARGE > 0x06070100 // NDC space screen limits aScreenLimits[0] = -1.0; aScreenLimits[1] = 1.0; aScreenLimits[2] = -1.0; aScreenLimits[3] = 1.0; -#else - aView3d->View()->ViewMapping().WindowLimit( aScreenLimits[0], - aScreenLimits[1], - aScreenLimits[2], - aScreenLimits[3] ); -#endif Standard_Integer aPointsNb = 0; @@ -706,7 +688,6 @@ bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, dou if ( aStructure->IsEmpty() || !aStructure->IsVisible() || aStructure->CStructure()->IsForHighlight ) continue; -#if OCC_VERSION_LARGE > 0x06070100 Bnd_Box aBox = aStructure->MinMaxValues(); aXmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X(); aYmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y(); @@ -714,9 +695,6 @@ bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, dou aXmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().X(); aYmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Y(); aZmax = aBox.IsVoid() ? RealLast() : aBox.CornerMax().Z(); -#else - aStructure->MinMaxValues( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax ); -#endif // Infinite structures are skipped Standard_Real aLIM = ShortRealLast() - 1.0; @@ -735,16 +713,9 @@ bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, dou for ( Standard_Integer aPointIt = 0; aPointIt < 8; ++aPointIt ) { const gp_Pnt& aBBPoint = aPoints[aPointIt]; -#if OCC_VERSION_LARGE > 0x06070100 gp_Pnt aProjected = aView3d->Camera()->Project( aBBPoint ); const Standard_Real& U = aProjected.X(); const Standard_Real& V = aProjected.Y(); -#else - Standard_Real U = 0.0; - Standard_Real V = 0.0; - Standard_Real W = 0.0; - aView3d->View()->Projects( aBBPoint.X(), aBBPoint.Y(), aBBPoint.Z(), U, V, W ); -#endif if (U >= aScreenLimits[0] && U <= aScreenLimits[1] @@ -1066,9 +1037,6 @@ void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent) case PANVIEW: case ZOOMVIEW: -#if OCC_VERSION_LARGE <= 0x07000000 - myViewPort->getView()->ZFitAll(); -#endif resetState(); break; @@ -1335,7 +1303,7 @@ void OCCViewer_ViewWindow::createActions() aAction->setStatusTip(tr("DSC_PERSPECTIVE_MODE")); aAction->setCheckable(true); toolMgr()->registerAction( aAction, PerspectiveId ); -#if OCC_VERSION_LARGE > 0x06090000 + // - stereo projection aAction = new QtxAction(tr("MNU_STEREO_MODE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_STEREO" ) ), tr( "MNU_STEREO_MODE" ), 0, this); @@ -1343,7 +1311,7 @@ void OCCViewer_ViewWindow::createActions() aAction->setCheckable(true); toolMgr()->registerAction( aAction, StereoId ); connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onStereoType(bool))); -#endif + // - add exclusive action group QActionGroup* aProjectionGroup = new QActionGroup( this ); aProjectionGroup->addAction( toolMgr()->action( OrthographicId ) ); @@ -1525,9 +1493,7 @@ void OCCViewer_ViewWindow::createToolBar() QtxMultiAction* aScaleAction = new QtxMultiAction( this ); aScaleAction->insertAction( toolMgr()->action( FitAllId ) ); aScaleAction->insertAction( toolMgr()->action( FitRectId ) ); -#if OCC_VERSION_LARGE > 0x06090000 aScaleAction->insertAction( toolMgr()->action( FitSelectionId ) ); -#endif aScaleAction->insertAction( toolMgr()->action( ZoomId ) ); toolMgr()->append( aScaleAction, tid ); @@ -1554,9 +1520,7 @@ void OCCViewer_ViewWindow::createToolBar() toolMgr()->append( OrthographicId, tid ); toolMgr()->append( PerspectiveId, tid ); -#if OCC_VERSION_LARGE > 0x06090000 toolMgr()->append( StereoId, tid ); -#endif toolMgr()->append( ResetId, tid ); } @@ -1721,12 +1685,10 @@ void OCCViewer_ViewWindow::onProjectionType( QAction* theAction ) aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Perspective ); aCamera->SetFOVy(30.0); } -#if OCC_VERSION_LARGE > 0x06090000 if (toolMgr()->action( StereoId )->isChecked()) { aCamera->SetProjectionType ( Graphic3d_Camera::Projection_Stereo ); aCamera->SetFOVy(30.0); } -#endif aView3d->Redraw(); onViewFitAll(); } @@ -1739,7 +1701,6 @@ void OCCViewer_ViewWindow::onProjectionType( QAction* theAction ) */ void OCCViewer_ViewWindow::onStereoType( bool activate ) { -#if OCC_VERSION_LARGE > 0x06090000 Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); @@ -1774,7 +1735,6 @@ void OCCViewer_ViewWindow::onStereoType( bool activate ) if ( isQuadBufferSupport() && !isOpenGlStereoSupport() && stereoType() == QuadBuffer && toolMgr()->action( StereoId )->isChecked() ) SUIT_MessageBox::warning( 0, tr( "WRN_WARNING" ), tr( "WRN_SUPPORT_QUAD_BUFFER" ) ); -#endif } /*! @@ -1789,10 +1749,8 @@ void OCCViewer_ViewWindow::onProjectionType() setProjectionType( Orthographic ); if (toolMgr()->action( PerspectiveId )->isChecked()) setProjectionType( Perspective ); -#if OCC_VERSION_LARGE > 0x06090000 if (toolMgr()->action( StereoId )->isChecked()) setProjectionType( Stereo ); -#endif emit vpTransformationFinished( PROJECTION ); } @@ -1800,9 +1758,7 @@ void OCCViewer_ViewWindow::setProjectionType( int mode ) { QtxAction* anOrthographicAction = dynamic_cast( toolMgr()->action( OrthographicId ) ); QtxAction* aPerspectiveAction = dynamic_cast( toolMgr()->action( PerspectiveId ) ); -#if OCC_VERSION_LARGE > 0x06090000 QtxAction* aStereoAction = dynamic_cast( toolMgr()->action( StereoId ) ); -#endif switch ( mode ) { case Orthographic: onProjectionType( anOrthographicAction ); @@ -1817,17 +1773,12 @@ void OCCViewer_ViewWindow::setProjectionType( int mode ) // update action state if method is called outside if ( mode == Orthographic && !anOrthographicAction->isChecked() ) { anOrthographicAction->setChecked( true ); - #if OCC_VERSION_LARGE > 0x06090000 aStereoAction->setChecked( false ); - #endif } if ( mode == Perspective && !aPerspectiveAction->isChecked() ) { aPerspectiveAction->setChecked( true ); - #if OCC_VERSION_LARGE > 0x06090000 aStereoAction->setChecked( false ); - #endif } -#if OCC_VERSION_LARGE > 0x06090000 if ( mode == Stereo ) { aStereoAction->setChecked( true ); if ( anOrthographicAction->isEnabled() ) { @@ -1860,7 +1811,6 @@ void OCCViewer_ViewWindow::setProjectionType( int mode ) if ( !aPerspectiveAction->isEnabled() ) aPerspectiveAction->setEnabled( true ); } -#endif } /*! @@ -1879,9 +1829,7 @@ void OCCViewer_ViewWindow::onFitAll() void OCCViewer_ViewWindow::onFitSelection() { emit vpTransformationStarted( FITSELECTION ); -#if OCC_VERSION_LARGE > 0x06090000 myModel->getAISContext()->FitSelected( getViewPort()->getView() ); -#endif emit vpTransformationFinished( FITSELECTION ); } @@ -2012,7 +1960,6 @@ void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem, bool base aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ ); aView3d->SetAxialScale( anItem.scaleX, anItem.scaleY, anItem.scaleZ ); -#if OCC_VERSION_LARGE > 0x06070100 if ( anItem.centerX != 0.0 || anItem.centerY != 0.0 ) { double anUpX = 0.0, anUpY = 0.0, anUpZ = 0.0; @@ -2034,9 +1981,6 @@ void OCCViewer_ViewWindow::performRestoring( const viewAspect& anItem, bool base aView3d->SetAt( anAt.X(), anAt.Y(), anAt.Z() ); aView3d->SetProj( anItem.projX, anItem.projY, anItem.projZ ); } -#else - aView3d->SetCenter( anItem.centerX, anItem.centerY ); -#endif if ( !baseParamsOnly ) { @@ -2285,11 +2229,7 @@ QImage OCCViewer_ViewWindow::dumpView() QImage anImage( aWidth, aHeight, QImage::Format_ARGB32 ); for ( int i = 0; i < aWidth; i++ ) { for ( int j = 0; j < aHeight; j++ ) { -#if OCC_VERSION_LARGE > 0x07010001 Quantity_Color pixel = aPix.PixelColor( i, j ).GetRGB(); -#else - Quantity_Color pixel = aPix.PixelColor( i, j ); -#endif QColor color = QColor::fromRgbF( pixel.Red(), pixel.Green(), pixel.Blue() ); anImage.setPixelColor( i, j, color ); } @@ -2308,19 +2248,28 @@ bool OCCViewer_ViewWindow::dumpViewToFormat( const QImage& img, { bool res = false; QApplication::setOverrideCursor( Qt::WaitCursor ); - if ( format != "PS" && format != "EPS") - res = myViewPort->getView()->Dump( fileName.toStdString().c_str() ); -#if OCC_VERSION_MAJOR < 7 - Handle(Visual3d_View) a3dView = myViewPort->getView()->View(); -#else Handle(Graphic3d_CView) a3dView = myViewPort->getView()->View(); -#endif - if (format == "PS") + if (format == "PS") { + Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(myViewPort->getViewer()->Driver()); + OpenGl_Caps* aCaps = &aDriver->ChangeOptions(); + int prev = aCaps->ffpEnable; + aCaps->ffpEnable = 1; res = a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_PostScript); - else if (format == "EPS") + aCaps->ffpEnable = prev; + } + else if (format == "EPS") { + Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(myViewPort->getViewer()->Driver()); + OpenGl_Caps* aCaps = &aDriver->ChangeOptions(); + int prev = aCaps->ffpEnable; + aCaps->ffpEnable = 1; res = a3dView->Export(strdup(qPrintable(fileName)), Graphic3d_EF_EnhPostScript); + aCaps->ffpEnable = prev; + } + else { + res = myViewPort->getView()->Dump( fileName.toStdString().c_str() ); + } QApplication::restoreOverrideCursor(); return res; @@ -2360,15 +2309,9 @@ void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x, const doub gp_Pln pln (gp_Pnt(x, y, z), gp_Dir(dx, dy, dz)); double a, b, c, d; pln.Coefficients(a, b, c, d); -#if OCC_VERSION_LARGE > 0x07000000 Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = view->ClipPlanes(); Graphic3d_SequenceOfHClipPlane::Iterator anIter (*aPlanes); if(aPlanes->Size() > 0 ) { -#else - Graphic3d_SequenceOfHClipPlane aPlanes = view->GetClipPlanes(); - Graphic3d_SequenceOfHClipPlane::Iterator anIter (aPlanes); - if(aPlanes.Size() > 0 ) { -#endif Handle(Graphic3d_ClipPlane) aClipPlane = anIter.Value(); aClipPlane->SetEquation(pln); aClipPlane->SetOn(Standard_True); @@ -2377,13 +2320,8 @@ void OCCViewer_ViewWindow::setCuttingPlane( bool on, const double x, const doub } } else { -#if OCC_VERSION_LARGE > 0x07000000 Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = view->ClipPlanes(); Graphic3d_SequenceOfHClipPlane::Iterator anIter (*aPlanes); -#else - Graphic3d_SequenceOfHClipPlane aPlanes = view->GetClipPlanes(); - Graphic3d_SequenceOfHClipPlane::Iterator anIter (aPlanes); -#endif for( ;anIter.More();anIter.Next() ){ Handle(Graphic3d_ClipPlane) aClipPlane = anIter.Value(); aClipPlane->SetOn(Standard_False); @@ -2410,13 +2348,8 @@ bool OCCViewer_ViewWindow::isCuttingPlane() { Handle(V3d_View) view = myViewPort->getView(); bool res = false; -#if OCC_VERSION_LARGE > 0x07000000 Handle(Graphic3d_SequenceOfHClipPlane) aPlanes = view->ClipPlanes(); Graphic3d_SequenceOfHClipPlane::Iterator anIter (*aPlanes); -#else - Graphic3d_SequenceOfHClipPlane aPlanes = view->GetClipPlanes(); - Graphic3d_SequenceOfHClipPlane::Iterator anIter (aPlanes); -#endif for( ;anIter.More();anIter.Next() ) { Handle(Graphic3d_ClipPlane) aClipPlane = anIter.Value(); if(aClipPlane->IsOn()) { @@ -2470,10 +2403,6 @@ viewAspect OCCViewer_ViewWindow::getViewParams() const params.isVisible= isShown; params.size = size; -#if OCC_VERSION_LARGE <= 0x06070100 // the property is deprecated after OCCT 6.7.1 - aView3d->Center( params.centerX, params.centerY ); -#endif - // graduated trihedron bool anIsVisible = false; OCCViewer_AxisWidget::AxisData anAxisData[3]; @@ -2534,10 +2463,6 @@ QString OCCViewer_ViewWindow::getVisualParameters() QStringList data; data << QString( "scale=%1" ) .arg( params.scale, 0, 'e', 12 ); -#if OCC_VERSION_LARGE <= 0x06070100 // the property is deprecated after OCCT 6.7.1 - data << QString( "centerX=%1" ) .arg( params.centerX, 0, 'e', 12 ); - data << QString( "centerY=%1" ) .arg( params.centerY, 0, 'e', 12 ); -#endif data << QString( "projX=%1" ) .arg( params.projX, 0, 'e', 12 ); data << QString( "projY=%1" ) .arg( params.projY, 0, 'e', 12 ); data << QString( "projZ=%1" ) .arg( params.projZ, 0, 'e', 12 ); @@ -2836,9 +2761,6 @@ void OCCViewer_ViewWindow::setVisualParameters( const QString& parameters ) aTexture = new Graphic3d_TextureEnv( TCollection_AsciiString( et_paramValue.toStdString().c_str() ) ); Handle(V3d_View) aView = this->getViewPort()->getView(); aView->SetTextureEnv( aTexture ); -#if OCC_VERSION_LARGE <= 0x07000000 - aView->SetSurfaceDetail( V3d_TEX_ENVIRONMENT ); -#endif } } else if ( paramName == "lightSource" ) @@ -3210,10 +3132,8 @@ int OCCViewer_ViewWindow::projectionType() const mode = Perspective; if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Orthographic) mode = Orthographic; - #if OCC_VERSION_LARGE > 0x06090000 if (aCamera->ProjectionType() == Graphic3d_Camera::Projection_Stereo) mode = Stereo; - #endif } return mode; } @@ -3222,10 +3142,8 @@ void OCCViewer_ViewWindow::setStereoType( int type ) { Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); aParams->StereoMode = (Graphic3d_StereoMode)type; - #endif } } @@ -3234,10 +3152,8 @@ int OCCViewer_ViewWindow::stereoType() const int type = QuadBuffer; Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); type = (OCCViewer_ViewWindow::StereoType)aParams->StereoMode; - #endif } return type; } @@ -3246,7 +3162,6 @@ void OCCViewer_ViewWindow::setAnaglyphFilter( int type ) { Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); if (type == RedCyan) aParams->AnaglyphFilter = Graphic3d_RenderingParams::Anaglyph_RedCyan_Optimized; @@ -3254,7 +3169,6 @@ void OCCViewer_ViewWindow::setAnaglyphFilter( int type ) aParams->AnaglyphFilter = Graphic3d_RenderingParams::Anaglyph_YellowBlue_Optimized; if (type == GreenMagenta) aParams->AnaglyphFilter = Graphic3d_RenderingParams::Anaglyph_GreenMagenta_Simple; - #endif } } @@ -3263,7 +3177,6 @@ int OCCViewer_ViewWindow::anaglyphFilter() const int type = RedCyan; Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); if (aParams->AnaglyphFilter == Graphic3d_RenderingParams::Anaglyph_RedCyan_Optimized) type = RedCyan; @@ -3271,7 +3184,6 @@ int OCCViewer_ViewWindow::anaglyphFilter() const type = YellowBlue; if (aParams->AnaglyphFilter == Graphic3d_RenderingParams::Anaglyph_GreenMagenta_Simple) type = GreenMagenta; - #endif } return type; } @@ -3280,10 +3192,8 @@ void OCCViewer_ViewWindow::setStereographicFocus( int type, double value ) { Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); aCamera->SetZFocus( (Graphic3d_Camera::FocusType) type, value ); - #endif } } @@ -3292,10 +3202,8 @@ int OCCViewer_ViewWindow::stereographicFocusType() const int type = Relative; Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); type = (OCCViewer_ViewWindow::FocusIODType)aCamera->ZFocusType(); - #endif } return type; } @@ -3305,10 +3213,8 @@ double OCCViewer_ViewWindow::stereographicFocusValue() const double value = 1.0; Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); value = aCamera->ZFocus(); - #endif } return value; } @@ -3317,10 +3223,8 @@ void OCCViewer_ViewWindow::setInterocularDistance( int type, double value ) { Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); aCamera->SetIOD( (Graphic3d_Camera::IODType) type, value ); - #endif } } @@ -3329,10 +3233,8 @@ int OCCViewer_ViewWindow::interocularDistanceType() const int type = Relative; Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); type = (OCCViewer_ViewWindow::FocusIODType)aCamera->GetIODType(); - #endif } return type; } @@ -3342,10 +3244,8 @@ double OCCViewer_ViewWindow::interocularDistanceValue() const double value = 0.05; Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Handle(Graphic3d_Camera) aCamera = aView3d->Camera(); value = aCamera->IOD(); - #endif } return value; } @@ -3354,10 +3254,8 @@ void OCCViewer_ViewWindow::setReverseStereo( bool reverse ) { Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); aParams->ToReverseStereo = reverse; - #endif } } @@ -3366,10 +3264,8 @@ bool OCCViewer_ViewWindow::isReverseStereo() const int reverse = false; Handle(V3d_View) aView3d = myViewPort->getView(); if ( !aView3d.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Graphic3d_RenderingParams* aParams = &aView3d->ChangeRenderingParams(); reverse = aParams->ToReverseStereo; - #endif } return reverse; } @@ -3378,11 +3274,9 @@ void OCCViewer_ViewWindow::setVSync( bool enable ) { Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext(); if ( !anIntCont.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver()); OpenGl_Caps* aCaps = &aDriver->ChangeOptions(); aCaps->swapInterval = enable; - #endif } } @@ -3391,11 +3285,9 @@ bool OCCViewer_ViewWindow::isVSync() const int enable = true; Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext(); if ( !anIntCont.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver()); OpenGl_Caps* aCaps = &aDriver->ChangeOptions(); enable = aCaps->swapInterval; - #endif } return enable; } @@ -3404,11 +3296,9 @@ void OCCViewer_ViewWindow::setQuadBufferSupport( bool enable ) { Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext(); if ( !anIntCont.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver()); OpenGl_Caps* aCaps = &aDriver->ChangeOptions(); aCaps->contextStereo = enable; - #endif } } @@ -3417,11 +3307,9 @@ bool OCCViewer_ViewWindow::isQuadBufferSupport() const int enable = true; Handle(AIS_InteractiveContext) anIntCont = myModel->getAISContext(); if ( !anIntCont.IsNull() ) { - #if OCC_VERSION_LARGE > 0x06090000 Handle(OpenGl_GraphicDriver) aDriver = Handle(OpenGl_GraphicDriver)::DownCast(anIntCont->CurrentViewer()->Driver()); OpenGl_Caps* aCaps = &aDriver->ChangeOptions(); enable = aCaps->contextStereo; - #endif } return enable; } @@ -3532,7 +3420,6 @@ SUIT_CameraProperties OCCViewer_ViewWindow::cameraProperties() aProps.setAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] ); aProps.setViewUp( anUp[0], anUp[1], anUp[2] ); -#if OCC_VERSION_LARGE > 0x06070100 aSourceView->Eye( anEye[0], anEye[1], anEye[2] ); // store camera properties "as is": it is up to synchronized @@ -3551,50 +3438,6 @@ SUIT_CameraProperties OCCViewer_ViewWindow::cameraProperties() aProps.setViewAngle( aSourceView->Camera()->FOVy() ); } aProps.setMappingScale( aSourceView->Camera()->Scale() ); -#else - Standard_Real aCameraDepth = aSourceView->Depth() + aSourceView->ZSize() * 0.5; - - // generate view orientation matrix for transforming OCC projection reference point - // into a camera (eye) position. - gp_Dir aLeftDir = gp_Dir( anUp[0], anUp[1], anUp[2] ) ^ gp_Dir( aProj[0], aProj[1], aProj[2] ); - - gp_GTrsf aTrsf; - aTrsf.SetValue( 1, 1, aLeftDir.X() ); - aTrsf.SetValue( 2, 1, aLeftDir.Y() ); - aTrsf.SetValue( 3, 1, aLeftDir.Z() ); - - aTrsf.SetValue( 1, 2, anUp[0] ); - aTrsf.SetValue( 2, 2, anUp[1] ); - aTrsf.SetValue( 3, 2, anUp[2] ); - - aTrsf.SetValue( 1, 3, aProj[0] ); - aTrsf.SetValue( 2, 3, aProj[1] ); - aTrsf.SetValue( 3, 3, aProj[2] ); - - aTrsf.SetValue( 1, 4, anAt[0] ); - aTrsf.SetValue( 2, 4, anAt[1] ); - aTrsf.SetValue( 3, 4, anAt[2] ); - - Graphic3d_Vertex aProjRef = aSourceView->ViewMapping().ProjectionReferencePoint(); - - // transform to world-space coordinate system - gp_XYZ aPosition( aProjRef.X(), aProjRef.Y(), aCameraDepth ); - aTrsf.Transforms( aPosition ); - - // compute focal point - double aFocalPoint[3]; - - aFocalPoint[0] = aPosition.X() - aProj[0] * aCameraDepth; - aFocalPoint[1] = aPosition.Y() - aProj[1] * aCameraDepth; - aFocalPoint[2] = aPosition.Z() - aProj[2] * aCameraDepth; - - aProps.setFocalPoint( aFocalPoint[0], aFocalPoint[1], aFocalPoint[2] ); - aProps.setPosition( aPosition.X(), aPosition.Y(), aPosition.Z() ); - - Standard_Real aViewScale[2]; - aSourceView->Size( aViewScale[0], aViewScale[1] ); - aProps.setMappingScale( aViewScale[1] ); -#endif return aProps; } @@ -3630,77 +3473,12 @@ void OCCViewer_ViewWindow::synchronize( SUIT_ViewWindow* theView ) aProps.getViewUp( anUpDir[0], anUpDir[1], anUpDir[2] ); aProps.getAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] ); -#if OCC_VERSION_LARGE > 0x06070100 aDestView->SetAt( aFocalPoint[0], aFocalPoint[1], aFocalPoint[2] ); aDestView->SetEye( aPosition[0], aPosition[1], aPosition[2] ); aDestView->SetUp( anUpDir[0], anUpDir[1], anUpDir[2] ); aDestView->Camera()->SetScale( aProps.getMappingScale() ); -#else - gp_Dir aProjDir( aPosition[0] - aFocalPoint[0], - aPosition[1] - aFocalPoint[1], - aPosition[2] - aFocalPoint[2] ); - - // get custom view translation - Standard_Real aTranslation[3]; - aDestView->At( aTranslation[0], aTranslation[1], aTranslation[2] ); - - gp_Dir aLeftDir = gp_Dir( anUpDir[0], anUpDir[1], anUpDir[2] ) - ^ gp_Dir( aProjDir.X(), aProjDir.Y(), aProjDir.Z() ); - - gp_GTrsf aTrsf; - aTrsf.SetValue( 1, 1, aLeftDir.X() ); - aTrsf.SetValue( 2, 1, aLeftDir.Y() ); - aTrsf.SetValue( 3, 1, aLeftDir.Z() ); - - aTrsf.SetValue( 1, 2, anUpDir[0] ); - aTrsf.SetValue( 2, 2, anUpDir[1] ); - aTrsf.SetValue( 3, 2, anUpDir[2] ); - - aTrsf.SetValue( 1, 3, aProjDir.X() ); - aTrsf.SetValue( 2, 3, aProjDir.Y() ); - aTrsf.SetValue( 3, 3, aProjDir.Z() ); - - aTrsf.SetValue( 1, 4, aTranslation[0] ); - aTrsf.SetValue( 2, 4, aTranslation[1] ); - aTrsf.SetValue( 3, 4, aTranslation[2] ); - aTrsf.Invert(); - - // transform to view-space coordinate system - gp_XYZ aProjRef( aPosition[0], aPosition[1], aPosition[2] ); - aTrsf.Transforms( aProjRef ); - - // set view camera properties using low-level approach. this is done - // in order to avoid interference with static variables in v3d view used - // when rotation is in process in another view. - Visual3d_ViewMapping aMapping = aDestView->View()->ViewMapping(); - Visual3d_ViewOrientation anOrientation = aDestView->View()->ViewOrientation(); - - Graphic3d_Vector aMappingProj( aProjDir.X(), aProjDir.Y(), aProjDir.Z() ); - Graphic3d_Vector aMappingUp( anUpDir[0], anUpDir[1], anUpDir[2] ); - - aMappingProj.Normalize(); - aMappingUp.Normalize(); - - anOrientation.SetViewReferencePlane( aMappingProj ); - anOrientation.SetViewReferenceUp( aMappingUp ); - - aDestView->SetViewMapping( aMapping ); - aDestView->SetViewOrientation( anOrientation ); - - // set panning - aDestView->SetCenter( aProjRef.X(), aProjRef.Y() ); - - // set mapping scale - double aMapScaling = aProps.getMappingScale(); - Standard_Real aWidth, aHeight; - aDestView->Size( aWidth, aHeight ); - aDestView->SetSize ( aWidth > aHeight ? aMapScaling * (aWidth / aHeight) : aMapScaling ); -#endif getViewPort()->setAxialScale( anAxialScale[0], anAxialScale[1], anAxialScale[2] ); -#if OCC_VERSION_LARGE <= 0x07000000 - aDestView->ZFitAll(); -#endif aDestView->SetImmediateUpdate( Standard_True ); aDestView->Redraw(); diff --git a/src/OCCViewer/resources/OCCViewer_msg_fr.ts b/src/OCCViewer/resources/OCCViewer_msg_fr.ts index b75b568c8..1aaa3ec68 100755 --- a/src/OCCViewer/resources/OCCViewer_msg_fr.ts +++ b/src/OCCViewer/resources/OCCViewer_msg_fr.ts @@ -277,27 +277,27 @@ MNU_RAY_TRACING - Ray tracing + Ray tracing DSC_RAY_TRACING - Ray tracing + Ray tracing MNU_ENV_TEXTURE - Environment texture + Texture de l'environnement DSC_ENV_TEXTURE - Environment texture + Texture de l'environnement MNU_LIGHT_SOURCE - Light source + Source de lumière DSC_LIGHT_SOURCE - Light source + Source de lumière OCC_IMAGE_FILES @@ -646,109 +646,109 @@ OCCViewer_RayTracingDlg RAY_TRACING - Ray tracing + Ray tracing DEPTH - Depth + Profondeur SHADOW - Shadows rendering + Rendu des ombres REFLECTION - Specular reflections + Réflexions spéculaires ANTIALIASING - Adaptive anti-aliasing + Anti-crénelage adaptatif TRANSPARENT_SHADOW - Transparent shadow + Ombres transparentes OCCViewer_EnvTextureDlg ENV_TEXTURE - Environment texture + Texture de l'environnement ENV_CLOUDS - Clouds + Nuages ENV_CV - Cv + Cv ENV_MEDIT - Medit + Medit ENV_PEARL - Pearl + Perle ENV_SKY1 - Sky1 + Ciel1 ENV_SKY2 - Sky2 + Ciel2 ENV_LINES - Lines + Lignes ENV_ROAD - Road + Route ENV_CUSTOM - Custom... + Personnalisé... OCCViewer_LightSourceDlg LIGHT_SOURCE - Light source + Source de lumière TYPE - Type + Type DIRECTIONAL - Directional + Directionnel DIRECTION - Direction + Direction POSITIONAL - Positional + Positionnel POSITION - Position + Position COLOR - Color + Couleur HEADLIGHT - Headlight + Lumière frontale BUT_DEFAULT - Default + Défaut diff --git a/src/PVViewer/PVViewer_Behaviors.cxx b/src/PVViewer/PVViewer_Behaviors.cxx index ddaae388f..3c07d0328 100644 --- a/src/PVViewer/PVViewer_Behaviors.cxx +++ b/src/PVViewer/PVViewer_Behaviors.cxx @@ -75,6 +75,7 @@ void PVViewer_Behaviors::instanciateMinimalBehaviors(QMainWindow * desk) // Load plugins distributed with application. pqApplicationCore::instance()->loadDistributedPlugins(); + new pqPipelineContextMenuBehavior(this); new pqDefaultViewBehavior(this); // shows a 3D view as soon as a server connection is made new pqAlwaysConnectedBehavior(this); // client always connected to a server new pqVerifyRequiredPluginBehavior(this); @@ -105,7 +106,7 @@ void PVViewer_Behaviors::instanciateAllBehaviors(QMainWindow * desk) //new pqQtMessageHandlerBehavior(this); // THIS ONE TO EXCLUDE !! see comment above new pqDataTimeStepBehavior(this); new pqSpreadSheetVisibilityBehavior(this); - new pqPipelineContextMenuBehavior(this); + //new pqPipelineContextMenuBehavior(this); new pqUndoRedoBehavior(this); new pqAutoLoadPluginXMLBehavior(this); // auto load plugins GUI stuff new pqPluginDockWidgetsBehavior(desk); diff --git a/src/Prs/SALOME_Prs.h b/src/Prs/SALOME_Prs.h index f7f5e330f..10198c3cb 100755 --- a/src/Prs/SALOME_Prs.h +++ b/src/Prs/SALOME_Prs.h @@ -36,16 +36,12 @@ #include #include -#include +#include class SALOME_View; class SALOME_Displayer; class SALOME_ListIO; -#if OCC_VERSION_MAJOR >= 7 - class SALOME_InteractiveObject; -#else - class Handle_SALOME_InteractiveObject; -#endif +class SALOME_InteractiveObject; /*! \class SALOME_Prs diff --git a/src/PyViewer/resources/PyViewer_msg_fr.ts b/src/PyViewer/resources/PyViewer_msg_fr.ts index 7a52883c0..132733b31 100644 --- a/src/PyViewer/resources/PyViewer_msg_fr.ts +++ b/src/PyViewer/resources/PyViewer_msg_fr.ts @@ -148,27 +148,27 @@ ACT_FIND - Find + Cherche TTP_FIND - Find + Cherche DSC_FIND - Find text + Cherche le text ACT_REPLACE - Replace + Remplace TTP_REPLACE - Find & Replace + Cherche & Remplace DSC_REPLACE - Find and replace text + Cherche et remplace le texte ACT_PREFERENCES diff --git a/src/PyViewer/resources/PyViewer_msg_ja.ts b/src/PyViewer/resources/PyViewer_msg_ja.ts index 35c4e054e..9d95992c0 100644 --- a/src/PyViewer/resources/PyViewer_msg_ja.ts +++ b/src/PyViewer/resources/PyViewer_msg_ja.ts @@ -148,27 +148,27 @@ ACT_FIND - Find + 検索 TTP_FIND - Find + 検索 DSC_FIND - Find text + テキストの検索 ACT_REPLACE - Replace + 置換 TTP_REPLACE - Find & Replace + 検索と置換 DSC_REPLACE - Find and replace text + テキストの検索と置換 ACT_PREFERENCES diff --git a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx index bcd1e54ad..32178b894 100644 --- a/src/SALOME_SWIG/SALOMEGUI_Swig.cxx +++ b/src/SALOME_SWIG/SALOMEGUI_Swig.cxx @@ -484,7 +484,7 @@ void SALOMEGUI_Swig::DisplayOnly( const char* theEntry ) QStringList comps; aStudy->components( comps ); foreach( QString comp, comps ) { - LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( anApp->moduleTitle( comp ), true ); + LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( anApp->moduleTitle( comp ), false ); if ( d ) d->EraseAll( false, false, 0 ); } @@ -594,7 +594,7 @@ void SALOMEGUI_Swig::EraseAll() QStringList comps; aStudy->components( comps ); foreach( QString comp, comps ) { - LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( anApp->moduleTitle( comp ), true ); + LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( anApp->moduleTitle( comp ), false ); if ( d ) d->EraseAll( false, false, 0 ); } } @@ -628,7 +628,7 @@ public: if (!viewMgr) return; SUIT_ViewWindow* window = viewMgr->getActiveView(); if ( window ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getActiveView() ); + SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); if ( view ) { SALOME_Prs* aPrs = view->CreatePrs( myEntry.toLatin1() ); myResult = !aPrs->IsNull(); @@ -658,7 +658,7 @@ void SALOMEGUI_Swig::UpdateView() if (!viewMgr) return; SUIT_ViewWindow* window = viewMgr->getActiveView(); if ( window ) { - SALOME_View* view = dynamic_cast( window->getViewManager()->getActiveView() ); + SALOME_View* view = dynamic_cast( window->getViewManager()->getViewModel() ); if ( view ) view->Repaint(); } diff --git a/src/SVTK/CMakeLists.txt b/src/SVTK/CMakeLists.txt index 493e5651c..611319e14 100755 --- a/src/SVTK/CMakeLists.txt +++ b/src/SVTK/CMakeLists.txt @@ -99,6 +99,7 @@ SET(_other_HEADERS SVTK_Selector.h SVTK_SpaceMouse.h SVTK_Utils.h + SVTK_Hash.h ) # header files / no moc processing / internal diff --git a/src/SVTK/SALOME_Actor.cxx b/src/SVTK/SALOME_Actor.cxx index eafd19747..b0e88eca6 100644 --- a/src/SVTK/SALOME_Actor.cxx +++ b/src/SVTK/SALOME_Actor.cxx @@ -84,9 +84,11 @@ int SALOME_LINE_WIDTH = 3; namespace { int - GetEdgeId(SALOME_Actor* theActor, - vtkPicker* thePicker, - int theObjId) + GetEdgeAndNodesId(SALOME_Actor* theActor, + vtkPicker* thePicker, + int theObjId, + int& theFirstNodeId, + int& theSecondNodeId) { int anEdgeId = 0; if (vtkCell* aPickedCell = theActor->GetElemCell(theObjId)) { @@ -104,6 +106,8 @@ namespace if (aDist < aMinDist) { aMinDist = aDist; anEdgeId = -1 - i; + theFirstNodeId = aSelEdge->GetPointId(0); + theSecondNodeId = aSelEdge->GetPointId(1); } } } @@ -447,15 +451,11 @@ SALOME_Actor if(mySelectionMode != ActorSelection){ TColStd_IndexedMapOfInteger aMapIndex; mySelector->GetIndex( getIO(), aMapIndex ); - switch( mySelectionMode ){ + switch( mySelectionMode ) { case NodeSelection: myHighlightActor->GetProperty()->SetRepresentationToPoints(); myHighlightActor->MapPoints( this, aMapIndex ); break; - case EdgeOfCellSelection: - myHighlightActor->GetProperty()->SetRepresentationToWireframe(); - myHighlightActor->MapEdge( this, aMapIndex ); - break; case CellSelection: case EdgeSelection: case FaceSelection: @@ -465,6 +465,12 @@ SALOME_Actor myHighlightActor->GetProperty()->SetRepresentationToSurface(); myHighlightActor->MapCells( this, aMapIndex ); break; + case EdgeOfCellSelection: + SVTK_IndexedMapOfIds aMapCompositeIndex; + mySelector->GetCompositeIndex( getIO(), aMapCompositeIndex ); + myHighlightActor->GetProperty()->SetRepresentationToWireframe(); + myHighlightActor->MapEdge( this, aMapCompositeIndex ); + break; } myHighlightActor->SetVisibility( GetVisibility() && theIsHighlight ); } @@ -597,20 +603,24 @@ SALOME_Actor if ( aVtkId >= 0 && mySelector->IsValid( this, aVtkId )) { int anObjId = GetElemObjId( aVtkId ); if ( anObjId >= 0 ) { - int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId); + int aFNId, aSNId; + int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId); myIsPreselected = anEdgeId < 0; if(myIsPreselected){ - const TColStd_IndexedMapOfInteger& aMapIndex = myPreHighlightActor->GetMapIndex(); - int anExtent = aMapIndex.Extent(); - anIsChanged |= (anExtent == 0 || anExtent == 1); - anIsChanged |= (anExtent == 2 && (anObjId != aMapIndex(1) || anEdgeId != aMapIndex(2))); - if(anIsChanged){ - TColStd_IndexedMapOfInteger aMapIndex; - aMapIndex.Add( anObjId ); - aMapIndex.Add( anEdgeId ); - + int aFNObjId = GetNodeObjId( aFNId ); + int aSNObjId = GetNodeObjId( aSNId ); + const SVTK_IndexedMapOfIds& aMapIds = myPreHighlightActor->GetMapCompositeIndex(); + int anExtent = aMapIds.Extent(); + anIsChanged |= (anExtent == 0 || (anExtent > 0 && aMapIds(1).size() == 2 && + (aFNObjId != aMapIds(1)[0] || aSNObjId != aMapIds(1)[1] ) ) ); + if( anIsChanged ) { + SVTK_IndexedMapOfIds aMapIds; + SVTK_ListOfInteger aCompositeID; + aCompositeID.push_back( aFNObjId ); + aCompositeID.push_back( aSNObjId ); + aMapIds.Add( aCompositeID ); myPreHighlightActor->GetProperty()->SetRepresentationToWireframe(); - myPreHighlightActor->MapEdge( this, aMapIndex ); + myPreHighlightActor->MapEdge( this, aMapIds ); } myPreHighlightActor->SetVisibility( true ); } @@ -798,6 +808,50 @@ SALOME_Actor else if ( !anIsShift ) mySelector->RemoveIObject( this ); } + break; + } + case EdgeOfCellSelection: + { + SVTK::TPickLimiter aPickLimiter( myCellAreaPicker, this ); + if( theSelectionEvent->myIsRectangle ) + myCellAreaPicker->Pick( x1, y1, x2, y2, aRenderer, SVTK_AreaPicker::RectangleMode ); + else if( theSelectionEvent->myIsPolygon ) + myCellAreaPicker->Pick( theSelectionEvent->myPolygonPoints, aRenderer, SVTK_AreaPicker::PolygonMode ); + + const SVTK_AreaPicker::TVectorIdsMap& aVectorIdsMap = myCellAreaPicker->GetCellIdsMap(); + SVTK_AreaPicker::TVectorIdsMap::const_iterator aMapIter = aVectorIdsMap.find(this); + SVTK_IndexedMapOfIds anIndexes; + if(aMapIter != aVectorIdsMap.end()){ + const SVTK_AreaPicker::TVectorIds& aVectorIds = aMapIter->second; + vtkIdType anEnd = aVectorIds.size(); + for(vtkIdType anId = 0; anId < anEnd; anId++ ) { + int aCellId = aVectorIds[anId]; + if ( !mySelector->IsValid( this, aCellId ) ) + continue; + + int anObjId = GetElemObjId( aCellId ); + if( anObjId != -1 ) { + int aFNId, aSNId; + int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId); + if( anEdgeId < 0 ) { + SVTK_ListOfInteger aCompositeID; + aCompositeID.push_back( GetNodeObjId( aFNId ) ); + aCompositeID.push_back( GetNodeObjId( aSNId ) ); + anIndexes.Add( aCompositeID ); + } + } + } + } + + if ( hasIO() ) { + if( !anIndexes.IsEmpty() ) { + mySelector->AddOrRemoveCompositeIndex( myIO, anIndexes, anIsShift ); + mySelector->AddIObject( this ); + anIndexes.Clear(); + } + else if ( !anIsShift ) + mySelector->RemoveIObject( this ); + } } default: break; @@ -850,11 +904,14 @@ SALOME_Actor if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId ) ) { int anObjId = GetElemObjId( aVtkId ); if( anObjId >= 0 ) { - int anEdgeId = GetEdgeId(this,myCellPicker.GetPointer(),anObjId); + int aFNId, aSNId; + int anEdgeId = GetEdgeAndNodesId(this,myCellPicker.GetPointer(),anObjId,aFNId,aSNId); if( hasIO() && anEdgeId < 0 ) { - mySelector->AddOrRemoveIndex( myIO, anObjId, false ); - mySelector->AddOrRemoveIndex( myIO, anEdgeId, true ); - mySelector->AddIObject( this ); + SVTK_ListOfInteger aCompositeID; + aCompositeID.push_back( GetNodeObjId( aFNId ) ); + aCompositeID.push_back( GetNodeObjId( aSNId ) ); + mySelector->AddOrRemoveCompositeIndex( myIO, aCompositeID, anIsShift ); + mySelector->AddIObject( this ); } } } diff --git a/src/SVTK/SVTK_Actor.cxx b/src/SVTK/SVTK_Actor.cxx index a4e404ee6..d41044469 100644 --- a/src/SVTK/SVTK_Actor.cxx +++ b/src/SVTK/SVTK_Actor.cxx @@ -103,6 +103,14 @@ SVTK_Actor return myMapIndex; } + +const SVTK_IndexedMapOfIds& +SVTK_Actor +::GetMapCompositeIndex() const +{ + return myMapCompositeIndex; +} + void SVTK_Actor ::MapCells(SALOME_Actor* theMapActor, @@ -213,6 +221,34 @@ SVTK_Actor myMapIndex = theMapIndex; } +void +SVTK_Actor +::MapEdge( SALOME_Actor* theMapActor, + const SVTK_IndexedMapOfIds& theMapCompositeIndex) { + myUnstructuredGrid->Initialize(); + myUnstructuredGrid->Allocate(); + + vtkUnstructuredGrid * aSourceGrid = ( vtkUnstructuredGrid * )theMapActor->GetInput(); + GetSource()->SetPoints( aSourceGrid->GetPoints() ); + + int aNbOfParts = theMapCompositeIndex.Extent(); + for(int ind = 1; ind <= aNbOfParts; ind++){ + std::vector aNodesIds = theMapCompositeIndex( ind ); + vtkSmartPointer ids = vtkSmartPointer::New(); + ids->InsertNextId(theMapActor->GetNodeVtkId( aNodesIds[0] ) ); + ids->InsertNextId(theMapActor->GetNodeVtkId( aNodesIds[1] ) ); + myUnstructuredGrid->InsertNextCell(VTK_LINE,ids); + } + + UnShrink(); + if(theMapActor->IsShrunk()){ + SetShrinkFactor(theMapActor->GetShrinkFactor()); + SetShrink(); + } + + myMapCompositeIndex = theMapCompositeIndex; +} + /*! To publish the actor an all its internal devices */ diff --git a/src/SVTK/SVTK_Actor.h b/src/SVTK/SVTK_Actor.h index 3b18d036b..5b27bffeb 100644 --- a/src/SVTK/SVTK_Actor.h +++ b/src/SVTK/SVTK_Actor.h @@ -23,6 +23,7 @@ #ifndef SVTK_ACTOR_H #define SVTK_ACTOR_H +#include "SVTK_Selector.h" #include class vtkRenderer; @@ -32,7 +33,7 @@ class vtkUnstructuredGrid; #include "SVTK.h" #include "SVTK_DeviceActor.h" - +#include "SVTK_Hash.h" #include class SALOME_Actor; @@ -83,11 +84,21 @@ public: MapEdge(SALOME_Actor* theMapActor, const TColStd_IndexedMapOfInteger& theMapIndex); +//! Allow to recostruct selected edges from source SALOME_Actor and map of subindexes using corner node ids + virtual void + MapEdge(SALOME_Actor* theMapActor, + const SVTK_IndexedMapOfIds& theMapCompositeIndex); + + const TColStd_IndexedMapOfInteger& GetMapIndex() const; + const SVTK_IndexedMapOfIds& + GetMapCompositeIndex() const; + protected: TColStd_IndexedMapOfInteger myMapIndex; + SVTK_IndexedMapOfIds myMapCompositeIndex; vtkSmartPointer myUnstructuredGrid; diff --git a/src/SVTK/SVTK_Hash.h b/src/SVTK/SVTK_Hash.h new file mode 100644 index 000000000..4f045d510 --- /dev/null +++ b/src/SVTK/SVTK_Hash.h @@ -0,0 +1,57 @@ +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// 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, or (at your option) any later version. +// +// 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. +// +// 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 +// + +// SALOME SALOMEGUI : +// File : SVTK_Hash.h +// Author : Roman NIKOLAEV + +#ifndef SVTK_HASH_H +#define SVTK_HASH_H + +#include +#include +#include + +typedef std::vector SVTK_ListOfInteger; + +class SVTK_Hasher { + +public: + static Standard_Integer HashCode(const std::vector ids, + const Standard_Integer upper) { + Standard_Integer seed = ids.size(); + for( Standard_Integer i = 0; i < (Standard_Integer) ids.size(); i++ ) { + Standard_Integer v = ids[i]; + seed ^= v + 0x9e3779b9 + ( seed << 6 ) + ( seed >> 2 ); + } + return ::HashCode(seed,upper); + } + + static Standard_Boolean IsEqual(const SVTK_ListOfInteger& theKey1, + const SVTK_ListOfInteger& theKey2) { + return theKey1 == theKey2; + } +}; + +typedef NCollection_IndexedMap SVTK_IndexedMapOfIds; + +#endif // SVTK_HASH_H diff --git a/src/SVTK/SVTK_Selector.cxx b/src/SVTK/SVTK_Selector.cxx index 51b32f21e..885f3485d 100644 --- a/src/SVTK/SVTK_Selector.cxx +++ b/src/SVTK/SVTK_Selector.cxx @@ -23,7 +23,6 @@ // SALOME SALOMEGUI : implementation of desktop and GUI kernel // File : SALOME_Selection.cxx // Author : Nicolas REJNERI - #include "SVTK_SelectorDef.h" #include @@ -106,6 +105,7 @@ SVTK_SelectorDef if(mySelectionMode != theMode){ mySelectionMode = theMode; myMapIOSubIndex.clear(); + myMapIOSubCompositeIndex.clear(); this->EndPickCallback(); } } @@ -120,6 +120,7 @@ SVTK_SelectorDef myIO2Actors.clear(); myIObjects.clear(); myMapIOSubIndex.clear(); + myMapIOSubCompositeIndex.clear(); } /*! @@ -206,6 +207,7 @@ SVTK_SelectorDef myIObjects.erase(theIO); myIO2Actors.erase(theIO); myMapIOSubIndex.erase(theIO); + myMapIOSubCompositeIndex.erase(theIO); return anIsIOBound; } @@ -321,6 +323,29 @@ static bool removeIndex(TColStd_IndexedMapOfInteger& theMapIndex, const int theI return anId != 0; } +static bool removeCompositeIndex( SVTK_IndexedMapOfIds& theMapIndex, const SVTK_ListOfInteger theIds ) +{ + int anId = theMapIndex.FindIndex( theIds ); // i==0 if Index is not in the MapIndex + if( anId ) { + // only the last key can be removed + SVTK_ListOfInteger aLastIds = theMapIndex.FindKey( theMapIndex.Extent() ); + if( aLastIds == theIds ) + theMapIndex.RemoveLast(); + else { + SVTK_IndexedMapOfIds aNewMap; + aNewMap.ReSize(theMapIndex.Extent()-1); + for( int j = 1; j <= theMapIndex.Extent(); j++ ){ + SVTK_ListOfInteger anIds = theMapIndex( j ); + if ( anIds != theIds ) + aNewMap.Add( anIds ); + } + theMapIndex = aNewMap; + } + } + return anId != 0; +} + + /*! Changes indices of subselection for SALOME_InteractiveObject \param theIO - SALOME_InteractiveObject @@ -456,6 +481,147 @@ SVTK_SelectorDef myMapIOSubIndex.clear(); } +/*! + \return true if the SALOME_InteractiveObject has a composite index subselection + \param theIO - SALOME_InteractiveObject +*/ +bool +SVTK_SelectorDef +::HasCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO ) const +{ + return myMapIOSubCompositeIndex.find( theIO ) != myMapIOSubCompositeIndex.end(); +} + +/*! + Gets composite indices of subselection for SALOME_InteractiveObject + \param theIO - SALOME_InteractiveObject +*/ +void +SVTK_SelectorDef +::GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + SVTK_IndexedMapOfIds& theIds ) +{ + TMapIOSubCompositeIndex::const_iterator anIter = myMapIOSubCompositeIndex.find( theIO ); + if( anIter != myMapIOSubCompositeIndex.end() ) + theIds = anIter->second; + else + theIds.Clear(); +} + +/*! + Changes composite indices of subselection for SALOME_InteractiveObject + \param theIO - SALOME_InteractiveObject + \param theIndices - composite id + \param theIsModeShift - if it is false, then map will be cleared before indices are added +*/ +bool +SVTK_SelectorDef +::AddOrRemoveCompositeIndex( const Handle( SALOME_InteractiveObject )& theIO, + const SVTK_IndexedMapOfIds& theIds, + bool theIsModeShift) +{ + TMapIOSubCompositeIndex::iterator aMapIter = myMapIOSubCompositeIndex.find( theIO ); + if( aMapIter == myMapIOSubCompositeIndex.end() ) { + SVTK_IndexedMapOfIds anEmpty; + aMapIter = myMapIOSubCompositeIndex.insert( TMapIOSubCompositeIndex::value_type( theIO, anEmpty ) ).first; + } + SVTK_IndexedMapOfIds& aMapIndex = aMapIter->second; + + if( !theIsModeShift ) + aMapIndex.Clear(); + + for( int i = 1, iEnd = theIds.Extent(); i <= iEnd; i++ ) + aMapIndex.Add( theIds( i ) ); + + if( aMapIndex.IsEmpty() ) { + myMapIOSubCompositeIndex.erase( theIO ); + return false; + } + return true; +} + +/*! + Changes indices of subselection for SALOME_InteractiveObject + \param theIO - SALOME_InteractiveObject + \param theIds - composite ids + \param theIsModeShift - if it is false, then map will be cleared before indices are added +*/ +bool +SVTK_SelectorDef +::AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ListOfInteger theIds, + bool theIsModeShift) +{ + TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO ); + if( anIter == myMapIOSubCompositeIndex.end() ) { + SVTK_IndexedMapOfIds anEmpty; + anIter = myMapIOSubCompositeIndex.insert(TMapIOSubCompositeIndex::value_type( theIO,anEmpty ) ).first; + } + + SVTK_IndexedMapOfIds& aMapIndex = anIter->second; + + bool anIsContains = aMapIndex.Contains( theIds ) == Standard_True; + if ( anIsContains ) + removeCompositeIndex( aMapIndex, theIds ); + + if ( !theIsModeShift ) + aMapIndex.Clear(); + + if ( !anIsContains ) + aMapIndex.Add( theIds ); + + if ( aMapIndex.IsEmpty() ) + myMapIOSubIndex.erase( theIO ); + + return false; +} + +/*! + Removes composite index of subselection for SALOME_InteractiveObject + \param theIO - SALOME_InteractiveObject + \param theIds - index +*/ +void +SVTK_SelectorDef +::RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ListOfInteger theIds ) +{ + if(IsCompositeIndexSelected( theIO, theIds ) ) { + TMapIOSubCompositeIndex::iterator anIter = myMapIOSubCompositeIndex.find( theIO ); + SVTK_IndexedMapOfIds& aMapIndex = anIter->second; + removeCompositeIndex( aMapIndex,theIds ); + } +} + +/*! + \return true if the composite index presents in subselection + \param theIO - SALOME_InteractiveObject + \param theIds - index +*/ +bool +SVTK_SelectorDef +::IsCompositeIndexSelected( const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ListOfInteger theIds ) const +{ + TMapIOSubCompositeIndex::const_iterator anIter = myMapIOSubCompositeIndex.find( theIO ); + if( anIter != myMapIOSubCompositeIndex.end() ) { + const SVTK_IndexedMapOfIds& aMapIndex = anIter->second; + return aMapIndex.Contains( theIds ) == Standard_True; + } + return false; +} + +/*! + Clears all composite indices of subselection +*/ +void +SVTK_SelectorDef +::ClearCompositeIndex() +{ + myMapIOSubCompositeIndex.clear(); +} + + /*! To apply a filter on the selection \param theFilter - new filter diff --git a/src/SVTK/SVTK_Selector.h b/src/SVTK/SVTK_Selector.h index c5c9831a5..7b33b3d36 100644 --- a/src/SVTK/SVTK_Selector.h +++ b/src/SVTK/SVTK_Selector.h @@ -29,6 +29,8 @@ #include "SVTK.h" #include "SVTK_Selection.h" +#include "SVTK_Hash.h" + #include "SALOME_ListIO.hxx" #include @@ -168,6 +170,48 @@ public: void ClearIndex() = 0; + /// ! Composite indexes + virtual + bool + HasCompositeIndex(const Handle(SALOME_InteractiveObject)& theIO ) const = 0; + + //! Get composite indexes of subslection for given #SALOME_InteractiveObject + virtual + void + GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + SVTK_IndexedMapOfIds& theIds ) = 0; + + //! Change composite indices of subselection for given #SALOME_InteractiveObject + virtual + bool + AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + const SVTK_IndexedMapOfIds& theIds, + bool theIsModeShift) = 0; + + //! Change composite index of subslection for given #SALOME_InteractiveObject + virtual + bool + AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ListOfInteger ids, + bool theIsModeShift) = 0; + + //! Change composite index of subslection for given #SALOME_InteractiveObject + virtual + void + RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ListOfInteger ids ) = 0; + + //! Check, if the given composite index is present in subselection + virtual + bool + IsCompositeIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ListOfInteger ids ) const = 0; + + //! Clear composite indexes subselection + virtual + void + ClearCompositeIndex() = 0; + //---------------------------------------------------------------------------- typedef int TFilterID; diff --git a/src/SVTK/SVTK_SelectorDef.h b/src/SVTK/SVTK_SelectorDef.h index 2bec20757..c2e60309b 100644 --- a/src/SVTK/SVTK_SelectorDef.h +++ b/src/SVTK/SVTK_SelectorDef.h @@ -27,6 +27,8 @@ #ifndef SVTK_SELECTORDEF_H #define SVTK_SELECTORDEF_H +#include "SVTK_Selector.h" + #include #include @@ -36,8 +38,6 @@ #include "SALOME_InteractiveObject.hxx" -#include "SVTK_Selector.h" - class SALOME_Actor; class SVTK_Viewer; @@ -135,6 +135,42 @@ public: void ClearIndex(); + //---------------------------------------------------------------------------- + /// ! Composite indexes + virtual + bool + HasCompositeIndex(const Handle(SALOME_InteractiveObject)& theIO ) const; + + virtual + void + GetCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + SVTK_IndexedMapOfIds& theIds ); + virtual + bool + AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + const SVTK_IndexedMapOfIds& theIds, + bool theIsModeShift); + + virtual + bool + AddOrRemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ListOfInteger theIds, + bool theIsModeShift); + + virtual + void + RemoveCompositeIndex( const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ListOfInteger theIds ); + + virtual + bool + IsCompositeIndexSelected(const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ListOfInteger theIds ) const; + + virtual + void + ClearCompositeIndex(); + //---------------------------------------------------------------------------- virtual void @@ -243,6 +279,12 @@ private: TIOLessThan> TMapIOSubIndex; TMapIOSubIndex myMapIOSubIndex; + typedef std::map TMapIOSubCompositeIndex; + TMapIOSubCompositeIndex myMapIOSubCompositeIndex; + + typedef std::map TFilters; TFilters myFilters; diff --git a/src/SalomeApp/SalomeApp_Engine_i.cxx b/src/SalomeApp/SalomeApp_Engine_i.cxx index 16c1fcc29..4c85ff6c7 100644 --- a/src/SalomeApp/SalomeApp_Engine_i.cxx +++ b/src/SalomeApp/SalomeApp_Engine_i.cxx @@ -26,6 +26,10 @@ #include "SalomeApp_Engine_i.h" #include "SalomeApp_Application.h" +#include "SalomeApp_Study.h" +#include "SUIT_Session.h" +#include "CAM_Module.h" +#include "LightApp_DataModel.h" #include #include @@ -40,14 +44,30 @@ #include +namespace +{ + SalomeApp_Study* getStudyById( int id ) + { + SalomeApp_Study* study = 0; + QList apps = SUIT_Session::session()->applications(); + for ( int i = 0; i < apps.count() && !study; i++ ) + { + SalomeApp_Study* appStudy = dynamic_cast( apps[i]->activeStudy() ); + if ( appStudy && appStudy->id() == id ) + study = appStudy; + } + return study; + } +} + /*! Constructor */ SalomeApp_Engine_i::SalomeApp_Engine_i( const char* theComponentName ) + : myComponentName( theComponentName ) { - myComponentName = theComponentName; MESSAGE("SalomeApp_Engine_i::SalomeApp_Engine_i(): myComponentName = " << - myComponentName << ", this = " << this); + qPrintable( myComponentName ) << ", this = " << this); } /*! @@ -56,7 +76,7 @@ SalomeApp_Engine_i::SalomeApp_Engine_i( const char* theComponentName ) SalomeApp_Engine_i::~SalomeApp_Engine_i() { MESSAGE("SalomeApp_Engine_i::~SalomeApp_Engine_i(): myComponentName = " << - myComponentName << ", this = " << this); + qPrintable( myComponentName ) << ", this = " << this); } SALOMEDS::TMPFile* SalomeApp_Engine_i::Save (SALOMEDS::SComponent_ptr theComponent, @@ -65,21 +85,63 @@ SALOMEDS::TMPFile* SalomeApp_Engine_i::Save (SALOMEDS::SComponent_ptr theCompone { SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile; - if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy())) + if ( CORBA::is_nil(theComponent) || CORBA::is_nil( theComponent->GetStudy() ) ) + return aStreamFile._retn(); + + // Component type + QString componentName = theComponent->ComponentDataType(); + // Error somewhere outside - Save() called with wrong SComponent instance + if ( myComponentName != componentName ) return aStreamFile._retn(); + // Get study ID const int studyId = theComponent->GetStudy()->StudyId(); - // Get a temporary directory to store a file - //std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); + bool manuallySaved = false; - if (myMap.count(studyId)) { - std::string componentName (theComponent->ComponentDataType()); + if ( !myMap.count( studyId ) ) { + // Save was probably called from outside GUI, so SetListOfFiles was not called! + // Try to get list of files from directly from data model - // Error somewhere outside - Save() called with - // wrong SComponent instance - if ( myComponentName != componentName ) + MESSAGE("SalomeApp_Engine_i::Save(): myComponentName = " << + qPrintable( myComponentName ) << + "it seems Save() was called from outside GUI" ); + + // - Get study + SalomeApp_Study* study = getStudyById( studyId ); + if ( !study ) + return aStreamFile._retn(); + QString url = QString::fromStdString(study->studyDS()->URL()); + // - Get app + SalomeApp_Application* app = dynamic_cast( study->application() ); + if ( !app ) + return aStreamFile._retn(); + // - Get module + CAM_Module* module = app->module( SalomeApp_Application::moduleTitle( componentName ) ); + if ( !module ) // load module??? return aStreamFile._retn(); + // - Get data model + LightApp_DataModel* dataModel = dynamic_cast( module->dataModel() ); + if ( !dataModel ) + return aStreamFile._retn(); + // - Save data files + QStringList dataFiles; + // we use 'url' instead of 'theURL' as latter normally contains path to the tmp dir, + // but not actual study's URL + dataModel->saveAs( url, study, dataFiles ); + std::vector names; + foreach ( QString name, dataFiles ) { + if ( !name.isEmpty() ) + names.push_back(name.toUtf8().data()); + } + SetListOfFiles( names, studyId ); + manuallySaved = true; + } + + // Get a temporary directory to store a file + //std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); + + if ( myMap.count( studyId ) ) { const ListOfFiles& listOfFiles = myMap[studyId]; @@ -104,6 +166,9 @@ SALOMEDS::TMPFile* SalomeApp_Engine_i::Save (SALOMEDS::SComponent_ptr theCompone } } + if ( manuallySaved ) + SetListOfFiles( ListOfFiles(), studyId ); + return aStreamFile._retn(); } @@ -118,7 +183,7 @@ CORBA::Boolean SalomeApp_Engine_i::Load (SALOMEDS::SComponent_ptr theComponent, // Error somewhere outside - Load() called with // wrong SComponent instance - std::string componentName (theComponent->ComponentDataType()); + QString componentName = theComponent->ComponentDataType(); if ( myComponentName != componentName ) return false; @@ -159,7 +224,10 @@ SalomeApp_Engine_i::ListOfFiles SalomeApp_Engine_i::GetListOfFiles (const int th void SalomeApp_Engine_i::SetListOfFiles (const ListOfFiles& theListOfFiles, const int theStudyId) { - myMap[theStudyId] = theListOfFiles; + if ( theListOfFiles.empty() ) + myMap.erase( theStudyId ); + else + myMap[theStudyId] = theListOfFiles; } /*! @@ -171,7 +239,7 @@ Engines::TMPFile* SalomeApp_Engine_i::DumpPython(CORBA::Object_ptr theStudy, CORBA::Boolean& isValidScript) { MESSAGE("SalomeApp_Engine_i::DumpPython(): myComponentName = "<< - myComponentName << ", this = " << this); + qPrintable( myComponentName ) << ", this = " << this); // Temporary solution: returning a non-empty sequence // even if there's nothing to dump, to avoid crashes in SALOMEDS @@ -276,7 +344,7 @@ Engines::TMPFile* SalomeApp_Engine_i::DumpPython(CORBA::Object_ptr theStudy, */ char* SalomeApp_Engine_i::ComponentDataType() { - return const_cast( myComponentName.c_str() ); + return CORBA::string_dup( myComponentName.toLatin1().constData() ); } /*! @@ -288,7 +356,7 @@ char* SalomeApp_Engine_i::getVersion() QString version; SalomeApp_Application::ModuleShortInfo version_info; foreach ( version_info, versions ) { - if ( SalomeApp_Application::moduleName( version_info.name ) == myComponentName.c_str() ) { + if ( SalomeApp_Application::moduleName( version_info.name ) == myComponentName ) { version = version_info.version; break; } diff --git a/src/SalomeApp/SalomeApp_Engine_i.h b/src/SalomeApp/SalomeApp_Engine_i.h index ec2641913..d9b3d4b22 100644 --- a/src/SalomeApp/SalomeApp_Engine_i.h +++ b/src/SalomeApp/SalomeApp_Engine_i.h @@ -31,6 +31,7 @@ #include "SALOME_Component_i.hxx" +#include #include #include @@ -101,7 +102,7 @@ private: typedef std::map MapOfListOfFiles; MapOfListOfFiles myMap; - std::string myComponentName; + QString myComponentName; }; #endif diff --git a/src/SalomeApp/SalomeApp_ExceptionHandler.cxx b/src/SalomeApp/SalomeApp_ExceptionHandler.cxx index 4534dcf6b..36534eee5 100644 --- a/src/SalomeApp/SalomeApp_ExceptionHandler.cxx +++ b/src/SalomeApp/SalomeApp_ExceptionHandler.cxx @@ -23,8 +23,6 @@ #include "SalomeApp_ExceptionHandler.h" #include "Utils_CorbaException.hxx" -#include "CASCatch.hxx" - #include #include @@ -53,16 +51,19 @@ SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal ) /*!Try to call SUIT_ExceptionHandler::internalHandle(o, e), catch if failure.*/ bool SalomeApp_ExceptionHandler::handleSignals( QObject* o, QEvent* e ) { - try { + bool result = true; + + try + { OCC_CATCH_SIGNALS; - SUIT_ExceptionHandler::internalHandle( o, e ); + result = SUIT_ExceptionHandler::internalHandle( o, e ); } - catch(Standard_Failure) { - Handle(Standard_Failure) aFail = Standard_Failure::Caught(); - throw Standard_Failure( aFail->GetMessageString() ); + catch( Standard_Failure& e ) + { + throw Standard_Failure( e.GetMessageString() ); } - return true; + return result; } /*!Try to call handleSignals( o, e ), catch and show error message.*/ diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index 84bb76df6..b60de1a8a 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -1119,6 +1119,8 @@ bool SalomeApp_Study::openDataModel( const QString& studyName, CAM_DataModel* dm // for this module by LightApp_Engine_i::Load() bool isMultiFile = false; // TODO: decide, how to access this parameter RemoveTemporaryFiles( dm->module()->name().toStdString().c_str(), isMultiFile ); + std::vector listOfFiles ; + SetListOfFiles( dm->module()->name().toStdString().c_str(), listOfFiles ); // Something has been read -> create data model tree LightApp_DataModel* aDM = dynamic_cast( dm ); diff --git a/src/SalomeApp/pluginsdemo/CMakeLists.txt b/src/SalomeApp/pluginsdemo/CMakeLists.txt index 68319ee8a..93f64bc3e 100755 --- a/src/SalomeApp/pluginsdemo/CMakeLists.txt +++ b/src/SalomeApp/pluginsdemo/CMakeLists.txt @@ -31,19 +31,18 @@ INCLUDE(UsePyQt) # --- resources --- # uic files / to be processed by pyuic -SET(_pyuic_files +SET(_pyuic_FILES minmax.ui ) # scripts / pyuic wrappings -PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_files}) +PYQT_WRAP_UIC(_pyuic_SCRIPTS ${_pyuic_FILES} TARGET_NAME _target_name_pyuic) # --- scripts --- # scripts / static # TODO: process UIC files via PyQt pyuic tool, see UsePyQt.cmake SET(_plugins_SCRIPTS - ${_pyuic_SCRIPTS} minmax_plugin.py trihedron.py tubedialog_ui.py @@ -52,11 +51,16 @@ SET(_plugins_SCRIPTS salome_plugins.py smesh_plugins.py ) + SET(_helper_SCRIPTS xalome.py ) # --- rules --- -SALOME_INSTALL_SCRIPTS("${_plugins_SCRIPTS}" ${SALOME_GUI_INSTALL_PLUGINS}/demo DEF_PERMS) SALOME_INSTALL_SCRIPTS("${_helper_SCRIPTS}" ${SALOME_INSTALL_PYTHON}) +SALOME_INSTALL_SCRIPTS("${_plugins_SCRIPTS}" ${SALOME_GUI_INSTALL_PLUGINS}/demo DEF_PERMS) +SALOME_INSTALL_SCRIPTS("${_pyuic_SCRIPTS}" ${SALOME_GUI_INSTALL_PLUGINS}/demo DEF_PERMS TARGET_NAME _target_name_pyuic_py) +# add dependency of compiled py files on uic files in order +# to avoid races problems when compiling in parallel +ADD_DEPENDENCIES(${_target_name_pyuic_py} ${_target_name_pyuic}) diff --git a/src/VTKViewer/VTKViewer_Actor.cxx b/src/VTKViewer/VTKViewer_Actor.cxx index 56312d57d..c3f17f6e0 100755 --- a/src/VTKViewer/VTKViewer_Actor.cxx +++ b/src/VTKViewer/VTKViewer_Actor.cxx @@ -450,6 +450,17 @@ VTKViewer_Actor return GetInput()->GetPoint(theObjID); } +/*! + Maps object index of a node to corresponding VTK index +*/ +int +VTKViewer_Actor +::GetNodeVtkId( int theObjID ) +{ + return theObjID; +} + + /*! Get corresponding #vtkCell for given object index */ diff --git a/src/VTKViewer/VTKViewer_Actor.h b/src/VTKViewer/VTKViewer_Actor.h index 306578bec..478623638 100755 --- a/src/VTKViewer/VTKViewer_Actor.h +++ b/src/VTKViewer/VTKViewer_Actor.h @@ -146,6 +146,11 @@ class VTKVIEWER_EXPORT VTKViewer_Actor : public vtkLODActor double* GetNodeCoord(int theObjID); + //! Maps object index of a node to corresponding VTK index + virtual + int + GetNodeVtkId(int theObjID); + //! Maps VTK index of a cell to corresponding object index virtual int diff --git a/src/VTKViewer/VTKViewer_Filter.cxx b/src/VTKViewer/VTKViewer_Filter.cxx index 7aa8e69a9..63e048e27 100755 --- a/src/VTKViewer/VTKViewer_Filter.cxx +++ b/src/VTKViewer/VTKViewer_Filter.cxx @@ -26,7 +26,7 @@ #include "VTKViewer_Filter.h" -OCCT_IMPLEMENT_STANDARD_RTTIEXT(VTKViewer_Filter, MMgt_TShared) +IMPLEMENT_STANDARD_RTTIEXT(VTKViewer_Filter, Standard_Transient) /*! * \class VTKViewer_Filter diff --git a/src/VTKViewer/VTKViewer_Filter.h b/src/VTKViewer/VTKViewer_Filter.h index 1ccb8ed14..9926bde2d 100755 --- a/src/VTKViewer/VTKViewer_Filter.h +++ b/src/VTKViewer/VTKViewer_Filter.h @@ -30,14 +30,12 @@ #include "VTKViewer.h" -#include +#include #include -#include - class VTKViewer_Actor; -DEFINE_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared); +DEFINE_STANDARD_HANDLE(VTKViewer_Filter, Standard_Transient); /* Class : VTKViewer_Filter @@ -45,7 +43,7 @@ DEFINE_STANDARD_HANDLE(VTKViewer_Filter, MMgt_TShared); should be redefined in derived classes */ -class VTKViewer_Filter : public MMgt_TShared +class VTKViewer_Filter : public Standard_Transient { public: @@ -63,7 +61,7 @@ protected: VTKViewer_Actor* myActor; public: - OCCT_DEFINE_STANDARD_RTTIEXT(VTKViewer_Filter,MMgt_TShared) + DEFINE_STANDARD_RTTIEXT(VTKViewer_Filter, Standard_Transient) }; #endif diff --git a/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx b/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx index 53a65830a..f99d102e1 100644 --- a/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx +++ b/src/VTKViewer/VTKViewer_OpenGLRenderer.cxx @@ -68,6 +68,7 @@ void VTKViewer_OpenGLRenderer::SetGradientType( const int theGradientType ) void VTKViewer_OpenGLRenderer::Clear(void) { + vtkOpenGLRenderer::Clear(); #ifdef VTK_OPENGL2 if (this->OpenGLHelper.IsInitialized()) { diff --git a/src/ViewerData/ViewerData_AISShape.cxx b/src/ViewerData/ViewerData_AISShape.cxx index 4e97067ee..fe91800a8 100644 --- a/src/ViewerData/ViewerData_AISShape.cxx +++ b/src/ViewerData/ViewerData_AISShape.cxx @@ -22,26 +22,21 @@ #include "ViewerData_AISShape.hxx" -#ifdef USE_TEXTURED_SHAPE - OCCT_IMPLEMENT_STANDARD_RTTIEXT(ViewerData_AISShape, AIS_TexturedShape) -#else - OCCT_IMPLEMENT_STANDARD_RTTIEXT(ViewerData_AISShape, AIS_Shape) -#endif +IMPLEMENT_STANDARD_RTTIEXT(ViewerData_AISShape, AIS_ColoredShape) /*! - Constructor - \param shape - TopoDS shape + Constructor. + \param shape Shape to manage. */ -ViewerData_AISShape::ViewerData_AISShape (const TopoDS_Shape& theShape) -: BASE_SHAPE (theShape), - myIsClippable (true) +ViewerData_AISShape::ViewerData_AISShape(const TopoDS_Shape& theShape) +: AIS_ColoredShape(theShape), + myIsClippable(true) { } /*! - Destructor + Destructor. */ ViewerData_AISShape::~ViewerData_AISShape() { } - diff --git a/src/ViewerData/ViewerData_AISShape.hxx b/src/ViewerData/ViewerData_AISShape.hxx index ed725f80b..d45ade296 100644 --- a/src/ViewerData/ViewerData_AISShape.hxx +++ b/src/ViewerData/ViewerData_AISShape.hxx @@ -20,40 +20,27 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -#ifndef _ViewerData_AISShape_HeaderFile -#define _ViewerData_AISShape_HeaderFile - -// When below macro is defined, AIS_TexturedShape is used as base class -#define USE_TEXTURED_SHAPE - -#ifdef USE_TEXTURED_SHAPE - #include - #define BASE_SHAPE AIS_TexturedShape -#else - #include - #define BASE_SHAPE AIS_Shape -#endif +#ifndef VIEWERDATA_AISSHAPE +#define VIEWERDATA_AISSHAPE #include #include +#include -#include - -class ViewerData_AISShape - : public BASE_SHAPE +class ViewerData_AISShape : public AIS_ColoredShape { public: - Standard_EXPORT ViewerData_AISShape (const TopoDS_Shape& theShape); + Standard_EXPORT ViewerData_AISShape(const TopoDS_Shape&); Standard_EXPORT ~ViewerData_AISShape(); - // checks if shape is clippable + //! Checks if shape is clippable. Standard_EXPORT inline bool IsClippable() const { return myIsClippable; } - // makes shape clippable/not clippable - Standard_EXPORT inline void SetClippable (bool isClippable) + //! Makes shape clippable/not clippable. + Standard_EXPORT inline void SetClippable(bool isClippable) { myIsClippable = isClippable; } @@ -62,9 +49,9 @@ protected: bool myIsClippable; public: - OCCT_DEFINE_STANDARD_RTTIEXT(ViewerData_AISShape, BASE_SHAPE) + DEFINE_STANDARD_RTTIEXT(ViewerData_AISShape, AIS_ColoredShape) }; -DEFINE_STANDARD_HANDLE(ViewerData_AISShape, BASE_SHAPE) +DEFINE_STANDARD_HANDLE(ViewerData_AISShape, AIS_ColoredShape) -#endif // _ViewerData_AISShape_HeaderFile +#endif // VIEWERDATA_AISSHAPE diff --git a/tools/PyConsole/src/resources/PyConsole_msg_fr.ts b/tools/PyConsole/src/resources/PyConsole_msg_fr.ts index 9eaf24482..0c9e9dada 100644 --- a/tools/PyConsole/src/resources/PyConsole_msg_fr.ts +++ b/tools/PyConsole/src/resources/PyConsole_msg_fr.ts @@ -64,11 +64,11 @@ TOO_MANY_MATCHES - Too many matches! Displaying first ones only... + Trop d'occurences! Affichage des premières... NO_DOC_AVAILABLE - no documentation available + pas de documentation disponible diff --git a/tools/PyEditor/src/resources/translations/PyEditor_msg_fr.ts b/tools/PyEditor/src/resources/translations/PyEditor_msg_fr.ts index fc2decc6a..f8e309645 100644 --- a/tools/PyEditor/src/resources/translations/PyEditor_msg_fr.ts +++ b/tools/PyEditor/src/resources/translations/PyEditor_msg_fr.ts @@ -33,27 +33,27 @@ GR_EDIT_SET - Editor settings + Paramètres de l'éditeur LBL_COMPLETION_MODE - Completion mode + Mode de complétion LBL_NONE - None + Auncun LBL_AUTO - Auto + Auto LBL_MANUAL - Manual + Manuel LBL_ALWAYS - Always + Toujours GR_TAB_SET @@ -252,27 +252,27 @@ ACT_FIND - Find + Cherche TTP_FIND - Find + Cherche DSC_FIND - Find text + Cherche le texte ACT_REPLACE - Replace + Remplace TTP_REPLACE - Find & Replace + Cherche & Remplace DSC_REPLACE - Find and replace text + Cherche et remplace le texte ACT_PREFERENCES @@ -365,46 +365,46 @@ FILE_PARAM_NAME - file + fichier FILE_PARAM_DESCRIPTION - File to edit. + Fichier à éditer. PyEditor_FindTool FIND_LABEL - Find: + Cherche: REPLACE_LABEL - Replace with: + Remplace avec: REPLACE_BTN - Replace + Remplace REPLACE_ALL_BTN - Replace All + Remplace tout CASE_SENSITIVE_CHECK - Case Sensitive + Sensible à la casse WHOLE_WORDS_CHECK - Whole Words Only + Mots entiers uniquement REGEX_CHECK - Use Regular Expressions + Utilise des expressions régulières NB_MATCHED_LABEL - %1 of %2 matches + %1 sur %2 correspond diff --git a/tools/PyEditor/src/resources/translations/PyEditor_msg_ja.ts b/tools/PyEditor/src/resources/translations/PyEditor_msg_ja.ts index ec1846668..d34a57d0c 100644 --- a/tools/PyEditor/src/resources/translations/PyEditor_msg_ja.ts +++ b/tools/PyEditor/src/resources/translations/PyEditor_msg_ja.ts @@ -33,27 +33,27 @@ GR_EDIT_SET - Editor settings + エディタの設定 LBL_COMPLETION_MODE - Completion mode + 完全モード LBL_NONE - None + なし LBL_AUTO - Auto + 自動 LBL_MANUAL - Manual + 手動 LBL_ALWAYS - Always + 常時 GR_TAB_SET @@ -252,27 +252,27 @@ ACT_FIND - Find + 検索 TTP_FIND - Find + 検索 DSC_FIND - Find text + テキストの検索 ACT_REPLACE - Replace + 置換 TTP_REPLACE - Find & Replace + 検索と置換 DSC_REPLACE - Find and replace text + テキストの検索と置換 ACT_PREFERENCES @@ -332,13 +332,11 @@ WRN_READ_FILE - ファイルが読めません %1: -%2. + ファイルが読めません %1:\n%2. WRN_WRITE_FILE - ファイルが書き込めません %1: -%2. + ファイルが書き込めません %1:\n%2. STS_READY @@ -361,50 +359,50 @@ PyEditor PROGRAM_DESCRIPTION - Pythonのエディタ + 簡易 Python エディタ FILE_PARAM_NAME - file + ファイル FILE_PARAM_DESCRIPTION - File to edit. + ファイルの編集 PyEditor_FindTool FIND_LABEL - Find: + Find: REPLACE_LABEL - Replace with: + Replace with: REPLACE_BTN - Replace + 置換 REPLACE_ALL_BTN - Replace All + 全て置換 CASE_SENSITIVE_CHECK - Case Sensitive + 大文字と小文字を区別 WHOLE_WORDS_CHECK - Whole Words Only + 完全に同一な単語のみ REGEX_CHECK - Use Regular Expressions + 正規表現を使用 NB_MATCHED_LABEL - %1 of %2 matches + %1 of %2 matches