Salome HOME
Merge from V6_main 13/12/2012 BR_KERNEL_REFACTORING V7_1_0_pre
authorvsr <vsr@opencascade.com>
Thu, 13 Dec 2012 08:17:51 +0000 (08:17 +0000)
committervsr <vsr@opencascade.com>
Thu, 13 Dec 2012 08:17:51 +0000 (08:17 +0000)
68 files changed:
CMakeLists.txt
doc/salome/gui/images/desktop.png [new file with mode: 0644]
doc/salome/gui/images/geomview-alt.png [deleted file]
doc/salome/gui/images/studyproperties.png
doc/salome/gui/input/salome_desktop.doc
doc/salome/gui/input/study_management_chapter.doc
src/CAM/CAM_Application.cxx
src/CAM/CAM_Application.h
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/LightApp/LightApp_ShowHideOp.cxx
src/LightApp/resources/LightApp.xml
src/OCCViewer/Makefile.am
src/OCCViewer/OCCViewer_ViewFrame.cxx
src/OCCViewer/OCCViewer_ViewFrame.h
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/OCCViewer_ViewWindow.h
src/OCCViewer/resources/OCCViewer_images.ts
src/OCCViewer/resources/OCCViewer_msg_en.ts
src/OCCViewer/resources/OCCViewer_msg_fr.ts
src/OCCViewer/resources/occ_view_sync.png [deleted file]
src/Plot2d/Plot2d_ViewFrame.cxx
src/Plot2d/Plot2d_ViewFrame.h
src/Qtx/QtxMainWindow.cxx
src/Qtx/QtxMainWindow.h
src/Qtx/QtxPopupMgr.cxx
src/SALOME_PYQT/SalomePyQt/Makefile.am
src/SUIT/CMakeLists.txt
src/SUIT/Makefile.am
src/SUIT/SUIT_CameraProperties.cxx [new file with mode: 0644]
src/SUIT/SUIT_CameraProperties.h [new file with mode: 0644]
src/SUIT/SUIT_ExceptionHandler.cxx
src/SUIT/SUIT_ExceptionHandler.h
src/SUIT/SUIT_ViewWindow.cxx
src/SUIT/SUIT_ViewWindow.h
src/SUIT/resources/SUIT_images.ts
src/SUIT/resources/SUIT_msg_en.ts
src/SUIT/resources/SUIT_msg_fr.ts
src/SUIT/resources/view_sync.png [new file with mode: 0644]
src/SVTK/Makefile.am
src/SVTK/SVTK_ViewWindow.cxx
src/SVTK/SVTK_ViewWindow.h
src/SVTK/resources/SVTK_images.ts
src/SVTK/resources/SVTK_msg_en.ts
src/SVTK/resources/SVTK_msg_fr.ts
src/SVTK/resources/vtk_view_sync.png [deleted file]
src/SalomeApp/CMakeLists.txt
src/SalomeApp/Makefile.am
src/SalomeApp/SalomeApp_Engine_i.cxx [new file with mode: 0644]
src/SalomeApp/SalomeApp_Engine_i.h [new file with mode: 0644]
src/SalomeApp/SalomeApp_Study.cxx
src/SalomeApp/SalomeApp_StudyPropertiesDlg.cxx
src/SalomeApp/SalomeApp_StudyPropertiesDlg.h
src/SalomeApp/pluginsdemo/salome_plugins.py
src/SalomeApp/resources/SalomeApp.xml
src/SalomeApp/resources/SalomeApp_msg_en.ts
src/SalomeApp/resources/SalomeApp_msg_fr.ts
src/Session/CMakeLists.txt
src/Session/Makefile.am
src/Session/SALOME_Session_Server.cxx
src/Session/SalomeApp_Engine_i.cxx [deleted file]
src/Session/SalomeApp_Engine_i.hxx [deleted file]
src/Session/Session_ServerLauncher.cxx
src/Session/Session_ServerLauncher.hxx
src/Session/Session_ServerThread.cxx
src/Session/Session_ServerThread.hxx
src/TreeData/Test/Makefile.am
src/VTKViewer/VTKViewer_GeometryFilter.cxx

index 3284c0519222bb4ac1f3087ffe56f704b7385333..a03543dd252ab1a56ca819917bf1d040edad3676 100755 (executable)
@@ -39,7 +39,7 @@ SET(ENABLE_SUPERVGRAPHVIEWER ON)
 SET(ENABLE_QXGRAPHVIEWER ON)
 
 ENABLE_TESTING()
-SET(VERSION "6.5.0")
+SET(VERSION "7.0.0")
 SET(VERSION_DEV "1")
 
 SET(KERNEL_ROOT_DIR $ENV{KERNEL_ROOT_DIR})
diff --git a/doc/salome/gui/images/desktop.png b/doc/salome/gui/images/desktop.png
new file mode 100644 (file)
index 0000000..cb4d425
Binary files /dev/null and b/doc/salome/gui/images/desktop.png differ
diff --git a/doc/salome/gui/images/geomview-alt.png b/doc/salome/gui/images/geomview-alt.png
deleted file mode 100755 (executable)
index b76055e..0000000
Binary files a/doc/salome/gui/images/geomview-alt.png and /dev/null differ
index c86d0bc041b2e12b27b999662f44ecd0ba4b7842..3ea51b879a7a31fc8120b4d189bc557b652636d7 100755 (executable)
Binary files a/doc/salome/gui/images/studyproperties.png and b/doc/salome/gui/images/studyproperties.png differ
index f6361c6206a82c78d5219d68eae77f2bc447b70b..5ce734d80b16c7b97835f682ee7e62cbca08bcf4 100644 (file)
@@ -12,23 +12,23 @@ viewers, dialogs, etc. Each desktop also has its own menu and toolbar.
 The main SALOME Desktop consists of the following sections and
 toolbars:
 
-\image html geomview-alt.png
+\image html desktop.png
 
 
 <b>Basic parts of the SALOME Desktop:</b>
 <ul>
 <li><b>Main menu</b> - This is a set of context-sensitive menus, which will
-be updated according the functionality of the loaded component. In
-general,  these menus contain all functional options of SALOME
+be updated according to the functionality of the currently active component. In
+general, these menus contain all functional options of SALOME
 platform.</li>
-<li><b>Standard Toolbar</b> - This toolbar contains icons allowing
-creating/saving studies, correcting mistakes, copying/pasting
-objects.</li>
-<li><b>Components Toolbar</b> - This toolbar is destined for uploading
+<li><b>Standard toolbar</b> - This toolbar contains standard actions
+that allow creating new or opening existing study, saving study, deleting
+objects etc.</li>
+<li><b>Components toolbar</b> - This toolbar allows activating
 components in SALOME platform.</li>
-<li><b>Module Toolbar</b> - This toolbar contains icons specific to the
-loaded module.</li>
-<li><b>Viewer Toolbar</b> - This is a set of tools destined for visualization
+<li><b>Module toolbars</b> - These toolbars contain actions specific to the
+currently active module.</li>
+<li><b>Viewer toolbar</b> - This is a set of tools destined for visualization
 of the presentations in the viewer.</li>
 </ul>
 
@@ -47,7 +47,7 @@ place of the window.
 
 <b>Parts of  the study window:</b>
 <ul>
-<li><b>Object Browser</b> - Management of objects created or imported into
+<li><b>Object browser</b> - Management of objects created or imported into
 SALOME application.</li>
 <li>\b Viewer - This window is destined for visualization of
 presentations.</li>
@@ -107,4 +107,4 @@ window. </li>
 
 
 
-*/
\ No newline at end of file
+*/
index 71f3ed5e260fa54bc10a041ad4d97f94c3fb63af..b06d868738c3845b2076c58dfec941b0ea109203 100644 (file)
@@ -86,25 +86,32 @@ To confirm your choice click \b Save.
 
 To confirm your choice click \b Open.
 
-<b>Properties</b> - allows to edit the properties of the current study.
+<b>Properties</b> - allows to show/edit the properties of the current study.
 
 \image html studyproperties.png
 
 <ul>
 <li>\b Author - allows to change the name of the study author.</li>
 <li><b> Creation date</b> - gives the date and time of Study creation.</li>
-<li>\b Locked - allows to lock the  study for modifications. 
+<li>\b Locked - allows to lock the study for modifications. 
 In case if \b Locked checkbox is checked your study will be locked for any modifications
 for all users. Next time you try to edit it, you will see the
 following warning message:
 \image html lockedstudy.png </li>
-<li><b>Modified/Not Modified</b>  - allows to see if any modifications have been
+<li><b>Modified/Not Modified</b> - allows to see if any modifications have been
 introduced into study since its last save. </li>
 <li><b>Length units</b> - allows to change the units of the study.</li>
-<li>\b Comment - allows to change the comment of the study.</li>
+<li>\b Comment - allows to add arbitrary comment for the study.</li>
 <li>\b Modifications - allows to  view the list of changes made in the study.
 Each record contains the date and time of the
 modification and the name of the user, who has introduced it.</li>
+<li><b> Stored data </b> - Shows the versions of data currently stored
+in the study. Note, that this information does not concern current
+versions of SALOME modules, it shows the version in which the data has been
+initially created. If the study is re-saved in the version of SALOME,
+different from initial one, the version information is
+highlighted by red-colored font; this means that version information
+is not actually valid.</li>
 </ul>
 
 \b Preferences - allows \ref setting_preferences_page "setting preferences"
index fc99c754c652d4463fe1de5529deab84285fd33f..0f742ad8781eec026f6cf4d225f5e6f11bc229e9 100755 (executable)
@@ -82,6 +82,8 @@ extern "C" CAM_EXPORT SUIT_Application* createApplication()
   - etc
 */
 
+CAM_Application::ModuleInfoList CAM_Application::myInfoList;
+
 /*!
   \brief Constructor.
 
@@ -361,7 +363,7 @@ CAM_Module* CAM_Application::loadModule( const QString& modName, const bool show
 
   char* version = getVersion ? getVersion() : 0;
 
-  if(version) {    
+  if ( version ) {    
     for ( ModuleInfoList::iterator it = myInfoList.begin(); it != myInfoList.end(); ++it ) {
       if ( (*it).title == modName ) {
         if( (*it).version.isEmpty() ) {
@@ -518,7 +520,7 @@ void CAM_Application::moduleAdded( CAM_Module* /*mod*/ )
   \param title module title (user name)
   \return module name or null QString if module is not found
 */
-QString CAM_Application::moduleName( const QString& title ) const
+QString CAM_Application::moduleName( const QString& title )
 {
   QString res;
   for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
@@ -534,7 +536,7 @@ QString CAM_Application::moduleName( const QString& title ) const
   \param name module name
   \return module title (user name) or null QString if module is not found
 */
-QString CAM_Application::moduleTitle( const QString& name ) const
+QString CAM_Application::moduleTitle( const QString& name )
 {
   QString res;
   for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
@@ -550,7 +552,7 @@ QString CAM_Application::moduleTitle( const QString& name ) const
   \param name module name
   \return module icon or null QString if module is not found
 */
-QString CAM_Application::moduleIcon( const QString& name ) const
+QString CAM_Application::moduleIcon( const QString& name )
 {
   QString res;
   for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isNull(); ++it )
@@ -568,7 +570,7 @@ QString CAM_Application::moduleIcon( const QString& name ) const
   \param title module title (user name)
   \return \c true if module is accessible (can be loaded) or \c false otherwise
  */
-bool CAM_Application::isModuleAccessible( const QString& title ) const
+bool CAM_Application::isModuleAccessible( const QString& title )
 {
   bool found   = false;
   bool blocked = false;
@@ -599,7 +601,7 @@ bool CAM_Application::isModuleAccessible( const QString& title ) const
   \param full if \c true, return full library name, otherwise return its internal name
   \return module library name or null QString if module is not found
  */
-QString CAM_Application::moduleLibrary( const QString& title, const bool full ) const
+QString CAM_Application::moduleLibrary( const QString& title, const bool full )
 {
   QString res;
   for ( ModuleInfoList::const_iterator it = myInfoList.begin(); it != myInfoList.end() && res.isEmpty(); ++it )
@@ -777,8 +779,8 @@ void CAM_Application::createEmptyStudy()
 /*!
   \brief Return information about version of the each module.
 */
-CAM_Application::ModuleShortInfoList CAM_Application::getVersionInfo() const {
-
+CAM_Application::ModuleShortInfoList CAM_Application::getVersionInfo()
+{
   ModuleShortInfoList info;
 
   ModuleShortInfo kernel;
index 45b527a65ddac9ef62efad8515029b6a082f5328..546781b97f6e87738db0ae5b0477cd283f762c91 100755 (executable)
@@ -66,14 +66,14 @@ public:
 
   virtual void        contextMenuPopup( const QString&, QMenu*, QString& );
 
-  QString             moduleName( const QString& ) const;
-  QString             moduleTitle( const QString& ) const;
-  QString             moduleIcon( const QString& ) const;
-  bool                isModuleAccessible( const QString& ) const;
+  static QString      moduleName( const QString& );
+  static QString      moduleTitle( const QString& );
+  static QString      moduleIcon( const QString& );
+  static bool         isModuleAccessible( const QString& );
 
   virtual void        createEmptyStudy();
 
-  ModuleShortInfoList getVersionInfo() const;
+  static ModuleShortInfoList getVersionInfo();
 
 protected:
   virtual SUIT_Study* createNewStudy();
@@ -86,7 +86,7 @@ protected:
 
   virtual void        setActiveStudy( SUIT_Study* );
 
-  QString             moduleLibrary( const QString&, const bool = true ) const;
+  static QString      moduleLibrary( const QString&, const bool = true );
 
 private:
   void                readModuleList();
@@ -96,11 +96,11 @@ private:
   typedef QList<ModuleInfo> ModuleInfoList;
 
 private:
-  CAM_Module*         myModule;        //!< active module
-  ModuleList          myModules;       //!< loaded modules list
-  ModuleInfoList      myInfoList;      //!< modules info list
-  bool                myAutoLoad;      //!< auto loading flag
-  bool                myBlocked;       //!< "blocked" flag, internal usage
+  CAM_Module*           myModule;        //!< active module
+  ModuleList            myModules;       //!< loaded modules list
+  static ModuleInfoList myInfoList;      //!< modules info list
+  bool                  myAutoLoad;      //!< auto loading flag
+  bool                  myBlocked;       //!< "blocked" flag, internal usage
 };
 
 #ifdef WIN32
index 7b2bd00de5587a99983f946d8c62c58feba508f8..cf0163b5a2d40b291ef0894af0a7a4558d213a0b 100644 (file)
@@ -254,6 +254,7 @@ LightApp_Application::LightApp_Application()
 
   STD_TabDesktop* desk = new STD_TabDesktop();
   desk->setFullScreenAllowed(false);
+  desk->setMinimizeAllowed(false);
 
   setDesktop( desk );
 
@@ -1279,11 +1280,21 @@ LogWindow* LightApp_Application::logWindow()
 
 #ifndef DISABLE_PYCONSOLE
 /*!
+  This returns the python console integrated to the GUI. Depending
+  when you request the python console, this function could return
+  null. Then the optional parameter force (default to false) can be
+  set to force the creation of the python console if it is not done
+  already. 
+  \param force - if true, the pythonConsole is created if it does not exist yet
   \return Python Console
 */
-PyConsole_Console* LightApp_Application::pythonConsole()
+PyConsole_Console* LightApp_Application::pythonConsole(const bool force)
 {
-  return qobject_cast<PyConsole_Console*>( dockWindow( WT_PyConsole ) );
+  QWidget* wid = dockWindow( WT_PyConsole );
+  if ( !wid && force==true) {
+    wid = getWindow(WT_PyConsole);
+  }
+  return qobject_cast<PyConsole_Console*>( wid );
 }
 #endif
 
index f872518670e7ba27938e1e2c1bb0495cad228a84..009432d2984c7a6ea938cd6333f3e2a8647c0f96 100644 (file)
@@ -108,7 +108,7 @@ public:
   LogWindow*                          logWindow();
   SUIT_DataBrowser*                   objectBrowser();
 #ifndef DISABLE_PYCONSOLE
-  PyConsole_Console*                  pythonConsole();
+  PyConsole_Console*                  pythonConsole(const bool force = false);
 #endif
 
   virtual void                        updateObjectBrowser( const bool = true );
index ba427c713f403b4ae04559a6130d3936212f49e9..67103afde534eed7f06b0ba091eec48c589d72d6 100644 (file)
@@ -103,7 +103,7 @@ void LightApp_ShowHideOp::startOperation()
     QStringList::const_iterator anIt = comps.begin(), aLast = comps.end();
     for( ; anIt!=aLast; anIt++ )
     {
-      LightApp_Displayer* disp = LightApp_Displayer::FindDisplayer( app->moduleTitle( *anIt ), true );
+      LightApp_Displayer* disp = LightApp_Displayer::FindDisplayer( app->moduleTitle( *anIt ), false );
       if( disp )
         disp->EraseAll( false, false, 0 );
     }
index 104d123d6426c5e041dd02db1c28e4c6873582e3..0ae06e0a1f1016be0f5462cd2d014cbe68e85cda 100644 (file)
   </section>
   <section name="viewers" >
     <!-- common viewers preferences -->
-    <parameter name="drop_down_buttons"     value="true" />
+    <parameter name="drop_down_buttons"     value="false" />
   </section>
   <section name="OCCViewer" >
     <!-- OCC viewer preferences -->
index 14c993ba4aaabdd883c0ac52a8e51a81b6694db9..5adeea751d438f4867f7ccb97a2b5920404f5d21 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-#  File   : Makefile.in
-#  Author : Vladimir Klyachin (OCN)
-#  Module : OCCViewer
-#  $Header$
-#
-
 include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 lib_LTLIBRARIES = libOCCViewer.la
@@ -118,8 +112,7 @@ dist_salomeres_DATA =                               \
        resources/occ_view_style_switch.png     \
        resources/occ_view_zooming_style_switch.png \
        resources/occ_view_maximized.png        \
-       resources/occ_view_minimized.png        \
-       resources/occ_view_sync.png
+       resources/occ_view_minimized.png
 
 nodist_salomeres_DATA =                \
        OCCViewer_images.qm     \
index 2d3b66ae7957558ca19bfaa569c9894c7b34fe64..ada4a63a83d6566f5eeee31b6ab27d1d6fddb202 100644 (file)
@@ -37,6 +37,7 @@ OCCViewer_ViewFrame::OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Vie
   setCentralWidget( centralFrame );
 
   OCCViewer_ViewWindow* view0 = theModel->createSubWindow();
+  updateWindowTitle( view0 );
   view0->setParent( centralFrame );
   myViews.append( view0 ); // MAIN_VIEW
 
@@ -52,6 +53,17 @@ OCCViewer_ViewFrame::~OCCViewer_ViewFrame()
 {
 }
 
+bool OCCViewer_ViewFrame::event( QEvent* e )
+{
+  if ( e->type() == QEvent::WindowTitleChange ) {
+    updateWindowTitle( getView( MAIN_VIEW ) );
+    updateWindowTitle( getView( BOTTOM_LEFT ) );
+    updateWindowTitle( getView( TOP_LEFT ) );
+    updateWindowTitle( getView( TOP_RIGHT ) );
+  }
+  return OCCViewer_ViewWindow::event( e );
+}
+
 //**************************************************************************************
 OCCViewer_ViewWindow* OCCViewer_ViewFrame::getView( const int i ) const
 {
@@ -101,6 +113,7 @@ void OCCViewer_ViewFrame::onMaximizedView( OCCViewer_ViewWindow* theView, bool i
         view->set2dMode( (Mode2dType) i );
         view->setParent( centralWidget() );
         view->setViewManager(myManager); 
+       updateWindowTitle( view );
         myViews.append( view ); 
         aModel->initView(view);
         view->setMaximized(false, false);
@@ -337,3 +350,30 @@ void OCCViewer_ViewFrame::setVisualParameters( const QString& parameters )
     getView(MAIN_VIEW)->setVisualParameters( parameters );
   }
 }
+
+SUIT_CameraProperties OCCViewer_ViewFrame::cameraProperties()
+{
+  // view frame does not have camera properties
+  return SUIT_CameraProperties();
+}
+
+void OCCViewer_ViewFrame::updateWindowTitle(OCCViewer_ViewWindow* theView)
+{
+  if ( !theView )
+    return;
+  QString title;
+  switch ( theView->get2dMode() ) {
+  case No2dMode:
+    title = "3D"; break;
+  case XYPlane:
+    title = "YX"; break;
+  case XZPlane:
+    title = "XZ"; break;
+  case YZPlane:
+    title = "YZ"; break;
+  default:
+    break;
+  }
+  if ( !title.isEmpty() )
+    theView->setWindowTitle( windowTitle() + " - " + title );
+}
index b00bc6a8ba538f0e1782abb8417c08821b1704bd..b9ce195e238ca19d2410fdaced23e83f0b306966 100644 (file)
@@ -41,6 +41,8 @@ public:
   OCCViewer_ViewFrame(SUIT_Desktop* theDesktop, OCCViewer_Viewer* theModel);
   virtual ~OCCViewer_ViewFrame();
 
+  bool event( QEvent* e );
+
   OCCViewer_ViewWindow*   getView( const int ) const;
 
   virtual OCCViewer_ViewPort3d* getViewPort() { return getView(MAIN_VIEW)->getViewPort(); }
@@ -82,6 +84,8 @@ public:
 
   virtual void   setDropDownButtons( bool );
 
+  virtual SUIT_CameraProperties cameraProperties();
+
 public slots:
   virtual void onFrontView() { getView(MAIN_VIEW)->onFrontView(); }
   virtual void onViewFitAll();
@@ -123,8 +127,8 @@ private slots:
   void onContextMenuRequested(QContextMenuEvent*);
 
 private:
-  void connectViewSignals(OCCViewer_ViewWindow* theView);
-
+  void connectViewSignals( OCCViewer_ViewWindow* theView );
+  void updateWindowTitle( OCCViewer_ViewWindow* theView );
 
   QList<OCCViewer_ViewWindow*> myViews;
   QGridLayout* myLayout;
index 26e9ba79db5f86e6772d1b1dbdce2634d67a52a6..0a4905ef930632f59202a8937fe92175ae9b1190 100755 (executable)
@@ -287,6 +287,8 @@ void OCCViewer_ViewWindow::initLayout()
   QtxAction* anAction = dynamic_cast<QtxAction*>( toolMgr()->action( GraduatedAxesId ) );
   myCubeAxesDlg = new OCCViewer_CubeAxesDlg( anAction, this, "OCCViewer_CubeAxesDlg" );
   myCubeAxesDlg->initialize();
+  
+  connect( myViewPort, SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), this, SLOT( emitViewModified() ) );
 }
 
 OCCViewer_ViewWindow* OCCViewer_ViewWindow::getView( const int mode ) const
@@ -1240,15 +1242,8 @@ void OCCViewer_ViewWindow::createActions()
   connect(aAction, SIGNAL(triggered()), this, SLOT(onMaximizedView()));
   toolMgr()->registerAction( aAction, MaximizedId );
 
-  // Synchronize view
-  aAction = new QtxAction(tr("MNU_SYNCHRONIZE_VIEW"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_SYNC" ) ),
-                          tr( "MNU_SYNCHRONIZE_VIEW" ), 0, this );
-  aAction->setStatusTip(tr("DSC_SYNCHRONIZE_VIEW"));
-  aAction->setMenu( new QMenu( this ) );
-  aAction->setCheckable(true);
-  connect(aAction->menu(), SIGNAL(aboutToShow()), this, SLOT(updateSyncViews()));
-  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onSynchronizeView(bool)));
-  toolMgr()->registerAction( aAction, SynchronizeId );
+  // Synchronize View 
+  toolMgr()->registerAction( synchronizeAction(), SynchronizeId );
 }
 
 /*!
@@ -1547,7 +1542,10 @@ void OCCViewer_ViewWindow::onAxialScale()
     myScalingDlg = new OCCViewer_AxialScaleDlg( this );
   
   if ( !myScalingDlg->isVisible() )
+  {
+    myScalingDlg->Update();
     myScalingDlg->show();
+  }
 }
 
 /*!
@@ -2493,144 +2491,174 @@ void OCCViewer_ViewWindow::updateViewAspects( const viewAspectList& aViewList )
   myViewAspects = aViewList;
 }
 
-void OCCViewer_ViewWindow::synchronizeView( OCCViewer_ViewWindow* viewWindow, int id )
+/*!
+  Get camera properties for the OCC view window.
+  \return shared pointer on camera properties.
+*/
+SUIT_CameraProperties OCCViewer_ViewWindow::cameraProperties()
 {
-  OCCViewer_ViewWindow* otherViewWindow = 0;
-  QList<OCCViewer_ViewWindow*> compatibleViews;
+  SUIT_CameraProperties aProps;
 
-  bool isSync = viewWindow->toolMgr()->action( SynchronizeId )->isChecked();
+  Handle(V3d_View) aSourceView = getViewPort()->getView();
+  if ( aSourceView.IsNull() )
+    return aProps;
 
-  int vwid = viewWindow->getId();
-  
-  SUIT_Application* app = SUIT_Session::session()->activeApplication();
-  if ( !app ) return;
-
-  QList<SUIT_ViewManager*> wmlist;
-  app->viewManagers( viewWindow->getViewManager()->getType(), wmlist );
-
-  foreach( SUIT_ViewManager* wm, wmlist ) {
-    QVector<SUIT_ViewWindow*> vwlist = wm->getViews();
-
-    foreach( SUIT_ViewWindow* vw, vwlist ) {
-      OCCViewer_ViewWindow* occVW = dynamic_cast<OCCViewer_ViewWindow*>( vw );
-      if ( !occVW ) continue;
-
-      // check only compatible types
-      occVW = occVW->getView( viewWindow->get2dMode() );
-      if ( occVW ) {
-       if ( occVW->getId() == id ) 
-         otherViewWindow = occVW;
-       else if ( occVW != viewWindow )
-         compatibleViews.append( occVW );
-      }
-    }
+  if ( get2dMode() == No2dMode ) {
+    aProps.setDimension( SUIT_CameraProperties::Dim3D );
   }
-
-  if ( isSync && id ) {
-    // remove all possible disconnections
-    foreach( OCCViewer_ViewWindow* vw, compatibleViews ) {
-      // disconnect target view
-      vw->getViewPort()->disconnect( SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), viewWindow->getViewPort(), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
-      viewWindow->getViewPort()->disconnect( SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), vw->getViewPort(), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
-      if ( otherViewWindow ) {
-       // disconnect source view
-       vw->getViewPort()->disconnect( SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), otherViewWindow->getViewPort(), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
-       otherViewWindow->getViewPort()->disconnect( SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), vw->getViewPort(), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
-      }
-      QAction* a = vw->toolMgr()->action( SynchronizeId );
-      if ( a ) {
-       int anid = a->data().toInt();
-       if ( a->isChecked() && ( anid == id || anid == vwid ) ) {
-         bool blocked = a->blockSignals( true );
-         a->setChecked( false );
-         a->blockSignals( blocked );
-       }
-      }
-    }
-    if ( otherViewWindow ) {
-      // reconnect source and target view
-      otherViewWindow->getViewPort()->disconnect( SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), viewWindow->getViewPort(), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
-      viewWindow->getViewPort()->disconnect( SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), otherViewWindow->getViewPort(), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
-      otherViewWindow->getViewPort()->connect( viewWindow->getViewPort(), SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
-      viewWindow->getViewPort()->connect( otherViewWindow->getViewPort(), SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
-      // synchronize target view with source view
-      viewWindow->getViewPort()->synchronize( otherViewWindow->getViewPort() );
-      viewWindow->toolMgr()->action( SynchronizeId )->setData( otherViewWindow->getId() );
-      QAction* anOtherAcion = otherViewWindow->toolMgr()->action( SynchronizeId );
-      if (anOtherAcion) {
-        anOtherAcion->setData( viewWindow->getId() );
-        if ( !anOtherAcion->isChecked() ) {
-               bool blocked = anOtherAcion->blockSignals( true );
-               anOtherAcion->setChecked( true );
-               anOtherAcion->blockSignals( blocked );
-        }
-      }
-    }
-  }
-  else if ( otherViewWindow ) {
-    // reconnect source and target view
-    otherViewWindow->getViewPort()->disconnect( SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), viewWindow->getViewPort(), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
-    viewWindow->getViewPort()->disconnect( SIGNAL( vpTransformed( OCCViewer_ViewPort* ) ), otherViewWindow->getViewPort(), SLOT( synchronize( OCCViewer_ViewPort* ) ) );
-    viewWindow->getViewPort()->synchronize( otherViewWindow->getViewPort() );
-    viewWindow->toolMgr()->action( SynchronizeId )->setData( otherViewWindow->getId() );
-    QAction* anOtherAcion = otherViewWindow->toolMgr()->action( SynchronizeId );
-    if (anOtherAcion) {
-      if ( anOtherAcion->data().toInt() == viewWindow->getId() && anOtherAcion->isChecked() ) {
-        bool blocked = anOtherAcion->blockSignals( true );
-        anOtherAcion->setChecked( false );
-        anOtherAcion->blockSignals( blocked );
-      }
-    }
+  else {
+    aProps.setDimension( SUIT_CameraProperties::Dim2D );
+    aProps.setViewSide( (SUIT_CameraProperties::ViewSide)(int)get2dMode() );
   }
+  
+  // read common properites of the view
+  Standard_Real anUpDir[3];
+  Standard_Real aPrjDir[3];
+  Standard_Real aMapScale[2];
+  Standard_Real aTranslation[3];
+  Standard_Real anAxialScale[3];
+  
+  aSourceView->Up(anUpDir[0], anUpDir[1], anUpDir[2]);
+  aSourceView->Proj(aPrjDir[0], aPrjDir[1], aPrjDir[2]);
+  aSourceView->At(aTranslation[0], aTranslation[1], aTranslation[2]);
+  aSourceView->Size(aMapScale[0], aMapScale[1]);
+
+  getViewPort()->getAxialScale(anAxialScale[0], anAxialScale[1], anAxialScale[2]);
+
+  // we use similar depth to the one used in perspective projection 
+  // to proivde a convinience synchronization with other camera views that
+  // can switch between orthogonal & perspective projection. otherwise,
+  // the camera will get to close when switching from orthogonal to perspective.
+  Standard_Real aCameraDepth = aSourceView->Depth() + aSourceView->ZSize() * 0.5;
+
+  // store common props
+  aProps.setViewUp(anUpDir[0], anUpDir[1], anUpDir[2]);
+  aProps.setMappingScale(aMapScale[1] / 2.0);
+  aProps.setAxialScale(anAxialScale[0], anAxialScale[1], anAxialScale[2]);
+  
+  // generate view orientation matrix for transforming OCC projection reference point
+  // into a camera (eye) position.
+  gp_Dir aLeftDir = gp_Dir(anUpDir[0], anUpDir[1], anUpDir[2]).Crossed(
+    gp_Dir(aPrjDir[0], aPrjDir[1], aPrjDir[2]));
+
+  gp_Trsf aTrsf;
+  aTrsf.SetValues( aLeftDir.X(), anUpDir[0], aPrjDir[0], aTranslation[0],
+                   aLeftDir.Y(), anUpDir[1], aPrjDir[1], aTranslation[1],
+                   aLeftDir.Z(), anUpDir[2], aPrjDir[2], aTranslation[2],
+                   Precision::Confusion(),
+                   Precision::Confusion() );
+
+  // get projection reference point in view coordinates
+  Graphic3d_Vertex aProjRef = aSourceView->ViewMapping().ProjectionReferencePoint();
+  
+  // transform to world-space coordinate system
+  gp_Pnt aPosition = gp_Pnt(aProjRef.X(), aProjRef.Y(), aCameraDepth).Transformed(aTrsf);
+  
+  // compute focal point
+  double aFocalPoint[3];
+
+  aFocalPoint[0] = aPosition.X() - aPrjDir[0] * aCameraDepth;
+  aFocalPoint[1] = aPosition.Y() - aPrjDir[1] * aCameraDepth;
+  aFocalPoint[2] = aPosition.Z() - aPrjDir[2] * aCameraDepth;
+
+  aProps.setFocalPoint(aFocalPoint[0], aFocalPoint[1], aFocalPoint[2]);
+  aProps.setPosition(aPosition.X(), aPosition.Y(), aPosition.Z());
+
+  return aProps;
 }
 
 /*!
-  "Synchronize View" action slot.
+  Synchronize views.
+  This implementation synchronizes OCC view's camera propreties.
 */
-void OCCViewer_ViewWindow::onSynchronizeView(bool checked)
+void OCCViewer_ViewWindow::synchronize( SUIT_ViewWindow* theView )
 {
-  QAction* a = qobject_cast<QAction*>( sender() );
-  if ( a ) {
-    synchronizeView( this, a->data().toInt() );
-  }
-}
+  bool blocked = blockSignals( true );
 
-/*!
-  Update list of available view for the "Synchronize View" action
-*/
-void OCCViewer_ViewWindow::updateSyncViews()
-{
-  QAction* anAction = toolMgr()->action( SynchronizeId );
-  if ( anAction && anAction->menu() ) {
-    int currentId = anAction->data().toInt();
-    anAction->menu()->clear();
-    SUIT_Application* app = SUIT_Session::session()->activeApplication();
-    if ( app ) { 
-      QList<SUIT_ViewManager*> wmlist;
-      app->viewManagers( getViewManager()->getType(), wmlist );
-      foreach( SUIT_ViewManager* wm, wmlist ) {
-       QVector<SUIT_ViewWindow*> vwlist = wm->getViews();
-       foreach ( SUIT_ViewWindow* vw, vwlist ) {
-         OCCViewer_ViewWindow* occVW = dynamic_cast<OCCViewer_ViewWindow*>( vw );
-         if ( !occVW || occVW == this ) continue;
-         // list only compatible types
-         OCCViewer_ViewWindow* subWindow = occVW->getView( get2dMode() );
-         if ( subWindow && subWindow != this ) {
-           QAction* a = anAction->menu()->addAction( occVW->windowTitle() );
-           if ( subWindow->getId() == currentId ) {
-             QFont f = a->font();
-             f.setBold( true );
-             a->setFont( f );
-           }
-           a->setData( subWindow->getId() );
-           connect( a, SIGNAL( triggered(bool) ), this, SLOT( onSynchronizeView(bool) ) );
-         }
-       }
-      }
-    }
-    if ( anAction->menu()->actions().isEmpty() ) {
-      anAction->setData( 0 );
-      anAction->menu()->addAction( tr( "MNU_SYNC_NO_VIEW" ) );
-    }
+  SUIT_CameraProperties aProps = theView->cameraProperties();
+  if ( !cameraProperties().isCompatible( aProps ) ) {
+    // other view, this one is being currently synchronized to, seems has become incompatible
+    // we have to break synchronization
+    updateSyncViews();
+    return;
   }
+
+  Handle(V3d_View) aDestView = getViewPort()->getView();
+
+  aDestView->SetImmediateUpdate( Standard_False );
+
+  double anUpDir[3];
+  double aPosition[3];
+  double aFocalPoint[3];
+  double aMapScaling;
+  double anAxialScale[3];
+
+  // get common properties
+  aProps.getFocalPoint(aFocalPoint[0], aFocalPoint[1], aFocalPoint[2]);
+  aProps.getPosition(aPosition[0], aPosition[1], aPosition[2]);
+  aProps.getViewUp(anUpDir[0], anUpDir[1], anUpDir[2]);
+  aProps.getAxialScale(anAxialScale[0], anAxialScale[1], anAxialScale[2]);
+  aMapScaling = aProps.getMappingScale() * 2.0;
+
+  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]).Crossed(
+    gp_Dir(aProjDir.X(), aProjDir.Y(), aProjDir.Z()));
+
+  // convert camera position into a view reference point
+  gp_Trsf aTrsf;
+  aTrsf.SetValues( aLeftDir.X(), anUpDir[0], aProjDir.X(), aTranslation[0],
+                   aLeftDir.Y(), anUpDir[1], aProjDir.Y(), aTranslation[1],
+                   aLeftDir.Z(), anUpDir[2], aProjDir.Z(), aTranslation[2], 
+                   Precision::Confusion(),
+                   Precision::Confusion() );
+  aTrsf.Invert();
+
+  // transform to view-space coordinate system
+  gp_Pnt aProjRef(aPosition[0], aPosition[1], aPosition[2]);
+  aProjRef.Transform(aTrsf);
+
+  // 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
+  Standard_Real aWidth, aHeight;
+  aDestView->Size(aWidth, aHeight);
+  
+  if ( aWidth > aHeight )
+    aDestView->SetSize (aMapScaling * (aWidth / aHeight));
+  else
+    aDestView->SetSize (aMapScaling);
+
+  getViewPort()->setAxialScale(anAxialScale[0], anAxialScale[1], anAxialScale[2]);
+
+  aDestView->ZFitAll();
+  aDestView->SetImmediateUpdate( Standard_True );
+  aDestView->Redraw();
+
+  blockSignals( blocked );
 }
index 28d3d8d649bf53aea819a0b044f813fa02386e1d..625e4c58cf826d0d327b3fd532a8181d644e2a3e 100755 (executable)
@@ -195,6 +195,8 @@ public:
   virtual void                    updateViewAspects( const viewAspectList& );
   virtual void                    clearViewAspects();
 
+  virtual SUIT_CameraProperties   cameraProperties();
+
 public slots:
   virtual void onFrontView();
   virtual void onViewFitAll();
@@ -244,6 +246,9 @@ signals:
   void Hide( QHideEvent * );
   void maximized( OCCViewer_ViewWindow*, bool );
 
+protected slots:
+  void synchronize( SUIT_ViewWindow* );
+
 public:
   virtual QImage dumpView();
   virtual bool   dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
@@ -315,13 +320,6 @@ protected:
 
   double myCurScale;
 
-private slots:
-  void                  onSynchronizeView(bool);
-  void                  updateSyncViews();
-
-private:
-  static void           synchronizeView( OCCViewer_ViewWindow*, int );
-
 private:
   OCCViewer_ClippingDlg* myClippingDlg;
   QtxAction* myClippingAction;
index 21c1ae70581fb893b2a1d34b5e5bdfdcf7428467..40bb075112c5cb4bdc789dc2005573086f1c920c 100644 (file)
         <source>ICON_OCCVIEWER_MINIMIZE</source>
         <translation>occ_view_minimized.png</translation>
     </message>
-    <message>
-        <source>ICON_OCCVIEWER_SYNC</source>
-        <translation>occ_view_sync.png</translation>
-    </message>
 </context>
 </TS>
index 301870645feacc1a2c5cd258b7605e98a8291628..029eda7dc759c5686877b7047400c9d0ff4be19b 100644 (file)
         <source>DSC_MINIMIZE_VIEW</source>
         <translation>Minimize view</translation>
     </message>
-    <message>
-        <source>DSC_SYNCHRONIZE_VIEW</source>
-        <translation>Synchronize view</translation>
-    </message>
     <message>
         <source>MNU_MAXIMIZE_VIEW</source>
         <translation>Maximize</translation>
         <source>MNU_MINIMIZE_VIEW</source>
         <translation>Minimize</translation>
     </message>
-    <message>
-        <source>MNU_SYNCHRONIZE_VIEW</source>
-        <translation>Synchronize</translation>
-    </message>
-    <message>
-        <source>MNU_SYNC_NO_VIEW</source>
-        <translation>[ No appropriate view ]</translation>
-    </message>
 </context>
 <context>
     <name>OCCViewer_CreateRestoreViewDlg</name>
index 843d08b779e706f0f12fb74b22f1ca69624fd899..c54f679891909763a1d8aaa89d5d378800365de2 100755 (executable)
         <source>DSC_MINIMIZE_VIEW</source>
         <translation>Minimiser la vue</translation>
     </message>
-    <message>
-        <source>DSC_SYNCHRONIZE_VIEW</source>
-        <translation>Synchroniser la vue</translation>
-    </message>
     <message>
         <source>MNU_MAXIMIZE_VIEW</source>
         <translation>Maximiser</translation>
         <source>MNU_MINIMIZE_VIEW</source>
         <translation>Minimiser</translation>
     </message>
-    <message>
-        <source>MNU_SYNCHRONIZE_VIEW</source>
-        <translation>Synchroniser</translation>
-    </message>
-    <message>
-        <source>MNU_SYNC_NO_VIEW</source>
-        <translation>[ Pas de vue appropriée ]</translation>
-    </message>
 </context>
 <context>
     <name>OCCViewer_CreateRestoreViewDlg</name>
diff --git a/src/OCCViewer/resources/occ_view_sync.png b/src/OCCViewer/resources/occ_view_sync.png
deleted file mode 100755 (executable)
index 32b9522..0000000
Binary files a/src/OCCViewer/resources/occ_view_sync.png and /dev/null differ
index 3e65e51fee1e0c3ec695d091cdeb20d39e6c9f93..a1fb3648794db5a4e7095ae4a90dfb58681a8318 100755 (executable)
@@ -298,31 +298,7 @@ void Plot2d_ViewFrame::EraseAll()
       }
       myIntermittentSegmentList.clear();
   }
-
-  // 2)- Erase all curves points markers
-
-  int nbMark = myMarkerList.size();
-  if (nbMark > 0)
-  {
-      for (int imar=0; imar < nbMark; imar++)
-      {
-          QwtPlotMarker *marker = myMarkerList[imar];
-
-          marker->detach();  // erase in QwtPlot window
-          delete marker;
-      }
-      myMarkerList.clear();
-  }
-
-  // The graphic view's picker
-  Plot2d_QwtPlotPicker *picker = myPlot->getPicker();
-
-  // Clear points markers list and associations (marker,tooltip)
-  if ( picker ) {
-    picker->pMarkers.clear();         // QList<QwtPlotMarker*>
-    picker->pMarkersToolTip.clear();  // QMap<QwtPlotMarker*, QwtText>
-  }
-
+  
   // 3)- Erase all QwtPlotCurve associated with the Plot2d_Curve
 
   int nbCur1 = myQwtPlotCurveList.size();
@@ -1435,6 +1411,7 @@ void Plot2d_ViewFrame::fitAll()
 
   double xmin, xmax, y1min, y1max, y2min, y2max;
   getFitRangeByCurves(xmin, xmax, y1min, y1max, y2min, y2max);
+  getFitRangeByMarkers(xmin, xmax, y1min, y1max, y2min, y2max);
 
   myPlot->setAxisScale( QwtPlot::xBottom, xmin, xmax );
   myPlot->setAxisScale( QwtPlot::yLeft, y1min, y1max );
@@ -1586,6 +1563,47 @@ void Plot2d_ViewFrame::getFitRangeByCurves(double& xMin,  double& xMax,
   }
 }
 
+/*!
+  Gets current fit ranges by Markers
+  All parameters are inout.
+*/
+void Plot2d_ViewFrame::getFitRangeByMarkers(double& xMin,  double& xMax,
+                                            double& yMin,  double& yMax,
+                                            double& y2Min, double& y2Max)
+{
+  Plot2d_QwtPlotPicker *picker=myPlot->getPicker();
+  if(!picker)
+    return;
+  if(picker->pMarkers.empty())
+    return;
+  foreach(QwtPlotMarker *mrker,picker->pMarkers)
+    {
+      bool isV2 = mrker->yAxis() == QwtPlot::yRight;
+      xMin = qMin( xMin, mrker->xValue() );
+      xMax = qMax( xMax, mrker->xValue() );
+      if ( isV2 ) {
+        y2Min = qMin( y2Min, mrker->yValue() );
+        y2Max = qMax( y2Max, mrker->yValue() );
+      }
+      else {
+        yMin = qMin( yMin, mrker->yValue() );
+        yMax = qMax( yMax, mrker->yValue() );
+      }
+      if ( xMin == xMax ) {
+        xMin = xMin == 0. ? -1. : xMin - xMin/10.;
+        xMax = xMax == 0. ?  1. : xMax + xMax/10.;
+      }
+      if ( yMin == yMax ) {
+        yMin = yMin == 0. ? -1. : yMin - yMin/10.;
+        yMax = yMax == 0. ?  1  : yMax + yMax/10.;
+      }
+      if ( y2Min == y2Max ) {
+        y2Min = y2Min == 0. ? -1. : y2Min - y2Min/10.;
+        y2Max = y2Max == 0. ?  1  : y2Max + y2Max/10.;
+      }
+    }
+}
+
 /*!
   Tests if it is necessary to start operation on mouse action
 */
@@ -2813,7 +2831,8 @@ public:
 */
 Plot2d_Plot2d::Plot2d_Plot2d( QWidget* parent )
   : QwtPlot( parent ),
-    myIsPolished( false )
+    myIsPolished( false ),
+    myPicker( 0 )
 {
   // Create alternative scales
   setAxisScaleDraw( QwtPlot::yLeft,   new Plot2d_ScaleDraw() );
@@ -4294,28 +4313,28 @@ Plot2d_QwtPlotPicker::~Plot2d_QwtPlotPicker()
  */
 QwtText Plot2d_QwtPlotPicker::trackerText( const QwtDoublePoint & pos ) const
 {
-  for (QList<QwtPlotMarker* >::const_iterator pMarkerIt = pMarkers.begin();
-                                              pMarkerIt != pMarkers.end();
-                                              ++pMarkerIt )
-  {
+  for (QList<QwtPlotMarker* >::const_iterator pMarkerIt = pMarkers.begin();pMarkerIt != pMarkers.end(); ++pMarkerIt )
+    {
       QwtPlotMarker* pMarker = *pMarkerIt;
       if ( pMarker != NULL )
-      {
-          QwtDoubleRect  bound0        = pMarker->boundingRect();
-          QwtDoublePoint center_bound0 = bound0.center();
-          double left = center_bound0.x()-(BOUND_HV_SIZE/2.);
-          double top  = center_bound0.y()-(BOUND_HV_SIZE/2.);
-         
-          QwtDoubleRect  bound( left, top , BOUND_HV_SIZE, BOUND_HV_SIZE);
-         
-          if( bound.contains(pos) )
-          {
-            //QString toolTip =  "X="  + QString::number( pMarker->xValue() )
-            //                 + " Y=" + QString::number( pMarker->yValue() );
-            return pMarkersToolTip[pMarker];
-          }
-      }        
+        {
+          const QwtSymbol &symb=pMarker->symbol();
+          const QSize& sz=symb.size();
+          const QwtScaleMap yMapRef=plot()->canvasMap(QwtPlot::yLeft);
+          const QwtScaleMap xMap=plot()->canvasMap(pMarker->xAxis());
+          const QwtScaleMap yMap=plot()->canvasMap(pMarker->yAxis());
+          QwtDoubleRect  bound0=pMarker->boundingRect();
+          QRect bound00=pMarker->transform(xMap,yMap,bound0);
+          QPoint toto(xMap.transform(pos.x()),yMapRef.transform(pos.y()));
+          bound00.setX(bound00.x()-sz.width());
+          bound00.setY(bound00.y()-sz.height());
+          bound00.setWidth(bound00.width()+sz.width());
+          bound00.setHeight(bound00.height()+sz.height());
+          if( bound00.contains(toto) )
+            {
+              return pMarkersToolTip[pMarker];
+            }
+        }
   }
-      
   return QwtText();      
 }
index a517e96a238922b6ba224c88a95d9f14b811667d..0455f1c850c45d7b550bad82d61687f2425bed6b 100755 (executable)
@@ -154,6 +154,9 @@ public:
   void           getFitRangeByCurves( double&, double&, double&, double&,
                                      double&, double& );
 
+  void           getFitRangeByMarkers(double&, double&, double&, double&,
+                                      double&, double& );
+
   void              addAnalyticalCurve( Plot2d_AnalyticalCurve* );
   void              removeAnalyticalCurve( Plot2d_AnalyticalCurve* );
   void              updateAnalyticalCurve( Plot2d_AnalyticalCurve*, bool = false );
@@ -319,9 +322,6 @@ protected:
   // List of intermittent segments to connect curves
   QList<QwtPlotCurve*> myIntermittentSegmentList;
 
-  // List of markers associated with curves points
-  QList<QwtPlotMarker*> myMarkerList;
-
   // List of curves Plot2d_Curve
   QList<Plot2d_Curve*> myPlot2dCurveList;
 };
index d8aa1e33f99d82cd82435a4666f04d8a7bd7b83c..574b8b0bb2a04be92bf34f053d11a90e71c8e7f8 100644 (file)
@@ -242,7 +242,8 @@ QtxMainWindow::QtxMainWindow( QWidget* parent, Qt::WindowFlags f )
   myOpaque( true ),
   myResizer( 0 ),
   myMouseMove( 0 ),
-  myFullScreenAllowed(true)
+  myFullScreenAllowed(true),
+  myMinimizeAllowed(true)
 {
   //rnv: Enables tooltips for inactive windows.
   //rnv: For details see http://bugtracker.opencascade.com/show_bug.cgi?id=20893
@@ -398,7 +399,7 @@ QString QtxMainWindow::storeGeometry() const
     state = QString( "max" );
     break;
   case Qt::WindowMinimized:
-    state = QString( "min" );
+    if ( isMinimizeAllowed() ) state = QString( "min" );
     break;
   case Qt::WindowFullScreen:
     state = isFullScreenAllowed() ? QString( "full" ) : QString( "max" );
@@ -482,12 +483,16 @@ void QtxMainWindow::retrieveGeometry( const QString& str )
   if ( stRx.indexIn( geom ) != -1 )
   {
     QString stStr = stRx.cap( 1 ).trimmed().toLower();
-    if ( stStr.startsWith( QString( "max" ) ) )
+    if ( stStr.startsWith( QString( "max" ) ) ) {
       state = Qt::WindowMaximized;
-    else if ( stStr.startsWith( QString( "min" ) ) )
-      state = Qt::WindowMinimized;
-    else if ( stStr.startsWith( QString( "full" ) ) )
-      state = Qt::WindowFullScreen;
+    }
+    else if ( stStr.startsWith( QString( "min" ) ) ) {
+      if ( isMinimizeAllowed() )
+       state = Qt::WindowMinimized;
+    }
+    else if ( stStr.startsWith( QString( "full" ) ) ) {
+      state = isFullScreenAllowed() ? Qt::WindowFullScreen : Qt::WindowMaximized;
+    }
   }
 
   resize( rect.size() );
@@ -629,7 +634,7 @@ bool QtxMainWindow::event( QEvent* e )
 /*!
   \brief FullScreenAllowed flag allowed dump in the main window geometry 
          Qt::WindowFullScreen parameter.
-  \return \c fullScreenAllowed flag.
+  \return \c FullScreenAllowed flag.
 */
 bool QtxMainWindow::isFullScreenAllowed() const {
   return myFullScreenAllowed;
@@ -639,8 +644,27 @@ bool QtxMainWindow::isFullScreenAllowed() const {
 /*!
   \brief Set FullScreenAllowed flag.
          The default value is true.
-  \param f value of the fullScreenAllowed flag.
+  \param f value of the FullScreenAllowed flag.
 */
 void QtxMainWindow::setFullScreenAllowed( const bool f ) {
     myFullScreenAllowed = f;
 }
+
+/*!
+  \brief MinimizeAllowed flag allowed dump in the main window geometry 
+         Qt::WindowMinimized parameter.
+  \return \c MinimizeAllowed flag.
+*/
+bool QtxMainWindow::isMinimizeAllowed() const {
+  return myMinimizeAllowed;
+}
+
+
+/*!
+  \brief Set MinimizeAllowed flag.
+         The default value is true.
+  \param f value of the MinimizeAllowed flag.
+*/
+void QtxMainWindow::setMinimizeAllowed( const bool f ) {
+    myMinimizeAllowed = f;
+}
index 5148f1d8e720ae18969c685e788828874b3cc42a..8de97eb0b6450194f9e5c06bf1a5487d46ed2910 100644 (file)
@@ -57,6 +57,9 @@ public:
   bool              isFullScreenAllowed() const;
   void              setFullScreenAllowed( const bool );
 
+  bool              isMinimizeAllowed() const;
+  void              setMinimizeAllowed( const bool );
+
 protected:
   virtual bool      event( QEvent* );
 
@@ -71,6 +74,7 @@ private:
   QToolBar*         myStatusBar;     //!< dockable status bar
 
   bool              myFullScreenAllowed;
+  bool              myMinimizeAllowed;
 
   bool              myOpaque;
   Resizer*          myResizer;
index 2710a09337c45da9f17b50b254e573e65b32507b..1c9055c9b3187be526a407e1414761bdd1b1a677 100644 (file)
@@ -374,7 +374,7 @@ int QtxPopupMgr::insertAction( QAction* a, const int pId, const QString& rule, c
 */
 bool QtxPopupMgr::hasRule( QAction* a, const RuleType t ) const
 {
-  return a ? expression( a, t, false ) : false;
+  return a ? expression( a, t, false )!=0 : false;
 }
 
 /*!
index e08d354570c25f35d51d3a3615dd158b2e4bc742..7fdb22aa49fe1befc973432bc95782e1a5a8b5a7 100644 (file)
@@ -27,8 +27,8 @@
 include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 # extra source files (generated by sip)
-SIP_SRC = sipAPISalomePyQt.h                   \
-         sipSalomePyQtSalomePyQt.cc            \
+SIP_API = sipAPISalomePyQt.h
+SIP_SRC = sipSalomePyQtSalomePyQt.cc           \
          sipSalomePyQtSALOME_Selection.cc      \
          sipSalomePyQtQtxAction.cc             \
          sipSalomePyQtQtxActionGroup.cc        \
@@ -42,7 +42,7 @@ SIP_FILES = SalomePyQt.sip
 EXTRA_DIST += $(SIP_FILES)
 
 # extra clean files
-CLEANFILES = $(SIP_SRC)
+CLEANFILES = $(SIP_SRC) $(SIP_API)
 
 # moc files (generated my moc)
 MOC_FILES = SalomePyQt_moc.cxx
@@ -80,7 +80,9 @@ libSalomePyQt_la_CPPFLAGS = $(COMMON_CPP_FLAGS)
 libSalomePyQt_la_LIBADD = $(COMMON_LIBS)
 
 # custom build step: generate C++ wrapping according to $(SIP_FILES)
-$(SIP_SRC): $(SIP_FILES)
+$(SIP_SRC): $(SIP_API)
+
+$(SIP_API): $(SIP_FILES)
        $(SIP) $(PYQT_SIPFLAGS) $<
 
 # custom install step: create symbolic link
index fcd2d6c293232bd32dffff4001e04e333c891e27..e2f2c98e2c922003b306d475b11b63572fc7524b 100644 (file)
@@ -59,6 +59,7 @@ SET(GUI_HEADERS
   SUIT_ViewModel.h 
   SUIT_ViewWindow.h 
   SUIT_ShortcutMgr.h
+  SUIT_CameraProperties.h
 )
 QT4_WRAP_CPP(GUI_HEADERS_MOC ${GUI_HEADERS})
 
@@ -93,6 +94,7 @@ SET(suit_SOURCES
   SUIT_ViewModel.cxx
   SUIT_ViewWindow.cxx
   SUIT_ShortcutMgr.cxx
+  SUIT_CameraProperties.cxx
 )
 SET(GUITS_SOURCES
   resources/SUIT_msg_en.ts
index 68f6184c0e8859e1d9a71ff61875bbe845674f23..e9ec7b620a63dd3da47bbad792b8bc1b6c2d7300 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-#  File   : Makefile.in
-#  Author : Vladimir Klyachin (OCN)
-#  Module : suit
-#  $Header$
-#
 include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 lib_LTLIBRARIES = libsuit.la
@@ -62,7 +57,8 @@ salomeinclude_HEADERS =                       \
        SUIT_ViewManager.h              \
        SUIT_ViewModel.h                \
        SUIT_ViewWindow.h               \
-       SUIT_ShortcutMgr.h
+       SUIT_ShortcutMgr.h              \
+       SUIT_CameraProperties.h
 
 dist_libsuit_la_SOURCES =              \
        SUIT_Accel.cxx                  \
@@ -94,7 +90,8 @@ dist_libsuit_la_SOURCES =             \
        SUIT_ViewManager.cxx            \
        SUIT_ViewModel.cxx              \
        SUIT_ViewWindow.cxx             \
-       SUIT_ShortcutMgr.cxx
+       SUIT_ShortcutMgr.cxx            \
+       SUIT_CameraProperties.cxx
 
 MOC_FILES =                            \
        SUIT_Accel_moc.cxx              \
@@ -124,11 +121,11 @@ nodist_salomeres_DATA =                   \
        SUIT_msg_en.qm                  \
        SUIT_msg_fr.qm                  \
        SUIT_images.qm
-               
+
 dist_salomeres_DATA =                     \
        resources/icon_visibility_on.png  \
-       resources/icon_visibility_off.png
-                               
+       resources/icon_visibility_off.png \
+       resources/view_sync.png
 
 libsuit_la_CPPFLAGS = $(QT_INCLUDES) -I$(srcdir)/../Qtx -I$(srcdir)/../ObjBrowser
 
diff --git a/src/SUIT/SUIT_CameraProperties.cxx b/src/SUIT/SUIT_CameraProperties.cxx
new file mode 100644 (file)
index 0000000..2848887
--- /dev/null
@@ -0,0 +1,357 @@
+// Copyright (C) 2007-2012  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.
+//
+// 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
+//
+
+#include "SUIT_CameraProperties.h"
+
+/*!
+  \class SUIT_CameraProperties
+  \brief Base class for Camera Properties
+  
+  This class provides common properties that
+  can be used for any arbitrary camera. This
+  properties are employed by camera synchronization
+  algorithms.
+*/
+
+/*!
+  \brief Default constructor. 
+
+  Creates invalid camera properties data, i.e. IsValid() returns \c false.
+*/
+SUIT_CameraProperties::SUIT_CameraProperties()
+{
+  // init with some default values
+  myUpDir[0] = 0.0;
+  myUpDir[1] = 1.0;
+  myUpDir[2] = 0.0;
+  
+  myPosition[0] = 0.0;
+  myPosition[1] = 0.0;
+  myPosition[2] = 500.0;
+  
+  myFocalPoint[0] = 0.0;
+  myFocalPoint[1] = 0.0;
+  myFocalPoint[2] = 0.0;
+    
+  myAxialScale[0] = 1.0;
+  myAxialScale[1] = 1.0;
+  myAxialScale[2] = 1.0;
+  
+  myMappingScale = 1000;
+
+  myDimension   = DimNone;        // none dimension by default
+  myProjection  = PrjOrthogonal;  // orthogonal projection by default
+  myViewSide    = ViewNone;       // no side view by default
+  
+  myViewAngle = 45.0;
+}
+
+/*!
+  \brief Destructor
+*/
+SUIT_CameraProperties::~SUIT_CameraProperties()
+{
+}
+
+/*!
+  \brief Check if camera properties are valid.
+  \return \c true if camera properties data is valid.
+  \sa setDimension()
+*/
+bool SUIT_CameraProperties::isValid() const
+{
+  return myDimension != DimNone;
+}
+
+/*!
+  \brief Check if this camera properties data is compatible with other camera properties.
+  \param other other properties data
+  \return \c true if both camera properties sets are compatible
+*/
+bool SUIT_CameraProperties::isCompatible( const SUIT_CameraProperties& other )
+{
+  bool result = false;
+  // check only valid data and data with same dimensions
+  if ( isValid() && other.isValid() && getDimension() == other.getDimension() ) {
+    switch( getDimension() ) {
+    case SUIT_CameraProperties::Dim2D:
+      // two 2d views are compatible if their view side is the same
+      result = getViewSide() == other.getViewSide();
+      break;
+    case SUIT_CameraProperties::Dim3D:
+      // two 3d views are compatible if their projection mode is the same
+      result = getProjection() == other.getProjection();
+      break;
+    default:
+      break;
+    }
+  }
+  return result;
+}
+
+/*!
+  \brief get dimension supported by camera.
+  \return dimension mode.
+  \sa setDimension()
+*/
+SUIT_CameraProperties::Dimension SUIT_CameraProperties::getDimension() const
+{
+  return myDimension;
+}
+
+/*!
+  \brief set dimension supported by camera.
+  \param theDimension [in] dimension mode.
+  \sa getDimension()
+*/
+void SUIT_CameraProperties::setDimension( const SUIT_CameraProperties::Dimension theDimension )
+{
+  myDimension = theDimension;
+}
+
+/*!
+  \brief get side view supported by camera (for 2d viewer).
+
+  For 2d viewer, side view can be of following values:
+  - SUIT_CameraProperties::ViewNone - no side view (for instance, for true 2d viewer)
+  - SUIT_CameraProperties::ViewXY   - XY side view of 3d scene
+  - SUIT_CameraProperties::ViewXZ   - XZ side view of 3d scene
+  - SUIT_CameraProperties::ViewYZ   - YZ side view of 3d scene
+
+  \return side view.
+  \sa setViewSide()
+*/
+SUIT_CameraProperties::ViewSide SUIT_CameraProperties::getViewSide() const
+{
+  return myViewSide;
+}
+
+/*!
+  \brief set side view supported by camera (for 2d viewer).
+
+  For 2d viewer, side view can be of following values:
+  - SUIT_CameraProperties::ViewNone - no side view (for instance, for true 2d viewer)
+  - SUIT_CameraProperties::ViewXY   - XY side view of 3d scene
+  - SUIT_CameraProperties::ViewXZ   - XZ side view of 3d scene
+  - SUIT_CameraProperties::ViewYZ   - YZ side view of 3d scene
+
+  \param theViewSide [in] view side.
+  \sa getViewSide()
+*/
+void SUIT_CameraProperties::setViewSide( const SUIT_CameraProperties::ViewSide theViewSide )
+{
+  myViewSide = theViewSide;
+}
+
+/*!
+  \brief get projection mode supported by camera (for 3d viewer).
+
+  For 3d viewer, projection mode can be of following values:
+  - SUIT_CameraProperties::PrjOrthogonal - orthogonal projection
+  - SUIT_CameraProperties::PrjPerspective - perspective projection
+
+  \return projection mode.
+  \sa setProjection()
+*/
+SUIT_CameraProperties::Projection SUIT_CameraProperties::getProjection() const
+{
+  return myProjection;
+}
+
+/*!
+  \brief set projection mode supported by camera (for 3d viewer).
+
+  For 3d viewer, projection mode can be of following values:
+  - SUIT_CameraProperties::PrjOrthogonal - orthogonal projection
+  - SUIT_CameraProperties::PrjPerspective - perspective projection
+
+  \param theProjection [in] projection mode.
+  \sa getProjection()
+*/
+void SUIT_CameraProperties::setProjection( const SUIT_CameraProperties::Projection theProjection )
+{
+  myProjection = theProjection;
+}
+
+/*!
+  \brief get camera up direction vector.
+  \param theX [out] vector's x coordinate in world-coordinates space.
+  \param theY [out] vector's y coordinate in world-coordinates space.
+  \param theZ [out] vector's z coordinate in world-coordinates space.
+  \sa setViewUp()
+*/
+void SUIT_CameraProperties::getViewUp(double& theX, double& theY, double& theZ) const
+{
+  theX = myUpDir[0];
+  theY = myUpDir[1];
+  theZ = myUpDir[2];
+}
+
+/*!
+  \brief set camera up direction vector.
+
+  It is recommended to set normalized vector coordinates for
+  synchronization compatibility.
+  
+  \param theX [in] vector's x coordinate in world-coordinates space.
+  \param theY [in] vector's y coordinate in world-coordinates space.
+  \param theZ [in] vector's z coordinate in world-coordinates space.
+  \sa getViewUp()
+*/
+void SUIT_CameraProperties::setViewUp(const double theX, const double theY, const double theZ)
+{
+  myUpDir[0] = theX;
+  myUpDir[1] = theY;
+  myUpDir[2] = theZ;
+}
+
+/*!
+  \brief get camera's position (eye).
+  \param theX [out] x coordinate in world-coordinates space.
+  \param theY [out] y coordinate in world-coordinates space.
+  \param theZ [out] z coordinate in world-coordinates space.
+  \sa setPosition()
+*/
+void SUIT_CameraProperties::getPosition(double& theX, double& theY, double& theZ) const
+{
+  theX = myPosition[0];
+  theY = myPosition[1];
+  theZ = myPosition[2];
+}
+
+/*!
+  \brief get camera's position (eye).
+  \param theX [in] x coordinate in world-coordinates space.
+  \param theY [in] y coordinate in world-coordinates space.
+  \param theZ [in] z coordinate in world-coordinates space.
+  \sa getPosition()
+*/
+void SUIT_CameraProperties::setPosition(const double theX, const double theY, const double theZ)
+{
+  myPosition[0] = theX;
+  myPosition[1] = theY;
+  myPosition[2] = theZ;
+}
+
+/*!
+  \brief get camera's focal point (look point).
+  \param theX [out] x coordinate in world-coordinates space.
+  \param theY [out] y coordinate in world-coordinates space.
+  \param theZ [out] z coordinate in world-coordinates space.
+  \sa setFocalPoint()
+*/
+void SUIT_CameraProperties::getFocalPoint(double& theX, double& theY, double& theZ) const
+{
+  theX = myFocalPoint[0];
+  theY = myFocalPoint[1];
+  theZ = myFocalPoint[2];
+}
+
+/*!
+  \brief set camera's focal point (look point).
+  \param theX [in] x coordinate in world-coordinates space.
+  \param theY [in] y coordinate in world-coordinates space.
+  \param theZ [in] z coordinate in world-coordinates space.
+  \sa getFocalPoint()
+*/
+void SUIT_CameraProperties::setFocalPoint(const double theX, const double theY, const double theZ)
+{
+  myFocalPoint[0] = theX;
+  myFocalPoint[1] = theY;
+  myFocalPoint[2] = theZ;
+}
+
+/*!
+  \brief get window mapping scale (parallel scale).
+
+  Mapping scale defines a mapping scaling factor for the height
+  of the viewport in world-coordinate distances.
+
+  \return scaling value.
+  \sa setMappingScale()
+*/
+double SUIT_CameraProperties::getMappingScale() const
+{
+  return myMappingScale;
+}
+
+/*!
+  \brief set window mapping scale (parallel scale).
+
+  Mapping scale defines a mapping scaling factor for the height
+  of the viewport in world-coordinate distances.
+
+  \param theScale [in] the scaling.
+  \sa getMappingScale()
+*/
+void SUIT_CameraProperties::setMappingScale(const double theScale)
+{
+  myMappingScale = theScale;
+}
+
+/*! 
+  \brief get scaling factors for world-coordinate space axes.
+  \param theScaleX [out] scale by x coordinate.
+  \param theScaleY [out] scale by y coordinate.
+  \param theScaleZ [out] scale by z coordinate.
+  \sa setAxialScale()
+*/
+void SUIT_CameraProperties::getAxialScale(double& theScaleX, double& theScaleY, double& theScaleZ)
+{
+  theScaleX = myAxialScale[0];
+  theScaleY = myAxialScale[1];
+  theScaleZ = myAxialScale[2];
+}
+
+/*!
+  \brief set scaling factors for world-coordinate space axes.
+  \param theScaleX [in] scale by x coordinate.
+  \param theScaleY [in] scale by y coordinate.
+  \param theScaleZ [in] scale by z coordinate.
+  \sa getAxialScale()
+*/
+void SUIT_CameraProperties::setAxialScale(const double theScaleX, const double theScaleY, const double theScaleZ)
+{ 
+  myAxialScale[0] = theScaleX;
+  myAxialScale[1] = theScaleY;
+  myAxialScale[2] = theScaleZ;
+}
+
+/*!
+  \brief get angle (typically in degrees) of view for perpective projection mode.
+  \return the angle of view.
+  \sa setViewAngle()
+*/
+double SUIT_CameraProperties::getViewAngle() const
+{
+  return myViewAngle;
+}
+
+/*!
+  \brief set angle (typically in degrees) of view for perpective projection mode.
+  \param theViewAngle [in] the angle of view.
+  \sa getViewAngle()
+*/
+void SUIT_CameraProperties::setViewAngle(const double theViewAngle)
+{
+  myViewAngle = theViewAngle;
+}
diff --git a/src/SUIT/SUIT_CameraProperties.h b/src/SUIT/SUIT_CameraProperties.h
new file mode 100644 (file)
index 0000000..366de65
--- /dev/null
@@ -0,0 +1,81 @@
+// Copyright (C) 2007-2012  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.
+//
+// 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
+//
+
+#ifndef SUIT_CAMERAPROPERITES_H
+#define SUIT_CAMERAPROPERITES_H
+
+#include "SUIT.h"
+
+class SUIT_EXPORT SUIT_CameraProperties
+{
+public:
+  enum Dimension  { DimNone, Dim2D, Dim3D };
+  enum ViewSide   { ViewNone, ViewXY, ViewXZ, ViewYZ };
+  enum Projection { PrjOrthogonal, PrjPerspective };
+
+  SUIT_CameraProperties();
+  virtual ~SUIT_CameraProperties();
+
+  bool       isValid() const;
+  bool       isCompatible( const SUIT_CameraProperties& other );
+
+  Dimension  getDimension() const;
+  void       setDimension( const Dimension theDimension );
+
+  ViewSide   getViewSide() const;
+  void       setViewSide( const ViewSide theViewSide );
+
+  Projection getProjection() const;
+  void       setProjection( const Projection theProjection );
+
+  void       getViewUp(double& theX, double& theY, double& theZ) const;
+  void       setViewUp(const double theX, const double theY, const double theZ);
+
+  void       getPosition(double& theX, double& theY, double& theZ) const;
+  void       setPosition(const double theX, const double theY, const double theZ);
+
+  void       getFocalPoint(double& theX, double& theY, double& theZ) const;
+  void       setFocalPoint(const double theX, const double theY, const double theZ);
+
+  double     getMappingScale() const;
+  void       setMappingScale(const double theScale);
+
+  void       getAxialScale(double& theScaleX, double& theScaleY, double& theScaleZ);
+  void       setAxialScale(const double theScaleX, const double theScaleY, const double theScaleZ);
+
+  double     getViewAngle() const;
+  void       setViewAngle(const double theViewAngle);
+  
+// common properties for all viewers
+private:
+  Dimension  myDimension;        //!< dimension
+  ViewSide   myViewSide;         //!< side view (for 2d viewer)
+  Projection myProjection;       //!< projection mode (for 3d viewer): orthogonal / perspective
+  double     myUpDir[3];         //!< camera up vector
+  double     myPosition[3];      //!< camera position (eye).
+  double     myFocalPoint[3];    //!< focal point position in world-space coordinates
+  double     myMappingScale;     //!< window mapping scale (parallel projection scale)
+  double     myAxialScale[3];    //!< scaling factors for world axes
+  double     myViewAngle;        //!< perspective view angle in degrees
+};
+
+#endif // SUIT_CAMERAPROPERITES_H
index 9a616557fae7db416aaa076d7a9fe61f84b35d22..b1fa95b1b9abbb69836044dc30171ad06e6c814c 100755 (executable)
@@ -65,6 +65,28 @@ void SUIT_ExceptionHandler::showMessage( const QString& title, const QString& ms
   
   while ( QApplication::overrideCursor() )
     QApplication::restoreOverrideCursor();
-  
+
+  cleanUp();
+
   SUIT_MessageBox::critical( 0, title, msg );
 }
+
+CleanUpFuncList SUIT_ExceptionHandler::myCleanUpFunctions;
+
+void SUIT_ExceptionHandler::addCleanUpRoutine(CleanUpFunction p)
+{
+  myCleanUpFunctions.append(p);
+}
+
+void SUIT_ExceptionHandler::removeCleanUpRoutine(CleanUpFunction p)
+{
+  myCleanUpFunctions.removeAll(p);
+}
+
+void SUIT_ExceptionHandler::cleanUp()
+{
+  foreach( QtCleanUpFunction f, myCleanUpFunctions )
+  {
+    f();
+  }
+}
index 53922d2c03b4afb9f52cd1c8e1e16d25b32c35ae..ea67fc1b74ef01a0e3b85935fd46bf915a7d4fb7 100755 (executable)
 #define SUIT_EXCEPTIONHANDLER_H
 
 #include "SUIT.h"
+#include <QList>
 
 class QEvent;
 class QObject;
 class QString;
 
+typedef void (*CleanUpFunction)();
+typedef QList<CleanUpFunction> CleanUpFuncList;
+
 class SUIT_EXPORT SUIT_ExceptionHandler
 {
 public:
+  static void  addCleanUpRoutine(CleanUpFunction p);
+  static void  removeCleanUpRoutine(CleanUpFunction p);
+
   virtual bool handle( QObject*, QEvent* );
 
 protected:
   bool         internalHandle( QObject*, QEvent* );
   void         showMessage( const QString&, const QString& );
+
+private:
+  void         cleanUp();
+
+  static CleanUpFuncList myCleanUpFunctions;
 };
 
 extern "C"
index 6bf0ebe3c3a8fb0bcbe60f56659d07fc08d70787..b063cbb8be07b65b3ea0dac166bd314fa2878c2a 100755 (executable)
 #include "SUIT_ViewWindow.h"
 
 #include "SUIT_Tools.h"
+#include "SUIT_Session.h"
 #include "SUIT_Study.h"
 #include "SUIT_Desktop.h"
 #include "SUIT_MessageBox.h"
 #include "SUIT_Application.h"
 #include "SUIT_ViewManager.h"
+#include "SUIT_ResourceMgr.h"
 #include "QtxActionToolMgr.h"
 #include "QtxMultiAction.h"
 
 #include <QEvent>
 #include <QIcon>
+#include <QMenu>
 #include <QApplication>
 #include <QContextMenuEvent>
 
@@ -47,7 +50,7 @@ const int DUMP_EVENT = QEvent::User + 123;
 
 /*! Constructor.*/
 SUIT_ViewWindow::SUIT_ViewWindow( SUIT_Desktop* theDesktop )
-  : QMainWindow( theDesktop ), myManager( 0 ), myIsDropDown( true )
+  : QMainWindow( theDesktop ), myManager( 0 ), myIsDropDown( true ), mySyncAction( 0 )
 {
   myDesktop = theDesktop;
 
@@ -259,7 +262,7 @@ QtxActionToolMgr* SUIT_ViewWindow::toolMgr() const
 }
 
 /*!
-  \brief Set buttons mode to drop-down (\a on = \c true) or ligned (\a on = \c false) 
+  \brief Set buttons mode to drop-down (\a on = \c true) or ligned (\a on = \c false)
   \param on new buttons mode
   \sa dropDownButtons()
 */
@@ -320,9 +323,222 @@ bool SUIT_ViewWindow::dropDownButtons() const
 }
 
 /*!
-  \return window unique identifier  
+  \return window unique identifier
 */
 int SUIT_ViewWindow::getId() const
 {
   return int(long(this));
 }
+
+/*!
+  Get camera properties for the view window.
+  \return shared pointer on camera properties. Base implementation
+          returns null properties.
+*/
+SUIT_CameraProperties SUIT_ViewWindow::cameraProperties()
+{
+  return SUIT_CameraProperties();
+}
+
+/*!
+  Synchronize this view window's camera properties with specified
+  view window.
+
+  This method is a part of general views synchronization mechanism.
+  It should be redefined in successors. Base imlementation does nothing.
+
+  \param otherWindow other view window
+*/
+void SUIT_ViewWindow::synchronize( SUIT_ViewWindow* /*otherWindow*/ )
+{
+  // base implementation does nothing
+}
+
+/*!
+  Get action for views syncronization.
+
+  This method is a part of general views synchronization mechanism.
+  It creates an action that can be inserted, for instance, to the toolbar.
+
+  \return action for views synchronization
+*/
+QAction* SUIT_ViewWindow::synchronizeAction()
+{
+  if ( !mySyncAction ) {
+    SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+    mySyncAction = new QtxAction( tr( "MNU_SYNCHRONIZE_VIEW" ),
+                                 resMgr->loadPixmap( "SUIT", tr( "ICON_VIEW_SYNC" ) ),
+                                 tr( "MNU_SYNCHRONIZE_VIEW" ), 0, this );
+    mySyncAction->setStatusTip( tr( "DSC_SYNCHRONIZE_VIEW" ) );
+    mySyncAction->setMenu( new QMenu( this ) );
+    mySyncAction->setCheckable( true );
+    connect( mySyncAction->menu(), SIGNAL( aboutToShow() ),     this, SLOT( updateSyncViews() ) );
+    connect( mySyncAction,         SIGNAL( triggered( bool ) ), this, SLOT( onSynchronizeView( bool ) ) );
+  }
+  return mySyncAction;
+}
+
+/*!
+  Emit notification signal that the view is transformed.
+  Other views can use the signal for synchronization.
+*/
+void SUIT_ViewWindow::emitViewModified()
+{
+  emit viewModified( this );
+}
+
+/*!
+  Update list of available view for the "Synchronize View" action
+*/
+void SUIT_ViewWindow::updateSyncViews()
+{
+  SUIT_CameraProperties props = cameraProperties();
+  if ( !props.isValid() )
+    return;
+
+  QAction* anAction = synchronizeAction();
+  if ( anAction && anAction->menu() ) {
+    int currentId = anAction->data().toInt();
+    anAction->menu()->clear();
+    SUIT_Application* app = SUIT_Session::session()->activeApplication();
+    if ( app ) {
+      SUIT_Desktop* d = app->desktop();
+      QList<SUIT_ViewWindow*> allViews = qFindChildren<SUIT_ViewWindow*>( d );
+      foreach( SUIT_ViewWindow* vw, allViews ) {
+       if ( !vw || vw == this ) continue; // skip invalid views and this one
+       SUIT_CameraProperties otherProps = vw->cameraProperties();
+       if ( otherProps.isCompatible( props ) ) {
+         QAction* a = anAction->menu()->addAction( vw->windowTitle() );
+         if ( vw->getId() == currentId ) {
+           QFont f = a->font();
+           f.setBold( true );
+           a->setFont( f );
+         }
+         a->setData( vw->getId() );
+         connect( a, SIGNAL( triggered( bool ) ), this, SLOT( onSynchronizeView( bool ) ) );
+       }
+       else if ( vw->getId() == currentId ) {
+         // other view, this one is being currently synchronized to, seems has become incompatible
+         // we have to break synchronization
+         vw->disconnect( SIGNAL( viewModified( SUIT_ViewWindow* ) ), this, SLOT( synchronize( SUIT_ViewWindow* ) ) );
+         this->disconnect( SIGNAL( viewModified( SUIT_ViewWindow* ) ), vw, SLOT( synchronize( SUIT_ViewWindow* ) ) );
+         // 
+         bool blocked = anAction->blockSignals( true );
+         anAction->setChecked( false );
+         anAction->blockSignals( blocked );
+         anAction->setData( 0 );
+         //
+         QAction* a = vw->synchronizeAction();
+         if ( a ) {
+           blocked = a->blockSignals( true );
+           a->setChecked( false );
+           a->blockSignals( blocked );
+         }
+       }
+      }
+    }
+    if ( anAction->menu()->actions().isEmpty() ) {
+      anAction->setData( 0 );
+      anAction->menu()->addAction( tr( "MNU_SYNC_NO_VIEW" ) );
+    }
+  }
+}
+
+/*!
+  "Synchronize View" action slot.
+*/
+void SUIT_ViewWindow::onSynchronizeView( bool checked )
+{
+  QAction* a = qobject_cast<QAction*>( sender() );
+  if ( a ) {
+    synchronizeView( this, a->data().toInt() );
+  }
+}
+
+/*!
+  Synchronize camera properties of view \a viewWindow with
+  camera properties of view specified via \a id
+*/
+void SUIT_ViewWindow::synchronizeView( SUIT_ViewWindow* viewWindow, int id )
+{
+  SUIT_ViewWindow* sourceView = 0;
+  QList<SUIT_ViewWindow*> otherViews;
+
+  bool isSync = viewWindow->synchronizeAction() && viewWindow->synchronizeAction()->isChecked();
+
+  int vwid = viewWindow->getId();
+
+  SUIT_Application* app = SUIT_Session::session()->activeApplication();
+  if ( !app ) return;
+  SUIT_Desktop* d = app->desktop();
+  if ( !d ) return;
+
+  QList<SUIT_ViewWindow*> allViews = qFindChildren<SUIT_ViewWindow*>( d );
+  foreach( SUIT_ViewWindow* vw, allViews ) {
+    if ( !vw->cameraProperties().isValid() )
+      continue;                    // omit views not supporting camera properties
+    if ( vw->getId() == id )
+      sourceView = vw;             // remember source view
+    else if ( vw != viewWindow )
+      otherViews.append( vw );     // collect all remaining views
+  }
+
+  if ( isSync && id ) {
+    // remove all possible disconnections
+    foreach( SUIT_ViewWindow* vw, otherViews ) {
+      // disconnect target view
+      vw->disconnect( SIGNAL( viewModified( SUIT_ViewWindow* ) ), viewWindow, SLOT( synchronize( SUIT_ViewWindow* ) ) );
+      viewWindow->disconnect( SIGNAL( viewModified( SUIT_ViewWindow* ) ), vw, SLOT( synchronize( SUIT_ViewWindow* ) ) );
+      if ( sourceView ) {
+       // disconnect source view
+       vw->disconnect( SIGNAL( viewModified( SUIT_ViewWindow* ) ), sourceView, SLOT( synchronize( SUIT_ViewWindow* ) ) );
+       sourceView->disconnect( SIGNAL( viewModified( SUIT_ViewWindow* ) ), vw, SLOT( synchronize( SUIT_ViewWindow* ) ) );
+      }
+      QAction* a = vw->synchronizeAction();
+      if ( a ) {
+       int anid = a->data().toInt();
+       if ( a->isChecked() && ( anid == id || anid == vwid ) ) {
+         bool blocked = a->blockSignals( true );
+         a->setChecked( false );
+         a->blockSignals( blocked );
+       }
+      }
+    }
+    if ( sourceView ) {
+      // reconnect source and target views
+      sourceView->disconnect( SIGNAL( viewModified( SUIT_ViewWindow* ) ), viewWindow, SLOT( synchronize( SUIT_ViewWindow* ) ) );
+      viewWindow->disconnect( SIGNAL( viewModified( SUIT_ViewWindow* ) ), sourceView, SLOT( synchronize( SUIT_ViewWindow* ) ) );
+      sourceView->connect( viewWindow, SIGNAL( viewModified( SUIT_ViewWindow* ) ), SLOT( synchronize( SUIT_ViewWindow* ) ) );
+      viewWindow->connect( sourceView, SIGNAL( viewModified( SUIT_ViewWindow* ) ), SLOT( synchronize( SUIT_ViewWindow* ) ) );
+      // synchronize target view with source view
+      viewWindow->synchronize( sourceView );
+      if ( viewWindow->synchronizeAction() )
+       viewWindow->synchronizeAction()->setData( sourceView->getId() );
+      QAction* sourceAction = sourceView->synchronizeAction();
+      if ( sourceAction ) {
+        sourceAction->setData( viewWindow->getId() );
+        if ( !sourceAction->isChecked() ) {
+         bool blocked = sourceAction->blockSignals( true );
+         sourceAction->setChecked( true );
+         sourceAction->blockSignals( blocked );
+        }
+      }
+    }
+  }
+  else if ( sourceView ) {
+    // reconnect source and target view
+    sourceView->disconnect( SIGNAL( viewModified( SUIT_ViewWindow* ) ), viewWindow, SLOT( synchronize( SUIT_ViewWindow* ) ) );
+    viewWindow->disconnect( SIGNAL( viewModified( SUIT_ViewWindow* ) ), sourceView, SLOT( synchronize( SUIT_ViewWindow* ) ) );
+    viewWindow->synchronize( sourceView );
+    if ( viewWindow->synchronizeAction() )
+      viewWindow->synchronizeAction() ->setData( sourceView->getId() );
+    QAction* sourceAction = sourceView->synchronizeAction();
+    if ( sourceAction ) {
+      if ( sourceAction->data().toInt() == viewWindow->getId() && sourceAction->isChecked() ) {
+        bool blocked = sourceAction->blockSignals( true );
+        sourceAction->setChecked( false );
+        sourceAction->blockSignals( blocked );
+      }
+    }
+  }
+}
index e7dc87a1a8492625fc37c8face92e17287a06b5f..bf39ba042beaba793b02a51674f540d8454279b8 100755 (executable)
@@ -26,6 +26,7 @@
 #define SUIT_VIEWWINDOW_H
 
 #include "SUIT.h"
+#include "SUIT_CameraProperties.h"
 
 #include <QMainWindow>
 #include <QList>
@@ -71,6 +72,8 @@ public:
   virtual void      setDropDownButtons( bool );
   bool              dropDownButtons() const;
 
+  virtual SUIT_CameraProperties cameraProperties();
+
 public slots:
   virtual void      onDumpView();
 
@@ -85,7 +88,8 @@ signals:
   void              keyPressed( SUIT_ViewWindow*, QKeyEvent* );
   void              keyReleased( SUIT_ViewWindow*, QKeyEvent* );
   void              contextMenuRequested( QContextMenuEvent *e );
-
+  void              viewModified( SUIT_ViewWindow* );
+  
 protected:
   void              closeEvent( QCloseEvent* );
   virtual void      contextMenuEvent( QContextMenuEvent* );
@@ -93,15 +97,25 @@ protected:
   virtual bool      action( const int );
   virtual bool      dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
 
+  virtual QAction*  synchronizeAction();
+  static void       synchronizeView( SUIT_ViewWindow* viewWindow, int id );
+  
   SUIT_Desktop*     myDesktop;
   SUIT_ViewManager* myManager;
 
+protected slots:
+  void              updateSyncViews();
+  void              onSynchronizeView(bool);
+  virtual void      synchronize( SUIT_ViewWindow* );
+  void              emitViewModified();
+  
 private:
   typedef QMap< int, QList<QtxMultiAction*> > ActionsMap;
 
   QtxActionToolMgr* myToolMgr;
   bool              myIsDropDown;
   ActionsMap        myMultiActions;
+  QAction*          mySyncAction;
 };
 
 #endif // SUIT_VIEWWINDOW_H
index ff3f7d4fcaece79d4540a7567790f90fb06d4122..63c6010503e7d186a44db1bd65c3368e51a0b8af 100644 (file)
@@ -11,5 +11,9 @@
         <source>ICON_DATAOBJ_INVISIBLE</source>
         <translation>icon_visibility_off.png</translation>
     </message>
+    <message>
+        <source>ICON_VIEW_SYNC</source>
+        <translation>view_sync.png</translation>
+    </message>
 </context>
 </TS>
index c1435da5bad404f50a62202a39d585a34dc45712..31bbc382a8d46ff7f789c34ebf8e6cf918ff57f0 100644 (file)
@@ -113,6 +113,18 @@ Do you want to overwrite it?</translation>
         <source>NAME_COLUMN</source>
         <translation>Name</translation>
     </message>
+    <message>
+        <source>MNU_SYNCHRONIZE_VIEW</source>
+        <translation>Synchronize</translation>
+    </message>
+    <message>
+        <source>DSC_SYNCHRONIZE_VIEW</source>
+        <translation>Synchronize view</translation>
+    </message>
+    <message>
+        <source>MNU_SYNC_NO_VIEW</source>
+        <translation>[ No appropriate view ]</translation>
+    </message>
 </context>
 <context>
     <name>SUIT_Study</name>
index 345b25512aaf2c3cd962ebbb3272b23ae6e75a03..d3785c28da1ece546f7d5a85e0f6c922cc31c496 100755 (executable)
@@ -113,6 +113,18 @@ Voulez-vous l&apos;écraser ?</translation>
         <source>NAME_COLUMN</source>
         <translation>Nom</translation>
     </message>
+    <message>
+        <source>MNU_SYNCHRONIZE_VIEW</source>
+        <translation>Synchroniser</translation>
+    </message>
+    <message>
+        <source>DSC_SYNCHRONIZE_VIEW</source>
+        <translation>Synchroniser la vue</translation>
+    </message>
+    <message>
+        <source>MNU_SYNC_NO_VIEW</source>
+        <translation>[ Pas de vue appropriée ]</translation>
+    </message>
 </context>
 <context>
     <name>SUIT_Study</name>
diff --git a/src/SUIT/resources/view_sync.png b/src/SUIT/resources/view_sync.png
new file mode 100644 (file)
index 0000000..32b9522
Binary files /dev/null and b/src/SUIT/resources/view_sync.png differ
index c048c3f49a9e073abe496551c4c51dada3907942..ad697f4fae752ab2b2447610f49eafd69dc57286 100755 (executable)
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-#  File   : Makefile.in
-#  Author : Alexander Solovyov(OCN)
-#  Module : SVTK
-# $Header$
-#
 include $(top_srcdir)/adm_local/unix/make_common_starter.am
 
 lib_LTLIBRARIES = libSVTK.la
@@ -135,7 +130,6 @@ dist_salomeres_DATA=\
        resources/vtk_view_recording_play.png \
        resources/vtk_view_recording_pause.png \
        resources/vtk_view_recording_stop.png \
-       resources/vtk_view_sync.png \
        resources/vtk_view_highlight.png
 
 nodist_salomeres_DATA =        \
index 3a81fc72a29871a7ed2a78224cedd9ff22767375..271aa4c938e9e4809392a4ad2dbd9aeffce4b9f8 100755 (executable)
@@ -76,7 +76,6 @@
 #include "VTKViewer_Trihedron.h"
 
 #include "SVTK_View.h"
-//#include "SVTK_MainWindow.h"
 #include "SVTK_Selector.h"
 
 #include "SVTK_Event.h"
@@ -229,6 +228,8 @@ void SVTK_ViewWindow::Initialize(SVTK_ViewModelBase* theModel)
 
   GetInteractor()->GetInteractorStyle()->AddObserver(SVTK::OperationFinished, 
                                                     myEventCallbackCommand.GetPointer(), 0.0);
+  myKeyFreeInteractorStyle->AddObserver(SVTK::OperationFinished, 
+                                       myEventCallbackCommand.GetPointer(), 0.0);
 
 
   
@@ -259,6 +260,8 @@ void SVTK_ViewWindow::Initialize(SVTK_View* theView,
           this,SIGNAL(contextMenuRequested(QContextMenuEvent *)));
   connect(theView,SIGNAL(selectionChanged()),
           theModel,SLOT(onSelectionChanged()));
+
+  connect( this, SIGNAL( transformed( SVTK_ViewWindow* ) ), SLOT( emitViewModified() ) );
 }
 
 /*!
@@ -1843,6 +1846,8 @@ void SVTK_ViewWindow::onPerspectiveMode()
   vtkCamera* aCamera = getRenderer()->GetActiveCamera();
   aCamera->SetParallelProjection(anIsParallelMode);
   GetInteractor()->GetDevice()->CreateTimer(VTKI_TIMER_FIRST);
+
+  emit transformed( this );
 }
 
 void SVTK_ViewWindow::SetEventDispatcher(vtkObject* theDispatcher)
@@ -2065,15 +2070,7 @@ void SVTK_ViewWindow::createActions(SUIT_ResourceMgr* theResourceMgr)
   mgr->registerAction( anAction, ViewParametersId );
 
   // Synchronize View 
-  anAction = new QtxAction(tr("MNU_SYNCHRONIZE_VIEW"), 
-                           theResourceMgr->loadPixmap( "VTKViewer", tr( "ICON_SVTK_SYNCHRONIZE" ) ),
-                           tr( "MNU_SYNCHRONIZE_VIEW" ), 0, this);
-  anAction->setStatusTip(tr("DSC_SYNCHRONIZE_VIEW"));
-  anAction->setMenu( new QMenu( this ) );
-  anAction->setCheckable(true);
-  connect(anAction->menu(), SIGNAL(aboutToShow()), this, SLOT(updateSyncViews()));
-  connect(anAction, SIGNAL(triggered(bool)), this, SLOT(onSynchronizeView(bool)));
-  mgr->registerAction( anAction, SynchronizeId );
+  mgr->registerAction( synchronizeAction(), SynchronizeId );
 
   // Switch between interaction styles
   anAction = new QtxAction(tr("MNU_SVTK_STYLE_SWITCH"), 
@@ -2361,134 +2358,6 @@ void SVTK_ViewWindow::hideEvent( QHideEvent * theEvent )
   emit Hide( theEvent );
 }
 
-void SVTK_ViewWindow::synchronizeView( SVTK_ViewWindow* viewWindow, int id )
-{
-  SVTK_ViewWindow* otherViewWindow = 0;
-  QList<SVTK_ViewWindow*> compatibleViews;
-
-  bool isSync = viewWindow->toolMgr()->action( SynchronizeId )->isChecked();
-
-  int vwid = viewWindow->getId();
-  
-  SUIT_Application* app = SUIT_Session::session()->activeApplication();
-  if ( !app ) return;
-
-  QList<SUIT_ViewManager*> wmlist;
-  app->viewManagers( viewWindow->getViewManager()->getType(), wmlist );
-
-  foreach( SUIT_ViewManager* wm, wmlist ) {
-    QVector<SUIT_ViewWindow*> vwlist = wm->getViews();
-
-    foreach( SUIT_ViewWindow* vw, vwlist ) {
-      SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( vw );
-      if ( !vtkVW ) continue;
-      if ( vtkVW->getId() == id ) 
-       otherViewWindow = vtkVW;
-      else if ( vtkVW != viewWindow )
-       compatibleViews.append( vtkVW );
-    }
-  }
-
-  if ( isSync && id ) {
-    // remove all possible disconnections
-    foreach( SVTK_ViewWindow* vw, compatibleViews ) {
-      // disconnect target view
-      vw->disconnect( SIGNAL( transformed( SVTK_ViewPort* ) ), viewWindow, SLOT( synchronize( SVTK_ViewPort* ) ) );
-      viewWindow->disconnect( SIGNAL( transformed( SVTK_ViewPort* ) ), vw, SLOT( synchronize( SVTK_ViewPort* ) ) );
-      if ( otherViewWindow ) {
-       // disconnect source view
-       vw->disconnect( SIGNAL( transformed( SVTK_ViewPort* ) ), otherViewWindow, SLOT( synchronize( SVTK_ViewPort* ) ) );
-       otherViewWindow->disconnect( SIGNAL( transformed( SVTK_ViewPort* ) ), vw, SLOT( synchronize( SVTK_ViewPort* ) ) );
-      }
-      QAction* a = vw->toolMgr()->action( SynchronizeId );
-      if ( a ) {
-       int anid = a->data().toInt();
-       if ( a->isChecked() && ( anid == id || anid == vwid ) ) {
-         bool blocked = a->blockSignals( true );
-         a->setChecked( false );
-         a->blockSignals( blocked );
-       }
-      }
-    }
-    if ( otherViewWindow ) {
-      // reconnect source and target view
-      otherViewWindow->disconnect( SIGNAL( transformed( SVTK_ViewWindow* ) ), viewWindow, SLOT( synchronize( SVTK_ViewWindow* ) ) );
-      viewWindow->disconnect( SIGNAL( transformed( SVTK_ViewWindow* ) ), otherViewWindow, SLOT( synchronize( SVTK_ViewWindow* ) ) );
-      otherViewWindow->connect( viewWindow, SIGNAL( transformed( SVTK_ViewWindow* ) ), SLOT( synchronize( SVTK_ViewWindow* ) ) );
-      viewWindow->connect( otherViewWindow, SIGNAL( transformed( SVTK_ViewWindow* ) ), SLOT( synchronize( SVTK_ViewWindow* ) ) );
-      // synchronize target view with source view
-      viewWindow->doSetVisualParameters( otherViewWindow->getVisualParameters(), true );
-      viewWindow->toolMgr()->action( SynchronizeId )->setData( otherViewWindow->getId() );
-      otherViewWindow->toolMgr()->action( SynchronizeId )->setData( viewWindow->getId() );
-      if ( !otherViewWindow->toolMgr()->action( SynchronizeId )->isChecked() ) {
-       bool blocked = otherViewWindow->toolMgr()->action( SynchronizeId )->blockSignals( true );
-       otherViewWindow->toolMgr()->action( SynchronizeId )->setChecked( true );
-       otherViewWindow->toolMgr()->action( SynchronizeId )->blockSignals( blocked );
-      }
-    }
-  }
-  else if ( otherViewWindow ) {
-    // reconnect source and target view
-    otherViewWindow->disconnect( SIGNAL( transformed( SVTK_ViewWindow* ) ), viewWindow, SLOT( synchronize( SVTK_ViewWindow* ) ) );
-    viewWindow->disconnect( SIGNAL( transformed( SVTK_ViewWindow* ) ), otherViewWindow, SLOT( synchronize( SVTK_ViewWindow* ) ) );
-    viewWindow->doSetVisualParameters( otherViewWindow->getVisualParameters(), true );
-    viewWindow->toolMgr()->action( SynchronizeId )->setData( otherViewWindow->getId() );
-    if ( otherViewWindow->toolMgr()->action( SynchronizeId )->data().toInt() == viewWindow->getId() && otherViewWindow->toolMgr()->action( SynchronizeId )->isChecked() ) {
-      bool blocked = otherViewWindow->toolMgr()->action( SynchronizeId )->blockSignals( true );
-      otherViewWindow->toolMgr()->action( SynchronizeId )->setChecked( false );
-      otherViewWindow->toolMgr()->action( SynchronizeId )->blockSignals( blocked );
-    }
-  }
-}
-
-/*!
-  "Synchronize View" action slot.
-*/
-void SVTK_ViewWindow::onSynchronizeView(bool checked)
-{
-  QAction* a = qobject_cast<QAction*>( sender() );
-  if ( a ) {
-    synchronizeView( this, a->data().toInt() );
-  }
-}
-
-/*!
-  Update list of available view for the "Synchronize View" action
-*/
-void SVTK_ViewWindow::updateSyncViews()
-{
-  QAction* anAction = toolMgr()->action( SynchronizeId );
-  if ( anAction && anAction->menu() ) {
-    int currentId = anAction->data().toInt();
-    anAction->menu()->clear();
-    SUIT_Application* app = SUIT_Session::session()->activeApplication();
-    if ( app ) { 
-      QList<SUIT_ViewManager*> wmlist;
-      app->viewManagers( getViewManager()->getType(), wmlist );
-      foreach( SUIT_ViewManager* wm, wmlist ) {
-       QVector<SUIT_ViewWindow*> vwlist = wm->getViews();
-       foreach ( SUIT_ViewWindow* vw, vwlist ) {
-         SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( vw );
-         if ( !vtkVW || vtkVW == this ) continue;
-         QAction* a = anAction->menu()->addAction( vtkVW->windowTitle() );
-          if ( vtkVW->getId() == currentId ) {
-            QFont f = a->font();
-           f.setBold( true );
-           a->setFont( f );
-         }
-         a->setData( vtkVW->getId() );
-         connect( a, SIGNAL( triggered(bool) ), this, SLOT( onSynchronizeView(bool) ) );
-       }
-      }
-    }
-    if ( anAction->menu()->actions().isEmpty() ) {
-      anAction->setData( 0 );
-      anAction->menu()->addAction( tr( "MNU_SYNC_NO_VIEW" ) );
-    }
-  }
-}
-
-
 /*!
   Emit transformed signal.
 */
@@ -2508,3 +2377,99 @@ void SVTK_ViewWindow::ProcessEvents(vtkObject* vtkNotUsed(theObject),
   if(self)
     self->emitTransformed();
 }
+
+/*!
+  Get camera properties for the SVTK view window.
+  \return shared pointer on camera properties.
+*/
+SUIT_CameraProperties SVTK_ViewWindow::cameraProperties()
+{
+  SUIT_CameraProperties aProps;
+
+  // get vtk camera
+  vtkCamera* aCamera = getRenderer()->GetActiveCamera();
+  if ( !aCamera )
+    return aProps;
+  
+  aProps.setDimension( SUIT_CameraProperties::Dim3D );
+  if ( toolMgr()->action( ParallelModeId ) ) {
+    if ( toolMgr()->action( ParallelModeId )->isChecked() )
+      aProps.setProjection( SUIT_CameraProperties::PrjOrthogonal );
+    else
+      aProps.setProjection( SUIT_CameraProperties::PrjPerspective );
+  }
+
+  double aFocalPoint[3];
+  double aPosition[3];
+  double aViewUp[3];
+  double anAxialScale[3];
+
+  aCamera->OrthogonalizeViewUp();
+  aCamera->GetFocalPoint(aFocalPoint);
+  aCamera->GetPosition(aPosition);
+  aCamera->GetViewUp(aViewUp);
+  
+  aProps.setFocalPoint(aFocalPoint[0], aFocalPoint[1], aFocalPoint[2]);
+  aProps.setPosition(aPosition[0], aPosition[1], aPosition[2]);
+  aProps.setViewUp(aViewUp[0], aViewUp[1], aViewUp[2]);
+  aProps.setMappingScale(aCamera->GetParallelScale());
+
+  if (aProps.getProjection() == SUIT_CameraProperties::PrjPerspective)
+  {
+    aProps.setViewAngle(aCamera->GetViewAngle());
+  }
+
+  GetRenderer()->GetScale(anAxialScale);
+  aProps.setAxialScale(anAxialScale[0], anAxialScale[1], anAxialScale[2]);
+  
+  return aProps;
+}
+
+/*!
+  Synchronize views.
+  This implementation synchronizes camera propreties.
+*/
+void SVTK_ViewWindow::synchronize( SUIT_ViewWindow* theView )
+{
+  bool blocked = blockSignals( true );
+
+  SUIT_CameraProperties aProps = theView->cameraProperties();
+  if ( !cameraProperties().isCompatible( aProps ) ) {
+    // other view, this one is being currently synchronized to, seems has become incompatible
+    // we have to break synchronization
+    updateSyncViews();
+    return;
+  }
+
+  // get camera
+  vtkCamera* aCamera = getRenderer()->GetActiveCamera();
+  
+  double aFocalPoint[3];
+  double aPosition[3];
+  double aViewUp[3];
+  double anAxialScale[3];
+
+  // get common properties
+  aProps.getViewUp(aViewUp[0], aViewUp[1], aViewUp[2]);
+  aProps.getPosition(aPosition[0], aPosition[1], aPosition[2]);
+  aProps.getFocalPoint(aFocalPoint[0], aFocalPoint[1], aFocalPoint[2]);
+  aProps.getAxialScale(anAxialScale[0], anAxialScale[1], anAxialScale[2]);
+  
+  // restore properties to the camera
+  aCamera->SetViewUp(aViewUp);
+  aCamera->SetPosition(aPosition);
+  aCamera->SetFocalPoint(aFocalPoint);
+  aCamera->SetParallelScale(aProps.getMappingScale());
+
+  if (aProps.getProjection() == SUIT_CameraProperties::PrjPerspective)
+  {
+    aCamera->SetViewAngle(aProps.getViewAngle());
+  }
+
+  GetRenderer()->SetScale(anAxialScale);
+
+  getRenderer()->ResetCameraClippingRange();
+  Repaint(false);
+
+  blockSignals( blocked );
+}
index 15c977e3eb0044b13232d805fb57a047ff0b4381..abb6c0968d7dc2ce5a170405c97a2f9ec3fd9dc8 100755 (executable)
@@ -276,6 +276,8 @@ class SVTK_EXPORT SVTK_ViewWindow : public SUIT_ViewWindow
   //! To invoke a VTK event on #SVTK_RenderWindowInteractor instance
   void InvokeEvent(unsigned long theEvent, void* theCallData);
   
+  virtual SUIT_CameraProperties cameraProperties();
+  
  signals:
   void Show( QShowEvent * );
   void Hide( QHideEvent * );
@@ -372,6 +374,7 @@ public slots:
   virtual void synchronize(SVTK_ViewWindow*);
     
 protected slots:
+  void synchronize( SUIT_ViewWindow* );
   void onKeyPressed(QKeyEvent* event);
   void onKeyReleased(QKeyEvent* event);
   void onMousePressed(QMouseEvent* event);
@@ -446,13 +449,6 @@ protected:
   vtkPVAxesWidget* myAxesWidget;
   Qtx::BackgroundData myBackground;
 
-private slots:
-  void onSynchronizeView(bool);
-  void updateSyncViews();
-
-private:
-  static void synchronizeView( SVTK_ViewWindow*, int );
-
 private:
   QImage myDumpImage;
 };
index 362ffef6e05bce95d7672a7ea037e7b622a830a7..3794dfb5484936bf515ef3d47c51d554786dbb7a 100644 (file)
         <source>ICON_SVTK_RECORDING_STOP</source>
         <translation>vtk_view_recording_stop.png</translation>
     </message>
-    <message>
-        <source>ICON_SVTK_SYNCHRONIZE</source>
-        <translation>vtk_view_sync.png</translation>
-    </message>
     <message>
         <source>ICON_SVTK_DYNAMIC_PRESLECTION_SWITCH</source>
         <translation>vtk_view_highlight.png</translation>
index a991c7902f0a53369eca663978d50ff0dc7a14e5..623656fef725fe54d64257f63301db8156edb705 100644 (file)
@@ -21,7 +21,7 @@
     </message>
     <message>
         <source>MNU_FRONT_VIEW</source>
-        <translation>Front</translation>
+        <translation>-OX</translation>
     </message>
     <message>
         <source>ERROR</source>
@@ -33,7 +33,7 @@
     </message>
     <message>
         <source>DSC_TOP_VIEW</source>
-        <translation>Top View</translation>
+        <translation>-OZ View</translation>
     </message>
     <message>
         <source>MNU_PAN_VIEW</source>
@@ -41,7 +41,7 @@
     </message>
     <message>
         <source>MNU_TOP_VIEW</source>
-        <translation>Top</translation>
+        <translation>-OZ</translation>
     </message>
     <message>
         <source>DSC_GLOBALPAN_VIEW</source>
@@ -61,7 +61,7 @@
     </message>
     <message>
         <source>DSC_LEFT_VIEW</source>
-        <translation>Left View</translation>
+        <translation>+OY View</translation>
     </message>
     <message>
         <source>DSC_FITALL</source>
@@ -81,7 +81,7 @@
     </message>
     <message>
         <source>DSC_FRONT_VIEW</source>
-        <translation>Front View</translation>
+        <translation>-OX View</translation>
     </message>
     <message>
         <source>MNU_GLOBALPAN_VIEW</source>
@@ -93,7 +93,7 @@
     </message>
     <message>
         <source>MNU_BACK_VIEW</source>
-        <translation>Back</translation>
+        <translation>+OX</translation>
     </message>
     <message>
         <source>MNU_SHOW_TRIHEDRON</source>
     </message>
     <message>
         <source>MNU_BOTTOM_VIEW</source>
-        <translation>Bottom</translation>
+        <translation>+OZ</translation>
     </message>
     <message>
         <source>MNU_RESET_VIEW</source>
     </message>
     <message>
         <source>MNU_LEFT_VIEW</source>
-        <translation>Left</translation>
+        <translation>+OY</translation>
     </message>
     <message>
         <source>DSC_RIGHT_VIEW</source>
-        <translation>Right View</translation>
+        <translation>-OY View</translation>
     </message>
     <message>
         <source>MNU_CHANGINGROTATIONPOINT_VIEW</source>
     </message>
     <message>
         <source>DSC_BOTTOM_VIEW</source>
-        <translation>Bottom View</translation>
+        <translation>+OZ View</translation>
     </message>
     <message>
         <source>DSC_DUMP_VIEW</source>
     </message>
     <message>
         <source>MNU_RIGHT_VIEW</source>
-        <translation>Right</translation>
+        <translation>-OY</translation>
     </message>
     <message>
         <source>LBL_TOOLBAR_LABEL</source>
     </message>
     <message>
         <source>DSC_BACK_VIEW</source>
-        <translation>Back View</translation>
+        <translation>+OX View</translation>
     </message>
     <message>
         <source>SVTK_IMAGE_FILES</source>
         <source>DSC_VIEWPARAMETERS_VIEW</source>
         <translation>Change the parameters of the view</translation>
     </message>
-    <message>
-        <source>MNU_SYNCHRONIZE_VIEW</source>
-        <translation>Synchronize</translation>
-    </message>
-    <message>
-        <source>DSC_SYNCHRONIZE_VIEW</source>
-        <translation>Synchronize view</translation>
-    </message>
-    <message>
-        <source>MNU_SYNC_NO_VIEW</source>
-        <translation>[ No appropriate view ]</translation>
-    </message>
     <message>
         <source>MNU_SVTK_PARALLEL_MODE</source>
         <translation>Orthogonal Mode</translation>
index 9ea65e81ec4e2559819eabd6310c8ed534b251e2..5c188b2f52c9fa2033d54dc66d8bd28a9403bb20 100755 (executable)
@@ -21,7 +21,7 @@
     </message>
     <message>
         <source>MNU_FRONT_VIEW</source>
-        <translation>Avant</translation>
+        <translation>-OX</translation>
     </message>
     <message>
         <source>ERROR</source>
@@ -33,7 +33,7 @@
     </message>
     <message>
         <source>DSC_TOP_VIEW</source>
-        <translation>Vue de dessus</translation>
+        <translation>Vue -OZ</translation>
     </message>
     <message>
         <source>MNU_PAN_VIEW</source>
@@ -41,7 +41,7 @@
     </message>
     <message>
         <source>MNU_TOP_VIEW</source>
-        <translation>Dessus</translation>
+        <translation>-OZ</translation>
     </message>
     <message>
         <source>DSC_GLOBALPAN_VIEW</source>
@@ -61,7 +61,7 @@
     </message>
     <message>
         <source>DSC_LEFT_VIEW</source>
-        <translation>Vue de gauche</translation>
+        <translation>Vue +OY</translation>
     </message>
     <message>
         <source>DSC_FITALL</source>
@@ -81,7 +81,7 @@
     </message>
     <message>
         <source>DSC_FRONT_VIEW</source>
-        <translation>Vue de face</translation>
+        <translation>Vue -OX</translation>
     </message>
     <message>
         <source>MNU_GLOBALPAN_VIEW</source>
@@ -93,7 +93,7 @@
     </message>
     <message>
         <source>MNU_BACK_VIEW</source>
-        <translation>Arrière</translation>
+        <translation>+OX</translation>
     </message>
     <message>
         <source>MNU_SHOW_TRIHEDRON</source>
     </message>
     <message>
         <source>MNU_BOTTOM_VIEW</source>
-        <translation>Dessous</translation>
+        <translation>+OZ</translation>
     </message>
     <message>
         <source>MNU_RESET_VIEW</source>
     </message>
     <message>
         <source>MNU_LEFT_VIEW</source>
-        <translation>Gauche</translation>
+        <translation>+OY</translation>
     </message>
     <message>
         <source>DSC_RIGHT_VIEW</source>
-        <translation>Vue de droite</translation>
+        <translation>Vue -OY</translation>
     </message>
     <message>
         <source>MNU_CHANGINGROTATIONPOINT_VIEW</source>
     </message>
     <message>
         <source>DSC_BOTTOM_VIEW</source>
-        <translation>Vue de dessous</translation>
+        <translation>Vue +OZ</translation>
     </message>
     <message>
         <source>DSC_DUMP_VIEW</source>
     </message>
     <message>
         <source>MNU_RIGHT_VIEW</source>
-        <translation>Droite</translation>
+        <translation>-OY</translation>
     </message>
     <message>
         <source>LBL_TOOLBAR_LABEL</source>
     </message>
     <message>
         <source>DSC_BACK_VIEW</source>
-        <translation>Vue arrière</translation>
+        <translation>Vue +OX</translation>
     </message>
     <message>
         <source>SVTK_IMAGE_FILES</source>
         <source>DSC_VIEWPARAMETERS_VIEW</source>
         <translation>Changer les paramètres de la vue</translation>
     </message>
-    <message>
-        <source>MNU_SYNCHRONIZE_VIEW</source>
-        <translation>Synchroniser</translation>
-    </message>
-    <message>
-        <source>DSC_SYNCHRONIZE_VIEW</source>
-        <translation>Synchroniser la vue</translation>
-    </message>
-    <message>
-        <source>MNU_SYNC_NO_VIEW</source>
-        <translation>[ Pas de vue appropriée ]</translation>
-    </message>
     <message>
         <source>MNU_SVTK_PARALLEL_MODE</source>
         <translation>Mode orthogonal</translation>
diff --git a/src/SVTK/resources/vtk_view_sync.png b/src/SVTK/resources/vtk_view_sync.png
deleted file mode 100755 (executable)
index 32b9522..0000000
Binary files a/src/SVTK/resources/vtk_view_sync.png and /dev/null differ
index 5418df21f4ce077a5a7093c64e372b90facef115..0ade4fd050746abbba4ea347176efde0b51e4ce8 100755 (executable)
@@ -126,6 +126,7 @@ SET(SalomeApp_SOURCES
   SalomeApp_NoteBookDlg.cxx
   SalomeApp_DoubleSpinBox.cxx
   SalomeApp_IntSpinBox.cxx
+  SalomeApp_Engine_i.cxx
 )
 
 SET(GUITS_SOURCES
@@ -160,6 +161,7 @@ SET(COMMON_HEADERS_H
   SalomeApp_NoteBookDlg.h
   SalomeApp_DoubleSpinBox.h
   SalomeApp_IntSpinBox.h
+  SalomeApp_Engine_i.h
 )
 
 INSTALL(FILES ${COMMON_HEADERS_H} DESTINATION ${GUI_salomeinclude_HEADERS})
index 6191bd8e2541bdf7fd0a9c257684f7878f04a980..9ed873df74c639a4d770b8553882522e451ede5c 100755 (executable)
@@ -57,7 +57,8 @@ salomeinclude_HEADERS =                       \
        SalomeApp_ExitDlg.h             \
        SalomeApp_NoteBookDlg.h         \
        SalomeApp_DoubleSpinBox.h       \
-       SalomeApp_IntSpinBox.h
+       SalomeApp_IntSpinBox.h          \
+       SalomeApp_Engine_i.h
 
 dist_libSalomeApp_la_SOURCES =                 \
        SalomeApp_Module.cxx                    \
@@ -79,7 +80,8 @@ dist_libSalomeApp_la_SOURCES =                        \
        SalomeApp_ExitDlg.cxx                   \
        SalomeApp_NoteBookDlg.cxx               \
        SalomeApp_DoubleSpinBox.cxx             \
-       SalomeApp_IntSpinBox.cxx
+       SalomeApp_IntSpinBox.cxx                \
+       SalomeApp_Engine_i.cxx
 
 MOC_FILES =                                    \
        SalomeApp_Application_moc.cxx           \
@@ -121,11 +123,12 @@ libSalomeApp_la_CPPFLAGS = $(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES)      \
        -I$(srcdir)/../Event -I$(srcdir)/../CASCatch  -I$(srcdir)/../Prs        \
        @CORBA_CXXFLAGS@ @CORBA_INCLUDES@ @LIBXML_INCLUDES@
 libSalomeApp_la_LDFLAGS = $(PYTHON_LIBS) $(QT_MT_LIBS) 
-libSalomeApp_la_LIBADD  = $(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSalomeLifeCycleCORBA -lSalomeDSClient                \
+libSalomeApp_la_LIBADD  = $(KERNEL_LDFLAGS) -lOpUtil -lSALOMELocalTrace -lSalomeLifeCycleCORBA \
+       -lSalomeDSClient -lTOOLSDS \
        ../SUIT/libsuit.la ../STD/libstd.la ../CAM/libCAM.la ../ObjBrowser/libObjBrowser.la     \
        ../Prs/libSalomePrs.la ../SPlot2d/libSPlot2d.la ../GLViewer/libGLViewer.la              \
        ../OCCViewer/libOCCViewer.la ../VTKViewer/libVTKViewer.la ../OBJECT/libSalomeObject.la  \
        ../SVTK/libSVTK.la ../SOCC/libSOCC.la ../PyInterp/libPyInterp.la                        \
        ../PyConsole/libPyConsole.la ../LogWindow/libLogWindow.la                               \
-       ../LightApp/libLightApp.la ../TOOLSGUI/libToolsGUI.la ../Session/libSalomeSession.la    \
+       ../LightApp/libLightApp.la ../TOOLSGUI/libToolsGUI.la ../../idl/libSalomeIDLGUI.la      \
        ../Event/libEvent.la ../CASCatch/libCASCatch.la ../Prs/libSalomePrs.la $(CAS_KERNEL)
diff --git a/src/SalomeApp/SalomeApp_Engine_i.cxx b/src/SalomeApp/SalomeApp_Engine_i.cxx
new file mode 100644 (file)
index 0000000..6c803e2
--- /dev/null
@@ -0,0 +1,414 @@
+// Copyright (C) 2007-2012  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.
+//
+// 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
+//
+
+//  SalomeApp_Engine_i : implementation of SalomeApp_Engine.idl
+//  File   : SalomeApp_Engine_i.cxx
+//  Author : Alexander SLADKOV
+
+#include "SalomeApp_Engine_i.h"
+#include "SalomeApp_Application.h"
+
+#include <SALOME_NamingService.hxx>
+#include <SALOMEDS_Tool.hxx>
+#include <Utils_ORB_INIT.hxx>
+#include <Utils_SINGLETON.hxx>
+#include <Utils_SALOME_Exception.hxx>
+#include <utilities.h>
+
+#include <QApplication>
+#include <QDir>
+#include <QFile>
+
+#include <iostream>
+
+/*!
+  Constructor
+*/
+SalomeApp_Engine_i::SalomeApp_Engine_i( const char* theComponentName )
+{
+  myComponentName = theComponentName;
+  MESSAGE("SalomeApp_Engine_i::SalomeApp_Engine_i(): myComponentName = " <<
+         myComponentName << ", this = " << this);
+}
+
+/*!
+  Destructor
+*/
+SalomeApp_Engine_i::~SalomeApp_Engine_i()
+{
+  MESSAGE("SalomeApp_Engine_i::~SalomeApp_Engine_i(): myComponentName = " << 
+         myComponentName << ", this = " << this);
+}
+
+SALOMEDS::TMPFile* SalomeApp_Engine_i::Save (SALOMEDS::SComponent_ptr theComponent,
+                                             const char* theURL,
+                                             bool isMultiFile)
+{
+  SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile;
+
+  if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy()))
+    return aStreamFile._retn();
+
+  const int studyId = theComponent->GetStudy()->StudyId();
+
+  // Get a temporary directory to store a file
+  //std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
+
+  if (myMap.count(studyId)) {
+    std::string componentName (theComponent->ComponentDataType());
+
+    // Error somewhere outside - Save() called with
+    // wrong SComponent instance
+    if ( myComponentName != componentName )
+      return aStreamFile._retn();
+
+    const ListOfFiles& listOfFiles = myMap[studyId];
+
+    // listOfFiles must contain temporary directory name in its first item
+    // and names of files (relatively the temporary directory) in the others
+    const int n = listOfFiles.size() - 1;
+
+    if (n > 0) { // there are some files, containing persistent data of the component
+      std::string aTmpDir = listOfFiles[0];
+
+      // Create a list to store names of created files
+      SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
+      aSeq->length(n);
+      for (int i = 0; i < n; i++)
+        aSeq[i] = CORBA::string_dup(listOfFiles[i + 1].c_str());
+
+      // Convert a file to the byte stream
+      aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq.in(), isMultiFile);
+
+      // Remove the files and tmp directory, created by the component storage procedure
+      if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
+    }
+  }
+
+  return aStreamFile._retn();
+}
+
+CORBA::Boolean SalomeApp_Engine_i::Load (SALOMEDS::SComponent_ptr theComponent,
+                                         const SALOMEDS::TMPFile& theFile,
+                                         const char* theURL,
+                                         bool isMultiFile)
+{
+  std::cout << "SalomeApp_Engine_i::Load() isMultiFile = " << isMultiFile << std::endl;
+  if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy()))
+    return false;
+
+  // Error somewhere outside - Load() called with
+  // wrong SComponent instance
+  std::string componentName (theComponent->ComponentDataType());
+  if ( myComponentName != componentName )
+    return false;
+
+  const int studyId = theComponent->GetStudy()->StudyId();
+
+  // Create a temporary directory for the component's data files
+  std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
+
+  // Convert the byte stream theStream to a files and place them in the tmp directory.
+  // The files and temporary directory must be deleted by the component loading procedure.
+  SALOMEDS::ListOfFileNames_var aSeq =
+    SALOMEDS_Tool::PutStreamToFiles(theFile, aTmpDir.c_str(), isMultiFile);
+
+  // Store list of file names to be used by the component loading procedure
+  const int n = aSeq->length() + 1;
+  ListOfFiles listOfFiles (n);
+  listOfFiles[0] = aTmpDir;
+  for (int i = 1; i < n; i++)
+    listOfFiles[i] = std::string(aSeq[i - 1]);
+
+  SetListOfFiles(listOfFiles, studyId);
+
+  return true;
+}
+
+SalomeApp_Engine_i::ListOfFiles SalomeApp_Engine_i::GetListOfFiles (const int theStudyId)
+{
+  ListOfFiles aListOfFiles;
+
+  if (myMap.find(theStudyId) != myMap.end())
+  {
+    aListOfFiles = myMap[theStudyId];
+  }
+
+  return aListOfFiles;
+}
+
+void SalomeApp_Engine_i::SetListOfFiles (const ListOfFiles& theListOfFiles,
+                                         const int          theStudyId)
+{
+  myMap[theStudyId] = theListOfFiles;
+}
+
+/*! 
+ *  DumpPython implementation for light modules
+ */
+Engines::TMPFile* SalomeApp_Engine_i::DumpPython(CORBA::Object_ptr theStudy, 
+                                                CORBA::Boolean isPublished, 
+                                                CORBA::Boolean isMultiFile, 
+                                                CORBA::Boolean& isValidScript)
+{
+  MESSAGE("SalomeApp_Engine_i::DumpPython(): myComponentName = "<<
+         myComponentName << ", this = " << this);
+  
+  // Temporary solution: returning a non-empty sequence
+  // even if there's nothing to dump, to avoid crashes in SALOMEDS
+  // TODO: Improve SALOMEDSImpl_Study::DumpStudy() by skipping the components 
+  // with isValidScript == false, and initialize isValidScript by false below.
+  Engines::TMPFile_var aStreamFile = new Engines::TMPFile(1);
+  aStreamFile->length( 1 );
+  aStreamFile[0] = '\0';
+  isValidScript = true;
+
+  if (CORBA::is_nil(theStudy))
+    return aStreamFile._retn();
+
+  SALOMEDS::Study_var studyDS = SALOMEDS::Study::_narrow( theStudy );
+  const int studyId = studyDS->StudyId();
+
+  if (!myMap.count(studyId))
+    return aStreamFile._retn();
+
+  ListOfFiles listOfFiles = myMap[studyId];
+
+  // listOfFiles must contain temporary directory name in its first item
+  // and names of files (relatively the temporary directory) in the others
+  if ( listOfFiles.size() < 2 ) 
+    return aStreamFile._retn();
+
+  // there are some files, containing persistent data of the component
+  QString aTmpPath( listOfFiles.front().c_str() );
+  QDir aTmpDir( aTmpPath );
+  if ( !aTmpDir.exists() )
+    return aStreamFile._retn();    
+
+  // Calculate file sizes
+  QStringList aFilePaths;
+  QList<qint64> aFileSizes;
+  qint64 aBuffSize = 0;
+  ListOfFiles::const_iterator aFIt  = listOfFiles.begin();
+  ListOfFiles::const_iterator aFEnd = listOfFiles.end();
+  aFIt++;
+  for (; aFIt != aFEnd; aFIt++){
+    QString aFileName( (*aFIt).c_str() );
+    if ( !aTmpDir.exists( aFileName ) ){
+      continue;
+    }
+
+    QFile aFile( aTmpDir.filePath( aFileName ) );
+    if ( !aFile.open( QIODevice::ReadOnly ) ){
+      continue;
+    }
+
+    aFilePaths.push_back( aTmpDir.filePath( aFileName ) );
+    aFileSizes.push_back( aFile.size() );
+    aBuffSize += aFileSizes.back();
+
+    aFile.close();
+  }
+
+  if ( !aFilePaths.size() || !aBuffSize )
+    return aStreamFile._retn(); 
+    
+  char* aBuffer = new char[aBuffSize + 1];
+  if ( !aBuffer )
+    return aStreamFile._retn();
+
+  // Convert the file(s) to the byte stream, multiple files are simply
+  // concatenated
+  // TODO: imporve multi-script support if necessary...
+  qint64 aCurrPos = 0;
+  QStringList::const_iterator aFileIt  = aFilePaths.begin();
+  QStringList::const_iterator aFileEnd = aFilePaths.end();
+  QList<qint64>::const_iterator   aSIt = aFileSizes.begin();
+  for ( ; aFileIt != aFileEnd; aFileIt++, aSIt++ ){
+    QFile aFile( aTmpDir.filePath( *aFileIt ) );
+    if ( !aFile.open( QIODevice::ReadOnly ) ){
+      continue;
+    }
+
+    // Incorrect size of file
+    // Do not remove the bad file to have some diagnostic means
+    if ( aFile.read( aBuffer + aCurrPos, *aSIt ) != *aSIt ){
+      aFile.close();      
+      return aStreamFile._retn();
+    }
+
+    aCurrPos += (*aSIt); 
+    aFile.remove();   
+  }
+
+  // Here we should end up with empty aTmpDir
+  // TODO: Handle QDir::rmdir() error status somehow...
+  aTmpDir.rmdir( aTmpPath );
+
+  aBuffer[aBuffSize] = '\0';
+  CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
+  aStreamFile = new Engines::TMPFile(aBuffSize + 1, aBuffSize + 1, anOctetBuf, 1); 
+
+  return aStreamFile._retn();
+}
+
+/*!
+  \return Component data type string for this instance of the engine
+*/
+char* SalomeApp_Engine_i::ComponentDataType()
+{
+  return const_cast<char*>( myComponentName.c_str() );
+}
+
+/*!
+  \return Component version
+*/
+char* SalomeApp_Engine_i::getVersion()
+{
+  SalomeApp_Application::ModuleShortInfoList versions = SalomeApp_Application::getVersionInfo();
+  QString version;
+  SalomeApp_Application::ModuleShortInfo version_info;
+  foreach ( version_info, versions ) {
+    if ( SalomeApp_Application::moduleName( version_info.name ) == myComponentName.c_str() ) {
+      version = version_info.version;
+      break;
+    }
+  }
+  
+  return CORBA::string_dup( version.toLatin1().constData() );
+}
+
+/*!
+  \return 
+*/
+CORBA::ORB_var SalomeApp_Engine_i::orb()
+{
+  ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
+  // TODO: using QApplication here looks ugly, think how to
+  // obtain the ORB reference in a nicer way...
+  static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() );
+  return _orb;
+}
+
+/*!
+  \return 
+*/
+PortableServer::POA_var SalomeApp_Engine_i::poa()
+{
+  static PortableServer::POA_var _poa;
+  if ( CORBA::is_nil( _poa ) ){
+    CORBA::Object_var obj = orb()->resolve_initial_references( "RootPOA" );
+    _poa = PortableServer::POA::_narrow( obj );
+  }
+  return _poa;
+}
+
+/*!
+  \return 
+*/
+SALOME_NamingService* SalomeApp_Engine_i::namingService()
+{
+  static SALOME_NamingService _ns(orb());
+  return &_ns;
+}
+
+/*!
+  Internal method, creates a CORBA engine for a light SALOME module
+  with the given "component data type" string,
+  activates it and registers in SALOME naming service with
+  /SalomeAppEngine/comp_data_type path. If the engine is already in the 
+  naming service, simply returns and object reference to it.
+  \param theComponentName - synthetic "component data type" used to identify a given light module
+  \return Object reference to the CORBA engine
+*/
+CORBA::Object_ptr SalomeApp_Engine_i::engineForComponent( const char* theComponentName,
+                                                         bool toCreate )
+{
+  CORBA::Object_var anEngine;
+  if ( !theComponentName || !strlen( theComponentName ) )
+    return anEngine._retn();
+
+  std::string aPath( "/SalomeAppEngine/" );
+  aPath += theComponentName;
+  anEngine = namingService()->Resolve( aPath.c_str() );
+
+  // Activating a new instance of the servant
+  if ( toCreate && CORBA::is_nil( anEngine ) ){
+    try {
+      SalomeApp_Engine_i* aServant    = new SalomeApp_Engine_i( theComponentName );
+      PortableServer::ObjectId_var id = poa()->activate_object( aServant );
+      anEngine = aServant->_this();
+      aServant->_remove_ref();
+      namingService()->Register( anEngine.in(), aPath.c_str() );
+    }
+    catch (CORBA::SystemException&) {
+      INFOS("Caught CORBA::SystemException.");
+    }
+    catch (CORBA::Exception&) {
+      INFOS("Caught CORBA::Exception.");
+    }
+    catch (...) {
+      INFOS("Caught unknown exception.");
+    }
+  }
+
+  return anEngine._retn();
+}
+
+/*!
+  \param theComponentName - synthetic "component data type" used to identify a given light module
+  \return IOR string for the CORBA engine for a light SALOME module
+  with the given "component data type" string
+  \sa GetInstance( const char* theComponentName )
+*/
+std::string SalomeApp_Engine_i::EngineIORForComponent( const char* theComponentName,
+                                                      bool toCreate )
+{
+  std::string anIOR( "" );
+  CORBA::Object_var anEngine = engineForComponent( theComponentName, toCreate );
+  if ( !CORBA::is_nil( anEngine ) )
+  {
+    CORBA::String_var objStr = orb()->object_to_string( anEngine.in() );
+    anIOR = std::string( objStr.in() );
+  }
+  return anIOR;
+}
+
+/*!
+  \param theComponentName - synthetic "component data type" used to identify a given light module
+  \return A pointer to corresponding C++ engine instance, null means some internal problems.
+  \sa EngineIORForComponent( const char* theComponentName )
+*/
+SalomeApp_Engine_i* SalomeApp_Engine_i::GetInstance( const char* theComponentName,
+                                                    bool toCreate )
+{
+  SalomeApp_Engine_i* aServant = 0;
+  CORBA::Object_var anEngine = engineForComponent( theComponentName, toCreate );
+  if ( !CORBA::is_nil( anEngine ) )
+  {
+    PortableServer::Servant aServantBase = poa()->reference_to_servant( anEngine.in() );
+    aServant = dynamic_cast<SalomeApp_Engine_i*>( aServantBase );
+  } 
+  MESSAGE("SalomeApp_Engine_i::GetInstance(): theComponentName = " <<
+         theComponentName << ", aServant = " << aServant);
+  return aServant;
+}
diff --git a/src/SalomeApp/SalomeApp_Engine_i.h b/src/SalomeApp/SalomeApp_Engine_i.h
new file mode 100644 (file)
index 0000000..51b8f69
--- /dev/null
@@ -0,0 +1,108 @@
+// Copyright (C) 2007-2012  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.
+//
+// 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
+//
+
+//  SalomeApp_Engine_i : implementation of SalomeApp_Engine.idl
+//  File   : SalomeApp_Engine_i.hxx
+//  Author : Alexander SLADKOV
+
+#ifndef _SALOMEAPP_ENGINE_I_HXX_
+#define _SALOMEAPP_ENGINE_I_HXX_
+
+#include "SalomeApp.h"
+
+#include "SALOME_Component_i.hxx"
+
+#include <vector> 
+#include <map> 
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(SalomeApp_Engine)
+
+class SALOME_NamingService;
+
+class SALOMEAPP_EXPORT SalomeApp_Engine_i: public POA_SalomeApp::Engine,
+                                          public Engines_Component_i
+{
+public:
+  SalomeApp_Engine_i( const char* theComponentName );
+  ~SalomeApp_Engine_i();
+
+  SALOMEDS::TMPFile*      Save( SALOMEDS::SComponent_ptr theComponent, 
+                               const char* theURL, 
+                               bool isMultiFile );
+
+  CORBA::Boolean          Load( SALOMEDS::SComponent_ptr theComponent, 
+                               const SALOMEDS::TMPFile& theFile, 
+                               const char* theURL, 
+                               bool isMultiFile );
+
+  virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
+                                       CORBA::Boolean isPublished,
+                                       CORBA::Boolean isMultiFile,
+                                       CORBA::Boolean& isValidScript);
+
+public:
+  typedef std::vector<std::string> ListOfFiles;
+
+  ListOfFiles             GetListOfFiles (const int          theStudyId);
+  void                    SetListOfFiles (const ListOfFiles& theListOfFiles,
+                                          const int          theStudyId);
+
+  static std::string         EngineIORForComponent( const char* theComponentName,
+                                                   bool toCreate );
+  static SalomeApp_Engine_i* GetInstance          ( const char* theComponentName,
+                                                   bool toCreate ); 
+
+public:
+  // methods from SALOMEDS::Driver without implementation.  Must be redefined because 
+  // there is no default implementation of SALOMEDS::Driver interface
+  SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr, const char*, bool )                                                                        {return 0;}
+  CORBA::Boolean LoadASCII( SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile&, const char*, bool )                                                  {return 0;}
+  void Close( SALOMEDS::SComponent_ptr )                                                                                                             {}
+  char* ComponentDataType();
+  char* IORToLocalPersistentID( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean,  CORBA::Boolean )                                                {return 0;}
+  char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean,  CORBA::Boolean )                                                {return 0;}
+  bool CanPublishInStudy( CORBA::Object_ptr )                                                                                                        {return 0;}
+  SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr, CORBA::Object_ptr, const char* ) throw (SALOME::SALOME_Exception) {return 0;}
+  CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr )                                                                                                    {return 0;}
+  SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr, CORBA::Long& )                                                                                 {return 0;}
+  CORBA::Boolean CanPaste( const char*, CORBA::Long )                                                                                                {return 0;}
+  SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile&, CORBA::Long, SALOMEDS::SObject_ptr )                                                    {return 0;}
+
+  char* getVersion();
+
+private:
+  static CORBA::ORB_var              orb();
+  static PortableServer::POA_var     poa();
+  static SALOME_NamingService*       namingService();
+  static CORBA::Object_ptr           engineForComponent( const char* theComponentName,
+                                                        bool toCreate  );
+
+private:
+  typedef std::map<int, ListOfFiles> MapOfListOfFiles;
+  MapOfListOfFiles                   myMap;
+
+  std::string                        myComponentName;
+};
+
+#endif
+
index 1a38c88e12a179a31704ddca75a4d17a7ffa0905..a6dd9377f845c271af85c6eb10d98015e5a21e16 100644 (file)
@@ -26,7 +26,7 @@
 #include "SalomeApp_DataObject.h"
 #include "SalomeApp_DataModel.h"
 #include "SalomeApp_Application.h"
-#include "SalomeApp_Engine_i.hxx"
+#include "SalomeApp_Engine_i.h"
 #include "SalomeApp_VisualState.h"
 
 // temporary commented
index 2fd7dcb8af63f47517d6ec1143c9eaad2b4b180b..54abf6d2fff0cac18b11698712f30e6b8aa2f5d2 100644 (file)
@@ -109,9 +109,20 @@ SalomeApp_StudyPropertiesDlg::SalomeApp_StudyPropertiesDlg(QWidget* parent)
   QStringList columnNames;
   columnNames.append(tr("PRP_AUTHOR"));
   columnNames.append(tr("PRP_DATE_MODIF"));
+  myModifications->setHeaderLabels( columnNames );
 
-  QTreeWidgetItem * headerItem = new QTreeWidgetItem(columnNames);
-  myModifications->setHeaderItem ( headerItem );
+  //Component versions
+  QLabel* versionsLabel = new QLabel(tr("PRP_VERSIONS"),this);  
+  myVersions = new QTreeWidget(this);
+  myVersions->setRootIsDecorated(false);
+  myVersions->setUniformRowHeights(true);
+  myVersions->setAllColumnsShowFocus(true);
+  myVersions->setColumnCount(2);
+  myVersions->setMaximumHeight(80);
+  columnNames.clear();
+  columnNames.append(tr("PRP_COMPONENT"));
+  columnNames.append(tr("PRP_VERSION"));
+  myVersions->setHeaderLabels( columnNames );
 
   QFrame* buttonFrame = new QFrame(this);
 
@@ -140,7 +151,9 @@ SalomeApp_StudyPropertiesDlg::SalomeApp_StudyPropertiesDlg(QWidget* parent)
   gridLayout->addWidget(myComment, 4, 1, 1, 2);
   gridLayout->addWidget(modificationsLabel, 5, 0, 1, 1);
   gridLayout->addWidget(myModifications, 5, 1, 1, 2);
-  gridLayout->addWidget(buttonFrame, 6, 0, 1, 3);
+  gridLayout->addWidget(versionsLabel, 6, 0, 1, 1);
+  gridLayout->addWidget(myVersions, 6, 1, 1, 2);
+  gridLayout->addWidget(buttonFrame, 7, 0, 1, 3);
 
   connect(myOkButton,     SIGNAL(clicked()), this, SLOT(clickOnOk()));
   connect(myCancelButton, SIGNAL(clicked()), this, SLOT(reject()));
@@ -183,15 +196,11 @@ void SalomeApp_StudyPropertiesDlg::initData()
     bool isModified = false;
     SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>
       (SUIT_Session::session()->activeApplication()->activeStudy());
-    if (study) {
-      isModified = study->isModified();
-      if (hasData) {
-        if (propAttr->IsModified() != isModified) {
-          propAttr->SetModified((int)isModified);
-        }
-      }
+    isModified = study->isModified();
+    if (propAttr->IsModified() != isModified) {
+      propAttr->SetModified((int)isModified);
     }
-
+    
     QString modif = propAttr->IsModified() ? tr( "PRP_MODIFIED" ) : tr( "PRP_NOT_MODIFIED" );
     myModification->setText(modif);
     
@@ -236,6 +245,20 @@ void SalomeApp_StudyPropertiesDlg::initData()
       QTreeWidgetItem* item = new  QTreeWidgetItem(aList);
       myModifications->addTopLevelItem(item);
     }        
+  
+    //Component versions
+    std::vector<std::string> aComponents = propAttr->GetStoredComponents();
+    for ( int i = 0; i < aComponents.size(); i++ ) {
+      std::vector<int>  aMins, aHours, aDays, aMonths, aYears;
+      std::vector<std::string> aVersions = propAttr->GetComponentVersions(aComponents[i]);
+      QStringList aData;
+      aData.append( aComponents[i].c_str() );
+      aData.append( aVersions.empty() || aVersions[0] == "" ? "unknown" : aVersions[0].c_str() );
+      QTreeWidgetItem* item = new QTreeWidgetItem( aData );
+      if ( aVersions.size() > 1 )
+       item->setForeground( 1, Qt::red );
+      myVersions->addTopLevelItem(item);
+    }
   }
   adjustSize();
 }
index 8ff0500d9d12fd0ee04e04cc5d4a10e1b9e98f8b..ad8c18246f5fe5778b036423bc7c52f56f64358a 100644 (file)
@@ -69,6 +69,7 @@ private:
  QComboBox*           myUnits;
  QTextEdit*           myComment;
  QTreeWidget*         myModifications;
+ QTreeWidget*         myVersions;
  QPushButton*         myOkButton;
  QPushButton*         myCancelButton;
 };
index edb361b5f4f34c9dfdfa8b843eb8736dcb76f378..e8de87156d574e734afb950776a23e5b235489fe 100755 (executable)
@@ -183,7 +183,7 @@ if DEMO_IS_ACTIVATED:
       global tubebuilder, xalome
       global dialogWithApply, activeStudy
       global previewShapeEntry, deletePreviewShape
-      global DEFAULT_FOLDER_NAME,DEFAULT_SHAPE_NAME 
+      global DEFAULT_FOLDER_NAME,DEFAULT_SHAPE_NAME
 
       dialogWithApply.accept()
 
@@ -194,7 +194,7 @@ if DEMO_IS_ACTIVATED:
       shape = tubebuilder.createGeometry(activeStudy, radius, length, width)
       entry = xalome.addToStudy(activeStudy, shape, DEFAULT_SHAPE_NAME, DEFAULT_FOLDER_NAME)
       xalome.displayShape(entry)
-      
+
   def rejectCallback():
       """Action to be done when click on Cancel"""
       global dialogWithApply, previewShapeEntry, deletePreviewShape
@@ -262,13 +262,15 @@ def runSalomeShellSession(context):
     version = salome_version.getVersion(full=True)
     kernel_appli_dir = os.environ['KERNEL_ROOT_DIR']
     command = ""
-    if os.path.exists("/usr/bin/xterm"):
-      command = 'xterm -T "SALOME %s - Shell session" -e %s/runSession &'%(version,kernel_appli_dir)
-    elif os.path.exists("/usr/bin/gnome-terminal"):
+    if os.path.exists("/usr/bin/gnome-terminal"):
       command = 'gnome-terminal -t "SALOME %s - Shell session" -e %s/runSession &'%(version,kernel_appli_dir)
+    elif os.path.exists("/usr/bin/konsole"):
+      command = 'PATH="/usr/bin:/sbin:/bin" LD_LIBRARY_PATH="" konsole -e %s/runSession &'%(kernel_appli_dir)
+    elif os.path.exists("/usr/bin/xterm"):
+      command = 'xterm -T "SALOME %s - Shell session" -e %s/runSession &'%(version,kernel_appli_dir)
     else:
-      print "Neither xterm nor gnome-terminal is installed."
-    
+      print "Neither xterm nor gnome-terminal nor konsole is installed."
+
     if command is not "":
       try:
         subprocess.check_call(command, shell = True)
index 5124442cade1de9655a876ea28a98b6b4e515230..8323e60c603168cab54e2afe9ad8de541504c253 100644 (file)
@@ -32,7 +32,7 @@
     <parameter name="killall"    value="no"/>
     <parameter name="pinter"     value="no"/>
     <parameter name="noexcepthandler"  value="no"/>
-    <parameter name="modules"    value="GEOM,SMESH,VISU,MED,YACS,PARAVIS"/>
+    <parameter name="modules"    value="GEOM,SMESH,HEXABLOCK,VISU,MED,YACS,PARAVIS"/>
     <parameter name="pyModules"  value=""/>
     <parameter name="embedded"   value="SalomeAppEngine,study,cppContainer,registry,moduleCatalog"/>
     <parameter name="standalone" value="pyContainer,supervContainer"/>
index c248a811da9e4b9d36451dee820673816b94a83c..dedd0f7c6106a9628200338379bc4272cd606916 100644 (file)
@@ -363,6 +363,18 @@ Do you want to reload it ?</translation>
         <source>PRP_MODIFICATIONS</source>
         <translation>Modifications</translation>
     </message>
+    <message>
+        <source>PRP_COMPONENT</source>
+        <translation>Component</translation>
+    </message>
+    <message>
+        <source>PRP_VERSION</source>
+        <translation>Version</translation>
+    </message>
+    <message>
+        <source>PRP_VERSIONS</source>
+        <translation>Stored data</translation>
+    </message>
     <message>
         <source>PRP_DATE_MODIF</source>
         <translation>Date</translation>
index dc4f87c5211980d440d0f592a97003c984463895..9adf4ae955691a779fc4934c2057cc078ff330c1 100755 (executable)
@@ -363,6 +363,18 @@ Voulez-vous le recharger ?</translation>
         <source>PRP_MODIFICATIONS</source>
         <translation>Modifications</translation>
     </message>
+    <message>
+        <source>PRP_COMPONENT</source>
+        <translation type="unfinished">Component</translation>
+    </message>
+    <message>
+        <source>PRP_VERSION</source>
+        <translation type="unfinished">Version</translation>
+    </message>
+    <message>
+        <source>PRP_VERSIONS</source>
+        <translation type="unfinished">Stored data</translation>
+    </message>
     <message>
         <source>PRP_DATE_MODIF</source>
         <translation>Date</translation>
index 2968dfecd7e20fa8a963d9f1f7e1e4fa2b746725..2a8cf2c8def7dc146778d1dad02a6d75a31652a1 100755 (executable)
@@ -69,7 +69,6 @@ SET(SalomeSession_SOURCES
   Session_ServerThread.cxx
   Session_ServerLauncher.cxx
   Session_ServerCheck.cxx
-  SalomeApp_Engine_i.cxx
 )
 ADD_LIBRARY(SalomeSession SHARED ${SalomeSession_SOURCES})
 SET_TARGET_PROPERTIES(SalomeSession PROPERTIES COMPILE_FLAGS "${COMMON_FLAGS}")
@@ -106,6 +105,5 @@ SET(COMMON_HEADERS_H
   Session_ServerLauncher.hxx
   Session_ServerThread.hxx
   Session_ServerCheck.hxx
-  SalomeApp_Engine_i.hxx
 )
 INSTALL(FILES ${COMMON_HEADERS_H} DESTINATION ${GUI_salomeinclude_HEADERS})
index eaf315c845831accb8a9b99e6593b2dbe93f78ff..26a25db0cb5bb12505feb3fd8b10fcafee5d29ef 100755 (executable)
@@ -35,8 +35,7 @@ salomeinclude_HEADERS =                       \
        SALOME_Session.hxx              \
        Session_ServerLauncher.hxx      \
        Session_ServerThread.hxx        \
-       Session_ServerCheck.hxx         \
-       SalomeApp_Engine_i.hxx
+       Session_ServerCheck.hxx
 
 # Libraries targets
 
@@ -44,8 +43,7 @@ dist_libSalomeSession_la_SOURCES =    \
        Session_Session_i.cxx           \
        Session_ServerThread.cxx        \
        Session_ServerLauncher.cxx      \
-       Session_ServerCheck.cxx         \
-       SalomeApp_Engine_i.cxx
+       Session_ServerCheck.cxx
 
 libSalomeSession_la_CPPFLAGS = $(QT_MT_INCLUDES) $(PYTHON_INCLUDES)            \
        $(HDF5_INCLUDES) $(BOOST_CPPFLAGS) @KERNEL_CXXFLAGS@ $(CAS_CPPFLAGS)    \
index f94e9a639cc2f4f90ee816027903764e643177d2..a0c6f883347f69b5a25b1d84ce7464e445ce9de4 100755 (executable)
@@ -659,11 +659,14 @@ int main( int argc, char **argv )
   // unlock Session mutex
   _SessionMutex.unlock();
   
-  if ( shutdownAll )
+  if ( myServerLauncher )
+    myServerLauncher->ShutdownAll(); // shutdown embedded servers
+
+  if ( shutdownAll )                 // shutdown standalone servers
     shutdownServers( _NS );
 
   if ( myServerLauncher )
-    myServerLauncher->KillAll(); // kill embedded servers
+    myServerLauncher->KillAll();     // kill embedded servers
 
   // Unregister session server
   SALOME_Session_i* sessionServant = dynamic_cast<SALOME_Session_i*>( poa->reference_to_servant( session.in() ) );
diff --git a/src/Session/SalomeApp_Engine_i.cxx b/src/Session/SalomeApp_Engine_i.cxx
deleted file mode 100644 (file)
index 15bb917..0000000
+++ /dev/null
@@ -1,396 +0,0 @@
-// Copyright (C) 2007-2012  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.
-//
-// 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
-//
-
-//  SalomeApp_Engine_i : implementation of SalomeApp_Engine.idl
-//  File   : SalomeApp_Engine_i.cxx
-//  Author : Alexander SLADKOV
-
-#include "SalomeApp_Engine_i.hxx"
-
-#include <SALOME_NamingService.hxx>
-#include <SALOMEDS_Tool.hxx>
-#include <Utils_ORB_INIT.hxx>
-#include <Utils_SINGLETON.hxx>
-#include <Utils_SALOME_Exception.hxx>
-#include <utilities.h>
-
-#include <QApplication>
-#include <QDir>
-#include <QFile>
-
-#include <iostream>
-
-/*!
-  Constructor
-*/
-SalomeApp_Engine_i::SalomeApp_Engine_i( const char* theComponentName )
-{
-  myComponentName = theComponentName;
-  MESSAGE("SalomeApp_Engine_i::SalomeApp_Engine_i(): myComponentName = " <<
-         myComponentName << ", this = " << this);
-}
-
-/*!
-  Destructor
-*/
-SalomeApp_Engine_i::~SalomeApp_Engine_i()
-{
-  MESSAGE("SalomeApp_Engine_i::~SalomeApp_Engine_i(): myComponentName = " << 
-         myComponentName << ", this = " << this);
-}
-
-SALOMEDS::TMPFile* SalomeApp_Engine_i::Save (SALOMEDS::SComponent_ptr theComponent,
-                                             const char* theURL,
-                                             bool isMultiFile)
-{
-  SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile;
-
-  if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy()))
-    return aStreamFile._retn();
-
-  const int studyId = theComponent->GetStudy()->StudyId();
-
-  // Get a temporary directory to store a file
-  //std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
-
-  if (myMap.count(studyId)) {
-    std::string componentName (theComponent->ComponentDataType());
-
-    // Error somewhere outside - Save() called with
-    // wrong SComponent instance
-    if ( myComponentName != componentName )
-      return aStreamFile._retn();
-
-    const ListOfFiles& listOfFiles = myMap[studyId];
-
-    // listOfFiles must contain temporary directory name in its first item
-    // and names of files (relatively the temporary directory) in the others
-    const int n = listOfFiles.size() - 1;
-
-    if (n > 0) { // there are some files, containing persistent data of the component
-      std::string aTmpDir = listOfFiles[0];
-
-      // Create a list to store names of created files
-      SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames;
-      aSeq->length(n);
-      for (int i = 0; i < n; i++)
-        aSeq[i] = CORBA::string_dup(listOfFiles[i + 1].c_str());
-
-      // Convert a file to the byte stream
-      aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.c_str(), aSeq.in(), isMultiFile);
-
-      // Remove the files and tmp directory, created by the component storage procedure
-      if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.c_str(), aSeq.in(), true);
-    }
-  }
-
-  return aStreamFile._retn();
-}
-
-CORBA::Boolean SalomeApp_Engine_i::Load (SALOMEDS::SComponent_ptr theComponent,
-                                         const SALOMEDS::TMPFile& theFile,
-                                         const char* theURL,
-                                         bool isMultiFile)
-{
-  std::cout << "SalomeApp_Engine_i::Load() isMultiFile = " << isMultiFile << std::endl;
-  if (CORBA::is_nil(theComponent) || CORBA::is_nil(theComponent->GetStudy()))
-    return false;
-
-  // Error somewhere outside - Load() called with
-  // wrong SComponent instance
-  std::string componentName (theComponent->ComponentDataType());
-  if ( myComponentName != componentName )
-    return false;
-
-  const int studyId = theComponent->GetStudy()->StudyId();
-
-  // Create a temporary directory for the component's data files
-  std::string aTmpDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir();
-
-  // Convert the byte stream theStream to a files and place them in the tmp directory.
-  // The files and temporary directory must be deleted by the component loading procedure.
-  SALOMEDS::ListOfFileNames_var aSeq =
-    SALOMEDS_Tool::PutStreamToFiles(theFile, aTmpDir.c_str(), isMultiFile);
-
-  // Store list of file names to be used by the component loading procedure
-  const int n = aSeq->length() + 1;
-  ListOfFiles listOfFiles (n);
-  listOfFiles[0] = aTmpDir;
-  for (int i = 1; i < n; i++)
-    listOfFiles[i] = std::string(aSeq[i - 1]);
-
-  SetListOfFiles(listOfFiles, studyId);
-
-  return true;
-}
-
-SalomeApp_Engine_i::ListOfFiles SalomeApp_Engine_i::GetListOfFiles (const int theStudyId)
-{
-  ListOfFiles aListOfFiles;
-
-  if (myMap.find(theStudyId) != myMap.end())
-  {
-    aListOfFiles = myMap[theStudyId];
-  }
-
-  return aListOfFiles;
-}
-
-void SalomeApp_Engine_i::SetListOfFiles (const ListOfFiles& theListOfFiles,
-                                         const int          theStudyId)
-{
-  myMap[theStudyId] = theListOfFiles;
-}
-
-/*! 
- *  DumpPython implementation for light modules
- */
-Engines::TMPFile* SalomeApp_Engine_i::DumpPython(CORBA::Object_ptr theStudy, 
-                                                CORBA::Boolean isPublished, 
-                                                CORBA::Boolean isMultiFile, 
-                                                CORBA::Boolean& isValidScript)
-{
-  MESSAGE("SalomeApp_Engine_i::DumpPython(): myComponentName = "<<
-         myComponentName << ", this = " << this);
-  
-  // Temporary solution: returning a non-empty sequence
-  // even if there's nothing to dump, to avoid crashes in SALOMEDS
-  // TODO: Improve SALOMEDSImpl_Study::DumpStudy() by skipping the components 
-  // with isValidScript == false, and initialize isValidScript by false below.
-  Engines::TMPFile_var aStreamFile = new Engines::TMPFile(1);
-  aStreamFile->length( 1 );
-  aStreamFile[0] = '\0';
-  isValidScript = true;
-
-  if (CORBA::is_nil(theStudy))
-    return aStreamFile._retn();
-
-  SALOMEDS::Study_var studyDS = SALOMEDS::Study::_narrow( theStudy );
-  const int studyId = studyDS->StudyId();
-
-  if (!myMap.count(studyId))
-    return aStreamFile._retn();
-
-  ListOfFiles listOfFiles = myMap[studyId];
-
-  // listOfFiles must contain temporary directory name in its first item
-  // and names of files (relatively the temporary directory) in the others
-  if ( listOfFiles.size() < 2 ) 
-    return aStreamFile._retn();
-
-  // there are some files, containing persistent data of the component
-  QString aTmpPath( listOfFiles.front().c_str() );
-  QDir aTmpDir( aTmpPath );
-  if ( !aTmpDir.exists() )
-    return aStreamFile._retn();    
-
-  // Calculate file sizes
-  QStringList aFilePaths;
-  QList<qint64> aFileSizes;
-  qint64 aBuffSize = 0;
-  ListOfFiles::const_iterator aFIt  = listOfFiles.begin();
-  ListOfFiles::const_iterator aFEnd = listOfFiles.end();
-  aFIt++;
-  for (; aFIt != aFEnd; aFIt++){
-    QString aFileName( (*aFIt).c_str() );
-    if ( !aTmpDir.exists( aFileName ) ){
-      continue;
-    }
-
-    QFile aFile( aTmpDir.filePath( aFileName ) );
-    if ( !aFile.open( QIODevice::ReadOnly ) ){
-      continue;
-    }
-
-    aFilePaths.push_back( aTmpDir.filePath( aFileName ) );
-    aFileSizes.push_back( aFile.size() );
-    aBuffSize += aFileSizes.back();
-
-    aFile.close();
-  }
-
-  if ( !aFilePaths.size() || !aBuffSize )
-    return aStreamFile._retn(); 
-    
-  char* aBuffer = new char[aBuffSize + 1];
-  if ( !aBuffer )
-    return aStreamFile._retn();
-
-  // Convert the file(s) to the byte stream, multiple files are simply
-  // concatenated
-  // TODO: imporve multi-script support if necessary...
-  qint64 aCurrPos = 0;
-  QStringList::const_iterator aFileIt  = aFilePaths.begin();
-  QStringList::const_iterator aFileEnd = aFilePaths.end();
-  QList<qint64>::const_iterator   aSIt = aFileSizes.begin();
-  for ( ; aFileIt != aFileEnd; aFileIt++, aSIt++ ){
-    QFile aFile( aTmpDir.filePath( *aFileIt ) );
-    if ( !aFile.open( QIODevice::ReadOnly ) ){
-      continue;
-    }
-
-    // Incorrect size of file
-    // Do not remove the bad file to have some diagnostic means
-    if ( aFile.read( aBuffer + aCurrPos, *aSIt ) != *aSIt ){
-      aFile.close();      
-      return aStreamFile._retn();
-    }
-
-    aCurrPos += (*aSIt); 
-    aFile.remove();   
-  }
-
-  // Here we should end up with empty aTmpDir
-  // TODO: Handle QDir::rmdir() error status somehow...
-  aTmpDir.rmdir( aTmpPath );
-
-  aBuffer[aBuffSize] = '\0';
-  CORBA::Octet* anOctetBuf =  (CORBA::Octet*)aBuffer;
-  aStreamFile = new Engines::TMPFile(aBuffSize + 1, aBuffSize + 1, anOctetBuf, 1); 
-
-  return aStreamFile._retn();
-}
-
-/*!
-  \return Component data type string for this instance of the engine
-*/
-char* SalomeApp_Engine_i::ComponentDataType()
-{
-  return const_cast<char*>( myComponentName.c_str() );
-}
-
-/*!
-  \return 
-*/
-CORBA::ORB_var SalomeApp_Engine_i::orb()
-{
-  ORB_INIT& init = *SINGLETON_<ORB_INIT>::Instance();
-  // TODO: using QApplication here looks ugly, think how to
-  // obtain the ORB reference in a nicer way...
-  static CORBA::ORB_var _orb = init( qApp->argc(), qApp->argv() );
-  return _orb;
-}
-
-/*!
-  \return 
-*/
-PortableServer::POA_var SalomeApp_Engine_i::poa()
-{
-  static PortableServer::POA_var _poa;
-  if ( CORBA::is_nil( _poa ) ){
-    CORBA::Object_var obj = orb()->resolve_initial_references( "RootPOA" );
-    _poa = PortableServer::POA::_narrow( obj );
-  }
-  return _poa;
-}
-
-/*!
-  \return 
-*/
-SALOME_NamingService* SalomeApp_Engine_i::namingService()
-{
-  static SALOME_NamingService _ns(orb());
-  return &_ns;
-}
-
-/*!
-  Internal method, creates a CORBA engine for a light SALOME module
-  with the given "component data type" string,
-  activates it and registers in SALOME naming service with
-  /SalomeAppEngine/comp_data_type path. If the engine is already in the 
-  naming service, simply returns and object reference to it.
-  \param theComponentName - synthetic "component data type" used to identify a given light module
-  \return Object reference to the CORBA engine
-*/
-CORBA::Object_ptr SalomeApp_Engine_i::engineForComponent( const char* theComponentName,
-                                                         bool toCreate )
-{
-  CORBA::Object_var anEngine;
-  if ( !theComponentName || !strlen( theComponentName ) )
-    return anEngine._retn();
-
-  std::string aPath( "/SalomeAppEngine/" );
-  aPath += theComponentName;
-  anEngine = namingService()->Resolve( aPath.c_str() );
-
-  // Activating a new instance of the servant
-  if ( toCreate && CORBA::is_nil( anEngine ) ){
-    try {
-      SalomeApp_Engine_i* aServant    = new SalomeApp_Engine_i( theComponentName );
-      PortableServer::ObjectId_var id = poa()->activate_object( aServant );
-      anEngine = aServant->_this();
-      aServant->_remove_ref();
-      namingService()->Register( anEngine.in(), aPath.c_str() );
-    }
-    catch (CORBA::SystemException&) {
-      INFOS("Caught CORBA::SystemException.");
-    }
-    catch (CORBA::Exception&) {
-      INFOS("Caught CORBA::Exception.");
-    }
-    catch (...) {
-      INFOS("Caught unknown exception.");
-    }
-  }
-
-  return anEngine._retn();
-}
-
-/*!
-  \param theComponentName - synthetic "component data type" used to identify a given light module
-  \return IOR string for the CORBA engine for a light SALOME module
-  with the given "component data type" string
-  \sa GetInstance( const char* theComponentName )
-*/
-std::string SalomeApp_Engine_i::EngineIORForComponent( const char* theComponentName,
-                                                      bool toCreate )
-{
-  std::string anIOR( "" );
-  CORBA::Object_var anEngine = engineForComponent( theComponentName, toCreate );
-  if ( !CORBA::is_nil( anEngine ) )
-  {
-    CORBA::String_var objStr = orb()->object_to_string( anEngine.in() );
-    anIOR = std::string( objStr.in() );
-  }
-  return anIOR;
-}
-
-/*!
-  \param theComponentName - synthetic "component data type" used to identify a given light module
-  \return A pointer to corresponding C++ engine instance, null means some internal problems.
-  \sa EngineIORForComponent( const char* theComponentName )
-*/
-SalomeApp_Engine_i* SalomeApp_Engine_i::GetInstance( const char* theComponentName,
-                                                    bool toCreate )
-{
-  SalomeApp_Engine_i* aServant = 0;
-  CORBA::Object_var anEngine = engineForComponent( theComponentName, toCreate );
-  if ( !CORBA::is_nil( anEngine ) )
-  {
-    PortableServer::Servant aServantBase = poa()->reference_to_servant( anEngine.in() );
-    aServant = dynamic_cast<SalomeApp_Engine_i*>( aServantBase );
-  } 
-  MESSAGE("SalomeApp_Engine_i::GetInstance(): theComponentName = " <<
-         theComponentName << ", aServant = " << aServant);
-  return aServant;
-}
-
diff --git a/src/Session/SalomeApp_Engine_i.hxx b/src/Session/SalomeApp_Engine_i.hxx
deleted file mode 100755 (executable)
index 0e728da..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (C) 2007-2012  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.
-//
-// 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
-//
-
-//  SalomeApp_Engine_i : implementation of SalomeApp_Engine.idl
-//  File   : SalomeApp_Engine_i.hxx
-//  Author : Alexander SLADKOV
-
-#ifndef _SALOMEAPP_ENGINE_I_HXX_
-#define _SALOMEAPP_ENGINE_I_HXX_
-
-#include "SALOME_Session.hxx"
-
-#include "SALOME_Component_i.hxx"
-
-#include <vector> 
-#include <map> 
-
-#include <SALOMEconfig.h>
-#include CORBA_SERVER_HEADER(SalomeApp_Engine)
-
-class SALOME_NamingService;
-
-class SESSION_EXPORT SalomeApp_Engine_i: public POA_SalomeApp::Engine,
-                                        public Engines_Component_i
-{
-public:
-  SalomeApp_Engine_i( const char* theComponentName );
-  ~SalomeApp_Engine_i();
-
-  SALOMEDS::TMPFile*      Save( SALOMEDS::SComponent_ptr theComponent, 
-                               const char* theURL, 
-                               bool isMultiFile );
-
-  CORBA::Boolean          Load( SALOMEDS::SComponent_ptr theComponent, 
-                               const SALOMEDS::TMPFile& theFile, 
-                               const char* theURL, 
-                               bool isMultiFile );
-
-  virtual Engines::TMPFile* DumpPython(CORBA::Object_ptr theStudy,
-                                       CORBA::Boolean isPublished,
-                                       CORBA::Boolean isMultiFile,
-                                       CORBA::Boolean& isValidScript);
-
-public:
-  typedef std::vector<std::string> ListOfFiles;
-
-  ListOfFiles             GetListOfFiles (const int          theStudyId);
-  void                    SetListOfFiles (const ListOfFiles& theListOfFiles,
-                                          const int          theStudyId);
-
-  static std::string         EngineIORForComponent( const char* theComponentName,
-                                                   bool toCreate );
-  static SalomeApp_Engine_i* GetInstance          ( const char* theComponentName,
-                                                   bool toCreate ); 
-
-public:
-  // methods from SALOMEDS::Driver without implementation.  Must be redefined because 
-  // there is no default implementation of SALOMEDS::Driver interface
-  SALOMEDS::TMPFile* SaveASCII( SALOMEDS::SComponent_ptr, const char*, bool )                                                                        {return 0;}
-  CORBA::Boolean LoadASCII( SALOMEDS::SComponent_ptr, const SALOMEDS::TMPFile&, const char*, bool )                                                  {return 0;}
-  void Close( SALOMEDS::SComponent_ptr )                                                                                                             {}
-  char* ComponentDataType();
-  char* IORToLocalPersistentID( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean,  CORBA::Boolean )                                                {return 0;}
-  char* LocalPersistentIDToIOR( SALOMEDS::SObject_ptr, const char*, CORBA::Boolean,  CORBA::Boolean )                                                {return 0;}
-  bool CanPublishInStudy( CORBA::Object_ptr )                                                                                                        {return 0;}
-  SALOMEDS::SObject_ptr PublishInStudy(SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr, CORBA::Object_ptr, const char* ) throw (SALOME::SALOME_Exception) {return 0;}
-  CORBA::Boolean CanCopy( SALOMEDS::SObject_ptr )                                                                                                    {return 0;}
-  SALOMEDS::TMPFile* CopyFrom( SALOMEDS::SObject_ptr, CORBA::Long& )                                                                                 {return 0;}
-  CORBA::Boolean CanPaste( const char*, CORBA::Long )                                                                                                {return 0;}
-  SALOMEDS::SObject_ptr PasteInto( const SALOMEDS::TMPFile&, CORBA::Long, SALOMEDS::SObject_ptr )                                                    {return 0;}
-
-private:
-  static CORBA::ORB_var              orb();
-  static PortableServer::POA_var     poa();
-  static SALOME_NamingService*       namingService();
-  static CORBA::Object_ptr           engineForComponent( const char* theComponentName,
-                                                        bool toCreate  );
-
-private:
-  typedef std::map<int, ListOfFiles> MapOfListOfFiles;
-  MapOfListOfFiles                   myMap;
-
-  std::string                        myComponentName;
-};
-
-#endif
-
index 39c9c5ef6752a1f3c553ef45e048cbf4fc6f8396..9a442e9f760d0f35e327b50df8dee42648091e26 100755 (executable)
@@ -230,6 +230,16 @@ void Session_ServerLauncher::ActivateAll()
   delete[] argv;
 }
 
+void Session_ServerLauncher::ShutdownAll()
+{
+  MESSAGE("Session_ServerLauncher::ShutdownAll()");
+  std::list<Session_ServerThread*>::reverse_iterator itServ;
+  for (itServ = _serverThreads.rbegin(); itServ !=_serverThreads.rend(); itServ++)
+  {
+    (*itServ)->Shutdown();
+  }
+}
+
 /*! 
   Destruction des classes serveur dans l'ordre inverse de creation
 */
index 39b9eaa834a3a6253f6187eba0cc9c2ce1ea5811..c2cd32176aff3ff5afe53e65ffcf2b0ee42d6042 100755 (executable)
@@ -67,6 +67,7 @@ public:
                          QWaitCondition *SessionStarted);
   virtual ~Session_ServerLauncher();
   void run();
+  void ShutdownAll();
   void KillAll();
 
 protected:
index 07e1e6726991ae1569e77eb800ec2b6341532399..341231c87d35c47091de52838de4f5da92864073 100755 (executable)
@@ -84,6 +84,7 @@ Session_ServerThread::Session_ServerThread(int argc,
   _servType =-1;
   _NS = new SALOME_NamingService(_orb); // one instance per server to limit
                                         // multi thread coherence problems
+  _container = 0;                       // embedded container
 }
 
 /*! 
@@ -165,6 +166,11 @@ void Session_ServerThread::Init()
   }
 }
 
+void Session_ServerThread::Shutdown()
+{
+  if ( _container ) _container->Shutdown();
+}
+
 void Session_ServerThread::ActivateModuleCatalog(int argc,
                                                  char ** argv)
 {
@@ -356,7 +362,7 @@ void Session_ServerThread::ActivateContainer(int argc,
       containerName = argv[1];
     }
     
-    new Engines_Container_i(_orb, _root_poa, containerName , argc , argv , true , false);
+    _container = new Engines_Container_i(_orb, _root_poa, containerName , argc , argv , true , false);
   }
   catch(CORBA::SystemException&) {
     INFOS("Caught CORBA::SystemException.");
index e6a970008c5ebc1adbd659380217afe36db1d534..46bd6d3cd9d88abe211d3a619f7cfbd3dc46f7f0 100755 (executable)
@@ -35,6 +35,7 @@
 void WaitForServerReadiness(std::string serverName);
 
 class SALOME_NamingService;
+class Engines_Container_i;
 
 class SESSION_EXPORT Session_ServerThread
 {
@@ -49,6 +50,7 @@ public:
                        PortableServer::POA_ptr poa);
   virtual ~Session_ServerThread();
   void         Init();
+  void         Shutdown();
 protected:
   void         ActivateModuleCatalog   ( int argc, char ** argv );
   void         ActivateSALOMEDS        ( int argc, char ** argv );
@@ -64,6 +66,7 @@ protected:
   CORBA::ORB_var          _orb;
   PortableServer::POA_var _root_poa;
   SALOME_NamingService *  _NS;
+  Engines_Container_i*    _container;
 };
 
 class QMutex;
index 8d6141e766e8a23ff1295e5b85af8c5f6b568bbb..cf7bf98db171399babab6934a96662057be1952c 100644 (file)
@@ -39,7 +39,7 @@ CORBA_CXXFLAGS=@OMNIORB_CXXFLAGS@ @OMNIORB_INCLUDES@
 CORBA_LIBS=@OMNIORB_LIBS@
 QT_CXXFLAGS=@QT_INCLUDES@ @QT_MT_INCLUDES@
 
-TEST_CPPFLAGS = \
+COMMON_CPP_FLAGS = \
        $(QT_CXXFLAGS) \
        $(CORBA_CXXFLAGS) \
        $(KERNEL_CXXFLAGS) \
@@ -47,11 +47,16 @@ TEST_CPPFLAGS = \
        -I$(top_srcdir)/src/TreeData \
        -I.
 
-TEST_LDFLAGS  = \
+COMMON_LIBS  = \
        $(CORBA_LIBS) $(QT_LIBS) \
        $(top_builddir)/src/TreeData/libSalomeTreeData.la \
        $(top_builddir)/src/GuiHelpers/libSalomeGuiHelpers.la \
-       $(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeKernelHelpers
+       $(top_builddir)/src/SUIT/libsuit.la \
+       $(top_builddir)/src/CAM/libCAM.la \
+       $(top_builddir)/src/Plot2d/libPlot2d.la \
+       $(top_builddir)/src/LightApp/libLightApp.la \
+       $(top_builddir)/src/SalomeApp/libSalomeApp.la \
+       $(KERNEL_LDFLAGS) -lSalomeLifeCycleCORBA -lSalomeKernelHelpers @LIBXML_LIBS@
 
 # Program targets
 bin_PROGRAMS = TreeData_guitester TreeData_tester
@@ -76,20 +81,20 @@ TreeData_guitester_SOURCES = \
        MyDataModel.cxx
 
 TreeData_guitester_CPPFLAGS = \
-       $(TEST_CPPFLAGS)
+       $(COMMON_CPP_FLAGS)
 
 TreeData_guitester_LDFLAGS = \
-       $(TEST_LDFLAGS)
+       $(COMMON_LIBS)
 
 TreeData_tester_SOURCES = \
        tester.cxx \
        MyDataModel.cxx
 
 TreeData_tester_CPPFLAGS = \
-       $(TEST_CPPFLAGS)
+       $(COMMON_CPP_FLAGS)
 
 TreeData_tester_LDFLAGS = \
-       $(TEST_LDFLAGS)
+       $(COMMON_LIBS)
 
 # test data files
 testdir = $(salomeresdir)/testdata
index f004c867b576d5e0e545606da561a05e8daf532c..7d139de0727e0000a820b41267b38454aae04a6b 100755 (executable)
 //#define __MYDEBUG__
 //#define USE_ROBUST_TRIANGULATION
 
+///////////////////////////////////////////////////////////////////////////////////////////////
+// VSR 26/10/2012: fix of regression (issue 21924) - increased memory consumption
+// for displaying of 3d elements, introduced by fix for issue 20314.
+// ...
+// The macro SHOW_COINCIDING_3D_PAL20314, when defined, allows correct visualization of
+// coincident 3d elements but causes substantial increasing of memory consumption, as all 3d 
+// elements are always shown, even if they are totally covered by surrounding faces.
+// If this macro is not defined (commented), the behaviour is defined by another macro -
+// SHOW_COINCIDING_3D_PAL21924, as follows:
+// - If SHOW_COINCIDING_3D_PAL21924 is defined, an alternative solution for computing 
+//   visibility of 3d elements is used; this solution allows to fix problem with visibility
+//   of coinciding 3d elements in most cases (though some cases might not work), while not
+//   causing significant increasing of memory consumption.
+// - If SHOW_COINCIDING_3D_PAL21924 is not defined (commented), coinciding 3d elements are 
+//   not shown at all (this corresponds to the state before issue 20314 fixing).
+///////////////////////////////////////////////////////////////////////////////////////////////
+//#define SHOW_COINCIDING_3D_PAL20314
+#ifndef SHOW_COINCIDING_3D_PAL20314
+#define SHOW_COINCIDING_3D_PAL21924
+#endif
+///////////////////////////////////////////////////////////////////////////////////////////////
+
 vtkCxxRevisionMacro(VTKViewer_GeometryFilter, "$Revision$");
 vtkStandardNewMacro(VTKViewer_GeometryFilter);
 
@@ -156,6 +178,8 @@ VTKViewer_GeometryFilter
 
   vtkIdList *cellIds = vtkIdList::New();
   vtkIdList *faceIds = vtkIdList::New();
+  vtkIdList *cellIdsTmp = vtkIdList::New();
+  vtkIdList *faceIdsTmp = vtkIdList::New();
 
   char *cellVis;
   vtkIdType newCellId;
@@ -331,7 +355,7 @@ VTKViewer_GeometryFilter
                                                       cellId,
                                                       myShowInside,
                                                       allVisible,
-                                                      myAppendCoincident3D,
+                                                      GetAppendCoincident3D(),
                                                       cellVis,
                                                       output,
                                                       outputCD,
@@ -345,7 +369,7 @@ VTKViewer_GeometryFilter
                                           cellId,
                                           myShowInside,
                                           allVisible,
-                                          myAppendCoincident3D,
+                                          GetAppendCoincident3D(),
                                           cellVis,
                                           output,
                                           outputCD,
@@ -357,6 +381,12 @@ VTKViewer_GeometryFilter
           break;
         }
         case VTK_TETRA: {
+#ifdef SHOW_COINCIDING_3D_PAL21924
+         faceIdsTmp->Reset();
+         for (int ai=0; ai<npts; ai++)
+           faceIdsTmp->InsertNextId(pts[ai]);
+         input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+#endif
           for (faceId = 0; faceId < 4; faceId++)
             {
             faceIds->Reset();
@@ -367,7 +397,15 @@ VTKViewer_GeometryFilter
             aCellType = VTK_TRIANGLE;
             numFacePts = 3;
             input->GetCellNeighbors(cellId, faceIds, cellIds);
-            bool process = cellIds->GetNumberOfIds() <= 0 ? true : myAppendCoincident3D;
+#ifdef SHOW_COINCIDING_3D_PAL21924
+           int nbNeighbors = 0;
+           for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+             if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+           }
+            bool process = nbNeighbors <= 0;
+#else
+            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+#endif
             if ( process || myShowInside ||
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
@@ -382,6 +420,12 @@ VTKViewer_GeometryFilter
           break;
         }
         case VTK_VOXEL: {
+#ifdef SHOW_COINCIDING_3D_PAL21924
+         faceIdsTmp->Reset();
+         for (int ai=0; ai<npts; ai++)
+           faceIdsTmp->InsertNextId(pts[ai]);
+         input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+#endif
           for (faceId = 0; faceId < 6; faceId++)
             {
             faceIds->Reset();
@@ -393,7 +437,15 @@ VTKViewer_GeometryFilter
             aCellType = VTK_QUAD;
             numFacePts = 4;
             input->GetCellNeighbors(cellId, faceIds, cellIds);
-            bool process = cellIds->GetNumberOfIds() <= 0 ? true : myAppendCoincident3D;
+#ifdef SHOW_COINCIDING_3D_PAL21924
+           int nbNeighbors = 0;
+           for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+             if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+           }
+            bool process = nbNeighbors <= 0;
+#else
+            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+#endif
             if ( process || myShowInside ||
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
@@ -408,6 +460,12 @@ VTKViewer_GeometryFilter
           break;
         }
         case VTK_HEXAHEDRON: {
+#ifdef SHOW_COINCIDING_3D_PAL21924
+         faceIdsTmp->Reset();
+         for (int ai=0; ai<npts; ai++)
+           faceIdsTmp->InsertNextId(pts[ai]);
+         input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+#endif
           for (faceId = 0; faceId < 6; faceId++)
             {
             faceIds->Reset();
@@ -419,7 +477,15 @@ VTKViewer_GeometryFilter
             aCellType = VTK_QUAD;
             numFacePts = 4;
             input->GetCellNeighbors(cellId, faceIds, cellIds);
-            bool process = cellIds->GetNumberOfIds() <= 0 ? true : myAppendCoincident3D;
+#ifdef SHOW_COINCIDING_3D_PAL21924
+           int nbNeighbors = 0;
+           for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+             if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+           }
+            bool process = nbNeighbors <= 0;
+#else
+            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+#endif
             if ( process || myShowInside ||
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
@@ -434,6 +500,12 @@ VTKViewer_GeometryFilter
           break;
         }
         case VTK_WEDGE: {
+#ifdef SHOW_COINCIDING_3D_PAL21924
+         faceIdsTmp->Reset();
+         for (int ai=0; ai<npts; ai++)
+           faceIdsTmp->InsertNextId(pts[ai]);
+         input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+#endif
           for (faceId = 0; faceId < 5; faceId++)
             {
             faceIds->Reset();
@@ -451,7 +523,15 @@ VTKViewer_GeometryFilter
               }
 
             input->GetCellNeighbors(cellId, faceIds, cellIds);
-            bool process = cellIds->GetNumberOfIds() <= 0 ? true : myAppendCoincident3D;
+#ifdef SHOW_COINCIDING_3D_PAL21924
+           int nbNeighbors = 0;
+           for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+             if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+           }
+            bool process = nbNeighbors <= 0;
+#else
+            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+#endif
             if ( process || myShowInside ||
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
@@ -466,6 +546,12 @@ VTKViewer_GeometryFilter
           break;
         }
         case VTK_HEXAGONAL_PRISM: {
+#ifdef SHOW_COINCIDING_3D_PAL21924
+         faceIdsTmp->Reset();
+         for (int ai=0; ai<npts; ai++)
+           faceIdsTmp->InsertNextId(pts[ai]);
+         input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+#endif
           for (faceId = 0; faceId < 8; faceId++)
           {
             faceVerts = vtkHexagonalPrism::GetFaceArray(faceId);
@@ -484,7 +570,15 @@ VTKViewer_GeometryFilter
               numFacePts = 6;
             }
             input->GetCellNeighbors(cellId, faceIds, cellIds);
-            bool process = cellIds->GetNumberOfIds() <= 0 ? true : myAppendCoincident3D;
+#ifdef SHOW_COINCIDING_3D_PAL21924
+           int nbNeighbors = 0;
+           for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+             if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+           }
+            bool process = nbNeighbors <= 0;
+#else
+            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+#endif
             if ( process || myShowInside ||
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
             {
@@ -499,6 +593,12 @@ VTKViewer_GeometryFilter
           break;
         }
         case VTK_PYRAMID: {
+#ifdef SHOW_COINCIDING_3D_PAL21924
+         faceIdsTmp->Reset();
+         for (int ai=0; ai<npts; ai++)
+           faceIdsTmp->InsertNextId(pts[ai]);
+         input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+#endif
           for (faceId = 0; faceId < 5; faceId++)
             {
             faceIds->Reset();
@@ -515,7 +615,15 @@ VTKViewer_GeometryFilter
               numFacePts = 4;
               }
             input->GetCellNeighbors(cellId, faceIds, cellIds);
-            bool process = cellIds->GetNumberOfIds() <= 0 ? true : myAppendCoincident3D;
+#ifdef SHOW_COINCIDING_3D_PAL21924
+           int nbNeighbors = 0;
+           for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+             if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+           }
+            bool process = nbNeighbors <= 0;
+#else
+            bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+#endif
             if ( process || myShowInside ||
                  (!allVisible && !cellVis[cellIds->GetId(0)]) )
               {
@@ -538,6 +646,12 @@ VTKViewer_GeometryFilter
             vtkIdType* ptIds = 0;
             int idp = 0;
             input->GetFaceStream(cellId, nFaces, ptIds);
+#ifdef SHOW_COINCIDING_3D_PAL21924
+           faceIdsTmp->Reset();
+           for (int ai=0; ai<npts; ai++)
+             faceIdsTmp->InsertNextId(pts[ai]);
+           input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+#endif
             for (faceId = 0; faceId < nFaces; faceId++)
               {
                 faceIds->Reset();
@@ -564,7 +678,15 @@ VTKViewer_GeometryFilter
                   }
                 // TODO understand and fix display of several polyhedrons                
                 input->GetCellNeighbors(cellId, faceIds, cellIds);
-                bool process = cellIds->GetNumberOfIds() <= 0 ? true : myAppendCoincident3D;
+#ifdef SHOW_COINCIDING_3D_PAL21924
+               int nbNeighbors = 0;
+               for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+                 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+               }
+               bool process = nbNeighbors <= 0;
+#else
+               bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+#endif
                 if (process || myShowInside
                     || (!allVisible && !cellVis[cellIds->GetId(0)]))
                   {
@@ -643,12 +765,36 @@ VTKViewer_GeometryFilter
             }
             else //3D nonlinear cell
             {
+#ifdef SHOW_COINCIDING_3D_PAL21924
+             faceIdsTmp->Reset();
+             int npts1 = 0;
+             switch (aCellType ){
+             case VTK_QUADRATIC_TETRA:         npts1 = 4; break;
+             case VTK_QUADRATIC_HEXAHEDRON:    npts1 = 8; break;
+             case VTK_TRIQUADRATIC_HEXAHEDRON: npts1 = 8; break;
+             case VTK_QUADRATIC_WEDGE:         npts1 = 6; break;
+             case VTK_QUADRATIC_PYRAMID:       npts1 = 5; break;
+             }
+             if ( npts1 > 0 ) {
+               for (int ai=0; ai<npts; ai++)
+                 faceIdsTmp->InsertNextId(pts[ai]);
+               input->GetCellNeighbors(cellId, faceIdsTmp, cellIdsTmp);
+             }
+#endif
               aCellType = VTK_TRIANGLE;
               numFacePts = 3;
               for (int j=0; j < cell->GetNumberOfFaces(); j++){
                 vtkCell *face = cell->GetFace(j);
                 input->GetCellNeighbors(cellId, face->PointIds, cellIds);
-                bool process = cellIds->GetNumberOfIds() <= 0 ? true : myAppendCoincident3D;
+#ifdef SHOW_COINCIDING_3D_PAL21924
+               int nbNeighbors = 0;
+               for(int ai=0;ai<cellIds->GetNumberOfIds();ai++) {
+                 if (cellIdsTmp->IsId(cellIds->GetId(ai)) == -1) nbNeighbors++;
+               }
+               bool process = nbNeighbors <= 0;
+#else
+               bool process = cellIds->GetNumberOfIds() <= 0 || GetAppendCoincident3D();
+#endif
                 if ( process || myShowInside ) {
                   face->Triangulate(0,lpts,coords);
                   for (i=0; i < lpts->GetNumberOfIds(); i+=3) {
@@ -1075,6 +1221,8 @@ VTKViewer_GeometryFilter
 
   cellIds->Delete();
   faceIds->Delete();
+  cellIdsTmp->Delete();
+  faceIdsTmp->Delete();
 
   if ( cellVis )
   {
@@ -1390,9 +1538,14 @@ vtkFloatingPointType VTKViewer_GeometryFilter:: GetQuadraticArcAngle() const
   return myMaxArcAngle;
 }
 
-
 int VTKViewer_GeometryFilter::GetAppendCoincident3D() const {
+// VSR 26/10/2012: see description of SHOW_COINCIDING_3D_PAL20314
+// in the top of this file
+#ifdef SHOW_COINCIDING_3D_PAL20314
   return myAppendCoincident3D;
+#else
+  return false;
+#endif
 }
 
 void VTKViewer_GeometryFilter::SetAppendCoincident3D(int theFlag) {